Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- reactor = peripheral.wrap("top")
- modem = peripheral.find("modem")
- FuelLevel = reactor.getFuelFilledPercentage()*100
- WasteLevel = reactor.getWasteFilledPercentage()*100
- Damage = reactor.getDamagePercent()*100
- function getRealTime()
- local time = os.date("*t")
- return time
- end
- modem.open(7)
- modem.open(8)
- modem.open(9)
- function handleModemMessages()
- while true do
- local event, _, channel, _, message = os.pullEventRaw("modem_message")
- if event == "modem_message" then
- if channel == 8 then
- reactor.activate()
- print("Turbine Low on Energy", "Activating")
- elseif channel == 7 then
- print("message received")
- reactor.scram()
- print("WasteBarrels, Almost Full, Scramming Reactor...")
- elseif channel == 9 then
- reactor.scram()
- print("Turbine High on Energy", "Deactivating")
- end
- end
- sleep(0.1)
- end
- end
- function checkDanger()
- --Temperature--
- if reactor.getTemperature() >= reactor.getHeatCapacity() / 2.7 then
- print("Reactor Scrammed , High Temperature Detected")
- end
- --FuelLevel--
- if FuelLevel <= 90 then
- print("Reactor Scrammed , Fuel Level Low")
- end
- --NuclearWaste--
- if WasteLevel >= 30 then
- print("Waste Level High")
- reactor.scram()
- end
- --Damage--
- if Damage >= 5 then
- print("Damage Detected")
- reactor.scram()
- end
- sleep(0.1)
- end
- function TimeLimit()
- local currentTime = getRealTime()
- if currentTime.hour == 04 and currentTime.min >= 50 then
- sleep(5000)
- end
- end
- parallel.waitForAll(handleModemMessages, checkDanger, TimeLimit)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement