Rearrange generator timer refresh setters

This commit is contained in:
Evert Prants 2018-09-25 16:36:14 +03:00
parent 54b1809f8f
commit 2eb0062491
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 9 additions and 3 deletions

View File

@ -84,7 +84,7 @@ function ele.register_fluid_generator(nodename, nodedef)
status = "Active"
-- Burn another bucket of lava
-- Burn another bucket of fluid fuel
if burn_time == 0 then
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_totaltime", btime)
-- Take lava
-- Take fluid fuel
flbuffer.amount = flbuffer.amount - busage
pow_buffer.usage = generation
@ -110,6 +110,8 @@ function ele.register_fluid_generator(nodename, nodedef)
else
status = "Idle"
ele.helpers.swap_node(pos, nodename)
refresh = false
end
end
if burn_totaltime == 0 then burn_totaltime = 1 end

View File

@ -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 burn_time > 0 then
if storage + generation > capacity then
return false
break
end
pow_buffer.storage = pow_buffer.storage + generation
@ -68,6 +68,8 @@ function elepm.register_fuel_generator(nodename, nodedef)
burn_time = burn_time - 1
meta:set_int("burn_time", burn_time)
refresh = true
end
status = "Active"
@ -102,6 +104,8 @@ function elepm.register_fuel_generator(nodename, nodedef)
else
status = "Idle"
ele.helpers.swap_node(pos, nodename)
refresh = false
end
end
if burn_totaltime == 0 then burn_totaltime = 1 end