Add harvesting functionality to bee nests

Still has temporary abm updating
This commit is contained in:
PrairieWind 2022-11-05 16:21:01 -06:00 committed by cora
parent cb60338f10
commit a79692a68b

@ -77,6 +77,7 @@ minetest.register_node("mcl_beehives:beehive_5", {
groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 5, material_wood = 1, not_in_creative_inventory = 1, beehive = 1 },
_mcl_blast_resistance = 0.6,
_mcl_hardness = 0.6,
drops = "mcl_beehives:beehive",
on_rightclick = honey_harvest,
})
@ -90,11 +91,44 @@ minetest.register_node("mcl_beehives:bee_nest", {
"mcl_beehives_bee_nest_side.png", "mcl_beehives_bee_nest_front.png",
},
paramtype2 = "facedir",
groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 30 },
groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 30, bee_nest = 1 },
_mcl_blast_resistance = 0.3,
_mcl_hardness = 0.3,
})
for i = 1, 4 do
minetest.register_node("mcl_beehives:bee_nest_"..i, {
description = S("Bee Nest"),
_doc_items_longdesc = S("A naturally generating block that houses bees and a tasty treat...if you can get it."),
tiles = {
"mcl_beehives_bee_nest_top.png", "mcl_beehives_bee_nest_bottom.png",
"mcl_beehives_bee_nest_side.png", "mcl_beehives_bee_nest_side.png",
"mcl_beehives_bee_nest_side.png", "mcl_beehives_bee_nest_front.png",
},
paramtype2 = "facedir",
groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 30, not_in_creative_inventory = 1, bee_nest = 1 },
_mcl_blast_resistance = 0.3,
_mcl_hardness = 0.3,
drops = "mcl_beehives:bee_nest",
})
end
minetest.register_node("mcl_beehives:bee_nest_5", {
description = S("Bee Nest"),
_doc_items_longdesc = S("A naturally generating block that houses bees and a tasty treat...if you can get it."),
tiles = {
"mcl_beehives_bee_nest_top.png", "mcl_beehives_bee_nest_bottom.png",
"mcl_beehives_bee_nest_side.png", "mcl_beehives_bee_nest_side.png",
"mcl_beehives_bee_nest_side.png", "mcl_beehives_bee_nest_front_honey.png",
},
paramtype2 = "facedir",
groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 30, not_in_creative_inventory = 1, bee_nest = 1 },
_mcl_blast_resistance = 0.3,
_mcl_hardness = 0.3,
drops = "mcl_beehives:bee_nest",
on_rightclick = honey_harvest,
})
-- Crafting
minetest.register_craft({
output = "mcl_beehives:beehive",
@ -131,3 +165,29 @@ minetest.register_abm({
end
end,
})
minetest.register_abm({
label = "Update Bee Nest Honey Levels",
nodenames = "group:bee_nest",
interval = 500,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local beehive = "mcl_beehives:bee_nest"
if node.name == beehive then
node.name = beehive.."_1"
minetest.set_node(pos, node)
elseif node.name == beehive.."_1" then
node.name = beehive.."_2"
minetest.set_node(pos, node)
elseif node.name == beehive.."_2" then
node.name = beehive.."_3"
minetest.set_node(pos, node)
elseif node.name == beehive.."_3" then
node.name = beehive.."_4"
minetest.set_node(pos, node)
elseif node.name == beehive.."_4" then
node.name = beehive.."_5"
minetest.set_node(pos, node)
end
end,
})