blob: f73f899748af590c34e1d5f4a1e6ef0186efeeb3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
-- get current skin
skins.get_player_skin = function(player)
local skin = player:get_attribute("skin")
if not skins.is_skin(skin) then
skin = skins.default
end
return skin
end
-- Set skin
skins.set_player_skin = function(player, skin)
if skin == skins.default then
skin = ""
end
player:set_attribute("skin", skin)
skins.update_player_skin(player)
end
-- update visuals
skins.update_player_skin = function(player)
local skin = skins.get_player_skin(player)
player:set_properties({
textures = {skins.list[skin]},
})
end
-- Update skin on join
minetest.register_on_joinplayer(function(player)
skins.update_player_skin(player)
end)
|