Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("disk/attached_devices")
- os.loadAPI("disk/var_dump")
- function react(t)
- local devices = attached_devices.load_attached_devices()
- --var_dump.var_dump(devices.drives[2])
- local reactor = devices.drives[2].obj
- local running = reactor.getActive()
- local energy = reactor.getEnergyStored()
- local fuel = reactor.getFuelAmount()
- local last_tick = reactor.getEnergyProducedLastTick()
- local task = ""
- if fuel == 0 then
- reactor.setActive(false)
- task = "STOPPED. NO FUEL"
- elseif energy < 8000000 and running == false then
- task = "STARTING..."
- reactor.setActive(true)
- if reactor.getActive()==false then
- task = task.." FAILED TO START"
- else
- task = task.." (SUCCESS)"
- end
- elseif running == false then
- task = "NOT RUNNING"
- elseif running == true and energy > 8000000 then
- task = "STOPPING..."
- reactor.setActive(false)
- if reactor.getActive()==true then
- task = task.." FAILED TO STOP"
- else
- task = task.." (SUCCESS)"
- end
- elseif running == true then
- task = "RUNNING"
- end
- local output = "** [Reactor Daemon] "..task..", Energy Stored: "..energy
- if task == "RUNNING" then
- output = output..", Energy Produced Last Tick: "..last_tick
- end
- output = output.. ", Fuel Remaining: "..fuel
- print(output)
- os.loadAPI("disk/discord")
- if not (task == t) then
- discord.webhook(output)
- end
- return task
- end
- local s = ""
- while true do
- s = react(s)
- os.sleep(15)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement