diff --git a/README.md b/README.md index 84b7b9e..0d9e8d5 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,8 @@ To download you can play this game with the following minetest engines: * so then default beds as `beds` [mods/beds](mods/beds) from default 0.4 * minetest floatlands as `floatlands` [mods/floatlands](mods/floatlands) derived from Floatlands Realm made to this servers, as https://codeberg.org/minenux/minetest-mod-floatland * so then default flowers as `flowers` are need. Later this will need ethereal modifications. +* tenplus1 simple skins as `skins` [mods/skins](mods/skins) from https://codeberg.org/minenux/minetest-mod-simple_skins + * customized so this was renamed to mantain consistency and simplification, also some settiungs were minimalized ## Licensing diff --git a/mods/skins/.gitignore b/mods/skins/.gitignore new file mode 100644 index 0000000..41bac1f --- /dev/null +++ b/mods/skins/.gitignore @@ -0,0 +1,4 @@ +*~ +.previews/output +.previews/blender_out +.previews/pngcrush_output diff --git a/mods/skins/depends.txt b/mods/skins/depends.txt new file mode 100644 index 0000000..39ba987 --- /dev/null +++ b/mods/skins/depends.txt @@ -0,0 +1,5 @@ +default +sfinv? +inventory_plus? +intllib? +unified_inventory? diff --git a/mods/skins/description.txt b/mods/skins/description.txt new file mode 100644 index 0000000..81e791b --- /dev/null +++ b/mods/skins/description.txt @@ -0,0 +1 @@ +SKIN mnager Mod, Simple skin modified that allows players to set their individual skins. \ No newline at end of file diff --git a/mods/skins/init.lua b/mods/skins/init.lua new file mode 100644 index 0000000..fe8f8f5 --- /dev/null +++ b/mods/skins/init.lua @@ -0,0 +1,333 @@ + +-- Simple Skins mod for minetest +-- Adds a simple skin selector to the inventory by using +-- the default sfinv or inventory_plus when running. +-- Released by TenPlus1 and based on Zeg9's code under MIT license + +-- check for minetest 5.x compatibility +local is_54 = minetest.has_feature("direct_velocity_on_players") or nil +local is_50 = minetest.has_feature("object_use_texture_alpha") or nil + +-- Load support for translation. +local S + +if minetest.get_translator ~= nil then + S = minetest.get_translator("skins") + is_50 = true +else + if minetest.get_modpath("intllib") then + dofile(minetest.get_modpath("intllib").."/init.lua") + if intllib.make_gettext_pair then + gettext, ngettext = intllib.make_gettext_pair() -- new gettext method + else + gettext = intllib.Getter() -- old text file method + end + S = gettext + else -- boilerplate function + S = function(str, ...) + local args = {...} + return str:gsub("@%d", function(match) + return args[tonumber(match:sub(2))] + end) + end + end +end + + +skins = { + skins = {}, list = {}, meta = {}, formspec = {}, + modpath = minetest.get_modpath("skins"), + invplus = minetest.get_modpath("inventory_plus"), + unified_inventory = minetest.get_modpath("unified_inventory"), + default_skin_tab = false, + sfinv = minetest.get_modpath("sfinv"), + transparant_list = false, + id = 1, + file = minetest.get_worldpath() .. "/skins.mt", + preview = minetest.settings:get_bool("skins_preview") or true, + translate = S, + skin_limit = tonumber(minetest.settings:get("skins_limit")) or 160 +} + + +-- check and use specific inventory +if skins.unified_inventory then + skins.transparant_list = true + dofile(skins.modpath .. "/unified_inventory.lua") + +elseif skins.invplus then + skins.transparant_list = true + dofile(skins.modpath .. "/inventory_plus.lua") + +elseif skins.sfinv then + skins.default_skin_tab = not skins.invplus and not skins.unified_inventory + dofile(skins.modpath .. "/sfinv.lua") +end + + +-- load skin list and metadata +local f, data, skin = 1 + +while skins.id <= skins.skin_limit do + + skin = "character_" .. skins.id + + -- does skin file exist ? + f = io.open(skins.modpath .. "/textures/" .. skin .. ".png") + + -- escape loop if not found and remove last entry + if not f then + skins.list[skins.id] = nil + skins.id = skins.id - 1 + break + end + + f:close() + + table.insert(skins.list, skin) + + -- does metadata exist for that skin file ? + f = io.open(skins.modpath .. "/meta/" .. skin .. ".txt") + + if f then + data = minetest.deserialize("return {" .. f:read("*all") .. "}") + f:close() + end + + -- add metadata to list + skins.meta[skin] = { + name = data and data.name and data.name:gsub("[%p%c]", "") or "", + author = data and data.author and data.author:gsub("[%p%c]", "") or "" + } + + skins.id = skins.id + 1 +end + + +-- load player skins file for backwards compatibility +local input = io.open(skins.file, "r") +local data = nil + +if input then + data = input:read("*all") + io.close(input) +end + +if data and data ~= "" then + + local lines = string.split(data, "\n") + + for _, line in pairs(lines) do + data = string.split(line, " ", 2) + skins.skins[data[1]] = data[2] + end +end + + +-- create formspec for skin selection page +skins.formspec.main = function(name) + + local formspec = "label[.5,2;" .. S("Select Player Skin:") .. "]" + .. "textlist[.5,2.5;6.8,6;skins_set;" + + local meta + local selected = 1 + + for i = 1, #skins.list do + + formspec = formspec .. skins.meta[ skins.list[i] ].name + + if skins.skins[name] == skins.list[i] then + selected = i + meta = skins.meta[ skins.skins[name] ] + end + + if i < #skins.list then + formspec = formspec .."," + end + end + + if skins.transparant_list then + formspec = formspec .. ";" .. selected .. ";true]" + else + formspec = formspec .. ";" .. selected .. ";false]" + end + + if meta then + + if meta.name then + formspec = formspec .. "label[2,.5;" .. S("Name: ") .. meta.name .. "]" + end + + if meta.author then + formspec = formspec .. "label[2,1;" .. S("Author: ") .. meta.author .. "]" + end + end + + -- if preview enabled then add player model to formspec (5.4dev only) + if skins.preview == true then + if is_54 then + formspec = formspec .. "model[6,-0.2;1.5,3;player;character.b3d;" + .. skins.skins[name] .. ".png;0,180;false;true]" + else + local head = "[combine:8x8:-8,-8="..skins.skins[name]..".png" + local body = "[combine:8x12:-20,-20="..skins.skins[name]..".png" + local left_leg = "[combine:4x12:-4,-20="..skins.skins[name]..".png" + local right_leg = "[combine:4x12:-4,-20="..skins.skins[name]..".png^[transformFX" + local left_hand = "[combine:4x12:-44,-20="..skins.skins[name]..".png" + local right_hand = "[combine:4x12:-44,-20="..skins.skins[name]..".png^[transformFX" + local back_head = "[combine:8x8:-24,-8="..skins.skins[name]..".png" + local body_back = "[combine:8x12:-32,-20="..skins.skins[name]..".png" + local legs_back = "[combine:4x12:-12,-20="..skins.skins[name]..".png" + local left_leg_back = "[combine:4x12:-12,-20="..skins.skins[name]..".png" + local right_leg_back = "[combine:4x12:-12,-20="..skins.skins[name]..".png^[transformFX" + local left_hand_back = "[combine:4x12:-52,-20="..skins.skins[name]..".png" + local right_hand_back = "[combine:4x12:-52,-20="..skins.skins[name]..".png^[transformFX" + formspec = formspec .. "image[3,1;2,2;".. head .. "] image[3,2.75;2,3;".. body .. "] image[3,5.35;1,3;".. left_leg .. "] image[3.82,5.35;1,3;".. right_leg .. "] image[2.2,2.75;1,3;".. left_hand .. "] image[4.63,2.75;1,3;".. right_hand .. "] image[7,1;2,2;".. back_head .. "] image[7,2.75;2,3;".. body_back .. "] image[7,5.35;1,3;".. left_leg_back .. "] image[7.82,5.35;1,3;".. right_leg_back .. "] image[6.2,2.75;1,3;".. left_hand_back .. "] image[8.63,2.75;1,3;".. right_hand_back .. "] image_button[0,1;2,2;"..head.."]" + end + end + + return formspec +end + + +-- Read the image size from a PNG file. (returns width, height) +local PNG_HDR = string.char(0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A) +local function read_image_size(filename) + + local f = io.open(filename, "rb") + + if not f then return end + + f:seek("set", 0x0) + + local hdr = f:read(string.len(PNG_HDR)) + + if hdr ~= PNG_HDR then + f:close() ; return + end + + f:seek("set", 0x13) ; local ws = f:read(1) + f:seek("set", 0x17) ; local hs = f:read(1) + f:close() + + return ws:byte(), hs:byte() +end + + +-- update player skin +skins.update_player_skin = function(player) + + if not player then + return + end + + local name = player:get_player_name() + + if minetest.get_modpath("player_api") then + player_api.set_textures(player, {skins.skins[name] .. ".png"}) + else + default.player_set_textures(player, {skins.skins[name] .. ".png"}) + end +end + + +skins.event_CHG = function(event, player) + + local name = player:get_player_name() + local index = math.min(event.index, skins.id) + + if not skins.list[index] then + return -- Do not update wrong skin number + end + + skins.skins[name] = skins.list[index] + + skins.update_player_skin(player) + + if is_50 then + + local meta = player:get_meta() + + meta:set_string("skins:skin", skins.skins[name]) + else + player:set_attribute("skins:skin", skins.skins[name]) + end +end + + +-- load player skin on join +minetest.register_on_joinplayer(function(player) + + local name = player:get_player_name() ; if not name then return end + local skin + + if is_50 then + + local meta = player:get_meta() + + skin = meta:get_string("skins:skin") + else + skin = player:get_attribute("skins:skins") + end + + -- do we already have a skin in player attributes? + if skin and skin ~= "" then + skins.skins[name] = skin + + -- otherwise use skin from skins.mt file or default if not set + elseif not skins.skins[name] then + skins.skins[name] = "character_1" + end + + skins.update_player_skin(player) +end) + + +-- admin command to set player skin (usually for custom skins) +minetest.register_chatcommand("setskin", { + params = " ", + description = S("Admin command to set player skin"), + privs = {server = true}, + func = function(name, param) + + local playername, skin = string.match(param, "([^ ]+) (-?%d+)") + + if not playername or not skin then + return false, S("** Insufficient or wrong parameters") + end + + local player = minetest.get_player_by_name(playername) + + if not player then + return false, S("** Player @1 not online!", playername) + end + + -- this check is only used when custom skins aren't in use +-- if not skins.list[tonumber(skin)] then +-- return false, S("** Invalid skin number (max value is @1)", id) +-- end + + skins.skins[playername] = "character_" .. tonumber(skin) + + skins.update_player_skin(player) + + if is_50 then + + local meta = player:get_meta() + + meta:set_string("skins:skin", skins.skins[playername]) + else + player:set_attribute("skins:skin", skins.skins[playername]) + end + + minetest.chat_send_player(playername, + S("Your skin has been set to") .. " character_" .. skin) + + return true, "** " .. playername .. S("'s skin set to") + .. " character_" .. skin .. ".png" + end, +}) + + +print ("[MOD] skins (Simple Skins) loaded") diff --git a/mods/skins/inventory_plus.lua b/mods/skins/inventory_plus.lua new file mode 100644 index 0000000..5c61193 --- /dev/null +++ b/mods/skins/inventory_plus.lua @@ -0,0 +1,40 @@ + +local S = skins.translate + + +minetest.register_on_joinplayer(function(player) + + inventory_plus.register_button(player, "skins", S("Skins"), 0, + "inventory_plus_skins.png") +end) + + +minetest.register_on_player_receive_fields(function(player, formname, fields) + + if skins.sfinv then + + local name = player:get_player_name() + + if fields.skins then + + inventory_plus.set_inventory_formspec(player, + "size[8,8.6]" + .. "bgcolor[#08080822;true]" + .. skins.formspec.main(name) + .. "button[0,.75;2,.5;main;" .. S("Back") .. "]") + end + + local event = minetest.explode_textlist_event(fields["skins_set"]) + + if event.type == "CHG" then + + skins.event_CHG(event, player) + + inventory_plus.set_inventory_formspec(player, + "size[8,8.6]" + .. "bgcolor[#08080822;true]" + .. skins.formspec.main(name) + .. "button[0,.75;2,.5;main;" .. S("Back") .. "]") + end + end +end) diff --git a/mods/skins/license.txt b/mods/skins/license.txt new file mode 100644 index 0000000..c4bf0c0 --- /dev/null +++ b/mods/skins/license.txt @@ -0,0 +1,36 @@ +License of Media: +----------------- + +Title: Minetest Skins Pack 1 +Title URL: https://opengameart.org/content/minetest-skins-pack-1 +Author: isaiah658 +License(s): License(s): CC0 ( http://creativecommons.org/publicdomain/zero/1.0/legalcode ) +Original file names: Skin_1.png to Skin_32.png and Icon.png +Simple Skins file names: character_1.png to character_31.png, character_900.png, and inventory_plus_skins.png +Modifications: None + + +License of Code: +---------------- + +The MIT License (MIT) + +Copyright (c) 2016 TenPlus1 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/mods/skins/locale/es.po b/mods/skins/locale/es.po new file mode 100644 index 0000000..d7c8a62 --- /dev/null +++ b/mods/skins/locale/es.po @@ -0,0 +1,52 @@ +# simple_skin . +# Copyright (C) 2018 +# This file is distributed under the same license as the PACKAGE package. +# Stefano Peris , 2018. +# Github: +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-21 07:29+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: PICCORO Lenz McKAY \n" +"Language-Team: \n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.12\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: init.lua +msgid "Select Player Skin:" +msgstr "Seleciona la apariencia:" + +#: init.lua +msgid "Name: " +msgstr "Nombre" + +#: init.lua +msgid "Author: " +msgstr "Autor" + +#: init.lua +msgid "Admin command to set player skin" +msgstr "Comando administrativo apra asignar apariencia de skin" + +#: init.lua +msgid "'s skin set to" +msgstr ", apariencia asignada a" + +#: init.lua +msgid "Set player skin" +msgstr "Configura la apariencia" + +#: init.lua +msgid "Close" +msgstr "Cerrar" + +#: init.lua +msgid "Skins" +msgstr "Figura" diff --git a/mods/skins/locale/fr.po b/mods/skins/locale/fr.po new file mode 100644 index 0000000..30d8e36 --- /dev/null +++ b/mods/skins/locale/fr.po @@ -0,0 +1,51 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-29 07:11+0200\n" +"PO-Revision-Date: 2017-07-29 07:17+0200\n" +"Last-Translator: fat115 \n" +"Language-Team: \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.12\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: init.lua +msgid "Select Player Skin:" +msgstr "Sélectionner l'apparence du joueur :" + +#: init.lua +msgid "Name: " +msgstr "Nom : " + +#: init.lua +msgid "Author: " +msgstr "Auteur : " + +#: init.lua +msgid "Admin command to set player skin" +msgstr "Commande admin pour définir l'apparence du joueur" + +#: init.lua +msgid "'s skin set to" +msgstr ", apparence définie pour" + +#: init.lua +msgid "Set player skin" +msgstr "Définir l'apparence du joueur" + +#: init.lua +msgid "Close" +msgstr "Fermer" + +#: init.lua +msgid "[MOD] Simple Skins loaded" +msgstr "[MOD] Simple Skins chargé" diff --git a/mods/skins/locale/it.po b/mods/skins/locale/it.po new file mode 100644 index 0000000..d470131 --- /dev/null +++ b/mods/skins/locale/it.po @@ -0,0 +1,52 @@ +# simple_skin . +# Copyright (C) 2018 +# This file is distributed under the same license as the PACKAGE package. +# Stefano Peris , 2018. +# Github: +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-21 07:29+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Stefano Peris \n" +"Language-Team: \n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.12\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: init.lua +msgid "Select Player Skin:" +msgstr "Seleziona la skin del giocatore" + +#: init.lua +msgid "Name: " +msgstr "Nome" + +#: init.lua +msgid "Author: " +msgstr "Autore" + +#: init.lua +msgid "Admin command to set player skin" +msgstr "Comando di admin per impostare la skin del giocatore" + +#: init.lua +msgid "'s skin set to" +msgstr ", la skin è impostata su" + +#: init.lua +msgid "Set player skin" +msgstr "Imposta la skin del giocatore" + +#: init.lua +msgid "Close" +msgstr "Chiudi" + +#: init.lua +msgid "[MOD] Simple Skins loaded" +msgstr "[MOD] Skins semplici caricate" diff --git a/mods/skins/locale/ms.po b/mods/skins/locale/ms.po new file mode 100644 index 0000000..bba5982 --- /dev/null +++ b/mods/skins/locale/ms.po @@ -0,0 +1,51 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-29 07:11+0200\n" +"PO-Revision-Date: 2018-02-14 01:23+0800\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.0.6\n" +"Last-Translator: MuhdNurHidayat (MNH48) \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"Language: ms\n" + +#: init.lua +msgid "Select Player Skin:" +msgstr "Pilih Kulit Pemain:" + +#: init.lua +msgid "Name: " +msgstr "Nama: " + +#: init.lua +msgid "Author: " +msgstr "Pencipta: " + +#: init.lua +msgid "Admin command to set player skin" +msgstr "Perintah pentadbir untuk menetapkan kulit pemain" + +#: init.lua +msgid "'s skin set to" +msgstr " telah ditukarkan kulitnya kepada" + +#: init.lua +msgid "Set player skin" +msgstr "Tetapkan kulit pemain" + +#: init.lua +msgid "Close" +msgstr "Tutup" + +#: init.lua +msgid "[MOD] Simple Skins loaded" +msgstr "[MODS] Simple Skins telah dimuatkan" diff --git a/mods/skins/locale/skins.es.tr b/mods/skins/locale/skins.es.tr new file mode 100644 index 0000000..51a2797 --- /dev/null +++ b/mods/skins/locale/skins.es.tr @@ -0,0 +1,10 @@ +# textdomain: simple_skins + +Select Player Skin:=Seleciona la apariencia: +Name: =Nombre: +Author: =Autor: +Admin command to set player skin=Comando administrativo apra asignar apariencia de skin +'s skin set to=, apariencia asignada a +Set player skin=Configura la apariencia +Close=Cerrar +Skins=Figura diff --git a/mods/skins/locale/skins.fr.tr b/mods/skins/locale/skins.fr.tr new file mode 100644 index 0000000..9f0bc89 --- /dev/null +++ b/mods/skins/locale/skins.fr.tr @@ -0,0 +1,10 @@ +# textdomain: simple_skins + +Select Player Skin:=Sélectionner l'apparence du joueur: +Name: =Nom: +Author: =Auteur: +Admin command to set player skin=Commande admin pour définir l'apparence du joueur +'s skin set to=, apparence définie pour +Set player skin=Définir l'apparence du joueur +Close=Fermer +Skins=Skins diff --git a/mods/skins/locale/skins.it.tr b/mods/skins/locale/skins.it.tr new file mode 100644 index 0000000..77e8012 --- /dev/null +++ b/mods/skins/locale/skins.it.tr @@ -0,0 +1,10 @@ +# textdomain: simple_skins + +Select Player Skin:=Seleziona la skin del giocatore +Name: =Nome: +Author: =Autore: +Admin command to set player skin=Comando di admin per impostare la skin del giocatore +'s skin set to=, la skin è impostata su +Set player skin=Imposta la skin del giocatore +Close=Chiudi +Skins=Pelli diff --git a/mods/skins/locale/skins.ms.tr b/mods/skins/locale/skins.ms.tr new file mode 100644 index 0000000..bcc71ff --- /dev/null +++ b/mods/skins/locale/skins.ms.tr @@ -0,0 +1,10 @@ +# textdomain: simple_skins + +Select Player Skin:=Pilih Kulit Pemain: +Name: =Nama: +Author: =Pencipta: +Admin command to set player skin=Perintah pentadbir untuk menetapkan kulit pemain +'s skin set to= telah ditukarkan kulitnya kepada +Set player skin=Tetapkan kulit pemain +Close=Tutup +Skins=Kulit diff --git a/mods/skins/locale/template.txt b/mods/skins/locale/template.txt new file mode 100644 index 0000000..5ada204 --- /dev/null +++ b/mods/skins/locale/template.txt @@ -0,0 +1,11 @@ +# textdomain: simple_skins + +Select Player Skin:= +Name: = +Author: = +Admin command to set player skin= +'s skin set to= +Set player skin= +Close= +Skins= +[MOD] Simple Skins loaded= diff --git a/mods/skins/meta/character_1.txt b/mods/skins/meta/character_1.txt new file mode 100644 index 0000000..7b2fffe --- /dev/null +++ b/mods/skins/meta/character_1.txt @@ -0,0 +1,2 @@ +name = "Farmer", +author = "isaiah658", diff --git a/mods/skins/meta/character_10.txt b/mods/skins/meta/character_10.txt new file mode 100644 index 0000000..ddc7581 --- /dev/null +++ b/mods/skins/meta/character_10.txt @@ -0,0 +1,2 @@ +name = "Farm Girl", +author = "isaiah658", diff --git a/mods/skins/meta/character_11.txt b/mods/skins/meta/character_11.txt new file mode 100644 index 0000000..e3c845f --- /dev/null +++ b/mods/skins/meta/character_11.txt @@ -0,0 +1,2 @@ +name = "Jerry", +author = "isaiah658", diff --git a/mods/skins/meta/character_12.txt b/mods/skins/meta/character_12.txt new file mode 100644 index 0000000..86f1f1a --- /dev/null +++ b/mods/skins/meta/character_12.txt @@ -0,0 +1,2 @@ +name = "Scary", +author = "isaiah658", diff --git a/mods/skins/meta/character_13.txt b/mods/skins/meta/character_13.txt new file mode 100644 index 0000000..e25e637 --- /dev/null +++ b/mods/skins/meta/character_13.txt @@ -0,0 +1,2 @@ +name = "Cool Dude", +author = "isaiah658", diff --git a/mods/skins/meta/character_14.txt b/mods/skins/meta/character_14.txt new file mode 100644 index 0000000..e6c6e63 --- /dev/null +++ b/mods/skins/meta/character_14.txt @@ -0,0 +1,2 @@ +name = "Knight", +author = "isaiah658", diff --git a/mods/skins/meta/character_15.txt b/mods/skins/meta/character_15.txt new file mode 100644 index 0000000..4f99bb4 --- /dev/null +++ b/mods/skins/meta/character_15.txt @@ -0,0 +1,2 @@ +name = "Derp Dirt", +author = "isaiah658", diff --git a/mods/skins/meta/character_16.txt b/mods/skins/meta/character_16.txt new file mode 100644 index 0000000..6214d58 --- /dev/null +++ b/mods/skins/meta/character_16.txt @@ -0,0 +1,2 @@ +name = "Ice", +author = "isaiah658", diff --git a/mods/skins/meta/character_17.txt b/mods/skins/meta/character_17.txt new file mode 100644 index 0000000..7e1218e --- /dev/null +++ b/mods/skins/meta/character_17.txt @@ -0,0 +1,2 @@ +name = "Robot", +author = "isaiah658", diff --git a/mods/skins/meta/character_18.txt b/mods/skins/meta/character_18.txt new file mode 100644 index 0000000..8e9297d --- /dev/null +++ b/mods/skins/meta/character_18.txt @@ -0,0 +1,2 @@ +name = "King", +author = "isaiah658", diff --git a/mods/skins/meta/character_19.txt b/mods/skins/meta/character_19.txt new file mode 100644 index 0000000..ec61eb0 --- /dev/null +++ b/mods/skins/meta/character_19.txt @@ -0,0 +1,2 @@ +name = "Diced", +author = "isaiah658", diff --git a/mods/skins/meta/character_2.txt b/mods/skins/meta/character_2.txt new file mode 100644 index 0000000..5cc134b --- /dev/null +++ b/mods/skins/meta/character_2.txt @@ -0,0 +1,2 @@ +name = "Waffles", +author = "isaiah658", diff --git a/mods/skins/meta/character_20.txt b/mods/skins/meta/character_20.txt new file mode 100644 index 0000000..e63411e --- /dev/null +++ b/mods/skins/meta/character_20.txt @@ -0,0 +1,2 @@ +name = "Glitch", +author = "isaiah658", diff --git a/mods/skins/meta/character_21.txt b/mods/skins/meta/character_21.txt new file mode 100644 index 0000000..c2512d0 --- /dev/null +++ b/mods/skins/meta/character_21.txt @@ -0,0 +1,2 @@ +name = "Pink Camouflage", +author = "isaiah658", diff --git a/mods/skins/meta/character_22.txt b/mods/skins/meta/character_22.txt new file mode 100644 index 0000000..69a730f --- /dev/null +++ b/mods/skins/meta/character_22.txt @@ -0,0 +1,2 @@ +name = "Biker", +author = "isaiah658", diff --git a/mods/skins/meta/character_23.txt b/mods/skins/meta/character_23.txt new file mode 100644 index 0000000..a84a7d2 --- /dev/null +++ b/mods/skins/meta/character_23.txt @@ -0,0 +1,2 @@ +name = "Jade", +author = "isaiah658", diff --git a/mods/skins/meta/character_24.txt b/mods/skins/meta/character_24.txt new file mode 100644 index 0000000..d49cd77 --- /dev/null +++ b/mods/skins/meta/character_24.txt @@ -0,0 +1,2 @@ +name = "Split", +author = "isaiah658", diff --git a/mods/skins/meta/character_25.txt b/mods/skins/meta/character_25.txt new file mode 100644 index 0000000..accb736 --- /dev/null +++ b/mods/skins/meta/character_25.txt @@ -0,0 +1,2 @@ +name = "Camouflage", +author = "isaiah658", diff --git a/mods/skins/meta/character_26.txt b/mods/skins/meta/character_26.txt new file mode 100644 index 0000000..e786110 --- /dev/null +++ b/mods/skins/meta/character_26.txt @@ -0,0 +1,2 @@ +name = "Earth", +author = "isaiah658", diff --git a/mods/skins/meta/character_27.txt b/mods/skins/meta/character_27.txt new file mode 100644 index 0000000..ba3d928 --- /dev/null +++ b/mods/skins/meta/character_27.txt @@ -0,0 +1,2 @@ +name = "Stone", +author = "isaiah658", diff --git a/mods/skins/meta/character_28.txt b/mods/skins/meta/character_28.txt new file mode 100644 index 0000000..b092b65 --- /dev/null +++ b/mods/skins/meta/character_28.txt @@ -0,0 +1,2 @@ +name = "Lab Coat", +author = "isaiah658", diff --git a/mods/skins/meta/character_29.txt b/mods/skins/meta/character_29.txt new file mode 100644 index 0000000..7bd505b --- /dev/null +++ b/mods/skins/meta/character_29.txt @@ -0,0 +1,2 @@ +name = "Skeleton", +author = "isaiah658", diff --git a/mods/skins/meta/character_3.txt b/mods/skins/meta/character_3.txt new file mode 100644 index 0000000..6a7c59d --- /dev/null +++ b/mods/skins/meta/character_3.txt @@ -0,0 +1,2 @@ +name = "Autumn", +author = "isaiah658", diff --git a/mods/skins/meta/character_30.txt b/mods/skins/meta/character_30.txt new file mode 100644 index 0000000..2031b24 --- /dev/null +++ b/mods/skins/meta/character_30.txt @@ -0,0 +1,2 @@ +name = "Winter Boy", +author = "isaiah658", diff --git a/mods/skins/meta/character_31.txt b/mods/skins/meta/character_31.txt new file mode 100644 index 0000000..cc65ae1 --- /dev/null +++ b/mods/skins/meta/character_31.txt @@ -0,0 +1,2 @@ +name = "Winter Girl", +author = "isaiah658", diff --git a/mods/skins/meta/character_4.txt b/mods/skins/meta/character_4.txt new file mode 100644 index 0000000..266adec --- /dev/null +++ b/mods/skins/meta/character_4.txt @@ -0,0 +1,2 @@ +name = "Cubed", +author = "isaiah658", diff --git a/mods/skins/meta/character_5.txt b/mods/skins/meta/character_5.txt new file mode 100644 index 0000000..fd4986d --- /dev/null +++ b/mods/skins/meta/character_5.txt @@ -0,0 +1,2 @@ +name = "Tux", +author = "isaiah658", diff --git a/mods/skins/meta/character_6.txt b/mods/skins/meta/character_6.txt new file mode 100644 index 0000000..3f039ee --- /dev/null +++ b/mods/skins/meta/character_6.txt @@ -0,0 +1,2 @@ +name = "Cool Guy", +author = "isaiah658", diff --git a/mods/skins/meta/character_7.txt b/mods/skins/meta/character_7.txt new file mode 100644 index 0000000..adbf474 --- /dev/null +++ b/mods/skins/meta/character_7.txt @@ -0,0 +1,2 @@ +name = "Cool Girl", +author = "isaiah658", diff --git a/mods/skins/meta/character_8.txt b/mods/skins/meta/character_8.txt new file mode 100644 index 0000000..72a6162 --- /dev/null +++ b/mods/skins/meta/character_8.txt @@ -0,0 +1,2 @@ +name = "Retro", +author = "isaiah658", diff --git a/mods/skins/meta/character_9.txt b/mods/skins/meta/character_9.txt new file mode 100644 index 0000000..9d3d7da --- /dev/null +++ b/mods/skins/meta/character_9.txt @@ -0,0 +1,2 @@ +name = "Jim", +author = "isaiah658", diff --git a/mods/skins/meta/character_900.txt b/mods/skins/meta/character_900.txt new file mode 100644 index 0000000..14e1901 --- /dev/null +++ b/mods/skins/meta/character_900.txt @@ -0,0 +1,2 @@ +name = "PICCORO", +author = "none", diff --git a/mods/skins/mod.conf b/mods/skins/mod.conf new file mode 100644 index 0000000..da6a90e --- /dev/null +++ b/mods/skins/mod.conf @@ -0,0 +1,4 @@ +name = skins +depends = default, player_api +optional_depends = sfinv, inventory_plus, intllib, unified_inventory +description = SKIN manager mod, Simple_Skin modified mod that allow players to set their individual skins. diff --git a/mods/skins/readme.md b/mods/skins/readme.md new file mode 100644 index 0000000..15cd437 --- /dev/null +++ b/mods/skins/readme.md @@ -0,0 +1,93 @@ +minetest mod Simple Skins +========================= + +Mod for skin appereance change of your player in a nice tab of your inventory + +Information +------------ + +This is a modification of origina Simple Skins mod, in sync with minenux project, +is a mod that's so easy to use you'll wonder why it hasn't been +done before... Just download and start to use it in your inventory. + +Must be named `skins` and uses SfInv or Inventory Plus mods, +and Unified Inventory if you use lasted original (master branch) +version when available to allow players to select a skin/texture from the list. + +![screenshot.jpg](screenshot.jpg) + +Original forum https://forum.minetest.net/viewtopic.php?id=9100 + +Technical Information +--------------------- + +This mod its more basic and minimalis, no preview and no download/upload, management, +it target is to be light for huge servers and be minimal for better performance. + +This version is fully compatible with 5.X and 4.X also 0.4.16 versions of minetest + +Based on Zeg9's Skins mod originally from https://github.com/Zeg9/minetest-skins/ and +with some help from PilzAdam. Also implements some minimal features backported from SkinDB +like preview (disabled by default). The preview is autogenerated (2d), unless others mods. + +#### Download + +You can clone this repository in your minetest mods directory or in your game. + +#### Depends + +* default +* sfinv (optional, autodetected) +* player_api (newer version only) +* inventory_plus (optional, autodetected) +* unified_inventory (optional, autodetected) + +#### Skin management + +You can download a skin from skin database, set a new skin converted +from others boxel games or create it from scrat. + +* **Download a mt-skin** It uses skins from Addi's **MT-Skin-DB** +skin database, currently at http://minetest.fensta.bplaced.net/ +* **Download a mc-skind** Uses minecraft 1.7 skins, for 1.8+ will need newer 5.X mt, +and some images must crop it from 64x64 to 64x32. + +To download a skin mt made or mc ones, just: + +1. go to the web page skin, and download it, will get you a `png` file, +2. put into the textures directory and rename it accordingly e.g `character_2.png` +3. pop into the meta directory and make a new `character_2.txt` empty file +4. fill the txt file with as described in [Structure and formats](#structure-and-formats) + +If you use the skindb download tool, that already generates all +the necessary files, with the requested names and formats. https://github.com/minetest-mods/skinsdb/tree/master/updater + +#### Structure and formats + +Each skin is made up of at least two files, a png file and a txt file, +the "png file" is placed in the `textures` directory and +the "txt file" in the `meta` directory. + +the format of the txt file is: + +``` +name = "Skin Name", +author = "author that make the skin", +``` + + +Change log: +----------- + +- 1.01- Replace all unlicensed skins with CC0 one's (many thanks isaiah658) +- 1.0 - Added skin_limit setting to limit skins loaded, sanitized skin description +- 0.9 - Added Unified Inventory support (thanks Opvolger) +- 0.8 - Added player model preview when viewing formspec (Minetest 5.4 dev only) +- 0.7 - Add some error checks, improve /setskin and tweak & tidy code +- 0.6 - Updated to use Minetest 0.4.16 functions +- 0.5 - Added compatibility with default sfinv inventory, disabled /skin command for now +- 0.4 - Added /skin command to set player skin, no longer dependent on Inventory+, also /setskin command for server admin to set custom skins for player. +- 0.3 - Now works with Minetest 0.4.10+ +- 0.2 - Added 3D_Armor mod compatibility +- 0.1 - Added addi's changes to highlight selected skin on list (thanks) +- 0.0 - Initial release diff --git a/mods/skins/screenshot.jpg b/mods/skins/screenshot.jpg new file mode 100644 index 0000000..77f013c Binary files /dev/null and b/mods/skins/screenshot.jpg differ diff --git a/mods/skins/settingtypes.txt b/mods/skins/settingtypes.txt new file mode 100644 index 0000000..4265971 --- /dev/null +++ b/mods/skins/settingtypes.txt @@ -0,0 +1,5 @@ +# When true character model will appear in formspec with current skin as texture +skins_preview (Simple Skins Preview) bool true + +# Skin limit number to limit the number of skins read onto list +skins_limit (Skin Limit) int 300 diff --git a/mods/skins/sfinv.lua b/mods/skins/sfinv.lua new file mode 100644 index 0000000..9ca118a --- /dev/null +++ b/mods/skins/sfinv.lua @@ -0,0 +1,39 @@ + +local S = skins.translate + + +if skins.default_skin_tab then + + sfinv.register_page("skins:skins", {title = S("Skins"), + + get = function(self, player, context) + + local name = player:get_player_name() + + return sfinv.make_formspec(player, context,skins.formspec.main(name)) + end, + + on_player_receive_fields = function(self, player, context, fields) + + local event = minetest.explode_textlist_event(fields["skins_set"]) + + if event.type == "CHG" then + + skins.event_CHG(event, player) + + sfinv.override_page("skins:skins", { + + get = function(self, player, context) + + local name = player:get_player_name() + + return sfinv.make_formspec(player, context, + skins.formspec.main(name)) + end + }) + + sfinv.set_player_inventory_formspec(player) + end + end + }) +end diff --git a/mods/skins/textures/character_1.png b/mods/skins/textures/character_1.png new file mode 100644 index 0000000..413a094 Binary files /dev/null and b/mods/skins/textures/character_1.png differ diff --git a/mods/skins/textures/character_10.png b/mods/skins/textures/character_10.png new file mode 100644 index 0000000..7d3d79b Binary files /dev/null and b/mods/skins/textures/character_10.png differ diff --git a/mods/skins/textures/character_11.png b/mods/skins/textures/character_11.png new file mode 100644 index 0000000..dfdd35e Binary files /dev/null and b/mods/skins/textures/character_11.png differ diff --git a/mods/skins/textures/character_12.png b/mods/skins/textures/character_12.png new file mode 100644 index 0000000..e9f026a Binary files /dev/null and b/mods/skins/textures/character_12.png differ diff --git a/mods/skins/textures/character_13.png b/mods/skins/textures/character_13.png new file mode 100644 index 0000000..c04e309 Binary files /dev/null and b/mods/skins/textures/character_13.png differ diff --git a/mods/skins/textures/character_14.png b/mods/skins/textures/character_14.png new file mode 100644 index 0000000..ce88dc3 Binary files /dev/null and b/mods/skins/textures/character_14.png differ diff --git a/mods/skins/textures/character_15.png b/mods/skins/textures/character_15.png new file mode 100644 index 0000000..e79c4a6 Binary files /dev/null and b/mods/skins/textures/character_15.png differ diff --git a/mods/skins/textures/character_16.png b/mods/skins/textures/character_16.png new file mode 100644 index 0000000..29a4a17 Binary files /dev/null and b/mods/skins/textures/character_16.png differ diff --git a/mods/skins/textures/character_17.png b/mods/skins/textures/character_17.png new file mode 100644 index 0000000..402fd59 Binary files /dev/null and b/mods/skins/textures/character_17.png differ diff --git a/mods/skins/textures/character_18.png b/mods/skins/textures/character_18.png new file mode 100644 index 0000000..4d36b00 Binary files /dev/null and b/mods/skins/textures/character_18.png differ diff --git a/mods/skins/textures/character_19.png b/mods/skins/textures/character_19.png new file mode 100644 index 0000000..eee2f45 Binary files /dev/null and b/mods/skins/textures/character_19.png differ diff --git a/mods/skins/textures/character_2.png b/mods/skins/textures/character_2.png new file mode 100644 index 0000000..f91cbf5 Binary files /dev/null and b/mods/skins/textures/character_2.png differ diff --git a/mods/skins/textures/character_20.png b/mods/skins/textures/character_20.png new file mode 100644 index 0000000..ceda4c0 Binary files /dev/null and b/mods/skins/textures/character_20.png differ diff --git a/mods/skins/textures/character_21.png b/mods/skins/textures/character_21.png new file mode 100644 index 0000000..1a17cdf Binary files /dev/null and b/mods/skins/textures/character_21.png differ diff --git a/mods/skins/textures/character_22.png b/mods/skins/textures/character_22.png new file mode 100644 index 0000000..1a340bb Binary files /dev/null and b/mods/skins/textures/character_22.png differ diff --git a/mods/skins/textures/character_23.png b/mods/skins/textures/character_23.png new file mode 100644 index 0000000..6881a89 Binary files /dev/null and b/mods/skins/textures/character_23.png differ diff --git a/mods/skins/textures/character_24.png b/mods/skins/textures/character_24.png new file mode 100644 index 0000000..6e01c5c Binary files /dev/null and b/mods/skins/textures/character_24.png differ diff --git a/mods/skins/textures/character_25.png b/mods/skins/textures/character_25.png new file mode 100644 index 0000000..ec2781f Binary files /dev/null and b/mods/skins/textures/character_25.png differ diff --git a/mods/skins/textures/character_26.png b/mods/skins/textures/character_26.png new file mode 100644 index 0000000..9b1c8f4 Binary files /dev/null and b/mods/skins/textures/character_26.png differ diff --git a/mods/skins/textures/character_27.png b/mods/skins/textures/character_27.png new file mode 100644 index 0000000..f30bab0 Binary files /dev/null and b/mods/skins/textures/character_27.png differ diff --git a/mods/skins/textures/character_28.png b/mods/skins/textures/character_28.png new file mode 100644 index 0000000..131e9f3 Binary files /dev/null and b/mods/skins/textures/character_28.png differ diff --git a/mods/skins/textures/character_29.png b/mods/skins/textures/character_29.png new file mode 100644 index 0000000..988ab0a Binary files /dev/null and b/mods/skins/textures/character_29.png differ diff --git a/mods/skins/textures/character_3.png b/mods/skins/textures/character_3.png new file mode 100644 index 0000000..6d93b64 Binary files /dev/null and b/mods/skins/textures/character_3.png differ diff --git a/mods/skins/textures/character_30.png b/mods/skins/textures/character_30.png new file mode 100644 index 0000000..c2e5a19 Binary files /dev/null and b/mods/skins/textures/character_30.png differ diff --git a/mods/skins/textures/character_31.png b/mods/skins/textures/character_31.png new file mode 100644 index 0000000..1b7b10d Binary files /dev/null and b/mods/skins/textures/character_31.png differ diff --git a/mods/skins/textures/character_4.png b/mods/skins/textures/character_4.png new file mode 100644 index 0000000..0d878bd Binary files /dev/null and b/mods/skins/textures/character_4.png differ diff --git a/mods/skins/textures/character_5.png b/mods/skins/textures/character_5.png new file mode 100644 index 0000000..49876b4 Binary files /dev/null and b/mods/skins/textures/character_5.png differ diff --git a/mods/skins/textures/character_6.png b/mods/skins/textures/character_6.png new file mode 100644 index 0000000..e4e3c02 Binary files /dev/null and b/mods/skins/textures/character_6.png differ diff --git a/mods/skins/textures/character_7.png b/mods/skins/textures/character_7.png new file mode 100644 index 0000000..b849f0a Binary files /dev/null and b/mods/skins/textures/character_7.png differ diff --git a/mods/skins/textures/character_8.png b/mods/skins/textures/character_8.png new file mode 100644 index 0000000..b2ad095 Binary files /dev/null and b/mods/skins/textures/character_8.png differ diff --git a/mods/skins/textures/character_9.png b/mods/skins/textures/character_9.png new file mode 100644 index 0000000..96eca82 Binary files /dev/null and b/mods/skins/textures/character_9.png differ diff --git a/mods/skins/textures/character_900.png b/mods/skins/textures/character_900.png new file mode 100644 index 0000000..8fae5f5 Binary files /dev/null and b/mods/skins/textures/character_900.png differ diff --git a/mods/skins/textures/inventory_plus_skins.png b/mods/skins/textures/inventory_plus_skins.png new file mode 100644 index 0000000..57ef73f Binary files /dev/null and b/mods/skins/textures/inventory_plus_skins.png differ diff --git a/mods/skins/unified_inventory.lua b/mods/skins/unified_inventory.lua new file mode 100644 index 0000000..cbd7c89 --- /dev/null +++ b/mods/skins/unified_inventory.lua @@ -0,0 +1,48 @@ + +local S = skins.translate + + +unified_inventory.register_button("skins", { + type = "image", + image = "inventory_plus_skins.png", + tooltip = S("Skins") +}) + + +unified_inventory.register_page("skins", { + + get_formspec = function(player, perplayer_formspec) + + local formheadery = perplayer_formspec.form_header_y + local F = minetest.formspec_escape + local player_name = player:get_player_name() + local formspec = "label[0," .. formheadery .. ";" .. F(S("Skins")) .."]" + + formspec = formspec .. "listcolors[#00000000;#00000000]" + formspec = formspec .. skins.formspec.main(player_name) + + return {formspec = formspec, draw_inventory = false} + end +}) + + +minetest.register_on_player_receive_fields(function(player, formname, fields) + + if skins.sfinv then + + local name = player:get_player_name() + + if fields.skins then + unified_inventory.set_inventory_formspec(player, "skins") + end + + local event = minetest.explode_textlist_event(fields["skins_set"]) + + if event.type == "CHG" then + + skins.event_CHG(event, player) + + unified_inventory.set_inventory_formspec(player, "skins") + end + end +end)