diff options
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..90c725c --- /dev/null +++ b/init.lua @@ -0,0 +1,23 @@ +local function pivot(table) + local ret = {} + for k,v in pairs(table) do + ret[v] = k + end + return ret +end + +local textures = pivot(minetest.get_dir_list(minetest.get_modpath("player_textures")..DIR_DELIM.."textures")) + +local function applyskin(player) + local name = player:get_player_name() + if textures[string.format("player_%s.png",name)] then + default.player_set_textures(player,string.format("[combine:64x32:0,0=player_%s.png",name)) + player:set_properties({textures={string.format("[combine:64x32:0,0=player_%s.png",name)}}) + end + player:set_properties({visual="mesh",visual_scale={x=1,y=1},mesh="character.b3d"}) +end + +minetest.register_on_joinplayer(function(player) + applyskin(player) + minetest.after(10,applyskin,player) +end) |