0
0
Fork 0
VoxeLibre_galician/mods/PLAYER/mcl_skins/mesh_hand.lua

58 lines
1.8 KiB
Lua
Raw Normal View History

2022-09-06 19:51:43 +02:00
local function make_texture(base, colorspec)
local output = ""
if mcl_skins.masks[base] then
output = mcl_skins.masks[base] ..
"^[colorize:" .. minetest.colorspec_to_colorstring(colorspec) .. ":alpha"
end
if #output > 0 then output = output .. "^" end
output = output .. base
return output
end
function mcl_skins.get_skin_list()
local list = {}
2023-01-11 19:31:56 +01:00
for _, game_mode in pairs({"_crea", "_surv"}) do
for _, base in pairs(mcl_skins.base) do
for _, base_color in pairs(mcl_skins.base_color) do
local id = base:gsub(".png$", "") .. minetest.colorspec_to_colorstring(base_color):gsub("#", "")
local female = {
texture = make_texture(base, base_color),
slim_arms = true,
id = id .. "_female" .. game_mode,
creative = game_mode == "_crea"
}
table.insert(list, female)
local male = {
texture = make_texture(base, base_color),
slim_arms = false,
id = id .. "_male" .. game_mode,
creative = game_mode == "_crea"
}
table.insert(list, male)
end
end
for _, skin in pairs(mcl_skins.simple_skins) do
table.insert(list, {
texture = skin.texture,
slim_arms = skin.slim_arms,
id = skin.texture:gsub(".png$", "") .. (skin.slim_arms and "_female" or "_male") .. game_mode,
})
2022-09-06 19:51:43 +02:00
end
end
return list
end
function mcl_skins.get_node_id_by_player(player)
local skin = mcl_skins.players[player]
2023-01-11 19:31:56 +01:00
local creative = minetest.is_creative_enabled(player:get_player_name())
local append = (skin.slim_arms and "_female" or "_male") .. (creative and "_crea" or "_surv")
2022-09-06 19:51:43 +02:00
if skin.simple_skins_id then
local skin = mcl_skins.simple_skins[skin.simple_skins_id]
2023-01-11 19:31:56 +01:00
return skin.texture:gsub(".png$", "") .. append
2022-09-06 19:51:43 +02:00
else
return skin.base:gsub(".png$", "") ..
2023-01-11 19:31:56 +01:00
minetest.colorspec_to_colorstring(skin.base_color):gsub("#", "") .. append
2022-09-06 19:51:43 +02:00
end
end