From ec302672234691b2cb1e5e909a81948718697a4a Mon Sep 17 00:00:00 2001 From: Suns <52580541+SunsBR@users.noreply.github.com> Date: Sat, 23 May 2020 03:56:30 -0300 Subject: [PATCH 01/10] Fix corrupted data in Windows systems (#47) The base64 data from the decoder to the file writer is in binary, using only the "w" flag would work in most unix systems but its incorrect and for all systems with crazy line_feed/Carrier_return or any character conversion the right way to save a binary data is using the "wb" flag. --- skins_updater.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skins_updater.lua b/skins_updater.lua index e349e99..22f3486 100644 --- a/skins_updater.lua +++ b/skins_updater.lua @@ -75,7 +75,7 @@ end -- Insecure workaround since meta/ and textures/ cannot be written to local function unsafe_file_write(path, contents) - local f = ie.io.open(path, "w") + local f = ie.io.open(path, "wb") f:write(contents) f:close() end From 55704e165732e5115bae82308a2c8876ee53cf4b Mon Sep 17 00:00:00 2001 From: Lejo1 Date: Mon, 25 May 2020 11:34:52 +0200 Subject: [PATCH 02/10] fix chrash when using /skinsdb set without parameter or /skinsdb list public --- chatcommands.lua | 13 ++++++++----- locale/skinsdb.de.tr | 1 + locale/template.txt | 1 + skin_meta_api.lua | 5 +++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/chatcommands.lua b/chatcommands.lua index 3d069e0..25e43d0 100644 --- a/chatcommands.lua +++ b/chatcommands.lua @@ -36,11 +36,14 @@ minetest.register_chatcommand("skinsdb", { end if command == "set" then - local success = skins.set_player_skin(player, parameter) - if success then - return true, S("skin set to").." "..parameter - else - return false, S("invalid skin").." "..parameter + if parameter then + local success = skins.set_player_skin(player, parameter) + if success then + return true, S("skin set to").." "..parameter + else + return false, S("invalid skin").." "..parameter + end + else return false, S("Requires skin key") end elseif command == "list" then local list diff --git a/locale/skinsdb.de.tr b/locale/skinsdb.de.tr index 2585624..8813756 100644 --- a/locale/skinsdb.de.tr +++ b/locale/skinsdb.de.tr @@ -16,3 +16,4 @@ skin set to=Skin ist jetzt invalid skin=unbekannter Skin unknown parameter=unbekannter Parameter Skins=Aussehen +Requires skin key=Benötigt Skin-Name diff --git a/locale/template.txt b/locale/template.txt index c5eb981..35d3021 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -17,3 +17,4 @@ unknown parameter= unknown skin= Downloads the specified range of skins and shuts down the server= Skins= +Requires skin key= diff --git a/skin_meta_api.lua b/skin_meta_api.lua index 375905b..29e174b 100644 --- a/skin_meta_api.lua +++ b/skin_meta_api.lua @@ -184,6 +184,7 @@ end function skin_class:is_applicable_for_player(playername) local assigned_player = self:get_meta("playername") - return minetest.check_player_privs(playername, {server=true}) or assigned_player == nil or assigned_player == true or - (assigned_player:lower() == playername:lower()) + return assigned_player == nil or assigned_player == true or + playername and (minetest.check_player_privs(playername, {server=true}) or + assigned_player:lower() == playername:lower()) end From 1fcd3c4a8c98563d007371be02ad567f4ba17bbb Mon Sep 17 00:00:00 2001 From: Lejo Date: Sun, 7 Jun 2020 13:39:57 +0200 Subject: [PATCH 03/10] Add python skin update script (#48) --- README.md | 14 ++++++++++++- updater/update_skins.py | 44 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 updater/update_skins.py diff --git a/README.md b/README.md index 99e6716..74e3808 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,9 @@ This Minetest mod offers changeable player skins with a graphical interface for ## Installing skins -### Download from the database +### Download from the [database](http://minetest.fensta.bplaced.net/) + +#### Ingame Downloader 1) Get Minetest 5.1.0-dev-cb00632 or newer 2) Start your world @@ -28,6 +30,16 @@ This Minetest mod offers changeable player skins with a graphical interface for You might want to run `minetest` in a Terminal/Console window to check the log output instantly. +#### Python Download script + +**Requirements:** + + * Python 3 + * `requests` library: `pip3 install requests` + +Go to the updater folder of this mod and run `python3 update_skins.py` +The Script will download all the skins from the database for you. + ### Manual addition 1) Copy your skin textures to `textures` as documented in `textures/readme.txt` diff --git a/updater/update_skins.py b/updater/update_skins.py new file mode 100644 index 0000000..f898148 --- /dev/null +++ b/updater/update_skins.py @@ -0,0 +1,44 @@ +import sys, requests, base64 + +print("Downloading skins from minetest.fensta.bplaced.net ...") +# Requesting all skins and their raw texture using the API +r = requests.get('http://minetest.fensta.bplaced.net/api/v2/get.json.php?getlist&page=1&per_page=999999999') + +if r.status_code != 200: + sys.exit("Request failed!") + +data = r.json() +count = 0 + +print("Writing to file and downloading previews ...") +for json in data["skins"]: + id = str(json["id"]) + # Downloading the preview of the skin + r2 = requests.get('http://minetest.fensta.bplaced.net/skins/1/' + id + ".png") + if r.status_code == 200: + preview = r2.content + # Read meta datas + name = str(json["name"]) + author = str(json["author"]) + license = str(json["license"]) + # Texture file + raw_data = base64.b64decode(json["img"]) + file = open("../textures/character_" + id + ".png", "wb") + file.write(bytearray(raw_data)) + file.close() + # Preview file + file = open("../textures/character_" + id + "_preview.png", "wb") + file.write(bytearray(preview)) + file.close() + # Meta file + file = open("../meta/character_" + id + ".txt", "w") + file.write(name + "\n" + author + "\n" + license + "\n") + file.close() + print("Added #%s Name: %s Author: %s License: %s" % (id, name, author, license)) + count += 1 + + else: + print("Failed to download skin #" + id) + + +print("Fetched " + str(count) + " skins!") From b5ba66deca68a33bd7df26bd840932e35335d148 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Wed, 29 Jul 2020 20:27:09 +0200 Subject: [PATCH 04/10] api.lua: Fix deprecation warnings --- api.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api.lua b/api.lua index add2fa8..87765d1 100644 --- a/api.lua +++ b/api.lua @@ -2,9 +2,11 @@ local storage = minetest.get_mod_storage() function skins.get_player_skin(player) - if player:get_attribute("skinsdb:skin_key") then - storage:set_string(player:get_player_name(), player:get_attribute("skinsdb:skin_key")) - player:set_attribute("skinsdb:skin_key", nil) + local meta = player:get_meta() + if meta:get("skinsdb:skin_key") then + -- Move player data prior July 2018 to mod storage + storage:set_string(player:get_player_name(), player:get_string("skinsdb:skin_key")) + meta:set_string("skinsdb:skin_key", "") end local skin = storage:get_string(player:get_player_name()) return skins.get(skin) or skins.get(skins.default) From 8799ba0bd5fe872819198ee0fc6add7923e6b0b7 Mon Sep 17 00:00:00 2001 From: Alexander Weber Date: Sun, 6 Sep 2020 13:29:59 +0200 Subject: [PATCH 05/10] updater/update_skins.py: Do not download preview files by default --- updater/update_skins.py | 66 ++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/updater/update_skins.py b/updater/update_skins.py index f898148..8132cbb 100644 --- a/updater/update_skins.py +++ b/updater/update_skins.py @@ -1,5 +1,8 @@ import sys, requests, base64 +download_preview = ( len (sys.argv) > 1 and sys.argv[1] == "with_preview" ) + + print("Downloading skins from minetest.fensta.bplaced.net ...") # Requesting all skins and their raw texture using the API r = requests.get('http://minetest.fensta.bplaced.net/api/v2/get.json.php?getlist&page=1&per_page=999999999') @@ -10,35 +13,42 @@ if r.status_code != 200: data = r.json() count = 0 -print("Writing to file and downloading previews ...") -for json in data["skins"]: - id = str(json["id"]) - # Downloading the preview of the skin - r2 = requests.get('http://minetest.fensta.bplaced.net/skins/1/' + id + ".png") - if r.status_code == 200: - preview = r2.content - # Read meta datas - name = str(json["name"]) - author = str(json["author"]) - license = str(json["license"]) - # Texture file - raw_data = base64.b64decode(json["img"]) - file = open("../textures/character_" + id + ".png", "wb") - file.write(bytearray(raw_data)) - file.close() - # Preview file - file = open("../textures/character_" + id + "_preview.png", "wb") - file.write(bytearray(preview)) - file.close() - # Meta file - file = open("../meta/character_" + id + ".txt", "w") - file.write(name + "\n" + author + "\n" + license + "\n") - file.close() - print("Added #%s Name: %s Author: %s License: %s" % (id, name, author, license)) - count += 1 +if download_preview: + print("Writing to file and downloading previews ...") +else: + print("Writing skins") - else: - print("Failed to download skin #" + id) + +for json in data["skins"]: + id = str(json["id"]).zfill(4) + + # Texture file + raw_data = base64.b64decode(json["img"]) + file = open("../textures/character_" + id + ".png", "wb") + file.write(bytearray(raw_data)) + file.close() + + # Meta file + name = str(json["name"]) + author = str(json["author"]) + license = str(json["license"]) + file = open("../meta/character_" + id + ".txt", "w") + file.write(name + "\n" + author + "\n" + license + "\n") + file.close() + print("Added #%s Name: %s Author: %s License: %s" % (id, name, author, license)) + count += 1 + + if download_preview: + # Downloading the preview of the skin + r2 = requests.get('http://minetest.fensta.bplaced.net/skins/1/' + id + ".png") + if r2.status_code == 200: + # Preview file + preview = r2.content + file = open("../textures/character_" + id + "_preview.png", "wb") + file.write(bytearray(preview)) + file.close() + else: + print("Failed to download skin preview #" + id) print("Fetched " + str(count) + " skins!") From 77c00a0823347012a4db3fd1d29cf85ea00e88fa Mon Sep 17 00:00:00 2001 From: bell07 Date: Thu, 10 Sep 2020 11:08:49 +0200 Subject: [PATCH 06/10] update_skins.py Remove leading zeros again --- updater/update_skins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/updater/update_skins.py b/updater/update_skins.py index 8132cbb..8b760b7 100644 --- a/updater/update_skins.py +++ b/updater/update_skins.py @@ -20,7 +20,7 @@ else: for json in data["skins"]: - id = str(json["id"]).zfill(4) + id = str(json["id"]) # Texture file raw_data = base64.b64decode(json["img"]) From 8048cb08f1baa2da9c6b392a9dfdcf8a8e174f8e Mon Sep 17 00:00:00 2001 From: Alexander Weber Date: Tue, 22 Sep 2020 16:03:00 +0200 Subject: [PATCH 07/10] change default dependency to player_api --- mod.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod.conf b/mod.conf index 624975f..51ba162 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = skinsdb description = Player skin mod, supporting unified_inventory, sfinv and smart_inventory -depends = default +depends = player_api optional_depends = unified_inventory,3d_armor,clothing,sfinv From da6905fd0216fa769aba6331bed5abd857c3e452 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sun, 3 Jan 2021 09:36:20 +0100 Subject: [PATCH 08/10] Mention i3 support (#55) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 74e3808..8a49f59 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ This Minetest mod offers changeable player skins with a graphical interface for - Skin change menu for sfinv (in minetest_game) and [unified_inventory](https://forum.minetest.net/viewtopic.php?t=12767) - Skins change menu and command line using chat command /skinsdb (set | show | list | list private | list public | ui) - Supported by [smart_inventory](https://forum.minetest.net/viewtopic.php?t=16597) for the skin selection +- Supported by [i3](https://github.com/minetest-mods/i3) inventory mod - Skin previews supported in selection - Additional information for each skin - Support for different skins lists: public and a per-player list are currently implemented From c53158d1596aaa32d4078d81f673dfb8e51a5ccd Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Tue, 9 Mar 2021 19:12:29 -0500 Subject: [PATCH 09/10] Update to work with Unified Inventory v2 i.e. the formspec v4 rewrite Requires UI "version-2" tag or commit a7556c50 or later and and Minetest v5.4.0 or later This also makes it work properly in UI's "lite" mode. --- formspecs.lua | 99 +++++++++++++++++++++++++++++-------- mod.conf | 1 + textures/ui_misc_form.png | Bin 6177 -> 0 bytes unified_inventory_page.lua | 19 ++++--- 4 files changed, 91 insertions(+), 28 deletions(-) delete mode 100644 textures/ui_misc_form.png diff --git a/formspecs.lua b/formspecs.lua index 39d4a17..70a5dd8 100644 --- a/formspecs.lua +++ b/formspecs.lua @@ -1,4 +1,5 @@ local S = minetest.get_translator("skinsdb") +local ui = unified_inventory function skins.get_formspec_context(player) if player then @@ -11,7 +12,7 @@ function skins.get_formspec_context(player) end -- Show skin info -function skins.get_skin_info_formspec(skin) +function skins.get_skin_info_formspec(skin, perplayer_formspec) local texture = skin:get_texture() local m_name = skin:get_meta_string("name") local m_author = skin:get_meta_string("author") @@ -20,30 +21,82 @@ function skins.get_skin_info_formspec(skin) -- overview page local raw_size = m_format == "1.8" and "2,2" or "2,1" - local formspec = "image[0.8,.6;1,2;"..minetest.formspec_escape(skin:get_preview()).."]" + local lxoffs = 0.8 + local cxoffs = 2 + local rxoffs = 5.5 + + if type(perplayer_formspec) == "table" then -- we're using Unified Inventory + lxoffs = 1.5 + cxoffs = 3.75 + rxoffs = 7.5 + end + + local formspec = "image["..lxoffs..",.6;1,2;"..minetest.formspec_escape(skin:get_preview()).."]" if texture then - formspec = formspec.."label[6,.5;"..S("Raw texture")..":]" - .."image[6,1;"..raw_size..";"..texture.."]" + formspec = formspec.."label["..rxoffs..",.5;"..S("Raw texture")..":]" + .."image["..rxoffs..",1;"..raw_size..";"..texture.."]" end if m_name ~= "" then - formspec = formspec.."label[2,.5;"..S("Name")..": "..minetest.formspec_escape(m_name).."]" + formspec = formspec.."label["..cxoffs..",.5;"..S("Name")..": "..minetest.formspec_escape(m_name).."]" end if m_author ~= "" then - formspec = formspec.."label[2,1;"..S("Author")..": "..minetest.formspec_escape(m_author).."]" + formspec = formspec.."label["..cxoffs..",1;"..S("Author")..": "..minetest.formspec_escape(m_author).."]" end if m_license ~= "" then - formspec = formspec.."label[2,1.5;"..S("License")..": "..minetest.formspec_escape(m_license).."]" + formspec = formspec.."label["..cxoffs..",1.5;"..S("License")..": "..minetest.formspec_escape(m_license).."]" end return formspec end -function skins.get_skin_selection_formspec(player, context, y_delta) +function skins.get_skin_selection_formspec(player, context, perplayer_formspec) context.skins_list = skins.get_skinlist_for_player(player:get_player_name()) context.total_pages = 1 + local xoffs = 0 + local yoffs = 4 + local xspc = 1 + local yspc = 2 + local skinwidth = 1 + local skinheight = 2 + local xscale = 1 + local btn_y = 8.15 + local drop_y = 8 + local btn_width = 1 + local droppos = 1 + local droplen = 6.25 + local btn_right = 7 + local maxdisp = 16 + + local ctrls_height = 0.5 + + if type(perplayer_formspec) == "table" then -- it's being used under Unified Inventory + xoffs = perplayer_formspec.std_inv_x + xspc = ui.imgscale + yspc = ui.imgscale*2 + skinwidth = ui.imgscale*0.9 + skinheight = ui.imgscale*1.9 + xscale = ui.imgscale + btn_width = ui.imgscale + droppos = xoffs + btn_width + 0.1 + droplen = ui.imgscale * 6 - 0.2 + btn_right = droppos + droplen + 0.1 + + if perplayer_formspec.pagecols == 4 then -- and we're in lite mode + yoffs = 1 + maxdisp = 8 + drop_y = yoffs + skinheight + 0.1 + else + yoffs = 0.2 + drop_y = yoffs + skinheight*2 + 0.2 + end + + btn_y = drop_y + + end + for i, skin in ipairs(context.skins_list ) do - local page = math.floor((i-1) / 16)+1 + local page = math.floor((i-1) / maxdisp)+1 skin:set_meta("inv_page", page) - skin:set_meta("inv_page_index", (i-1)%16+1) + skin:set_meta("inv_page_index", (i-1)%maxdisp+1) context.total_pages = page end context.skins_page = context.skins_page or skins.get_player_skin(player):get_meta("inv_page") or 1 @@ -51,22 +104,25 @@ function skins.get_skin_selection_formspec(player, context, y_delta) local page = context.skins_page local formspec = "" - for i = (page-1)*16+1, page*16 do + + for i = (page-1)*maxdisp+1, page*maxdisp do local skin = context.skins_list[i] if not skin then break end local index_p = skin:get_meta("inv_page_index") - local x = (index_p-1) % 8 + local x = ((index_p-1) % 8) * xspc + xoffs local y if index_p > 8 then - y = y_delta + 1.9 + y = yoffs + yspc else - y = y_delta + y = yoffs end - formspec = formspec.."image_button["..x..","..y..";1,2;".. - minetest.formspec_escape(skin:get_preview())..";skins_set$"..i..";]".. + formspec = formspec.. + string.format("image_button[%f,%f;%f,%f;%s;skins_set$%i;]", + x, y, skinwidth, skinheight, + minetest.formspec_escape(skin:get_preview()), i).. "tooltip[skins_set$"..i..";"..minetest.formspec_escape(skin:get_meta_string("name")).."]" end @@ -87,10 +143,13 @@ function skins.get_skin_selection_formspec(player, context, y_delta) if pg > 1 then page_list = page_list.."," end page_list = page_list..pagename end - formspec = formspec - .."button[0,"..(y_delta+4.0)..";1,.5;skins_page$"..page_prev..";<<]" - .."dropdown[0.9,"..(y_delta+3.88)..";6.5,.5;skins_selpg;"..page_list..";"..page.."]" - .."button[7,"..(y_delta+4.0)..";1,.5;skins_page$"..page_next..";>>]" + formspec = formspec.. + string.format("button[%f,%f;%f,%f;skins_page$%i;<<]", + xoffs, btn_y, btn_width, ctrls_height, page_prev).. + string.format("button[%f,%f;%f,%f;skins_page$%i;>>]", + btn_right, btn_y, btn_width, ctrls_height, page_next).. + string.format("dropdown[%f,%f;%f,%f;skins_selpg;%s;%i]", + droppos, drop_y, droplen, ctrls_height, page_list, page) end return formspec end diff --git a/mod.conf b/mod.conf index 51ba162..b79cd34 100644 --- a/mod.conf +++ b/mod.conf @@ -2,3 +2,4 @@ name = skinsdb description = Player skin mod, supporting unified_inventory, sfinv and smart_inventory depends = player_api optional_depends = unified_inventory,3d_armor,clothing,sfinv +min_minetest_version = 5.4.0 diff --git a/textures/ui_misc_form.png b/textures/ui_misc_form.png deleted file mode 100644 index 2a7edb9d51f4cc3bfeb04861868b8a366ea56d60..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6177 zcmeI0c~H~W+Q;c8wsPgR+DlO@wpya1L=6xENUB#swnP>|l%*;p1q6h!7?$LTd1d7ksjI16+B+ebS-GB7aso6DI~UIqs5cIuw!&F||*dYdGbx?dk&JL8WsFxawf z{dva#U;LSF&@j%$TPZ*O2=@{7x<6F%36=lHDXV)>16DND9cgtp!8 z;z?WHJNz_eD(Xf@Ie%S{JnSt9+#y-5!xpt%O)jaj@m|&OoC> zK`x2c>g~OBZ{jce(gqyHh7$&>kb9A_Hk3NNrDlm;-pwv9@#FPi64-Dkl2!ypX(ra1 zi!8f-Tetvj?bAo-U7H+3G$ex8nF=9gEzt-#*)J;W`87Xg_pW!NP5FvC@pxAR`cS2z zUsVXSG!4)uj-xMYzN^C&xkD0Os6m1*nj+#BsLsUcL;483u?B`7uQW7% zZK#x`Gc*~Q45G~64TJ;uJg@KxW4jRwiu;NN8EYNETCQdsM&w^b>ZEhSwafyjwEQ5I zE|Z3uuQT1~KwU8Cqa;2E2bD$xh3I<_jY|0T$yX5c9@t|BO!$P0h9RjJ}ZnZy5eV-M$f6q~ouyqud zlWG%L$bm~H08D`7WtqQj#VxNKTKk`S;g^Qic(E!#;JvawSCzj;Xb3$ALZ>xfH2iiw zN8Yso8yZg&e0nG&^i}qqCd;LeGz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g;R8pmg{}cZZXX@=hndeSe1(uvJrqu%0XB?5f?EiN);wz#9Adw`yIXO_=t< zLmaPT0dBer`B=dpM5_JA;Oeu|26v-awMd}w?go^(0^O)3_x?ay>1pd=$0Rq9bcTo4 zU8j?&d2vVz#A`#On#}N;>^02E4>Ri6`qt`O%hxgX21h#$o*n5l_~Ebo*xGasx^PE} zmP+&;r6)c!`TGEm=2Z{93}&ZLsa!w!kw-XlH)^><{oB@oDeXL{{vc!p=7f zcZ)18QhkJye4^I%A2u!GKLkoVZ4D1FHQ$7msFMLDPm8CGXm?M*Qls%XFE>!MrYi}g zT`j4XbJKxwJh%AEe%S{j3+wI;{m*j{Gv&hnoGwYyuemvb3Sb?P|XHzQ0T2kPF!Wy~yrIxh^- z?tmc2vz!0BC(;$aEWSx*7)AsFXLn}@?x-0OL&u-KEO*6Os!^(gAqD2Ttolm#88Gth z{BTw#++9BHr9W8<-G7|-Kv%(|9>Z^&=hzC|=2Q`LKVXu=*ddO_Q0F@Is zk~ER$9VpayIH@+ZwT%8D!02csQ8|@0={zdviB}JFqtYJxZqvU=&Duihc=AI%5>5WKBglurEc!{a6p%EW)L0f8+LQ90dL||>)_aKt?$RM z)q>?Q6Fg85dz?}$K1XGjX<}rfzg6apE0))iH;DC1u?Bnkx0lT&-2Hy*BQB?5r)o}q H^WDDyE1|wV diff --git a/unified_inventory_page.lua b/unified_inventory_page.lua index 3bf9575..d39ee4f 100644 --- a/unified_inventory_page.lua +++ b/unified_inventory_page.lua @@ -1,10 +1,13 @@ local S = minetest.get_translator("skinsdb") unified_inventory.register_page("skins", { - get_formspec = function(player) + get_formspec = function(player, perplayer_formspec) local skin = skins.get_player_skin(player) - local formspec = "background[0.06,0.99;7.92,7.52;ui_misc_form.png]"..skins.get_skin_info_formspec(skin).. - "button[.75,3;6.5,.5;skins_page;"..S("Change").."]" + local boffs = (type(perplayer_formspec) == "table") and 2 or 0.75 + + local formspec = perplayer_formspec.standard_inv_bg.. + skins.get_skin_info_formspec(skin, perplayer_formspec).. + "button["..boffs..",3;6.5,.5;skins_page;"..S("Change").."]" return {formspec=formspec} end, }) @@ -15,16 +18,16 @@ unified_inventory.register_button("skins", { tooltip = S("Skins"), }) -local function get_formspec(player) +local function get_formspec(player, perplayer_formspec) local context = skins.get_formspec_context(player) - local formspec = "background[0.06,0.99;7.92,7.52;ui_misc_form.png]".. - skins.get_skin_selection_formspec(player, context, -0.2) + local formspec = perplayer_formspec.standard_inv_bg.. + skins.get_skin_selection_formspec(player, context, perplayer_formspec) return formspec end unified_inventory.register_page("skins_page", { - get_formspec = function(player) - return {formspec=get_formspec(player)} + get_formspec = function(player, perplayer_formspec) + return {formspec=get_formspec(player, perplayer_formspec)} end }) From 716a9a3f9a9a43a762a44608945c6243df4e0681 Mon Sep 17 00:00:00 2001 From: Buckaroo Banzai <39065740+BuckarooBanzay@users.noreply.github.com> Date: Fri, 2 Jul 2021 07:28:12 +0200 Subject: [PATCH 10/10] fix get_string() on wrong variable --- api.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api.lua b/api.lua index 87765d1..92e1a3f 100644 --- a/api.lua +++ b/api.lua @@ -5,7 +5,7 @@ function skins.get_player_skin(player) local meta = player:get_meta() if meta:get("skinsdb:skin_key") then -- Move player data prior July 2018 to mod storage - storage:set_string(player:get_player_name(), player:get_string("skinsdb:skin_key")) + storage:set_string(player:get_player_name(), meta:get_string("skinsdb:skin_key")) meta:set_string("skinsdb:skin_key", "") end local skin = storage:get_string(player:get_player_name())