now the time the queen needs to die is queen specific and not apiary specific

This commit is contained in:
StochasticMouse 2024-10-10 14:56:32 +02:00
parent 30cf5b1c4f
commit a279c15d73

View File

@ -104,9 +104,11 @@ local function apiary_node_timer(pos,elapsed)
local is_queen, is_princess, is_drone local is_queen, is_princess, is_drone
local can_breed, can_live local can_breed, can_live
local actionable local actionable
local changed_queen = false
local breedtime = 1 local breedtime = 1
local needed_time = 1 --just so that the formspecs doesnt make an error local needed_time = 1 --just so that the formspecs doesnt make an error
local queentime = 0
while elapsed > 0 and update do while elapsed > 0 and update do
update = false 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) can_live = is_queen --these two event are disjoint (there are no queen & princess)
actionable = can_breed or can_live 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 local el = elapsed
--if actionable check if things are ready --if actionable check if things are ready
if actionable then if actionable then
@ -164,6 +171,7 @@ local function apiary_node_timer(pos,elapsed)
inv:set_stack("monarch",1,ItemStack()) inv:set_stack("monarch",1,ItemStack())
src_time = src_time - needed_time src_time = src_time - needed_time
update = true update = true
changed_queen = true
else else
dst_full = true dst_full = true
end end
@ -202,7 +210,10 @@ local function apiary_node_timer(pos,elapsed)
end end
formspec = forestry_bees.get_apiary_active_formspec(percent) 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_float("src_time", src_time)
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
minetest.chat_send_all(tostring(math.random())) minetest.chat_send_all(tostring(math.random()))