Advertisement
NusanTech

BigReactorControl

Jul 3rd, 2024 (edited)
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | Gaming | 0 0
  1. local component = require("component")
  2. local term = require("term")
  3. local reactor = component.br_reactor
  4.  
  5. -- Fungsi untuk menghabiskan energi
  6. local function consumeEnergy()
  7.   local energyStored = reactor.getEnergyStored()
  8.   if energyStored > 0 then
  9.     -- Mengatur produksi energi menjadi 0 untuk menghabiskan energi
  10.     reactor.setEnergyProducedLastTick(0)
  11.   end
  12. end
  13.  
  14. -- Fungsi utama untuk mengontrol proses penghabisan energi
  15. local function main()
  16.   while true do
  17.     consumeEnergy()
  18.     os.sleep(1)  -- Update setiap 1 detik
  19.   end
  20. end
  21.  
  22. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement