From f8efeee4d71a849a6f1f0e888aa0cba1103a70aa Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Sun, 29 Jun 2014 09:06:26 -0400 Subject: [PATCH] add computer desk --- homedecor/tables.lua | 107 ++++++++++++++++++ homedecor/textures/homedecor_desk_back_l.png | Bin 0 -> 640 bytes homedecor/textures/homedecor_desk_back_r.png | Bin 0 -> 568 bytes .../textures/homedecor_desk_bottom_l.png | Bin 0 -> 640 bytes .../textures/homedecor_desk_bottom_r.png | Bin 0 -> 640 bytes homedecor/textures/homedecor_desk_front_l.png | Bin 0 -> 702 bytes homedecor/textures/homedecor_desk_front_r.png | Bin 0 -> 577 bytes homedecor/textures/homedecor_desk_lside_l.png | Bin 0 -> 640 bytes homedecor/textures/homedecor_desk_lside_r.png | Bin 0 -> 640 bytes homedecor/textures/homedecor_desk_rside_l.png | Bin 0 -> 640 bytes homedecor/textures/homedecor_desk_rside_r.png | Bin 0 -> 640 bytes homedecor/textures/homedecor_desk_top_l.png | Bin 0 -> 640 bytes homedecor/textures/homedecor_desk_top_r.png | Bin 0 -> 640 bytes 13 files changed, 107 insertions(+) create mode 100644 homedecor/textures/homedecor_desk_back_l.png create mode 100644 homedecor/textures/homedecor_desk_back_r.png create mode 100644 homedecor/textures/homedecor_desk_bottom_l.png create mode 100644 homedecor/textures/homedecor_desk_bottom_r.png create mode 100644 homedecor/textures/homedecor_desk_front_l.png create mode 100644 homedecor/textures/homedecor_desk_front_r.png create mode 100644 homedecor/textures/homedecor_desk_lside_l.png create mode 100644 homedecor/textures/homedecor_desk_lside_r.png create mode 100644 homedecor/textures/homedecor_desk_rside_l.png create mode 100644 homedecor/textures/homedecor_desk_rside_r.png create mode 100644 homedecor/textures/homedecor_desk_top_l.png create mode 100644 homedecor/textures/homedecor_desk_top_r.png diff --git a/homedecor/tables.lua b/homedecor/tables.lua index 12d0dbf..ac90eec 100644 --- a/homedecor/tables.lua +++ b/homedecor/tables.lua @@ -489,3 +489,110 @@ minetest.register_node('homedecor:utility_table_legs', { }, }) +local function get_nodedef_field(nodename, fieldname) + if not minetest.registered_nodes[nodename] then + return nil + end + return minetest.registered_nodes[nodename][fieldname] +end + +local fdir_to_right = { + { 1, 0 }, + { 0, -1 }, + { -1, 0 }, + { 0, 1 }, +} + +minetest.register_node("homedecor:desk", { + drawtype = "nodebox", + description = "Desk", + tiles = { + "homedecor_desk_top_l.png", + "homedecor_desk_bottom_l.png", + "homedecor_desk_rside_l.png", + "homedecor_desk_lside_l.png", + "homedecor_desk_back_l.png", + "homedecor_desk_front_l.png" + }, + paramtype = "light", + paramtype2 = "facedir", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.4375, 0.375, 0.5, 0.5}, + {-0.5, 0.4375, -0.4375, 0.5, 0.5, 0.5}, + {-0.4375, -0.4375, -0.5, 0.3125, -0.0625, -0.4375}, + {-0.4375, 0, -0.5, 0.3125, 0.375, 0.5}, + {0.3125, -0.375, 0.4375, 0.5, 0.25, 0.5}, + } + }, + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 1.5, 0.5, 0.5 } + }, + groups = { snappy = 3 }, + 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 + fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + fdir_to_right[fdir+1][2] } + + local tnode = minetest.get_node(pos) + local tnode2 = minetest.get_node(pos2) + + if get_nodedef_field(tnode.name, "buildable_to") + and 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:desk", param2 = fdir }) + minetest.add_node(pos2, { name = "homedecor:desk_r", param2 = fdir }) + if not homedecor.expect_infinite_stacks then + itemstack:take_item() + return itemstack + end + end + end, + after_dig_node = function(pos, oldnode, oldmetadata, digger) + local fdir = oldnode.param2 + local pos2 = { x = pos.x + fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + fdir_to_right[fdir+1][2] } + if minetest.get_node(pos2).name == "homedecor:desk_r" then + minetest.remove_node(pos2) + end + end +}) + +minetest.register_node("homedecor:desk_r", { + drawtype = "nodebox", + tiles = { + "homedecor_desk_top_r.png", + "homedecor_desk_bottom_r.png", + "homedecor_desk_rside_r.png", + "homedecor_desk_lside_r.png", + "homedecor_desk_back_r.png", + "homedecor_desk_front_r.png" + }, + paramtype = "light", + paramtype2 = "facedir", + node_box = { + type = "fixed", + fixed = { + {-0.5, 0.4375, -0.4375, 0.5, 0.5, 0.5}, + {0.375, -0.5, -0.4375, 0.5, 0.5, 0.5}, + {-0.5, 0.3125, -0.4375, 0.5, 0.375, 0.5}, + {-0.5, 0.3125, -0.4375, -0.4375, 0.5, 0.5}, + {-0.5, -0.375, 0.4375, 0.4375, 0.25, 0.5}, + } + }, + selection_box = { + type = "fixed", + fixed = { 0,0,0,0,0,0 } + }, + groups = { snappy = 3, not_in_creative_inventory=1 } +}) + diff --git a/homedecor/textures/homedecor_desk_back_l.png b/homedecor/textures/homedecor_desk_back_l.png new file mode 100644 index 0000000000000000000000000000000000000000..7e44cea5223f0d2e4adddbfbd629dd8178cc674c GIT binary patch literal 640 zcmV-`0)PF9P)lAIWf5rT|Hrp(N?wo(9Rnn-G`aKGQ1MXjW;wataK)I=l{3#rp^b*oKEku#xl z-+#R9T7mVl5uBAX(MP3}j~ysLRTHJK z^K{8l!^2S<%PDXU=+Gzi^RdGZ_fgdL;dj~H2Mv)knR=;A1)^3)aipSL?60O>mtkO$ z5j66g{S;y)WwW7qo^Lk>r7ISNq%cw@jf-$Tp*CCucIRNUMD0)|=RlOY00NgZcM_ek zC5D&??BZ2-zHrI-5?mTn*N+F!`0qTA^K!c(AB13uSqe`vfRHFJxsa5A`*kwLAk<(? z7)CC}PaW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HurR|I|Wh}I)TWSPiO%|=o<#`Az#-+}iZOiWA;bp|5EUWjQL6eB% z&`(k(Bi*;e#q~e`lO=1Bi01R8C*_6SXdIz6!cT?tMAugTZbPzV+v{bjdTrOsm=Hg1 zOG5Jnm8}Q6uU|ZK{@ykKjW`~L%SGjld`EiuZoi%ftlTmKSBsH~z3_4G#!PZiAFKBp zh2T0ryoseF(AwguHb|dJN)&bm+r}LC2Y;+O6!-T<82gW3N`I2@*?bDz?sg>rjMG>t zmFEK>w1~yg-27K`%`jh{-sH>>zy9r7a92DO<;%+#jPx%bkFU;SBO^z!?Gs;SY#h0a k(;xTv?Rs3?HGY1r;P)Pr06u|Lk``MnE%q0Ct3YD5Hkw9XF;7Tkx4+r2j-627N1*%w3Xp?3#lkvy1{aA2; z{#O43{KcmaFGFB!?QwFbBqs)Agdn4lDKoQetQ5eRCX!k!+-x>qzW*feKmu_A1&{*( zP>KKm0B&&qqj|PocLJMv`}WN%RoN7hQYu9c3eYww!~Eic3(?re@gO1n_$y|oEnZ)L zhNscX&DYx=-@UvPjs5m3tk0DO!I?}mS4M$olu;b1s1%32=}yWxvd9P;*=IL}SWDTS zk@x;^U{JbdQAi3SWzskcyDe(NMPR=RMoZKcs#H}VN>c!VOY*(M%GeS^Oayke?01h` zGTwzM9aBFXZye+O&L91Jbw(}-!4k6+j$!~IQ9kBEQUY#Hk}(FM0b{~=*IJAlc~7l_z)=ae|)!X+D1w6Wez!^qkyAV$?*s!nRf z!gLfIOU#L4qUa7O7w0h;TeVd^?tU8y}?}u$&*B4h;;^X@lPh8{q+3Bz!Bs>|hYL?4?C;~5A@s|`e P00000NkvXXu0mjflK1>c literal 0 HcmV?d00001 diff --git a/homedecor/textures/homedecor_desk_lside_l.png b/homedecor/textures/homedecor_desk_lside_l.png new file mode 100644 index 0000000000000000000000000000000000000000..7e44cea5223f0d2e4adddbfbd629dd8178cc674c GIT binary patch literal 640 zcmV-`0)PF9P)lAIWf5rT|Hrp(N?wo(9Rnn-G`aK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