diff options
author | SmallJoker <mk939@ymail.com> | 2015-04-11 15:27:41 +0200 |
---|---|---|
committer | SmallJoker <mk939@ymail.com> | 2015-04-11 15:27:41 +0200 |
commit | e762283decb7c7b2bb07fe60816707b9f55807b5 (patch) | |
tree | 26ccf26259d9292e79c7912aadc451448ce3fc6d | |
parent | 5cb484e251c0ba32463c111f7f3d7379bfec27eb (diff) |
Use simple_skins if default selected
-rw-r--r-- | u_skins/depends.txt | 1 | ||||
-rw-r--r-- | u_skins/init.lua | 11 |
2 files changed, 11 insertions, 1 deletions
diff --git a/u_skins/depends.txt b/u_skins/depends.txt index 4b9cd19..050b422 100644 --- a/u_skins/depends.txt +++ b/u_skins/depends.txt @@ -1,2 +1,3 @@ unified_inventory default +simple_skins?
\ No newline at end of file diff --git a/u_skins/init.lua b/u_skins/init.lua index 1673954..bd223a2 100644 --- a/u_skins/init.lua +++ b/u_skins/init.lua @@ -9,6 +9,7 @@ u_skins.default = "character_1" u_skins.pages = {} u_skins.u_skins = {} u_skins.file_save = false +u_skins.simple_skins = false -- ( Deprecated u_skins.type = { SPRITE=0, MODEL=1, ERROR=99 } @@ -33,15 +34,22 @@ end dofile(u_skins.modpath.."/skinlist.lua") dofile(u_skins.modpath.."/players.lua") +if rawget(_G, "skins") then + u_skins.simple_skins = true +end + u_skins.update_player_skin = function(player) local name = player:get_player_name() + if u_skins.simple_skins and u_skins.u_skins[name] == u_skins.default then + return + end + if not u_skins.is_skin(u_skins.u_skins[name]) then u_skins.u_skins[name] = u_skins.default end player:set_properties({ textures = {u_skins.u_skins[name]..".png"}, }) - u_skins.file_save = true end -- Display Current Skin @@ -145,6 +153,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) if current[1] == "u_skins_set" then u_skins.u_skins[player:get_player_name()] = u_skins.list[tonumber(current[2])] u_skins.update_player_skin(player) + u_skins.file_save = true unified_inventory.set_inventory_formspec(player, "u_skins") elseif current[1] == "u_skins_page" then u_skins.pages[player:get_player_name()] = current[2] |