Advertisement
Guest User

test.lua

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