Skip to content

Codex Reference Computercraft

CaptainGummiball edited this page Nov 10, 2026 · 1 revision

ComputerCraft

With CC: Tweaked installed, a computer next to a QNet machine or plant controller (or connected to it with a wired modem) can read it and, where the machine allows it, control it. Everything runs on the server thread, and every command is checked on the server: a wrong value never changes anything, it returns an error text instead.

Switch: features.integration.computercraft (default true). While it is off, every QNet function of machines and the Factory Controller answers with the error "QNet: the computer integration is switched off on this server".

Finding the peripheral

QNet adds functions to the blocks themselves, so they show up as peripheral types of their own:

Type Blocks Functions
qnet every QNet machine and plant controller reading, and commands on some power plants
qnet_factory the Factory Controller reading, plans and orders
qnet the controllers of the Rift structures reading only

peripheral.find("qnet") finds every machine and controller around the computer. Ports are not peripherals: connect the computer to the controller.

Reading every machine

  • getInfo(): every value and text of the machine's window as a table, keyed by the label of each line. It also holds type (the window) and, for plants, formed (true or false). Bars come with a second key ending in Max.
  • getReadings(): the named readings the machine has, for example energyStored, energyCapacity, progress and status.
  • getCommands(): the commands this machine takes (an empty list for most machines).

Single readings have their own functions: temperature(), powerOutput(), energyStored(), fuelLevel(), turbineRpm(), reactorFlux(), controlRodPosition(), plasmaTemperature(), stability(), alarmState(), coolantTemperature(), steamFlow(), netPower(), fusionRate(), tritiumBreedingRate(), reactorState(), windSpeed(), heatStored(), coilTemperature() and singularityMass(). A reading that a machine does not have raises the error "this machine has no reading '…'". With the advanced reactor model the fission reactor also offers reactivity(), xenon(), voidReactivity() and doublingTime().

Readings keep working on a machine that the server has switched off; commands do not ("this machine is switched off on this server").

Commands

Only these machines take commands. Numbers must lie inside the range of the machine; switches take true or false.

Machine Commands
Industrial Boiler setSetpoint(celsius) from 100 to 350 °C
Steam Turbine setFlow(mbPerTick), setGenerator(on), setOverspeedTrip(on)
Gas Turbine setFuelFlow(mbPerTick), setGenerator(on), setOverspeedTrip(on)
Gas Engine start(), shutdown(), setPowerSetpoint(ePerTick), setFollowDemand(on)
Fission Reactor setControlRodTarget(percent) from 0 to 100, scram(), reset(), setAutoScram(on), setAutoScramTemperature(celsius) from 300 to 1,200 °C
Tokamak start(), shutdown(), setInjectionTarget(mbPerTick), setAuxHeating(ePerTick), setAutoRestart(on)
Little Star start(), shutdown(), reset(), setFeed(mbPerTick), setControlRodTarget(percent) from 20 to 100, setAuto(on)
Micro Black Hole Plant start(), shutdown(), reset(), setFeed(perTick), setJet(share) from 0 to 1, setAuto(on), splitCapsule()
Hawking Reactor shutdown(), reset(), setPowerSetpoint(ePerTick)
Capacitor Bank setRedstoneMode(mode) with "always", "release_on_signal" or "block_on_signal"
Battery Hall setProtection(on)
SMES setCooling(on)
Molten-Salt Store setHeatOutput(huPerTick)
Electrolyzer setFuelCell(on)

Flows, feeds and power setpoints go from 0 up to what the formed plant can take; the error text names the exact range. Some commands are refused with a reason, for example a reset while the core is still too hot, automatic control without the diagnostics block it needs, or switching off a protection while the server runs in safe mode.

The Factory Controller

The qnet_factory functions:

  • getFactory(): the state of the controller.
  • getCraftables(): the item ids the linked machines can make.
  • getOrders(), getJobs(), getMachines(): the orders, the running jobs and the linked machines.
  • plan(item, amount): what an order would need and do, without ordering.
  • order(item, amount): makes the amount once; returns the order number.
  • setStockTarget(item, amount): keeps that amount in stock; returns the order number.
  • cancel(id): cancels an order.

Reading always works. order, setStockTarget and cancel only work while the button in the controller's window says "Computers may order: on"; otherwise they raise an error.

Rift structures

The controllers of the Rift structures offer getInfo() (structure, link, the state of the complex, energy, stability and the kind of world the rift is open to; never addresses), and, once linked to a complex, getJobs() and getBuffer(). Running the rift stays with the console.

Example

A boiler controller next to the computer:

  • local boiler = peripheral.find("qnet") finds it.
  • print(boiler.getInfo().type) prints the kind of window it has.
  • boiler.setSetpoint(250) sets its temperature setpoint to 250 °C.

QNet Codex

Getting Started

Energy

Processing

Rift

Storage

Logic

Reference

Items and Blocks

Clone this wiki locally