diff options
author | cheapie <no-email-for-you@example.com> | 2017-02-12 22:08:33 -0600 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2017-02-12 22:08:33 -0600 |
commit | d3a2eb43eb29c26e18ffcba93cd13c12a2b26bf6 (patch) | |
tree | adbab78d3d6016a210922eac3f335dfcd8badc8d /init.lua | |
download | player_textures-d3a2eb43eb29c26e18ffcba93cd13c12a2b26bf6.tar player_textures-d3a2eb43eb29c26e18ffcba93cd13c12a2b26bf6.tar.gz player_textures-d3a2eb43eb29c26e18ffcba93cd13c12a2b26bf6.tar.bz2 player_textures-d3a2eb43eb29c26e18ffcba93cd13c12a2b26bf6.tar.xz player_textures-d3a2eb43eb29c26e18ffcba93cd13c12a2b26bf6.zip |
Add content
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) |