diff --git a/forestry_bees/apiary.lua b/forestry_bees/apiary.lua index 25a5997..03c5f18 100644 --- a/forestry_bees/apiary.lua +++ b/forestry_bees/apiary.lua @@ -104,9 +104,11 @@ local function apiary_node_timer(pos,elapsed) local is_queen, is_princess, is_drone local can_breed, can_live local actionable + local changed_queen = false local breedtime = 1 local needed_time = 1 --just so that the formspecs doesnt make an error + local queentime = 0 while elapsed > 0 and update do update = false @@ -120,6 +122,11 @@ local function apiary_node_timer(pos,elapsed) can_live = is_queen --these two event are disjoint (there are no queen & princess) actionable = can_breed or can_live + if is_queen then + queentime = monarchlist[1]:get_meta():get_float("queentime") or 0 + src_time = queentime + end + local el = elapsed --if actionable check if things are ready if actionable then @@ -164,6 +171,7 @@ local function apiary_node_timer(pos,elapsed) inv:set_stack("monarch",1,ItemStack()) src_time = src_time - needed_time update = true + changed_queen = true else dst_full = true end @@ -202,7 +210,10 @@ local function apiary_node_timer(pos,elapsed) end formspec = forestry_bees.get_apiary_active_formspec(percent) - + if is_queen and (not changed_queen) then + monarchlist[1]:get_meta():set_float("queentime", src_time) + inv:set_stack("monarch",1,monarchlist[1]) + end meta:set_float("src_time", src_time) meta:set_string("formspec", formspec) minetest.chat_send_all(tostring(math.random()))