From 195a0822a2ecaf6d96b9065424970037945507be Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Sun, 16 Aug 2015 14:41:03 +0200 Subject: [PATCH] Fixed texture, and animation bug in 3dchest - 3dChests can't be open if the two nodes standing behing them are not air - 3dChests now use our textures in inventory, wield, and entity - Solves #221 --- mods/3dchest/depends.txt | 1 + mods/3dchest/init.lua | 55 +++++++++++------- mods/3dchest/textures/default_chest3d.png | Bin 2424 -> 2211 bytes mods/3dchest/textures/default_chest_front.png | Bin 1124 -> 0 bytes mods/3dchest/textures/default_chest_side.png | Bin 838 -> 0 bytes mods/3dchest/textures/default_chest_top.png | Bin 843 -> 0 bytes 6 files changed, 35 insertions(+), 21 deletions(-) create mode 100644 mods/3dchest/depends.txt delete mode 100644 mods/3dchest/textures/default_chest_front.png delete mode 100644 mods/3dchest/textures/default_chest_side.png delete mode 100644 mods/3dchest/textures/default_chest_top.png diff --git a/mods/3dchest/depends.txt b/mods/3dchest/depends.txt new file mode 100644 index 00000000..4ad96d51 --- /dev/null +++ b/mods/3dchest/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/3dchest/init.lua b/mods/3dchest/init.lua index 08e2a9ba..18495f5f 100644 --- a/mods/3dchest/init.lua +++ b/mods/3dchest/init.lua @@ -77,27 +77,26 @@ local tdc = { minetest.register_entity('3dchest:3dchest', tdc) -- normal minetest.register_node("3dchest:chest", { - description = "Chest", - tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", - "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"}, - paramtype2 = "facedir", - -- temporary workaround - wield_image = "default_chest_front.png", --minetest.inventorycube("default_chest_top.png", "default_chest_side.png", "default_chest_front.png"), - inventory_image = minetest.inventorycube("default_chest_top.png", "default_chest_front.png", "default_chest_side.png"), - drawtype = "nodebox", - node_box = { + description = "Chest", + tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", + "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"}, + paramtype2 = "facedir", + wield_image = minetest.inventorycube("default_chest_top.png", "default_chest_front.png", "default_chest_side.png"), + inventory_image = minetest.inventorycube("default_chest_top.png", "default_chest_front.png", "default_chest_side.png"), + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = {-0.01, -0.01, -0.01, 0.01, 0.01, 0.01}, + }, + selection_box = { type = "fixed", - fixed = {-0.01, -0.01, -0.01, 0.01, 0.01, 0.01}, - }, - selection_box = { - type = "fixed", - fixed = { - {-0.501, -0.501, -0.501, 0.501, 0.501, 0.501}, - } - }, - paramtype = "light", - walkable = false, - groups = {choppy=2, dig_immediate = 2}, + fixed = { + {-0.501, -0.501, -0.501, 0.501, 0.501, 0.501}, + } + }, + paramtype = "light", + walkable = false, + groups = {choppy=2, dig_immediate = 2}, legacy_facedir_simple = true, on_construct = function(pos) @@ -212,7 +211,7 @@ minetest.register_node("3dchest:chest", { " takes stuff from chest at "..minetest.pos_to_string(pos)) end, - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local selves = minetest.get_objects_inside_radius(pos, 0.1) local self for _,obj in pairs(selves) do @@ -225,6 +224,20 @@ minetest.register_node("3dchest:chest", { local name = '3dchest:3dchest' local pll = clicker:get_player_name() local formspec = meta:get_string('formspect') + local dir = (meta:get_int("dir")+2)%4 + local directions = { + [0] = {x = pos.x, y = pos.y, z = pos.z + 1}, + [1] = {x = pos.x - 1, y = pos.y, z = pos.z}, + [2] = {x = pos.x, y = pos.y, z = pos.z - 1}, + [3] = {x = pos.x + 1, y = pos.y, z = pos.z} + } + local backnode = minetest.get_node(directions[dir]) + local upnode = minetest.get_node({x = directions[dir].x, y = directions[dir].y + 1, z = directions[dir].z}) + if (not backnode or (backnode and backnode.name ~= "air")) + or (not upnode or (upnode and upnode.name ~= "air")) then + minetest.chat_send_player(clicker:get_player_name(), "Cannot open chest's lid, move it.") + return + end if not self then minetest.show_formspec(pll, name..'_'..minetest.serialize(pos), formspec) diff --git a/mods/3dchest/textures/default_chest3d.png b/mods/3dchest/textures/default_chest3d.png index 41cc7bf4889eb81d80309424f3efffa893f42b87..617f51f47df15b7b7c59800c4c0a752868db80b9 100644 GIT binary patch delta 2153 zcmV-v2$uKw5~C52QGeeE5DX_TH`{Jp000OuNkl@JKcTyRDD(TRh=63%L|WdJb%Q)!$Up-`S7z#X8{2H zb`1b99*qD1^+wIOp;71aECv7^jWYm17$}mcM~|$9BwODP>ABqwU!MX1UVHr$Gab@ov}6kwE8u5E%DmDQWKS|J`@Kh-m(qM;iRxF3sPw=TB(< zI57~q)@T^>2Vv-(|D$U=D<9xQfY^Mn(E|XS+UT>*vt(_FY6>2$wKdXMy-wE$zHwcP zk#POiZ2&+NjhrtcHV-t6`Rld1(-)*Xf4|o?{=a6ur+>`pjQKzw6wWeC zb&G+~RC^gVGQ;fm zD1VFWajx=@s~-RWu8e;I0672Dc>usm=U)NR_AT7={?6LVn-+G_Gs00b`kSHLdvol#Cz=?n_Z&0nQ>5VxWbPd}NEJ@B&h{VuX zz{u#d&1fP%z!haw;oi;PWdTA8Mv%Mp#93ApekQG=wWYPS>ALKgW z7k19FLO{;AI6Q9ejtxl;4kOds^UjbUCgeO_*_z0to{Q>#6T5BX}iX=&)l!8(Ux=bO+2 zzB3JKtq}x%9=eu_2PmcT#Y;>TA-EQQCyOo$FiBFU07UcBA5gFNn87XRPlzeb*BiVa zz**!;{Rtm$-E<4UQ^*%DW`CfyhVo2587d&vK<1!7MPbRpwN}u_$c|b*1c;VM5HQ$P z5$bUX>WfI3qld(#oqTaV?EZj_bwa?s?oSw6{R!Sl@U3D3ReXV`mPhLg5nyX`4r5)= z;^J$If;!28+N0m6Jw@pc*#C<1_VM^8bAPTGa?Nr&nY!x(X== z>Pb2-TjZTai~F7nL{o*s(FEgZ4Bu1V$m^FaIL*kUnvEK|&Bjs?p?gk+ms#6)u$Wym_#AHcQ7l;!DLw+`8+A83DoD?-S*k|?s^y6*)7TujfYaf?>F#@S8k z3wZI|rV;0*KO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