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 formspec
|
||||||
local item_state
|
local item_state
|
||||||
local queen_percent = 0
|
local queen_percent = 0
|
||||||
|
--by default timer doesnt restart
|
||||||
|
local result = false
|
||||||
if actionable then
|
if actionable then
|
||||||
queen_percent = math.floor(src_time / breedtime * 100)
|
queen_percent = math.floor(src_time / breedtime * 100)
|
||||||
if dst_full then
|
if dst_full then
|
||||||
@ -179,6 +181,8 @@ local function apiary_node_timer(pos,elapsed)
|
|||||||
else
|
else
|
||||||
item_state = tostring(item_percent).."%"
|
item_state = tostring(item_percent).."%"
|
||||||
end
|
end
|
||||||
|
--make sure timer restarts
|
||||||
|
result = true
|
||||||
else
|
else
|
||||||
if (monarchlist and not monarchlist[1]:is_empty()) or (dronelist and not dronelist[1]:is_empty()) then
|
if (monarchlist and not monarchlist[1]:is_empty()) or (dronelist and not dronelist[1]:is_empty()) then
|
||||||
item_state = "Cannot breed"
|
item_state = "Cannot breed"
|
||||||
@ -186,14 +190,12 @@ local function apiary_node_timer(pos,elapsed)
|
|||||||
item_state = "Empty"
|
item_state = "Empty"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local result = false
|
|
||||||
formspec = forestry_bees.get_apiary_active_formspec(queen_percent)
|
formspec = forestry_bees.get_apiary_active_formspec(queen_percent)
|
||||||
--make sure timer restarts
|
|
||||||
result = true
|
|
||||||
|
|
||||||
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()))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user