now apiary_timer ticks only when necessary
This commit is contained in:
parent
1ff9bce3d2
commit
beba692c05
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user