From beba692c0588e0ce1f662e38e43f0538ac306496 Mon Sep 17 00:00:00 2001 From: StochasticMouse Date: Tue, 8 Oct 2024 15:04:59 +0200 Subject: [PATCH] now apiary_timer ticks only when necessary --- forestry_bees/apiary.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/forestry_bees/apiary.lua b/forestry_bees/apiary.lua index fc83311..db06313 100644 --- a/forestry_bees/apiary.lua +++ b/forestry_bees/apiary.lua @@ -172,6 +172,8 @@ local function apiary_node_timer(pos,elapsed) local formspec local item_state local queen_percent = 0 + --by default timer doesnt restart + local result = false if actionable then queen_percent = math.floor(src_time / breedtime * 100) if dst_full then @@ -179,6 +181,8 @@ local function apiary_node_timer(pos,elapsed) else item_state = tostring(item_percent).."%" end + --make sure timer restarts + result = true else if (monarchlist and not monarchlist[1]:is_empty()) or (dronelist and not dronelist[1]:is_empty()) then item_state = "Cannot breed" @@ -186,14 +190,12 @@ local function apiary_node_timer(pos,elapsed) item_state = "Empty" end end - local result = false + formspec = forestry_bees.get_apiary_active_formspec(queen_percent) - --make sure timer restarts - result = true meta:set_float("src_time", src_time) meta:set_string("formspec", formspec) - + minetest.chat_send_all(tostring(math.random())) return result end