Based on OC -based strong cold stack tutorial [with code] [GTNH] Gray Technology: New Horizons (GT: New Horizons) Minecr

This tutorial is set by the author to use the CC by-NC protocol.

Single pile version

Code first

 sides = request ("sides")

component = request ("component")

tp = request ("component"). Transposer

OS = Require ("OS")

battery = component.gt_batterybuffer

GPU = Component.gpu

uuid, reactor_name = component.list ('reactor') (0)

Print (reactor_name)

reactor = component [reactor_name]

Computer = reques ("Computer")

-Colon the direction of the reactor

function getReactorContaineridx ()

For i = 0,5,1 do

Local container = tp.getinventoryName (i);

If (container == "blockgenrator" or container == "blockReactorchamber") then

Return i;

End

End

Return nil;

end

-Cap the direction of the box

Function GetiocheStidx () ()

For i = 0,5,1 do

Local container = tp.getinventoryName (i);

If (container == "tile.ironches" or container == 'tile.chest') then;

Return i;

End

End

Return nil; End

Function Iscoontcell (itemstack)

Return String.find (itemstack.name, 'coolant') ~ = nil;

end

Function Isfuelrod (Itemstack)

Local name = itemstack.name;

Return Not (string.find (name, 'dep') ~ = nil or string.find (name,' dep') ~ = nil or string.find (name, 'deploy') ~ = nil) and (string.find(name, 'reactoruranium') ~ = nil or string.find (name, 'mox') ~ = nil or string.find (name, 'thoriumcell') ~ = nil or string.find (name, 'naq,' naq UADAHCELL ') ~ ~= Nil or string.find (name, 'mnqcell') ~ = nil);

end

Function IsdepleTedRod (itemstack)

Local name = itemstack.name

Return String.find (name, 'thoriumcelldep') ~ = nil or string.find (name, 'deploy') ~ = nil or string.find (name, 'naquadahcelldep') ~ = = = = = = = = = = = = = = nil or string.find (name, 'Mnqcelldep ') ~ = nil;

end

Function isCoolanTDEPLETED (Itemstack)

Return itemstack.damage> = itemstack.maxdamage-10;

end

Function TransferdepletedItem (Reactoridx, CheStidx, SourceSLOT)

Local chest = tp.getallstacks (chestidx)

Local SourceType = TP.getallStacks (Reactoridx) [SourceSlot] .Name

For i = 1, chest.count (), 1 do itemstack = chest [i]

If (itemstack == nil or itemstack.name == nil or (itemstack.size

TP.TRANSFERITEM (ReactoridX, ChestidX, 1, SourceSLot, I)

Break

End

End

end

Function TransferNewitem (ReactoridX, Chestidx, SourceSLOT, TargetsLot)

TP.TRANSFERITEM (CheStidX, ReactoridX, 1, SourceSLot, Targetslot)

end

Function Locatenewrod (CheStidX)

INV = TP.Getallstacks (CheStidX)

For i = 1, inv.count (), 1 do

If (INV [i] ~ = nil and inv [i] .name ~ = nil and isfuelrod (inv [i]) then

Return i

End

End

end

Function Locatenewcoolant (CheStidX)

INV = TP.Getallstacks (CheStidX)

For i = 1, inv.count (), 1 do

If (INV [i] ~ = nil and inv [i] .name ~ = nil and isCoolantcell (inv [i]) and inv [i] .damage

End

End

end

-The battery cache has a lot of batteries, so the information of each battery needs to be obtained

Function getBatteryBufferinfo ()

If (battery ~ = nil) then

LOCAL TOTALEUSTORED = 0

LOCAL TOTALMAXEU = 0

For i = 1, 16, 1 do

BatteryCharge = Battery.getBatteryCharge (i)

MaxbatteryCharge = Battery.getmaxbatterycharge (i)

If (batterycharge ~ = nil) then

Totaleustored = Totaleustored+BatteryCharge

TotalMaxeu = TotalMaxeu+MaxbatteryCharge

End

End

Return Totaleustodo, TotalMaxeu

End Return -1, -1

end

Function Sleep ()

Local clock = os.clock

Local t0 = clock ()

While Clock () -t0 <= 0.05 Do

End

end

Function Clear ()

If (gpu ~ = nil) then

Local w, h = gpu.getResolution ()

Gpu.fill (1,1, w, h, "")

Gpu.setForeground (0xffffff)

Gpu.setbackGrior (0x000000)

End

end

Function InitialText ()

If (gpu ~ = nil) then

GPU.SET (1,1, "STATUS:")

GPU.SET (1,2, "Power Output: EU/T"))

GPU.SET (1,3, "Reactor Heat:")

GPU.SET (1,4, "max head:")

If (battery ~ = nil) then

GPU.SET (1,5, "Batterybuffer Eu input: EU/T") GPU.SET (1,6, "Batterybuffer Eu Output: EU/T"))))))))))))))))))))))))))))))))).

GPU.SET (1,7, "Total Eu Stored in Batterybuffer:")

GPU.SET (1,8, "Max Eu Capacity in Batterybuffer:"))

End

End

end

Function Display (Status)

If (gpu ~ = nil) then

GPU.SET (8,1, String.Format ("%25S", Status))

GPU.SET (14,2, string.format ("%8F", reactor.getReactoreuoutput ())

Gpu.set (14,3, string.format ("%5F", Reactor.getheat ()))

GPU.SET (10,4, String.Format ("%5F", Reactor.getmaxheat ())))))))))))))

If (battery ~ = nil) then

GPU.SET (25,5, string.Format ("%8F", Battery.GeteuinputAVERage ())

GPU.SET (26,6, String.Format ("%8F", Battery.GeteuoutputaVeaVERAGE ())) Totaleustored, TotalMaxeu = getBatterybufferinfo ()

GPU.SET (35,7, String.Format ("%16D", Totaleustored)

GPU.SET (35,8, String.Format ("%16D", TotalMaxeu)

End

End

end

Function main_loop ()

Clear ())

Initialtext ()

LOCAL LANENERGYSTORD = 0;

While (computer.nergy ()/computer.maxnergy ()> 0.5) do

Totaleustored, TotalMaxeu = getBatteryBufferinfo ()

If (reactor.getheat ()> 0 or (TotalMaxeu> 0 and Totaleustored == TotalMaxeu) then

Reactor.setActive (FALSE)-private goods, 2.4.0 GTNH does not exist in this interface, and the main line has been merged.

Elseif (TotalMaxeu <0 or (TotalMaxeu> 0 and Totaleustored/TotalMaxeu <0.05).

Reactor.setActive (true)

End

LOCAL Reactoridx = getReactorContaineridx () Local Chestidx = GetioChestidx ()

Local reactorInventory = TP.GetAllstacks (ReactoridX)

For i = 1, reactorInventory.Count (), 1 do

Local itemstack = reactorInventory [i]

IfMStack ~ = nil and itemstack.name ~ = nil) then

If (ISDEPLETEDRODRO (Itemstack)) then

Reactor.setActive (false)

TransferdepletedItem (Reactoridx, CheStidX, I)

NewRodidx = Locatenewrod (CheStidX)

While (newrodidx == nil) do

Display ("WAITING FOR New Fuel")

SLEEP () newRodidX = localnewrod (cheatidx)

End

Transfernewitem (ReactoridX, CheStidx, Newrodidx, I)

Reactor.setActive (true)

Elseif (iScoolantcell (itemstack) and isCoolantDepleted (itemstack) then

Reactor.setActive (false)

TransferdepletedItem (Reactoridx, CheStidX, I)

Newcoolidx = LocatenewCooland (CheStidX)

While (newcoolidx == null) do

Display ("Waiting for MeW Cooland") Sleep ()

Newcoolidx = LocatenewCooland (CheStidX)

End

Transfernewitem (ReactoridX, CheStidx, NewCoolidx, I)

Reactor.setActive (true)

End

End

End

Display ("running")

End

end

main_loop ()

reactor.setActive (false)

In addition to the reactor, you need to prepare:

1 big refrigerator

1 basic camera

Several basic display

1 T1 CPU

2 T1 memory bar

1 T1 hard disk

1 original box is used to store premium cooling units and fuels, as well as temporarily placed waste and replaced units

1 transferor is used to transfer materials between the boxes and fuel boxes and fuels of the storage of backup components and fuels

1 adapter is used to interact with reactor and battery box

1 GT battery box is used to store electricity (internal cache information will be displayed on the screen. In addition to according to the heat, the program will also be based on the power of the power station in the battery box.Code obtained by changing power)

Several Enderio items pipelines

Several high -end items filters (for filtering NBT)

Put a reactor, computer and refrigerator, connect to the adapter and transferor with a cable.Among them, the adapter needs to be in contact with the reactor and the battery box at the same time.If you need to use multiple adapters, you need to upgrade your computer's chassis, CPU, etc. Otherwise, you will report an error of a 'too many components'.The transferor is also in contact with the box and the reactor at the same time to transfer items between the two.Use Ender IO pipeline to connect to the box-refrigerator input bus, box-refrigerator output bus.

Among them, the input bus requires the NBT 黒 list, the blacklist contains a full -durable cooling unit. The durable fuel rods and its exhaustive versions are used, and then the box is enabled to the input bus, and the extraction function of the output bus to both ends of the box.

On the built -up computer, install the operating system with OpenOS floppy disk.

After entering the operating system, enter Edit Reactor.Lua in the /Home# prompt and open the editor.

Check the adhesion key of OpenComputers.

Copy the code of the tutorial and paste the paste button to the editor.

Press Ctrl + S and CTRL + W, saved and exit.

Enter ./reactor.lua execution

Start power generation!Note: It will start when the deposit is less than 5%.

Note:

There is no exit method for this script, unless the computer's energy is disconnected (note that the power supply of the GUI is not turned off! The consequences are very serious!), The program monitors the energy level lower than 50%, and will automatically exit and return to the shell.

It is strictly forbidden to do any operation directly to the strong cold piles during operation, including but not limited to some components of the computer, components in the dynamic reactor, and the box that moves that depository.The energy of the computer exits it.

Make sure computers, large refrigerators, nuclear power, battery boxes in the same block (common sense!)

Any deployment of a single machine to test and then the server, the power generation is irregular, and the two lines of tears explode.

This tutorial code uses one of my private goods, and the change has been merged to the main line of the GTNH OpenComputers, https://github.com/gtnewhorizons/opencomputers/pull/108.

GTNH 2.5.x is available.

After many BOOM iterative iterations, the single machine tested for one afternoon, and MOX 0%stacked the temperature and run 2 rounds. There was no problem.

Multiple piles:

This design can be promoted to a multi -reactor, and the multi -reactor version needs to be used with AE.

Due to the more number of components in multiple versions, in order to enhance the expansion capacity, the "server" is no longer used to use ordinary "computer".

The server recommended configuration is shown in the figure

Configuration to: T2 APU (provided 12 component positions) + 2x super component bus (each provided 16 component positions) + 1x T2 memory + basic hard disk + E2PROM (LUA BIOS), if the keyboard and display, and connectingThe adapter of the ME controller (controls the AE fuel rod through this adapter), the initial component is 9.

The server provides 44 component positions and 35 available. It uses a transferor according to each reactor, and a battery box is calculated (the adapter does not calculate the component, and the reactor itself is a component). In this way, the server can bring 11 reactors.

The server uses right -click to open the GUI configuration. After putting the component, it is stuffed into the rack.

By clicking the middle vertical line to connect it with the server's grid, you can output the signal of the server from a specific surface, so that you can connect the external component with a wire.

Code:

 Local Component = Require ("Component")

local os = Require ("OS")

LOCAL COROUTINE = Require ("Coroutine")

local gpu = component.gpu

local clock = os.clock

LOCAL RODOPTIONS = {"Gregtech: gt.quad_thoriumcell", "Gregtech: gt.quad_ mnqcell", "Gregtech: gt.Readoruraniumquad", "Gregtech: GT.ReaCTORMOXQUD "}

Local ChosenOption = 2

LOCAL CRAFTINGTASK = Nillocal Event = Require ("Event")

Function craft ()

if (craftingtask ~ = nil) then

Canceled, Reason = Craftingtask.iscanceled ()

if (not can cover and not craftingsk.isdone ()) then

Return

end

end

for, craftable in pairs (component.me_controller.getcraft ())

if (craftable.getItemstack (). name == Rodoptions [chosenOption]) then

craftingsk = craftable.request (15)

Return

end

end

end

Function Shouldcraft ()

LOCAL FILTER = {}

Filter ["name"] = Rodoptions [chosenOption]

local item = component.me_controller.getItemsinNetwork (Filter)

if (item [1] ~ = nil) then

Return item [1] .iscraftable and item [1] .size <15

else

Return false

end

end

Function loadReactorconfig ()

reactorsconfs = {}

local I = 1

reactorsconfs [i] = {}

For Line in IO.Lines ("ReactorConfig.txt") do

if (string.find (line, "=====") ~ = nil) then

i = i+1;

reactorsconfs [i] = {};

Elseif (string.find (line, "reactor:") ~ = nil) then

reactorsconfs [i] ["reactor"] = component.proxy (string.sub (line, 9));

Elseif (string.find (line, "buffer:") ~ = nil) then

reactorsconfs [i] ["buffer"] = Component.proxy (string.sub (line, 8));

Elseif (String.find (LINE, "Transposer:") ~ = Nil) then

LOCAL Transposer = Component.proxy (String.Sub (Line, 12)); Reactorsconfs [i] ["transposer"] = transposer;

local reactoridx = getReactorContaineridx (transposer)

reactorsconfs [i] ["reactoridx"] = reactoridx;

reactorsconfs [i] ["Meidx"] = Getmeinterfaceidx (Transposer)

local initialitems = {}

reactorsconfs [i] ["initialitems"] = InitialItems

for idx, item in pairs (transposer.getallstacks (reactoridx) .getall ())

If (item.name ~ = nil) then

IF (ISFULROD (it) or isdepletedrod (item)) then

initialitems [idx] = "f"

Elseif (iSCoolantcell (item)) then

initialitems [IDX] = "C"

else

initialitems [IDX] = "O"

end

else

initialitems [IDX] = "E"

end

end

end

end

Return reactorsconfs;

end

Function getReactorContaineridx (TP)

for i = 0,5,1 do

local container = tp.getinventoryName (i);

if (container == "blockgenrator" or container == "blockReactorchamber") then

Return i;

end

end

Return nil;

end

Function GetMeinterfaceidX (TP)

for i = 0,5,1 do

local container = tp.getinventoryName (i);

if (container == "tile.appliednergistics2.blockInterface") then

Return i;

end

end

Return nil;

end

Function IsemptYitem (itemstack)

Return itEMSTACK == nil or ittemstack.name == nil;

end

Function Iscoontcell (itemstack)

Return String.find (itemstack.name, 'coolnt') ~ = nil; end

Function Isfuelrod (Itemstack)

local name = itemstack.name;

Return Not (string.find (name, 'dep') ~ = nil or string.find (name,' dep') ~ = nil or string.find (name, 'deploy') ~ = nil) and (string.find(name, 'reactoruranium') ~ = nil or string.find (name, 'mox') ~ = nil or string.find (name, 'thoriumcell') ~ = nil or string.find (name, 'naq,' naq UADAHCELL ') ~ ~= Nil or string.find (name, 'mnqcell') ~ = nil);

end

Function IsdepleTedRod (itemstack)

local name = itemstack.name

Return String.find (name, 'thoriumcelldep') ~ = nil or string.find (name, 'deploy') ~ = nil or string.find (name, 'naquadahcelldep') ~ = = = = = = = = = = = = = = nil or string.find (name, 'Mnqcelldep ') ~ = nil;

end

Function isCoolanTDEPLETED (Itemstack)

Return itemstack.damage> = itemstack.maxdamage-10;

end

Function TransferdepletedItem (TP, Reactoridx, Meidx, SourceSLOT)

Return TP.TRANSFERITEM (Reactoridx, Meidx, 1, SourceSLot, 3)

end

Function TransferNewitem (TP, Reactoridx, Meidx, SourceSLOT, TargetsLot)

Return TP.TRANSFERITEM (Meidx, ReactoridX, 1, SourceSLot, Targetslot)

end

-The battery cache has a lot of batteries, so the information of each battery needs to be obtained

Function GetBatteryBufferinfo (Battery)

LOCAL TOTALEUSTORED = 0

LOCAL TOTALMAXEU = 0FOR I = 1, 16, 1 Do

local batteryCharge = Battery.getBatteryCharge (i)

LOCAL MAXBATTERYCHARGE = BATTERY.GetMaxBatterycharge (i)

if (batterycharge ~ = nil) then

Totaleustored = Totaleustored+BatteryCharge

TotalMaxeu = TotalMaxeu+MaxbatteryCharge

end

end

Return Totaleustodo, TotalMaxeu

end

Function CheckClock (LAST)

local T1 = Clock ()

Return T1-Last> = 1

end

Function Clear ()

if (gpu ~ = nil) then

local w, h = gpu.getResolution ()

gpu.fill (1,1, w, h, "")

gpu.setForeground (0xffffff)

gpu.setbackGrior (0x000000)

end

end

Function InitialText (ReactorConfigs)

For, Config in Pairs (ReactorConfigs) do

local re = config ["reactor"]

GPU.SET (1, I, String.Format ("Reactor%D: Stopped, Output: 0eu/T", i)

end

end

Function Display (ReactorConfigs)

For, Config in Pairs (ReactorConfigs) do

local re = config ["reactor"]

GPU.SET (1, I, String.Format ("Reactor%D:%S, Output:%Deu/T", I, Config ["STATUS"], Re.getReactoreuoutput ())

end

end

reactors = loadReactorconfig ()

running = true

Function main_loop ()

Clear ())

InitialText (Reactors)

lastTime = Clock ()

While (running) do

For IDX, ReactorConfig in Pairs (Reactors) do

LOCAL Reactor = ReactorConfig ["Reactor"] LOCAL TP = ReactorConfig ["Transposer"]

local buffer = reactorconfig ["buffer"]

Local ShouldsetActive = false;

LOCAL StoppedDuetofull = false;

local reactoridx = reactorconfig ["reactoridx"]

local meidx = reactorconfig ["Meidx"]

Local InitialItemmap = ReactorConfig ["Initialitems"]

local activity = reactor.getReactoreuoutput ()> 0

Totaleustored, TotalMaxeu = getBatteryBufferinfo (buffer)

if (reactor.getheat ()> 0) then

ShouldsetActive = False

Elseif (not activive and totaleustored/TotalMaxeu <0.05)

shouldsetActive = true;

elseif (Active and Totaleustored> = TotalMaxeu) then

stoppedDuetofull = true;

elseif (Active and Totaleustored

shouldsetActive = true;

end

if (not stoppedDuetofull) then

local reactorInventory = tp.getallstacks (reactoridx) .getall ()

for, Itemtype in Pairs (Initialitemmap) Do

local itemstack = reactorInventory [i]

if (itemtype == "e" or itemtype == "o") then

elseif (itemtype == "f") then

ISEMPTYITEM (itemstack) then

-Print (i)

Transfernewitem (TP, Reactoridx, Meidx, 2, I+1)-ME interface second grid fuel stick

Elseif (ISDEPLETEDROD (itemstack)) then

TransferdepletedItem (TP, Reactoridx, Meidx, I+1)-ME interface other arbitrarily entered the network of drying items. Here I+1 is tried. The use of i will actually change the component of the left side., ReactoridX, Meidx, 2, I+1) -This no longer check whether it is successful, unsuccessful only causes the power to decrease. The next check will be replaced. The fuel rod can only be placed in the second grid.Destructive consequences

end

else

if (iScoontDepleted (itemstack)) then

Reactor.setActive (false)

TransferdepletedItem (TP, Reactoridx, Meidx, I+1)

Local Transfercount = TransferNewItem (TP, Reactoridx, Meidx, 1, I+1) -The cooling unit put me interface first, and disbursement will cause devastating consequences

if (transfercount <0) then-If the new unit of the ME interface is not available, the reactor will not be set up to boot

shouldsetActive = false;

end

end

end

end

end

if (ShouldsetActive) then

reactorConfig ["STATUS"] = "Running"

else

reactorConfig ["Status"] = "Stopped"

end

Reactor.setActive (ShouldSetActive)

end

Clear ())

display (reactors)

if (shoppingcrft ()) then

craft ())

end

Coroutine.yield ()

end

end

Function Stopallonerr ()

Print (debug.traceback ())

For IDX, ReactorConfig in Pairs (Reactors) do

Print ("Stopping Reactor#" .. IDX)

reactorconfig ["reactor"]. SetActive (false)

end

end

Function C ()

xpcall (main_loop, Stopallonerr)

end

Co = Coroutine.create (C)

While (running) do

local evt = event.pull (0.001, "interrupt")

if (EVT ~ = nil) then

running = false

end

Coroutine.Resume (Co)

end

For IDX, ReactorConfig in Pairs (Reactors) do

Print ("Stopping Reactor#" .. IDX)

reactorconfig ["reactor"]. SetActive (false) end

Use the Edit command to create a new file Reactor.Lua and stick the above code to save.

Configuration file format:

Use Edit to create the following format file reactorconfig.txt in reactor.Lua

The reactor, the battery box (mainly for low -power start+full power shutdown control), the three components of the transferor are a group. When you need to drive a few heaps, write a few sets of UUID configurations. Each set of configuration is separated by 5 = number.

UUID acquisition is introduced later.

 reactor: reactor UUID

buffer: me interface component UUID

Transposer: UUID

====

reactor: reactor component UUID

buffer: me interface component UUID

Transposer: UUID

====

reactor: reactor component UUID

buffer: me interface component UUID

Transposer: UUID

....

Reactor configuration:

As shown in the figure, the transferor is also exposed to the reactor and ME interface at the same time, and the adapter also contacts the reactor and battery box at the same time.

The first grid cooling unit of the ME interface, the second grid fuel stick (the default uranium) can be modified to modify the value of the 7th line of Local ChosenOption = 2.3 is MOX.

Large refrigerators are as follows: Power supply can be used for EV's single refrigerator.

The ME output bus configuration of the refrigerator, inserts a fuzzy card filter in the upper right corner, so that only the loss of cooling units can enter. When the vague comparison is selected at 99%, the separation loss is used.Can).

The ME input bus does not need to be installed directly without special configuration.

Use "analyzer" to obtain component UUID,

Handheld analyzer, press the stealth+right -click component.

The chat box shows the battery box and the UUID of the adapter contact. In order to easily obtain it, you can copy it directly from the label's log, and then paste it to the editor of the computer in the game.

Adapter to the ME controller:

3 reactor summary:

After all the reactors are configured, input ./reactor.lua in the terminal to start the operation of the reactor.

Run effect:

The output of 33000EU/T per pile can meet a large amount of energy consumption in the IV period, and can continue to expand to more reactors.