Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p = peripheral.wrap("back") --Where is the reactor
- componentThreshhold = 0.9 --90% durability lost
- SteamCapacity = 40000 -- Steam Reactor's have an internal capacity of 50000
- term.clear()
- term.setCursorPos(1,1)
- print("Starting up Reactor Manager")
- print("Please Wait...")
- --Checks to see if the reactor has Steam Vents and measures enables the steam sanity check if true
- sanitySteam = 0
- for i=1,54 do
- if p.getItem(i) then
- if p.getItemMeta(i).displayName == "Steam Vent" or p.getItemMeta(i).displayName == "Reactor Steam Vent" or p.getItemMeta(i).displayName == "Overclocked Steam Vent" or p.getItemMeta(i).displayName == "Advanced Steam Vent" then
- sanitySteam = sanitySteam + 1
- end
- end
- end
- if sanitySteam > 0 then
- SteamReactor = 1
- else
- SteamReactor = 0
- end
- --Starts the reactor loop
- while true do
- if rs.getAnalogInput("front") > 0 then --Checks the front of the computer for a Redstone signal to enable the reactor
- T = 0 --sets initial componentThreshhold bit
- F = 0 --sets initial fuelPresent bit
- for i=1,54 do --inspects every component in an ic2 reactor or steam reactor and checks to see if the durability is below the desired componentThreshhold, throws a componentThreshhold bit if true allowing the reactor to cool down
- if p.getItem(i) then
- if p.getItemMeta(i).name ~= "ic2:itemreactorrods" then
- if p.getItemMeta(i).durability then
- if p.getItemMeta(i).durability > componentThreshhold then
- T = T + 1
- end
- end
- else
- F = F + 1
- end
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- if SteamReactor > 0 then
- for _,v in pairs (p.getTanks()) do
- if v then
- if v.amount then
- print(v.name..":"..v.amount.."/"..v.capacity)
- if v.name == "steam" then
- if v.amount > SteamCapacity then
- T = T + 1
- end
- end
- else
- if v.name == nil and v.capacity == 50000 then --Written due to a bug with the steam reactor itself
- print("steam:0/50000")
- end
- end
- end
- end
- end
- if T > 0 then
- rs.setAnalogOutput("back", 0)
- rs.setAnalogOutput("left", 15) -- turns a lamp to the left on to show the reactor is off
- rs.setAnalogOutput("right", 0)
- print("Reactor:Sleep Cycle")
- sleep(2)
- else
- if F == 0 then
- rs.setAnalogOutput("back", 0)
- rs.setAnalogOutput("left", 15) -- turns a lamp to the left on to show the reactor is off
- rs.setAnalogOutput("right", 0)
- print("Reactor:Out of Fuel")
- sleep(2)
- else
- rs.setAnalogOutput("back", 15) --turns the reactor on
- rs.setAnalogOutput("left", 0)
- rs.setAnalogOutput("right", 15) --turns a lamp to the right on to show the reactor is on
- print("Reactor:On")
- end
- end
- else -- Disables the reactor because the redstone signal in front of the computer is off
- rs.setAnalogOutput("back", 0)
- rs.setAnalogOutput("left", 9)
- rs.setAnalogOutput("right", 0)
- sleep(10)
- end
- end
Advertisement
Advertisement