diff --git a/forestry_bees/apiary.lua b/forestry_bees/apiary.lua index d65f33e..60302fc 100644 --- a/forestry_bees/apiary.lua +++ b/forestry_bees/apiary.lua @@ -129,8 +129,9 @@ local function apiary_node_timer(pos,elapsed) inv:set_stack("drone",1,bee) end --------------------- + can_breed = is_princess and is_drone - can_live = is_queen --these two event are disjoint (there are no queen & princess) + can_live = is_queen and forestry_bees.can_queen_work(monarchlist[1], pos) --these two event are disjoint (there are no queen & princess) actionable = can_breed or can_live if is_queen then diff --git a/forestry_bees/helper.lua b/forestry_bees/helper.lua index 6bedc1c..4ec0602 100644 --- a/forestry_bees/helper.lua +++ b/forestry_bees/helper.lua @@ -16,6 +16,22 @@ function forestry_bees.Bee(bee_type,genes) return itemstack end +function forestry_bees.can_queen_work(queen, pos) + local genes = minetest.deserialize(queen:get_meta():get_string("genes")) + local biome_data = minetest.get_biome_data(pos) + local biome_name = minetest.get_biome_name(biome_data["biome"]) + local humidity = biome_data["humidity"] + local heat = biome_data["heat"] + --now get the environmental data + local is_right_heat = true --futureproofing + local is_right_humidity = true --futureproofing + local is_right_biome = true --futureproofing + local is_sky_access = (genes["cave"][1] or (minetest.get_natural_light(vector.offset(pos, 0, 1, 0), 0.5) == 15)) + local is_not_raining = (genes["flyer"][1] or true) --would require additional mods + local is_day = (genes["nocturnal"][1] or ((0.25 < minetest.get_timeofday()) and (minetest.get_timeofday() < 0.75))) + return is_sky_access and is_not_raining and is_day +end + function forestry_bees.calculate_drop(bee) local genes = minetest.deserialize(bee:get_meta():get_string("genes")) local possible_drops = forestry_bees.bee_drops[genes["type_gene"][1]] --this gets us a table