fix reactor.lua
This commit is contained in:
parent
9e699b71c8
commit
7f3431b912
|
@ -5,7 +5,14 @@ if reac == nil then
|
|||
end
|
||||
|
||||
while true do
|
||||
local newstate = reac.getEnergyStored() < reac.getEnergyCapacity() * 0.8
|
||||
local cap = reac.getEnergyCapacity()
|
||||
|
||||
-- this happens when the chunk loads in for some reason. gotta check to prevent crash
|
||||
if type(cap) ~= "number" then
|
||||
goto endloop
|
||||
end
|
||||
|
||||
local newstate = reac.getEnergyStored() < cap * 0.8
|
||||
|
||||
local active = reac.getActive()
|
||||
|
||||
|
@ -13,5 +20,6 @@ while true do
|
|||
reac.setActive(newstate)
|
||||
end
|
||||
|
||||
::endloop::
|
||||
sleep(5)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue