commit 9caec044175c01db9d54d4728bfcc49a8f45acf6 Author: MrRar Date: Mon Apr 17 07:37:28 2023 -0500 Initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..b42fb31 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +This mod is used to put custom skins in MineClone2 0.84 or greater. + +Place PNG skin files in the textures folder. If the skin should be used with the slim-armed player mesh, include a complimentary file in the `meta` directory. The file in the meta directory should have the same name as the texture with the file extension changed to `.txt`. Add the line to the file `gender="female",`. diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..19a9029 --- /dev/null +++ b/init.lua @@ -0,0 +1,24 @@ +if not mcl_skins or not mcl_skins.register_simple_skin then return end +local mod_path = minetest.get_modpath("mcl_custom_skins") +local textures = minetest.get_dir_list(mod_path .. "/textures") +table.sort(textures) +for i, texture in pairs(textures) do + if texture:find(".png$") then + local f = io.open(mod_path .. "/meta/" .. texture:gsub("png$", "txt")) + local slim_arms + if f then + local data = f:read("*all") + if data then + data = minetest.deserialize("return {" .. data .. "}") + if data then + slim_arms = data.gender == "female" + end + end + f:close() + end + mcl_skins.register_simple_skin({ + texture = texture, + slim_arms = slim_arms, + }) + end +end diff --git a/meta/.gitignore b/meta/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/meta/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..cacda18 --- /dev/null +++ b/mod.conf @@ -0,0 +1,2 @@ +name = mcl_custom_skins +depends = mcl_skins diff --git a/textures/.gitignore b/textures/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/textures/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore