diff --git a/crafts.lua b/crafts.lua index 7f2dca2..7215e30 100644 --- a/crafts.lua +++ b/crafts.lua @@ -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 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 +}) diff --git a/init.lua b/init.lua index 61250fd..0b3c285 100644 --- 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") diff --git a/nodes.lua b/nodes.lua index e75b957..b3c0e26 100644 --- 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 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 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 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 index 0000000..6d4dd04 Binary files /dev/null and b/textures/xdecor_honey.png differ diff --git a/textures/xdecor_ivy.png b/textures/xdecor_ivy.png index 65c65f9..d540e18 100644 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 index 0000000..fdf818a Binary files /dev/null and b/textures/xdecor_rust_bars.png differ