Advertisement
osmarks

NCController-CC

Sep 28th, 2019
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.48 KB | None | 0 0
  1. local input = "front"
  2. local ctrl
  3. for _, n in pairs(peripheral.getNames()) do
  4.     if peripheral.getType(n) == "nuclearcraft:fission_controller_new" then
  5.         ctrl = n
  6.     end
  7. end
  8.  
  9. while true do
  10.     local manual_control = rs.getInput(input)
  11.     local energy = peripheral.call(ctrl, "getEnergyStored") / peripheral.call(ctrl, "getEnergyCapacity")
  12.     local enable = energy < 0.5 and manual_control
  13.     print(os.date "%H:%M:%S", energy, manual_control, enable)
  14.     rs.setOutput(ctrl, enable)
  15.     sleep(2)
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement