From 484fde70f2701371578fd9f302cd29f82e6d370e Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Sun, 7 Sep 2014 15:14:48 -0400 Subject: [PATCH] Z-inverted the model for the back half of the pool table so that it doesn't have to be facedir-flipped in software use the aforementioned function to handle placing it added an abm to convert the old node. --- homedecor/misc-nodes.lua | 93 ++++++++---------- .../textures/homedecor_pool_table_bottom2.png | Bin 367 -> 370 bytes .../textures/homedecor_pool_table_sides3.png | Bin 259 -> 258 bytes .../textures/homedecor_pool_table_sides4.png | Bin 255 -> 253 bytes .../textures/homedecor_pool_table_top2.png | Bin 309 -> 310 bytes 5 files changed, 41 insertions(+), 52 deletions(-) diff --git a/homedecor/misc-nodes.lua b/homedecor/misc-nodes.lua index c56246fe..cdda63dd 100644 --- a/homedecor/misc-nodes.lua +++ b/homedecor/misc-nodes.lua @@ -693,8 +693,6 @@ minetest.register_node("homedecor:doghouse_roof", { groups = {snappy=3, not_in_creative_inventory=1}, }) -local swap_fdir = { 2, 3, 0, 1 } - minetest.register_node("homedecor:pool_table", { tiles = { "homedecor_pool_table_top1.png", @@ -743,43 +741,20 @@ minetest.register_node("homedecor:pool_table", { fixed = { -0.5, -0.5, -0.5, 0.5, 0.3125, 1.5 } }, on_place = function(itemstack, placer, pointed_thing) - local pos = pointed_thing.under - local pnode = minetest.get_node(pointed_thing.under) - local rnodedef = minetest.registered_nodes[pnode.name] - - if not rnodedef["buildable_to"] then - pos = pointed_thing.above - end - - local fdir = minetest.dir_to_facedir(placer:get_look_dir()) - local pos2 = { x = pos.x + homedecor.fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_fwd[fdir+1][2] } - - local tnode = minetest.get_node(pos) - local tnode2 = minetest.get_node(pos2) - - if homedecor.get_nodedef_field(tnode.name, "buildable_to") - and homedecor.get_nodedef_field(tnode2.name, "buildable_to") - and not minetest.is_protected(pos, placer:get_player_name()) - and not minetest.is_protected(pos2, placer:get_player_name()) then - minetest.add_node(pos, { name = "homedecor:pool_table", param2 = fdir }) - minetest.add_node(pos2, { name = "homedecor:pool_table2", param2 = swap_fdir[fdir+1] }) - if not homedecor.expect_infinite_stacks then - itemstack:take_item() - return itemstack - end - end + return homedecor.stack_sideways(itemstack, placer, pointed_thing, + "homedecor:pool_table", "homedecor:pool_table_2", false) end, after_dig_node = function(pos, oldnode, oldmetadata, digger) local fdir = oldnode.param2 if not fdir or fdir > 3 then return end local pos2 = { x = pos.x + homedecor.fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_fwd[fdir+1][2] } - if minetest.get_node(pos2).name == "homedecor:pool_table2" then + if minetest.get_node(pos2).name == "homedecor:pool_table_2" then minetest.remove_node(pos2) end end }) -minetest.register_node("homedecor:pool_table2", { +minetest.register_node("homedecor:pool_table_2", { tiles = { "homedecor_pool_table_top2.png", "homedecor_pool_table_bottom2.png", @@ -795,29 +770,29 @@ minetest.register_node("homedecor:pool_table2", { node_box = { type = "fixed", fixed = { - {-0.375, -0.5, -0.375, -0.25, 0.1875, -0.25}, -- NodeBox1 - {0.25, -0.5, -0.375, 0.375, 0.1875, -0.25}, -- NodeBox2 - {-0.25, -0.125, -0.3125, 0.25, -0.0625, 0}, -- NodeBox3 - {-0.3125, -0.0625, -0.3125, -0.25, 0.1875, 0}, -- NodeBox4 - {0.25, -0.0625, -0.3125, 0.3125, 0.1875, 0}, -- NodeBox5 - {-0.3125, -0.125, 0, 0.3125, 0.1875, 0.0625}, -- NodeBox6 - {0.25, -0.125, -0.25, 0.3125, 0.1875, 0.5}, -- NodeBox7 - {-0.3125, -0.125, -0.25, -0.25, 0.1875, 0.5}, -- NodeBox8 - {-0.5, 0.1875, -0.5, -0.4375, 0.25, 0.5}, -- NodeBox9 - {-0.5, 0.1875, -0.5, 0.5, 0.25, -0.4375}, -- NodeBox10 - {0.4375, 0.1875, -0.5, 0.5, 0.25, 0.5}, -- NodeBox11 - {-0.3125, 0.1875, -0.3125, 0.3125, 0.25, 0.5}, -- NodeBox12 - {-0.4375, 0.1875, -0.3125, 0.4375, 0.25, 0.4375}, -- NodeBox13 - {-0.3125, 0.1875, -0.5, 0.3125, 0.25, -0.3125}, -- NodeBox14 - {-0.25, -0.125, -0.325, 0.25, 0, -0.3125}, -- NodeBox15 - {0.25, 0.125, -0.4375, 0.4375, 0.1875, 0.5}, -- NodeBox16 - {-0.4375, 0.125, -0.4375, -0.25, 0.1875, 0.5}, -- NodeBox17 - {-0.5, 0.25, -0.5, -0.4375, 0.3125, 0.5}, -- NodeBox18 - {-0.5, 0.25, -0.5, 0.5, 0.3125, -0.4375}, -- NodeBox19 - {0.4375, 0.25, -0.5, 0.5, 0.3125, 0.5}, -- NodeBox20 - {-0.4375, 0.25, -0.3125, -0.375, 0.3125, 0.4375}, -- NodeBox23 - {-0.3125, 0.25, -0.4375, 0.3125, 0.3125, -0.375}, -- NodeBox24 - {0.375, 0.25, -0.3125, 0.4375, 0.3125, 0.4375}, -- NodeBox25 + {-0.375, -0.5, 0.25, -0.25, 0.1875, 0.375}, -- NodeBox1 + {0.25, -0.5, 0.25, 0.375, 0.1875, 0.375}, -- NodeBox2 + {-0.25, -0.125, 0, 0.25, -0.0625, 0.3125}, -- NodeBox3 + {-0.3125, -0.0625, 0, -0.25, 0.1875, 0.3125}, -- NodeBox4 + {0.25, -0.0625, 0, 0.3125, 0.1875, 0.3125}, -- NodeBox5 + {-0.3125, -0.125, -0.0625, 0.3125, 0.1875, 0}, -- NodeBox6 + {0.25, -0.125, -0.5, 0.3125, 0.1875, 0.25}, -- NodeBox7 + {-0.3125, -0.125, -0.5, -0.25, 0.1875, 0.25}, -- NodeBox8 + {-0.5, 0.1875, -0.5, -0.4375, 0.25, 0.5}, -- NodeBox9 + {-0.5, 0.1875, 0.4375, 0.5, 0.25, 0.5}, -- NodeBox10 + {0.4375, 0.1875, -0.5, 0.5, 0.25, 0.5}, -- NodeBox11 + {-0.3125, 0.1875, -0.5, 0.3125, 0.25, 0.3125}, -- NodeBox12 + {-0.4375, 0.1875, -0.4375, 0.4375, 0.25, 0.3125}, -- NodeBox13 + {-0.3125, 0.1875, 0.3125, 0.3125, 0.25, 0.5}, -- NodeBox14 + {-0.25, -0.125, 0.3125, 0.25, 0, 0.325}, -- NodeBox15 + {0.25, 0.125, -0.5, 0.4375, 0.1875, 0.4375}, -- NodeBox16 + {-0.4375, 0.125, -0.5, -0.25, 0.1875, 0.4375}, -- NodeBox17 + {-0.5, 0.25, -0.5, -0.4375, 0.3125, 0.5}, -- NodeBox18 + {-0.5, 0.25, 0.4375, 0.5, 0.3125, 0.5}, -- NodeBox19 + {0.4375, 0.25, -0.5, 0.5, 0.3125, 0.5}, -- NodeBox20 + {-0.4375, 0.25, -0.4375, -0.375, 0.3125, 0.3125}, -- NodeBox23 + {-0.3125, 0.25, 0.375, 0.3125, 0.3125, 0.4375}, -- NodeBox24 + {0.375, 0.25, -0.4375, 0.4375, 0.3125, 0.3125}, -- NodeBox25 } }, selection_box = { @@ -1366,3 +1341,17 @@ minetest.register_node("homedecor:toaster_loaf", { drop = "homedecor:toaster" }) +-- convert old pool tables into newer model + +minetest.register_abm({ + nodenames = { "homedecor:pool_table2" }, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local swap_fdir = { 2, 3, 0, 1 } + local fdir = swap_fdir[node.param2+1] + minetest.set_node(pos, {name = "homedecor:pool_table_2", param2 = fdir}) + end +}) + + diff --git a/homedecor/textures/homedecor_pool_table_bottom2.png b/homedecor/textures/homedecor_pool_table_bottom2.png index 5251f5d00cf0b3f14e2d64474fb99b4be3747f61..cf3c5fe2bd3eb1e638bacc009a806a7136351b8f 100644 GIT binary patch delta 343 zcmV-d0jU1(0`dZoB!4+cL_t(I%UzRea>FnPgg=nnvFV0Kj$#ff-2oP4(^q?vn>j6)pexTDcav`E>>)lrz=WzX#lNy*z=U7~V0U+bs{T>a3EmN`JQmD(Yt7RYNJ+Ta&88 zDRgOou067%q@6a=9%jKL;Y~X#As=?VSAs1Ptvg;TH=aoJAnCTbN8^=9N$*VCJe8C- z4I6o1i;thbk!)z)0ej7cmatbgxFgR1>~`jLM#52Qw>o^SF?Ts!mi3OFy=GjGa{Wx_ zIRjA)yY3yISx|P`o}+CxuB(h|^FHp09{Ex;j!i0N<9w8{<}>!*quKP$Cbl-RC-VPT pOW;inO%i=0Pki3KA_>(U;18V^(1)vVwxs|7002ovPDHLkV1iFjq)7k( delta 340 zcmV-a0jvJ<0`CHlB!4zZL_t(I%T<$6a>OtQLmxQX(mqP40e`LnBDOfo)MQXl8}i)f zEwmXp&H1&q;#J^%!*a!zD;5dA_onB4{+WQ8;EjM;IvlCk*HXTRqA85RRVo-UXLK9_ z{skYO8{$1Cd56}iG`7XO+8bjTFVuAc(dy^S+c$;LbZX7u8mHM|jsrQFT91tZUrI*7 zm8D=bl|hl?hfSVDW;?N)J|bRgyKjs#Vm^ls`;PTb2S2avv}Yl23|CBAnWvli|qy`#b(ke4lKnn~V(7|3w z*5a@~2{+gqKKsd%4F7I)JP@$xAn4HHu1K(08=Hg#pp1b8f&j3PNGOwwY6mp5G|%(X z!y-607WO!mAQ2D<-acnwSr#1+beOJt3@3py-Apy$mv;aIrC-6E8z3NIab78NT8Ei! ze2xFLQpVdAuqY#OU$@Y}v`HpRCfl+|(;#tLhtJXlc>Vaj`{&17WB$vtEVLI`vj^xA gZVzDX0qTdPZyn=dk6Vs~djJ3c07*qoM6N<$f`IsBtpET3 delta 231 zcmV<*mw%K)#p-+Sl;abTPjq|XZGy{+Oe h3Gt)pvq<9{(ic`)Te#nCxPSlv002ovPDHLkV1hwBXb=DZ diff --git a/homedecor/textures/homedecor_pool_table_sides4.png b/homedecor/textures/homedecor_pool_table_sides4.png index b42b3b168b6483a6cd34e10b2932c1112217e287..719455cdba30d20e80becfd69872b494ba665ede 100644 GIT binary patch delta 225 zcmV<703QGU0sR4xB!9$7L_t(2&&`p&QN=(IgFo#Zu{)pyXn_)-Rw|$eDxd>mdshVB zd-F0(#zlKG`Wp%U-P7w6SpX6eRg9pF#GZr*VF*!15M|0B%B^7-fsI56K!CB=y=@!t z^7w5qh(@f3XJjwFIC#L7l9k0L~L46`RkF&-yh=!4CCuAe#a|raZt1I$ b#p^;!Q3Y&xkpcw-R1OZ?nk#7rQ7NKqhh8PjLe2E2d%-u>(IPhB!B%$L_t(2&y|wBPQ)+}gg>v7D`;GvXy_0Xx{m4uZ@>$KglO*p zcmSHzS5Wxk#8)KaILD7fWF_nM%+BsO?)jd7Jq_^w8GwiD;~%&~7l5amV^dNuJ4j%V zAp_vF20}N({N0xARs7gTGFSyd+YCm$jgMck_1H}8VSrRY%YWNJf^i1g@|_BgFw9j+ z3QCg;VJh4LI(EwUuvrMriZDV34+ewCCNowFS?G({#2LR6Jow7cMw(RJu4Zs*qlnmY z&gnOoS`{9237aav5Jpu^QYg+uF@G4^X$;eCl!-50N>vX|fmiIIuLy@OgtvfKZ!MUl hPP2Y^4bu;M1{5byT46#T&rtvX002ovPDHLkV1hBhe)<3a delta 282 zcmV+#0p1R^l|h-Ay3YDSCQOPjcAt`Qw4{V?-c92Z2K%B(@nWs_NF(t{I66NLq1AhT-Ua@2mQ(Zf5-oM11duqi+~s|HU6M gOcy%r_*Yy3(i7oR&o$*{A^-pY07*qoM6N<$g8k%yGynhq