fix reactor.lua
This commit is contained in:
parent
9e699b71c8
commit
7f3431b912
|
@ -5,7 +5,14 @@ if reac == nil then
|
||||||
end
|
end
|
||||||
|
|
||||||
while true do
|
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()
|
local active = reac.getActive()
|
||||||
|
|
||||||
|
@ -13,5 +20,6 @@ while true do
|
||||||
reac.setActive(newstate)
|
reac.setActive(newstate)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
::endloop::
|
||||||
sleep(5)
|
sleep(5)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue