From 3800e73eb7e44af235e8f296df7f29f43e0468d0 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 6 Jan 2017 00:24:50 +0100 Subject: [PATCH] Better chest formspec --- mods/craftingpack/crafting/formspecs.lua | 44 ------------------ mods/craftingpack/crafting/init.lua | 2 - .../textures/crafting_inventory_chest.png | Bin 13142 -> 5497 bytes mods/default/nodes.lua | 31 ++++++------ 4 files changed, 15 insertions(+), 62 deletions(-) delete mode 100644 mods/craftingpack/crafting/formspecs.lua diff --git a/mods/craftingpack/crafting/formspecs.lua b/mods/craftingpack/crafting/formspecs.lua deleted file mode 100644 index 924019e64..000000000 --- a/mods/craftingpack/crafting/formspecs.lua +++ /dev/null @@ -1,44 +0,0 @@ -default.chest_formspec = - "size[9,9.75]".. - "background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]".. - default.inventory_header.. - "list[current_name;main;0,0.5;9,4;]".. - "list[current_player;main;0,5.5;9,3;9]".. - "list[current_player;main;0,8.74;9,1;]" - -local chest_inv_size = 4*9 -local chest_inv_vers = 2 - -function default.get_locked_chest_formspec(pos) - local meta = minetest.get_meta(pos) - local inv_v = meta:get_int("chest_inv_ver") - if inv_v and inv_v < chest_inv_vers then - local inv = meta:get_inventory() - inv:set_size("main",chest_inv_size) - meta:set_int("chest_inv_ver",chest_inv_vers) - end - local spos = pos.x .. "," .. pos.y .. "," ..pos.z - local formspec = - "size[9,9.75]".. - "background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]".. - default.inventory_header.. - "list[nodemeta:".. spos .. ";main;0,0.5;9,4;]".. - "list[current_player;main;0,5.5;9,3;9]".. - "list[current_player;main;0,8.74;9,1;]" - return formspec -end - -minetest.register_abm({ - nodenames = {"default:chest"}, - interval = 1, - chance = 1, - action = function(pos, node) - local meta = minetest.get_meta(pos) - local inv_v = meta:get_int("chest_inv_ver") - if inv_v and inv_v < chest_inv_vers then - local inv = meta:get_inventory() - inv:set_size("main",chest_inv_size) - meta:set_int("chest_inv_ver",chest_inv_vers) - end - end -}) diff --git a/mods/craftingpack/crafting/init.lua b/mods/craftingpack/crafting/init.lua index 263c4fe3c..c48703941 100644 --- a/mods/craftingpack/crafting/init.lua +++ b/mods/craftingpack/crafting/init.lua @@ -1,5 +1,3 @@ -dofile(minetest.get_modpath("crafting").."/formspecs.lua") - local show_armor = false if minetest.get_modpath("3d_armor") ~= nil then show_armor = true end diff --git a/mods/craftingpack/crafting/textures/crafting_inventory_chest.png b/mods/craftingpack/crafting/textures/crafting_inventory_chest.png index 5444a005632ebf883d02c9847a8d919b11cf9868..91f317fa468b9beaecf6b8f96d49545befed8b04 100644 GIT binary patch literal 5497 zcmeHL4N#N!8Giy6YW-RY6J<&*z0>Au6$=(>V9SD{1nVS_jxRTB;=~d@1c72>Nl2;?LIMf9_eI{)UgpS1%3;U5B`0DzLf_Ind56)YZ7UEO+FJ?*Ya{ ztH|LQfRN^s1ZoNf;+ucyW|ZCU5Y-tBS4WK6ofMFL>Of%g_03GCSW?lwzGR;rKwC-S z(BGriA;d1hn8nzeg<}4@IZ~IZ^`|6?owOay29Lm`>Py1GmdO|n?jACo&i-0smZcVnd8MDQXx0s`yVFOQU^9e)#Y%=@vCc1X zm`(iNbpFso#F%HPig_gt?_!cMKup|hP9X+x>{z5me>U&dz$;1B?g+n?mxPr=QV!aq zZvXa-#=kR5@F+uM7{=^>jP*!o?v{R|(O4WlF+AMA>wDWVv!X@h1duDALHG=GH|;e5 zFf>?!&br>rn&E`AJmp_~699o*{at&2T!odN1M$sYB(Cf4p!;5~)(cCcb=U56`Y0_HMu+eME8Qiz7(gqs zviq2rcXM>fRRCTaXP5=bm4WcbxQK;tFr93{`YOE3lH5O^;qd1%`yTmFjNZL5B%qQY z{)2Z?Rm)KYnyX*_TN;(DNysp)fsjK_$Ogyv@Ok@^yuIPbRJerB|7@Y|10?(Wj2B&h zBTm#Gr8T|=Alq=Sa90=|)#JGuRaWoJ-5R-nd9>&wc9uX8^{EEm*${P4?l4Lx)g@c{ z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`bEkc{Wo&I{ z=j3i3(bLCq9$KQS(fJ-aX+)>5=&tQc*0nwSe9zj_K>z*hWDZtTR5ZIS?DLok?2&Ym zh|V-EM0FowrF@-YCUk!1OMhS=ev)Wyxub_Vdon&)ksf+DfE;0Cx;;_`fZ;6l2nsRP zBP4yHj}j_Q6&O?6Jl9)z2>^x`Li8k2!6rm|vwh460PZd7sg+6DiUC WZ+qU(Y8wOq$a@|+@a}ht-}pCbz_2R- diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index de9034d76..601750a3e 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -1148,7 +1148,6 @@ minetest.register_node("default:chest", { local p = get_chest_neighborpos(pos, param2, "right") meta:set_string("formspec", "size[9,11.5]".. - default.inventory_header.. "list[nodemeta:"..p.x..","..p.y..","..p.z..";main;0,0;9,3;]".. "list[current_name;main;0,3;9,3;]".. "list[current_player;main;0,7;9,3;9]".. @@ -1162,7 +1161,6 @@ minetest.register_node("default:chest", { local m = minetest.env:get_meta(p) m:set_string("formspec", "size[9,11.5]".. - default.inventory_header.. "list[current_name;main;0,0;9,3;]".. "list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,3;9,3;]".. "list[current_player;main;0,7;9,3;9]".. @@ -1177,7 +1175,6 @@ minetest.register_node("default:chest", { local p = get_chest_neighborpos(pos, param2, "left") meta:set_string("formspec", "size[9,11.5]".. - default.inventory_header.. "list[current_name;main;0,0;9,3;]".. "list[nodemeta:"..p.x..","..p.y..","..p.z..";main;0,3;9,3;]".. "list[current_player;main;0,7;9,3;9]".. @@ -1191,7 +1188,6 @@ minetest.register_node("default:chest", { local m = minetest.env:get_meta(p) m:set_string("formspec", "size[9,11.5]".. - default.inventory_header.. "list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0;9,3;]".. "list[current_name;main;0,3;9,3;]".. "list[current_player;main;0,7;9,3;9]".. @@ -1203,11 +1199,12 @@ minetest.register_node("default:chest", { m:set_string("infotext", "Large Chest") else meta:set_string("formspec", - "size[9,8.5]".. + "size[9,8.75]".. + "background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]".. default.inventory_header.. - "list[current_name;main;0,0;9,3;]".. - "list[current_player;main;0,4;9,3;9]".. - "list[current_player;main;0,7.5.5;9,1;]".. + "list[current_name;main;0,0.5;9,3;]".. + "list[current_player;main;0,4.5;9,3;9]".. + "list[current_player;main;0,7.74;9,1;]".. "listring[current_name;main]".. "listring[current_player;main]") meta:set_string("infotext", "Chest") @@ -1263,11 +1260,12 @@ minetest.register_node("default:chest_left", { end local meta = minetest.env:get_meta(p) meta:set_string("formspec", - "size[9,8.5]".. + "size[9,8.75]".. + "background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]".. default.inventory_header.. - "list[current_name;main;0,0;9,3;]".. - "list[current_player;main;0,4;9,3;9]".. - "list[current_player;main;0,7.5.5;9,1;]".. + "list[current_name;main;0,0.5;9,3;]".. + "list[current_player;main;0,4.5;9,3;9]".. + "list[current_player;main;0,7.74;9,1;]".. "listring[current_name;main]".. "listring[current_player;main]") meta:set_string("infotext", "Chest") @@ -1321,11 +1319,12 @@ minetest.register_node("default:chest_right", { end local meta = minetest.env:get_meta(p) meta:set_string("formspec", - "size[9,8.5]".. + "size[9,8.75]".. + "background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]".. default.inventory_header.. - "list[current_name;main;0,0;9,3;]".. - "list[current_player;main;0,4;9,3;9]".. - "list[current_player;main;0,7.5.5;9,1;]".. + "list[current_name;main;0,0.5;9,3;]".. + "list[current_player;main;0,4.5;9,3;9]".. + "list[current_player;main;0,7.74;9,1;]".. "listring[current_name;main]".. "listring[current_player;main]") meta:set_string("infotext", "Chest")