From 84ab2967be8fb4213bd7cabcada21299046f4694 Mon Sep 17 00:00:00 2001 From: jp Date: Thu, 2 Jul 2015 15:26:19 +0200 Subject: [PATCH] Add new nodes and tweaks --- crafts.lua | 52 +++++++++++++++ depends.txt | 3 +- init.lua | 1 + mailbox.lua | 89 +++++++++++++++++++++++++ nodes.lua | 78 ++++++++++++++++++++++ textures/xdecor_bamboo_frame.png | Bin 0 -> 243 bytes textures/xdecor_baricade.png | Bin 0 -> 231 bytes textures/xdecor_brown.png | Bin 0 -> 82 bytes textures/xdecor_japanese_door_a.png | Bin 0 -> 291 bytes textures/xdecor_japanese_door_b.png | Bin 0 -> 299 bytes textures/xdecor_japanese_door_inv.png | Bin 0 -> 198 bytes textures/xdecor_mailbox.png | Bin 0 -> 193 bytes textures/xdecor_mailbox_bottom.png | Bin 0 -> 115 bytes textures/xdecor_mailbox_side.png | Bin 0 -> 166 bytes textures/xdecor_mailbox_top.png | Bin 0 -> 115 bytes textures/xdecor_tatami.png | Bin 0 -> 155 bytes textures/xdecor_woodglass_door_a.png | Bin 0 -> 265 bytes textures/xdecor_woodglass_door_b.png | Bin 0 -> 271 bytes textures/xdecor_woodglass_door_inv.png | Bin 0 -> 231 bytes worktable.lua | 3 + 20 files changed, 225 insertions(+), 1 deletion(-) create mode 100644 mailbox.lua create mode 100644 textures/xdecor_bamboo_frame.png create mode 100644 textures/xdecor_baricade.png create mode 100644 textures/xdecor_brown.png create mode 100644 textures/xdecor_japanese_door_a.png create mode 100644 textures/xdecor_japanese_door_b.png create mode 100644 textures/xdecor_japanese_door_inv.png create mode 100644 textures/xdecor_mailbox.png create mode 100644 textures/xdecor_mailbox_bottom.png create mode 100644 textures/xdecor_mailbox_side.png create mode 100644 textures/xdecor_mailbox_top.png create mode 100644 textures/xdecor_tatami.png create mode 100644 textures/xdecor_woodglass_door_a.png create mode 100644 textures/xdecor_woodglass_door_b.png create mode 100644 textures/xdecor_woodglass_door_inv.png diff --git a/crafts.lua b/crafts.lua index 1e98fcb..8edf5a7 100644 --- a/crafts.lua +++ b/crafts.lua @@ -1,3 +1,12 @@ +minetest.register_craft({ + output = "xdecor:baricade", + recipe = { + {"group:stick", "default:steel_ingot", "group:stick"}, + {"", "group:stick", ""}, + {"group:stick", "", "group:stick"} + } +}) + minetest.register_craft({ output = "xdecor:candle", recipe = { @@ -138,6 +147,15 @@ minetest.register_craftitem("xdecor:hammer", { description = "Hammer", inventory_image = "xdecor_hammer.png" }) + +minetest.register_craft({ + output = "xdecor:japanese_door", + recipe = { + {"group:wood", "group:wood"}, + {"default:paper", "default:paper"}, + {"group:wood", "group:wood"} + } +}) minetest.register_craft({ output = "xdecor:lantern", @@ -147,6 +165,15 @@ minetest.register_craft({ {"default:iron_lump"} } }) + +minetest.register_craft({ + output = "xdecor:mailbox", + recipe = { + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, + {"dye:red", "default:paper", "dye:red"}, + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"} + } +}) minetest.register_craft({ output = "xdecor:metal_cabinet", @@ -210,6 +237,15 @@ minetest.register_craft({ } }) +minetest.register_craft({ + output = "xdecor:stonepath 16", + recipe = { + {"stairs:slab_stone", "", "stairs:slab_stone"}, + {"", "stairs:slab_stone", ""}, + {"stairs:slab_stone", "", "stairs:slab_stone"} + } +}) + minetest.register_craft({ output = "xdecor:table", recipe = { @@ -219,6 +255,13 @@ minetest.register_craft({ } }) +minetest.register_craft({ + output = "xdecor:tatami", + recipe = { + {"farming:wheat", "farming:wheat", "farming:wheat"} + } +}) + minetest.register_craft({ output = "xdecor:tv", recipe = { @@ -253,3 +296,12 @@ minetest.register_craft({ {"group:wood", "group:wood"} } }) + +minetest.register_craft({ + output = "xdecor:woodglass_door", + recipe = { + {"default:glass", "default:glass"}, + {"group:wood", "group:wood"}, + {"group:wood", "group:wood"} + } +}) diff --git a/depends.txt b/depends.txt index 41bb35a..e05bacb 100644 --- a/depends.txt +++ b/depends.txt @@ -1,2 +1,3 @@ default -moreblocks? +doors +xpanes diff --git a/init.lua b/init.lua index 268cfd9..edfbdd6 100644 --- a/init.lua +++ b/init.lua @@ -5,5 +5,6 @@ dofile(modpath.."/handlers/nodeboxes.lua") dofile(modpath.."/handlers/registration.lua") dofile(modpath.."/crafts.lua") dofile(modpath.."/itemframes.lua") +dofile(modpath.."/mailbox.lua") dofile(modpath.."/nodes.lua") dofile(modpath.."/worktable.lua") diff --git a/mailbox.lua b/mailbox.lua new file mode 100644 index 0000000..135d559 --- /dev/null +++ b/mailbox.lua @@ -0,0 +1,89 @@ +xdecor.register("mailbox", { + description = "Mailbox", + tiles = { + "xdecor_mailbox_top.png", "xdecor_mailbox_bottom.png", + "xdecor_mailbox_side.png", "xdecor_mailbox_side.png", + "xdecor_mailbox.png", "xdecor_mailbox.png", + }, + groups = {snappy=3}, + after_place_node = function(pos, placer, itemstack) + local meta = minetest.get_meta(pos) + local owner = placer:get_player_name() + + meta:set_string("owner", owner) + meta:set_string("infotext", owner.."'s Mailbox") + + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + inv:set_size("drop", 1) + end, + on_rightclick = function(pos, node, clicker, itemstack) + local meta = minetest.get_meta(pos) + local player = clicker:get_player_name() + local owner = meta:get_string("owner") + local meta = minetest.get_meta(pos) + + if owner == player then + minetest.show_formspec( + clicker:get_player_name(), + "default:chest_locked", + xdecor.get_mailbox_formspec(pos)) + else + minetest.show_formspec( + clicker:get_player_name(), + "default:chest_locked", + xdecor.get_mailbox_insert_formspec(pos)) + end + end, + can_dig = function(pos,player) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + local inv = meta:get_inventory() + + return player:get_player_name() == owner and inv:is_empty("main") + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + + if listname == "drop" and inv:room_for_item("main", stack) then + inv:remove_item("drop", stack) + inv:add_item("main", stack) + end + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + if listname == "main" then + return 0 + end + if listname == "drop" then + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + + if inv:room_for_item("main", stack) then + return -1 + else + return 0 + end + end + end, +}) + +function xdecor.get_mailbox_formspec(pos) + local spos = pos.x..","..pos.y..","..pos.z + local formspec = + "size[8,9]"..xdecor.fancy_gui.. + "label[0,0;You received...]".. + "list[nodemeta:"..spos..";main;0,0.75;8,4;]".. + "list[current_player;main;0,5.25;8,4;]" + return formspec +end + +function xdecor.get_mailbox_insert_formspec(pos) + local spos = pos.x..","..pos.y..","..pos.z + local formspec = + "size[8,5]"..xdecor.fancy_gui.. + "label[0,0;Send your goods...]".. + "list[nodemeta:"..spos..";drop;3.5,0;1,1;]".. + "list[current_player;main;0,1.25;8,4;]" + return formspec +end diff --git a/nodes.lua b/nodes.lua index 83c4cd0..df0778f 100644 --- a/nodes.lua +++ b/nodes.lua @@ -1,3 +1,31 @@ +xpanes.register_pane("bamboo_frame", { + description = "Bamboo Frame", + tiles = {"xdecor_bamboo_frame.png"}, + drawtype = "airlike", + paramtype = "light", + sunlight_propagates = true, + textures = { "xdecor_bamboo_frame.png", "xdecor_bamboo_frame.png", + "xpanes_space.png" }, + inventory_image = "xdecor_bamboo_frame.png", + wield_image = "xdecor_bamboo_frame.png", + groups = {snappy=3, pane=1}, + recipe = { + {"default:papyrus", "default:papyrus", "default:papyrus"}, + {"default:papyrus", "farming:cotton", "default:papyrus"}, + {"default:papyrus", "default:papyrus", "default:papyrus"} + } +}) + +xdecor.register("baricade", { + description = "Baricade", + drawtype = "plantlike", + walkable = false, + inventory_image = "xdecor_baricade.png", + tiles = {"xdecor_baricade.png"}, + groups = {snappy=3}, + damage_per_second = 4 +}) + xdecor.register("barrel", { description = "Barrel", inventory = {size=24}, @@ -171,6 +199,20 @@ xdecor.register("cushion", { node_box = xdecor.nodebox.slab_y(-0.5, 0.5) }) +local door_types = {"woodglass", "japanese"} + +for _, d in pairs(door_types) do + doors.register_door("xdecor:"..d.."_door", { + description = string.sub(string.upper(d), 0, 1).. + string.sub(d, 2).." Door", + inventory_image = "xdecor_"..d.."_door_inv.png", + groups = {snappy=3, door=1}, + tiles_bottom = {"xdecor_"..d.."_door_b.png", "xdecor_brown.png"}, + tiles_top = {"xdecor_"..d.."_door_a.png", "xdecor_brown.png"}, + sounds = xdecor.wood, + }) +end + xdecor.register("empty_shelf", { description = "Empty Shelf", inventory = {size=24}, @@ -358,6 +400,30 @@ xdecor.register("stone_rune", { sounds = xdecor.stone }) +xdecor.register("stonepath", { + description = "Garden Stone Path", + tiles = { "default_stone.png" }, + groups = { snappy=3 }, + sounds = xdecor.stone, + node_box = { + type = "fixed", + fixed = { + {-0.4375, -0.5, 0.3125, -0.3125, -0.48, 0.4375}, + {-0.25, -0.5, 0.125, 0, -0.48, 0.375}, + {0.125, -0.5, 0.125, 0.4375, -0.48, 0.4375}, + {-0.4375, -0.5, -0.125, -0.25, -0.48, 0.0625}, + {-0.0625, -0.5, -0.25, 0.25, -0.48, 0.0625}, + {0.3125, -0.5, -0.25, 0.4375, -0.48, -0.125}, + {-0.3125, -0.5, -0.375, -0.125, -0.48, -0.1875}, + {0.125, -0.5, -0.4375, 0.25, -0.48, -0.3125} + } + }, + selection_box = { + type = "fixed", + fixed = { -0.4375, -0.5, -0.4375, 0.4375, -0.4, 0.4375 } + } +}) + xdecor.register("stone_tile", { description = "Stone Tile", tiles = {"xdecor_stone_tile.png"}, @@ -380,6 +446,18 @@ xdecor.register("table", { } }) +xdecor.register("tatami", { + description = "Tatami", + tiles = {"xdecor_tatami.png"}, + groups = {snappy=3}, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, + } + } +}) + xdecor.register("tv", { description = "Television", light_source = 11, diff --git a/textures/xdecor_bamboo_frame.png b/textures/xdecor_bamboo_frame.png new file mode 100644 index 0000000000000000000000000000000000000000..58a76b49edcb5267464051f581a70efa0a63402f GIT binary patch literal 243 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFP2=EDU1=7KVhM7GMWz(E|v$f1a zB%IGh(mWhYw%|#v_F~jaDz0v%V#vapbMMUO^s~tLUAnNpi zfs0 z24+P!0nG&`4m@N@T47>f;FHM0RbgackY&NhI*Uc3!HI`wUc%G8d^+Y1CX1gL&h%tT zSa`%`MPO2rz^t7HcNub4ykuIJFyZ5=t2{indmGAT>LnyR;0jAgVB=zF<&kh;Qcz^L X^;*DG_<7STptTI1u6{1-oD!M<0u)99 literal 0 HcmV?d00001 diff --git a/textures/xdecor_brown.png b/textures/xdecor_brown.png new file mode 100644 index 0000000000000000000000000000000000000000..c541a5725ee2d300d8a16c7adb889fe04ded8835 GIT binary patch literal 82 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga%mF?juKi)ga!S7z1G!wDE{-7_ b*OL=~Y$gWAM~Zulfh-13S3j3^P6#UQZP#`8O_bjSvwzMKpl5X zD`!C`Xhk4lIUiCr9I9?dTH<*40001%Nkl7WCX^hZbBib0G1r;QqK@gb`+&JBkG|p{n=ds;# z9=BMour~)9mU<<6WdQhl zQ(v5BpI|Q&X(1nJCh7W2It!?Ru_VYZn8D%MjWi%9%+tj&gyVX0LP9`sQE*@aL(`Q@ zpFG$FoP#4GM06(crKmJWyz}*ao1ht*nCNM6SXhHKZ3)xT16fxRcLgbC2`F)x&UDb+ o&|&SfyDFtZCBjS9mGuP=gAI#NzHz?bB%lopp00i_>zopr038%Mr2qf` literal 0 HcmV?d00001 diff --git a/textures/xdecor_mailbox.png b/textures/xdecor_mailbox.png new file mode 100644 index 0000000000000000000000000000000000000000..4fe62134ae1f77da273155acfd7610c445483cd4 GIT binary patch literal 193 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPGa3-AeXU1g(Dtgd`1z-EcL>g#De zjXEkiIy(E@jP~uE{rJH-$8PmMK$UTxE{-7_*KNBu@-`Uou-rH5xE6SXX`VvJ77ev9iqjS}a>8U+BC$@z;!y qElfAq#C+Adew>!k;$L@R^FHoWUj0K;Y_fqiF?hQAxvX2f+y4}+(x KpUXO@geCyRuNYkb literal 0 HcmV?d00001 diff --git a/textures/xdecor_mailbox_side.png b/textures/xdecor_mailbox_side.png new file mode 100644 index 0000000000000000000000000000000000000000..86858cb7c4d0b24cc104ffcd9f160b30881f6544 GIT binary patch literal 166 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPGa2=EDUU1g(jb7|+L0GlP|s>SNc zN6O>Qb{974sGR4J*#%VN>FMGa!f`!0poxi%Esc%EpdqLrFpa}cBt=9-gvB_LmDRPe zDW|EYv8gfPYtN!ZO$w=ExE!!OXD7fjvQ!H}L_`PzFy| KKbLh*2~7aakuhWd literal 0 HcmV?d00001 diff --git a/textures/xdecor_mailbox_top.png b/textures/xdecor_mailbox_top.png new file mode 100644 index 0000000000000000000000000000000000000000..4890366c29ac55130dc3d93377c09e3529bcd7b5 GIT binary patch literal 115 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9>!kpjlL59Ymkc%oMKnBJ z978y+Co?cHD&!?R5J*T!VJVbll8~6`z~d;kK*pnsRcGA^MimBA874tir_1R;Jq(_% KelF{r5}E)Gm>FFF literal 0 HcmV?d00001 diff --git a/textures/xdecor_tatami.png b/textures/xdecor_tatami.png new file mode 100644 index 0000000000000000000000000000000000000000..d7ea637a14a6c721fdec6d5cf397b4a7f71942ab GIT binary patch literal 155 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^4e$wZ{ds%#>+_TD9O^v3twB>t z!qZmUTvMT=@caXy0!L35#}JO|$sC-8+@74CrO5>;VJwbfZ7Bw4*Blby5KK%iXzMy~ zWrGpRVb_GLNt`PkXRP58aWuC)a`mjL>XEae3~S5;94{zm&jlLB;OXk;vd$@?2>>dq BGOhps literal 0 HcmV?d00001 diff --git a/textures/xdecor_woodglass_door_a.png b/textures/xdecor_woodglass_door_a.png new file mode 100644 index 0000000000000000000000000000000000000000..60a26635c76b61d7431b96bac7373bbf8d0d31be GIT binary patch literal 265 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPHF4e$wZ1=9Ut#tC*Zd2Z@0f%-EO zY*($ie(v1!NHeLOJMS${vp;a)@v1!6J9pl>>&kqZa3uh!fw3gWFPOpM*^M+Hr_0mD zF@)nf?@2?hLk1EK58c}vIu5V5Z7^N%R!#HKpXQq}N)?SI0^1iU^!drg+B9aXuYd61 z-NadMAKTU_7JX@#-^6+8`(^X{O7~ZuVJTdL^@pC z^1&;D=}3#NgYp~e2a`4HScTU$*34rH{4jOr%x`)&b2o2|eZjDDw&digeR{<}S21|H L`njxgN@xNAjcID* literal 0 HcmV?d00001 diff --git a/textures/xdecor_woodglass_door_b.png b/textures/xdecor_woodglass_door_b.png new file mode 100644 index 0000000000000000000000000000000000000000..335cdcc2368e46c09f84792609763e05f54d7fda GIT binary patch literal 271 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!Q-Dv1Yk!#W$|COsdzqODwk?7B zd2Z_SbKO?uxks8wZK@4loMxYBDetH*zIN@}d-v|`*|Vp+yL)GIq^FLQg_4M_G@qIz z_o}(m%YmkKc)B=-NL-HXkLF`C};Jmd!y95 z->LhVEPM|LU)U!8K-h;Rp}Irq_JkvB2M&I6-PRxkdE^X|Zb$E#LdH<#nNckfa0~