From aae30bba3964437830a0793aac64df5eda4743a7 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 5 Mar 2019 10:36:53 +0100 Subject: [PATCH] Rename simple_skins to mcl_skins --- .../minetest-3d_armor/3d_armor/armor.lua | 15 ++++++-- .../{simple_skins => mcl_skins}/depends.txt | 0 .../description.txt | 0 .../{simple_skins => mcl_skins}/init.lua | 36 +++++++++--------- .../{simple_skins => mcl_skins}/intllib.lua | 0 .../{simple_skins => mcl_skins}/license.txt | 0 .../{simple_skins => mcl_skins}/locale/fr.po | 0 .../{simple_skins => mcl_skins}/locale/it.po | 0 .../{simple_skins => mcl_skins}/locale/ms.po | 0 .../locale/template.pot | 0 .../meta/character.txt | 0 .../meta/character_1.txt | 0 mods/PLAYER/mcl_skins/mod.conf | 1 + .../{simple_skins => mcl_skins}/readme.md | 0 .../textures/character_1.png | Bin .../textures/inventory_plus_skins.png | Bin .../textures/player_1.png | Bin mods/PLAYER/simple_skins/mod.conf | 1 - 18 files changed, 31 insertions(+), 22 deletions(-) rename mods/PLAYER/{simple_skins => mcl_skins}/depends.txt (100%) rename mods/PLAYER/{simple_skins => mcl_skins}/description.txt (100%) rename mods/PLAYER/{simple_skins => mcl_skins}/init.lua (78%) rename mods/PLAYER/{simple_skins => mcl_skins}/intllib.lua (100%) rename mods/PLAYER/{simple_skins => mcl_skins}/license.txt (100%) rename mods/PLAYER/{simple_skins => mcl_skins}/locale/fr.po (100%) rename mods/PLAYER/{simple_skins => mcl_skins}/locale/it.po (100%) rename mods/PLAYER/{simple_skins => mcl_skins}/locale/ms.po (100%) rename mods/PLAYER/{simple_skins => mcl_skins}/locale/template.pot (100%) rename mods/PLAYER/{simple_skins => mcl_skins}/meta/character.txt (100%) rename mods/PLAYER/{simple_skins => mcl_skins}/meta/character_1.txt (100%) create mode 100644 mods/PLAYER/mcl_skins/mod.conf rename mods/PLAYER/{simple_skins => mcl_skins}/readme.md (100%) rename mods/PLAYER/{simple_skins => mcl_skins}/textures/character_1.png (100%) rename mods/PLAYER/{simple_skins => mcl_skins}/textures/inventory_plus_skins.png (100%) rename mods/PLAYER/{simple_skins => mcl_skins}/textures/player_1.png (100%) delete mode 100644 mods/PLAYER/simple_skins/mod.conf diff --git a/mods/ITEMS/minetest-3d_armor/3d_armor/armor.lua b/mods/ITEMS/minetest-3d_armor/3d_armor/armor.lua index 0b07fb14cc..ae9799f9ae 100644 --- a/mods/ITEMS/minetest-3d_armor/3d_armor/armor.lua +++ b/mods/ITEMS/minetest-3d_armor/3d_armor/armor.lua @@ -66,7 +66,9 @@ armor = { version = "0.4.6", } -if minetest.get_modpath("skins") then +if minetest.get_modpath("mcl_skins") then + skin_mod = "mcl_skins" +elseif minetest.get_modpath("skins") then skin_mod = "skins" elseif minetest.get_modpath("simple_skins") then skin_mod = "simple_skins" @@ -197,7 +199,9 @@ end armor.get_player_skin = function(self, name) local skin = nil - if skin_mod == "skins" or skin_mod == "simple_skins" then + if skin_mod == "mcl_skins" then + skin = mcl_skins.skins[name] + elseif skin_mod == "skins" or skin_mod == "simple_skins" then skin = skins.skins[name] elseif skin_mod == "u_skins" then skin = u_skins.u_skins[name] @@ -380,7 +384,12 @@ minetest.register_on_joinplayer(function(player) wielditem = "3d_armor_trans.png", preview = armor.default_skin.."_preview.png", } - if skin_mod == "skins" then + if skin_mod == "mcl_skins" then + local skin = mcl_skins.skins[name] + if skin then + armor.textures[name].skin = skin..".png" + end + elseif skin_mod == "skins" then local skin = skins.skins[name] if skin and skins.get_type(skin) == skins.type.MODEL then armor.textures[name].skin = skin..".png" diff --git a/mods/PLAYER/simple_skins/depends.txt b/mods/PLAYER/mcl_skins/depends.txt similarity index 100% rename from mods/PLAYER/simple_skins/depends.txt rename to mods/PLAYER/mcl_skins/depends.txt diff --git a/mods/PLAYER/simple_skins/description.txt b/mods/PLAYER/mcl_skins/description.txt similarity index 100% rename from mods/PLAYER/simple_skins/description.txt rename to mods/PLAYER/mcl_skins/description.txt diff --git a/mods/PLAYER/simple_skins/init.lua b/mods/PLAYER/mcl_skins/init.lua similarity index 78% rename from mods/PLAYER/simple_skins/init.lua rename to mods/PLAYER/mcl_skins/init.lua index 98d3e7e856..fc892471b9 100644 --- a/mods/PLAYER/simple_skins/init.lua +++ b/mods/PLAYER/mcl_skins/init.lua @@ -2,15 +2,15 @@ -- Released by TenPlus1 and based on Zeg9's code under MIT license -skins = { +mcl_skins = { skins = {}, previews = {}, meta = {}, - modpath = minetest.get_modpath("simple_skins"), + modpath = minetest.get_modpath("mcl_skins"), skin_count = 0, -- counter of _custom_ skins (all skins except character.png) } -- Load support for intllib. -local S, NS = dofile(skins.modpath .. "/intllib.lua") +local S, NS = dofile(mcl_skins.modpath .. "/intllib.lua") -- load skin list and metadata @@ -21,7 +21,7 @@ while true do skin = "character_" .. id -- does skin file exist ? - f = io.open(skins.modpath .. "/textures/" .. skin .. ".png") + f = io.open(mcl_skins.modpath .. "/textures/" .. skin .. ".png") -- escape loop if not found and remove last entry if not f then @@ -32,7 +32,7 @@ while true do f:close() -- does metadata exist for that skin file ? - f = io.open(skins.modpath .. "/meta/" .. skin .. ".txt") + f = io.open(mcl_skins.modpath .. "/meta/" .. skin .. ".txt") if f then data = minetest.deserialize("return {" .. f:read('*all') .. "}") @@ -40,22 +40,22 @@ while true do end -- add metadata to list - skins.meta[skin] = { + mcl_skins.meta[skin] = { name = data and data.name or "", author = data and data.author or "", } id = id + 1 - skins.skin_count = skins.skin_count + 1 + mcl_skins.skin_count = mcl_skins.skin_count + 1 end -skins.set_player_skin = function(player, skin_id) +mcl_skins.set_player_skin = function(player, skin_id) if not player then return false end local playername = player:get_player_name() local skin, preview - if skin_id == nil or type(skin_id) ~= "number" or skin_id < 0 or skin_id > skins.skin_count then + if skin_id == nil or type(skin_id) ~= "number" or skin_id < 0 or skin_id > mcl_skins.skin_count then return false elseif skin_id == 0 then skin = "character" @@ -64,10 +64,10 @@ skins.set_player_skin = function(player, skin_id) skin = "character_" .. tostring(skin_id) preview = "player_" .. tostring(skin_id) end - skins.skins[playername] = skin - skins.previews[playername] = preview + mcl_skins.skins[playername] = skin + mcl_skins.previews[playername] = preview player:set_attribute("simple_skins:skin_id", skin_id) - skins.update_player_skin(player) + mcl_skins.update_player_skin(player) if minetest.get_modpath("3d_armor") then armor.textures[playername].skin = skin .. ".png" armor:update_player_visuals(player) @@ -78,12 +78,12 @@ skins.set_player_skin = function(player, skin_id) return true end -skins.update_player_skin = function(player) +mcl_skins.update_player_skin = function(player) if not player then return end local playername = player:get_player_name() - mcl_player.player_set_textures(player, { skins.skins[playername] .. ".png" }, skins.previews[playername] .. ".png" ) + mcl_player.player_set_textures(player, { mcl_skins.skins[playername] .. ".png" }, mcl_skins.previews[playername] .. ".png" ) end -- load player skin on join @@ -97,10 +97,10 @@ minetest.register_on_joinplayer(function(player) set_skin = tonumber(skin_id) -- otherwise use random skin if not set else - set_skin = math.random(0, skins.skin_count) + set_skin = math.random(0, mcl_skins.skin_count) end if set_skin then - skins.set_player_skin(player, set_skin) + mcl_skins.set_player_skin(player, set_skin) end end) @@ -134,9 +134,9 @@ minetest.register_chatcommand("setskin", { end local skin - local ok = skins.set_player_skin(player, skin_id) + local ok = mcl_skins.set_player_skin(player, skin_id) if not ok then - return false, S("Invalid skin number! Valid numbers: 0 to @1", skins.skin_count) + return false, S("Invalid skin number! Valid numbers: 0 to @1", mcl_skins.skin_count) end local skinfile = "Skin #"..skin_id diff --git a/mods/PLAYER/simple_skins/intllib.lua b/mods/PLAYER/mcl_skins/intllib.lua similarity index 100% rename from mods/PLAYER/simple_skins/intllib.lua rename to mods/PLAYER/mcl_skins/intllib.lua diff --git a/mods/PLAYER/simple_skins/license.txt b/mods/PLAYER/mcl_skins/license.txt similarity index 100% rename from mods/PLAYER/simple_skins/license.txt rename to mods/PLAYER/mcl_skins/license.txt diff --git a/mods/PLAYER/simple_skins/locale/fr.po b/mods/PLAYER/mcl_skins/locale/fr.po similarity index 100% rename from mods/PLAYER/simple_skins/locale/fr.po rename to mods/PLAYER/mcl_skins/locale/fr.po diff --git a/mods/PLAYER/simple_skins/locale/it.po b/mods/PLAYER/mcl_skins/locale/it.po similarity index 100% rename from mods/PLAYER/simple_skins/locale/it.po rename to mods/PLAYER/mcl_skins/locale/it.po diff --git a/mods/PLAYER/simple_skins/locale/ms.po b/mods/PLAYER/mcl_skins/locale/ms.po similarity index 100% rename from mods/PLAYER/simple_skins/locale/ms.po rename to mods/PLAYER/mcl_skins/locale/ms.po diff --git a/mods/PLAYER/simple_skins/locale/template.pot b/mods/PLAYER/mcl_skins/locale/template.pot similarity index 100% rename from mods/PLAYER/simple_skins/locale/template.pot rename to mods/PLAYER/mcl_skins/locale/template.pot diff --git a/mods/PLAYER/simple_skins/meta/character.txt b/mods/PLAYER/mcl_skins/meta/character.txt similarity index 100% rename from mods/PLAYER/simple_skins/meta/character.txt rename to mods/PLAYER/mcl_skins/meta/character.txt diff --git a/mods/PLAYER/simple_skins/meta/character_1.txt b/mods/PLAYER/mcl_skins/meta/character_1.txt similarity index 100% rename from mods/PLAYER/simple_skins/meta/character_1.txt rename to mods/PLAYER/mcl_skins/meta/character_1.txt diff --git a/mods/PLAYER/mcl_skins/mod.conf b/mods/PLAYER/mcl_skins/mod.conf new file mode 100644 index 0000000000..96f827646a --- /dev/null +++ b/mods/PLAYER/mcl_skins/mod.conf @@ -0,0 +1 @@ +name = mcl_skins diff --git a/mods/PLAYER/simple_skins/readme.md b/mods/PLAYER/mcl_skins/readme.md similarity index 100% rename from mods/PLAYER/simple_skins/readme.md rename to mods/PLAYER/mcl_skins/readme.md diff --git a/mods/PLAYER/simple_skins/textures/character_1.png b/mods/PLAYER/mcl_skins/textures/character_1.png similarity index 100% rename from mods/PLAYER/simple_skins/textures/character_1.png rename to mods/PLAYER/mcl_skins/textures/character_1.png diff --git a/mods/PLAYER/simple_skins/textures/inventory_plus_skins.png b/mods/PLAYER/mcl_skins/textures/inventory_plus_skins.png similarity index 100% rename from mods/PLAYER/simple_skins/textures/inventory_plus_skins.png rename to mods/PLAYER/mcl_skins/textures/inventory_plus_skins.png diff --git a/mods/PLAYER/simple_skins/textures/player_1.png b/mods/PLAYER/mcl_skins/textures/player_1.png similarity index 100% rename from mods/PLAYER/simple_skins/textures/player_1.png rename to mods/PLAYER/mcl_skins/textures/player_1.png diff --git a/mods/PLAYER/simple_skins/mod.conf b/mods/PLAYER/simple_skins/mod.conf deleted file mode 100644 index aff90aabee..0000000000 --- a/mods/PLAYER/simple_skins/mod.conf +++ /dev/null @@ -1 +0,0 @@ -name = simple_skins