Skip to content

Simple OpenComputers ComputerCraft script for reactor

Sergey edited this page Apr 3, 2022 · 1 revision

Simple but not very effective Fusion Reactor control script

reactor.lua

local t = require "term"
local c = require "component"
local event = require "event"
local rla = c.reactor_logic_adapter

local lastEfficiency = 0
local curEfficiency = 0
local adjustment = 1

print("Hold CTRL+C to exit...")
os.sleep(3)

while not event.pull(0.1,"interrupted") do
  curEfficiency = rla.getEfficiency()
  if curEfficiency > 0 then
	if lastEfficiency > curEfficiency then
	  adjustment = -adjustment
	end
	rla.adjustReactivity(adjustment)
	t.clear()
	print("Efficiency = " .. curEfficiency .. "\n" .. "Adjustment: " ..adjustment)
	lastEfficiency = curEfficiency
	os.sleep(5.5)
  end
end
Clone this wiki locally