Advertisement
themath1234

test.lua

Nov 24th, 2024 (edited)
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- test
  2. local reactor
  3.  
  4. function reactorSearch()
  5.  local names = peripheral.getNames()
  6.  local i, name
  7.  for i, name in pairs(names) do
  8.   if peripheral.getType(name) == "fissionReactorLogicAdapter" then
  9.    return peripheral.wrap(name)
  10.   end
  11.  end    
  12. end
  13.  
  14. reactor = reactorSearch()
  15.  
  16. if reactor ~= nil then
  17.     local minPercentageToStart = 20 -- 20% minimum
  18.     local currentWastePercentage = math.floor(reactor.getWasteFilledPercentage() * 100)
  19.     local a = currentWastePercentage <= 90
  20.     print('currentWastePercentage',currentWastePercentage, a)
  21.     local coolantFilled = math.floor(reactor.getCoolantFilledPercentage()* 100)
  22.     local b = coolantFilled >= minPercentageToStart
  23.     print('coolantFilled',coolantFilled, b);
  24.     local fuelFilled = math.floor(reactor.getFuelFilledPercentage()* 100)
  25.     local c = fuelFilled >= minPercentageToStart
  26.     print('fuelFilled',fuelFilled, c);
  27.     local currentTemp = math.floor(reactor.getTemperature())
  28.     local d = currentTemp < 800
  29.     print('currentTemp',currentTemp, d);
  30.    
  31.    
  32.     local canOperate = a and b and c and d
  33.    
  34.     print('can operate',canOperate)
  35.      
  36. end
  37.  
  38. local alarmPos = "back"
  39.  
  40. redstone.setOutput(alarmPos, true)
  41. redstone.setOutput(alarmPos, false)
  42.  
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement