]> git.lizzy.rs Git - xdecor.git/commitdiff
Add Hive and Rust Bars
authorjp <jeanpatrick.guerrero@gmail.com>
Sat, 4 Jul 2015 23:38:12 +0000 (01:38 +0200)
committerjp <jeanpatrick.guerrero@gmail.com>
Sat, 4 Jul 2015 23:46:24 +0000 (01:46 +0200)
crafts.lua
hive.lua [new file with mode: 0644]
init.lua
nodes.lua
textures/xdecor_hive_front.png [new file with mode: 0644]
textures/xdecor_hive_side.png [new file with mode: 0644]
textures/xdecor_hive_top.png [new file with mode: 0644]
textures/xdecor_honey.png [new file with mode: 0644]
textures/xdecor_ivy.png
textures/xdecor_rust_bars.png [new file with mode: 0644]

index 7f2dca27aec55ea88800ebec01c927e37be90dc1..7215e30065034ee9afa39e74c7203fcea1239efa 100644 (file)
@@ -134,11 +134,26 @@ minetest.register_craftitem("xdecor:hammer", {
        inventory_image = "xdecor_hammer.png"
 })
 
+minetest.register_craft({
+       output = "xdecor:hive",
+       recipe = {
+               {"default:paper", "default:paper", "default:paper"},
+               {"default:paper", "", "default:paper"},
+               {"default:paper", "default:paper", "default:paper"}
+       }
+})
+
+minetest.register_craftitem("xdecor:honey", {
+       description = "Honey",
+       inventory_image = "xdecor_honey.png",
+       on_use = minetest.item_eat(2)
+})
+
 minetest.register_craft({
        output = "xdecor:ivy 2",
        recipe = {
-               {"group:leaves", "group:stick"},
-               {"group:stick", "group:leaves"}
+               {"group:leaves"},
+               {"group:leaves"}
        }
 })
 
diff --git a/hive.lua b/hive.lua
new file mode 100644 (file)
index 0000000..265e264
--- /dev/null
+++ b/hive.lua
@@ -0,0 +1,56 @@
+local function hive_construct(pos)
+       local meta = minetest.get_meta(pos)
+       meta:set_string("formspec", "size[8,5;]"..xdecor.fancy_gui..
+               "label[1.5,0;Bees are making honey\nwith pollen around...]"..
+               "list[current_name;honey;5,0;1,1;]"..
+               "list[current_player;main;0,1.35;8,4;]")
+       meta:set_string("infotext", "Artificial Hive")
+       local inv = meta:get_inventory()
+       inv:set_size("honey", 1)
+end
+
+local function hive_dig(pos, player)
+       local meta = minetest.get_meta(pos)
+       local inv = meta:get_inventory()
+       if not inv:is_empty("honey") then
+               return false
+       end
+       return true
+end
+
+xdecor.register("hive", {
+       description = "Artificial Hive",
+       tiles = {
+               "xdecor_hive_top.png",
+               "xdecor_hive_top.png",
+               "xdecor_hive_side.png",
+               "xdecor_hive_side.png",
+               "xdecor_hive_side.png",
+               "xdecor_hive_front.png",
+       },
+       groups = {choppy=3, flammable=1},
+       on_construct = hive_construct,
+       can_dig = hive_dig,
+       on_punch = function(pos, node, puncher, pointed_thing)
+               local health = puncher:get_hp()
+               puncher:set_hp(health-4)
+       end
+})
+
+minetest.register_abm({
+       nodenames = {"xdecor:hive"},
+       interval = 10, chance = 10,
+       action = function(pos, node, active_object_count, active_object_count_wider)
+               local meta = minetest.get_meta(pos)
+               local inv = meta:get_inventory()
+
+               local radius = 16
+               local minp = {x=pos.x-radius, y=pos.y-radius, z=pos.z-radius}
+               local maxp = {x=pos.x+radius, y=pos.y+radius, z=pos.z+radius}
+               local flowers = minetest.find_nodes_in_area(minp, maxp, "group:flower")
+
+               if #flowers >= 4 then
+                       inv:add_item("honey", "xdecor:honey")
+               end
+       end
+})
index 61250fdbe3eaab1cf91e2fa385ed9b559afcd4ea..0b3c285b31b1000ad43171f23368eeeecc4bd266 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -4,6 +4,7 @@ modpath = minetest.get_modpath("xdecor")
 dofile(modpath.."/handlers/nodeboxes.lua")
 dofile(modpath.."/handlers/registration.lua")
 dofile(modpath.."/crafts.lua")
+dofile(modpath.."/hive.lua")
 dofile(modpath.."/itemframes.lua")
 dofile(modpath.."/mailbox.lua")
 dofile(modpath.."/rope.lua")
index e75b957c29a0268c3adb527dcc27d8ef64feefab..b3c0e262b5c4b67f6bba470ce099614ff98ece6a 100644 (file)
--- a/nodes.lua
+++ b/nodes.lua
@@ -318,7 +318,7 @@ for _, f in ipairs(flowerstype) do
        xdecor.register("potted_"..f, {
                description = "Potted Flowers ("..f..")",
                walkable = false,
-               groups = {dig_immediate=3, flammable=3, plant=1},
+               groups = {dig_immediate=3, flammable=3, plant=1, flower=1},
                tiles = {"xdecor_"..f.."_pot.png"},
                inventory_image = "xdecor_"..f.."_pot.png",
                drawtype = "plantlike",
@@ -380,6 +380,22 @@ xdecor.register("multishelf", {
        sounds = xdecor.wood
 })
 
+xpanes.register_pane("rust_bar", {
+       description = "Rust Bars",
+       tiles = {"xdecor_rust_bars.png"},
+       drawtype = "airlike",
+       paramtype = "light",
+       sunlight_propagates = true,
+       textures = {"xdecor_rust_bars.png", "xdecor_rust_bars.png", 
+                       "xpanes_space.png"},
+       inventory_image = "xdecor_rust_bars.png",
+       wield_image = "xdecor_rust_bars.png",
+       groups = {snappy=2, pane=1},
+       recipe = {
+               {"xpanes:bar", "default:dirt"}
+       }
+})
+
 xdecor.register("stereo", {
        description = "Stereo",
        groups = {snappy=2},
diff --git a/textures/xdecor_hive_front.png b/textures/xdecor_hive_front.png
new file mode 100644 (file)
index 0000000..6d0af3b
Binary files /dev/null and b/textures/xdecor_hive_front.png differ
diff --git a/textures/xdecor_hive_side.png b/textures/xdecor_hive_side.png
new file mode 100644 (file)
index 0000000..f673733
Binary files /dev/null and b/textures/xdecor_hive_side.png differ
diff --git a/textures/xdecor_hive_top.png b/textures/xdecor_hive_top.png
new file mode 100644 (file)
index 0000000..14365dd
Binary files /dev/null and b/textures/xdecor_hive_top.png differ
diff --git a/textures/xdecor_honey.png b/textures/xdecor_honey.png
new file mode 100644 (file)
index 0000000..6d4dd04
Binary files /dev/null and b/textures/xdecor_honey.png differ
index 65c65f9ebfdc8e3b4009876faa6ab52ff0fad0ff..d540e1839b57d439a034d38c563590f19cff7b87 100644 (file)
Binary files a/textures/xdecor_ivy.png and b/textures/xdecor_ivy.png differ
diff --git a/textures/xdecor_rust_bars.png b/textures/xdecor_rust_bars.png
new file mode 100644 (file)
index 0000000..fdf818a
Binary files /dev/null and b/textures/xdecor_rust_bars.png differ