1 local function hive_construct(pos)
2 local meta = minetest.get_meta(pos)
3 meta:set_string("formspec", "size[8,5;]"..xdecor.fancy_gui..
4 "label[1.5,0;Bees are making honey\nwith pollen around...]"..
5 "list[current_name;honey;5,0;1,1;]"..
6 "list[current_player;main;0,1.35;8,4;]")
7 meta:set_string("infotext", "Artificial Hive")
8 local inv = meta:get_inventory()
9 inv:set_size("honey", 1)
12 local function hive_dig(pos, player)
13 local meta = minetest.get_meta(pos)
14 local inv = meta:get_inventory()
15 if not inv:is_empty("honey") then
21 xdecor.register("hive", {
22 description = "Artificial Hive",
24 "xdecor_hive_top.png",
25 "xdecor_hive_top.png",
26 "xdecor_hive_side.png",
27 "xdecor_hive_side.png",
28 "xdecor_hive_side.png",
29 "xdecor_hive_front.png",
31 groups = {choppy=3, flammable=1},
32 on_construct = hive_construct,
34 on_punch = function(pos, node, puncher, pointed_thing)
35 local health = puncher:get_hp()
36 puncher:set_hp(health-4)
40 minetest.register_abm({
41 nodenames = {"xdecor:hive"},
42 interval = 10, chance = 10,
43 action = function(pos, node, active_object_count, active_object_count_wider)
44 local meta = minetest.get_meta(pos)
45 local inv = meta:get_inventory()
48 local minp = {x=pos.x-radius, y=pos.y-radius, z=pos.z-radius}
49 local maxp = {x=pos.x+radius, y=pos.y+radius, z=pos.z+radius}
50 local flowers = minetest.find_nodes_in_area(minp, maxp, "group:flower")
53 inv:add_item("honey", "xdecor:honey")