]> git.lizzy.rs Git - xdecor.git/commitdiff
Add new nodes and tweaks
authorjp <jeanpatrick.guerrero@gmail.com>
Thu, 2 Jul 2015 13:26:19 +0000 (15:26 +0200)
committerjp <jeanpatrick.guerrero@gmail.com>
Thu, 2 Jul 2015 13:51:33 +0000 (15:51 +0200)
20 files changed:
crafts.lua
depends.txt
init.lua
mailbox.lua [new file with mode: 0644]
nodes.lua
textures/xdecor_bamboo_frame.png [new file with mode: 0644]
textures/xdecor_baricade.png [new file with mode: 0644]
textures/xdecor_brown.png [new file with mode: 0644]
textures/xdecor_japanese_door_a.png [new file with mode: 0644]
textures/xdecor_japanese_door_b.png [new file with mode: 0644]
textures/xdecor_japanese_door_inv.png [new file with mode: 0644]
textures/xdecor_mailbox.png [new file with mode: 0644]
textures/xdecor_mailbox_bottom.png [new file with mode: 0644]
textures/xdecor_mailbox_side.png [new file with mode: 0644]
textures/xdecor_mailbox_top.png [new file with mode: 0644]
textures/xdecor_tatami.png [new file with mode: 0644]
textures/xdecor_woodglass_door_a.png [new file with mode: 0644]
textures/xdecor_woodglass_door_b.png [new file with mode: 0644]
textures/xdecor_woodglass_door_inv.png [new file with mode: 0644]
worktable.lua

index 1e98fcb1c3d93f1ccb6ac5df8fb886edab38c86c..8edf5a7e5b4b952374b1571afcc91f873091fca3 100644 (file)
@@ -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"}
+       }
+})
index 41bb35a6a1e85a3ae5b1e9858df5bbdb2847b15e..e05bacb4c28c4bf0f38e023abe43c016808c2f19 100644 (file)
@@ -1,2 +1,3 @@
 default
-moreblocks?
+doors
+xpanes
index 268cfd96cd609cb85bbff491872fa5bc512d856a..edfbdd6d713e6886159f9912d1c8fec3b86d13aa 100644 (file)
--- 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 (file)
index 0000000..135d559
--- /dev/null
@@ -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
index 83c4cd091add7a9c401da80abebd64f9e1afe9f2..df0778f6d7c07c9fde0c480e82f993a8394f5e1b 100644 (file)
--- 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 (file)
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 (file)
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 (file)
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 (file)
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 (file)
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 (file)
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 (file)
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 (file)
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 (file)
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 (file)
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 (file)
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 (file)
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 (file)
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 (file)
index 0000000..0bc15e5
Binary files /dev/null and b/textures/xdecor_woodglass_door_inv.png differ
index be1d92b7bbd888daac3a06e4e4437188c904d4e2..27c6b7468b521aa22cc542aeb1a82b7a1c3e9272 100644 (file)
@@ -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