Rearrange generator timer refresh setters

This commit is contained in:
Evert Prants 2018-09-25 16:36:14 +03:00
parent 54b1809f8f
commit 2eb0062491
No known key found for this signature in database
GPG Key ID: 1688DA83D222D0B5
2 changed files with 9 additions and 3 deletions

@ -84,7 +84,7 @@ function ele.register_fluid_generator(nodename, nodedef)
status = "Active" status = "Active"
-- Burn another bucket of lava -- Burn another bucket of fluid fuel
if burn_time == 0 then if burn_time == 0 then
if not flbuffer or flbuffer.fluid == "" then break end if not flbuffer or flbuffer.fluid == "" then break end
@ -93,7 +93,7 @@ function ele.register_fluid_generator(nodename, nodedef)
meta:set_int("burn_time", btime) meta:set_int("burn_time", btime)
meta:set_int("burn_totaltime", btime) meta:set_int("burn_totaltime", btime)
-- Take lava -- Take fluid fuel
flbuffer.amount = flbuffer.amount - busage flbuffer.amount = flbuffer.amount - busage
pow_buffer.usage = generation pow_buffer.usage = generation
@ -110,6 +110,8 @@ function ele.register_fluid_generator(nodename, nodedef)
else else
status = "Idle" status = "Idle"
ele.helpers.swap_node(pos, nodename) ele.helpers.swap_node(pos, nodename)
refresh = false
end end
end end
if burn_totaltime == 0 then burn_totaltime = 1 end if burn_totaltime == 0 then burn_totaltime = 1 end

@ -60,7 +60,7 @@ function elepm.register_fuel_generator(nodename, nodedef)
-- If more to burn and the energy produced was used: produce some more -- If more to burn and the energy produced was used: produce some more
if burn_time > 0 then if burn_time > 0 then
if storage + generation > capacity then if storage + generation > capacity then
return false break
end end
pow_buffer.storage = pow_buffer.storage + generation pow_buffer.storage = pow_buffer.storage + generation
@ -68,6 +68,8 @@ function elepm.register_fuel_generator(nodename, nodedef)
burn_time = burn_time - 1 burn_time = burn_time - 1
meta:set_int("burn_time", burn_time) meta:set_int("burn_time", burn_time)
refresh = true
end end
status = "Active" status = "Active"
@ -102,6 +104,8 @@ function elepm.register_fuel_generator(nodename, nodedef)
else else
status = "Idle" status = "Idle"
ele.helpers.swap_node(pos, nodename) ele.helpers.swap_node(pos, nodename)
refresh = false
end end
end end
if burn_totaltime == 0 then burn_totaltime = 1 end if burn_totaltime == 0 then burn_totaltime = 1 end