fix reactor.lua

This commit is contained in:
LordMZTE 2021-11-13 15:23:18 +01:00
parent 9e699b71c8
commit 7f3431b912
1 changed files with 9 additions and 1 deletions

View File

@ -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