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 0000000..58a76b4 Binary files /dev/null and b/textures/xdecor_bamboo_frame.png differ diff --git a/textures/xdecor_baricade.png b/textures/xdecor_baricade.png new file mode 100644 index 0000000..2b8b73a Binary files /dev/null and b/textures/xdecor_baricade.png differ diff --git a/textures/xdecor_brown.png b/textures/xdecor_brown.png new file mode 100644 index 0000000..c541a57 Binary files /dev/null and b/textures/xdecor_brown.png differ diff --git a/textures/xdecor_japanese_door_a.png b/textures/xdecor_japanese_door_a.png new file mode 100644 index 0000000..fa466dc Binary files /dev/null and b/textures/xdecor_japanese_door_a.png differ diff --git a/textures/xdecor_japanese_door_b.png b/textures/xdecor_japanese_door_b.png new file mode 100644 index 0000000..db334e4 Binary files /dev/null and b/textures/xdecor_japanese_door_b.png differ diff --git a/textures/xdecor_japanese_door_inv.png b/textures/xdecor_japanese_door_inv.png new file mode 100644 index 0000000..bda0137 Binary files /dev/null and b/textures/xdecor_japanese_door_inv.png differ diff --git a/textures/xdecor_mailbox.png b/textures/xdecor_mailbox.png new file mode 100644 index 0000000..4fe6213 Binary files /dev/null and b/textures/xdecor_mailbox.png differ diff --git a/textures/xdecor_mailbox_bottom.png b/textures/xdecor_mailbox_bottom.png new file mode 100644 index 0000000..5c743f7 Binary files /dev/null and b/textures/xdecor_mailbox_bottom.png differ diff --git a/textures/xdecor_mailbox_side.png b/textures/xdecor_mailbox_side.png new file mode 100644 index 0000000..86858cb Binary files /dev/null and b/textures/xdecor_mailbox_side.png differ diff --git a/textures/xdecor_mailbox_top.png b/textures/xdecor_mailbox_top.png new file mode 100644 index 0000000..4890366 Binary files /dev/null and b/textures/xdecor_mailbox_top.png differ diff --git a/textures/xdecor_tatami.png b/textures/xdecor_tatami.png new file mode 100644 index 0000000..d7ea637 Binary files /dev/null and b/textures/xdecor_tatami.png differ diff --git a/textures/xdecor_woodglass_door_a.png b/textures/xdecor_woodglass_door_a.png new file mode 100644 index 0000000..60a2663 Binary files /dev/null and b/textures/xdecor_woodglass_door_a.png differ diff --git a/textures/xdecor_woodglass_door_b.png b/textures/xdecor_woodglass_door_b.png new file mode 100644 index 0000000..335cdcc Binary files /dev/null and b/textures/xdecor_woodglass_door_b.png differ diff --git a/textures/xdecor_woodglass_door_inv.png b/textures/xdecor_woodglass_door_inv.png new file mode 100644 index 0000000..0bc15e5 Binary files /dev/null and b/textures/xdecor_woodglass_door_inv.png differ diff --git a/worktable.lua b/worktable.lua index be1d92b..27c6b74 100644 --- a/worktable.lua +++ b/worktable.lua @@ -146,6 +146,9 @@ local function name(mat) elseif string.find(mat, "brick") then local newname = string.gsub(mat, "(brick)", "_%1") return "default_"..newname..".png" + elseif string.find(mat, "tree") then + local newname = string.gsub(mat, "(tree)", "%1_top") + return "default_"..newname..".png" else return "default_"..mat..".png" end