Advertisement
Guest User

startup

a guest
Mar 27th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. r = peripheral.wrap("back")
  2.  
  3. while true do
  4.  
  5.   if r.getActive() == false then
  6.     if r.getFuelAmount() > 189000 and redstone.getInput("left") == false then
  7.       r.setActive(true)
  8.       print("Setting reactor to active.")
  9.     else
  10.       print("Reactor not active, skipping.")
  11.       sleep(10)
  12.     end
  13.   elseif r.getActive() == true then
  14.     print("Reactor is active.")
  15.     insertion = 100 - (math.floor((7000000 - r.getEnergyStored()) / 70000))
  16.     if insertion > 100 then
  17.       insertion = 100
  18.     end
  19.     print("Setting control rod levels to " .. insertion)
  20.     print("There is currently " .. r.getEnergyStored() .. "RF in the reactor buffer")
  21.     r.setAllControlRodLevels(insertion)
  22.     if r.getFuelAmount() < 180000 and redstone.getInput("left") == false then
  23.       r.setActive(false)
  24.       print("Deactivating reactor (fuel levels low)")
  25.     end
  26.     sleep(1.5)
  27.   end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement