Component reference

Components & Machines

What each machine is, which calls work on it, and the mistake that costs you the run. Use the reference alongside the current component card and language help.

11 entries · checked 2026-09-29

Guide artwork of a code-driven planetary control room
Guide artwork — not an in-game screenshot.

Quick answer

Three rules cover almost every component question in Code: Terraform. Every piece of equipment has a name that get_component() takes verbatim; hardware actions stay on the machine running the script; and a machine does nothing until a script is attached to its own card. The rows below are the machines the recorded sessions actually show, with the calls that appeared on camera.

Before you script any machine

The syntax reference covers the language itself, the debugging reference covers the errors these machines throw, and the script library has the copyable versions of the patterns named below.

Every component the recordings cover

Choose a component type to narrow the reference.

Sensor

Thermometer

The first instrument the opening chain asks you to script.

Reads the planet temperature. The uplink task is three steps: connect the transmitter to Earth, read the thermometer, send the reading. The documentation entry the recording opened reads "value, current temperature" and points you at the thermometer and transmitter together.

  • get_component("thermometer")
  • thermo.get_value()

Watch out: Transmitting without connecting first sends nothing anywhere — connect("earth") is a separate call, and the key you transmit has to be a string like "current_temperature".

In-game docs, read on camera · recorded session

Companion guide →

Comms

Transmitter

Sends a key/value payload to whichever planet you connected to.

Connect picks the target planet, transmit ships the payload. Earth pays on delivery, and the same machine submits contract answers: for contracts the key is the contract ID, so a wrong key is a rejected contract rather than an error message.

  • get_component("transmitter")
  • transmitter.connect("earth")
  • transmitter.transmit("current_temperature", value)

Watch out: Set the connection in the same run as the transmit. A script that only transmits depends on a connection some earlier run left behind, which is why the starter pattern connects first every time.

In-game docs, read on camera · recorded session

Companion guide →

Sensor

Oxygen sensor

Pre-deployed beside your base and offline until you repair it.

One of the two sensors already on the map when the tutorial ends — the handoff text says "Pressure sensor and oxygen sensors are already deployed. Click repair on either card to bring it online with a calibration script." Repair means reading the raw value, converting it to the expected scale, then calibrating the sensor with the converted number.

  • get_component("oxygen sensor")
  • sensor.get_value()
  • sensor.calibrate(corrected)

Watch out: Hardcoding a value instead of reading the live one. The repair only takes when the calibrated number came from a real get_value() pass in the same run.

In-game docs, read on camera · published repair pattern

Companion guide →

Sensor

Pressure sensor

The other pre-deployed sensor, and the first task that needs a branch.

Reports a readable state — one recorded run showed it sitting at "stable", which is the state you check against. The repair is the demo's branching lesson: the value decides which of two paths you take, so it is the first place an if/else earns its keep. Even readings pass through; odd readings get bumped by one before stabilizing.

  • get_component("pressure sensor")
  • p_sensor.get_value()
  • p_sensor.stabilize(fixed)

Watch out: Indentation, and using = instead of == in the condition. The pressure repair is where "expected indent at start of block" and silent assignment bugs both show up.

In-game docs, read on camera · published repair pattern

Companion guide →

Power

Solar generator

Bought from the shop after your first successful uplink, then scripted to track the sun.

Power is what the sensors array needs before it can read the environment, and the shop task is explicit: "buy solar generator and battery. Open inventory. Deploy both." Once deployed you click manage on the solar generator card to give it a script. The tracking pattern reads elevation from the clock and tilts the panel.

  • self.set_tilt_degrees(90 - sun)
  • while True:

Watch out: Setting the tilt once and letting the script end — the panel then stops tracking. self is also the generator whose script you are editing, so the tilt call is machine-local.

In-game docs, read on camera · recorded session

Companion guide →

Power

Battery

Sold next to the solar generator, and deployed in the same step.

The shop instructions pair the two: buy the solar generator and the battery, open inventory, deploy both. The battery is part of bringing the power systems online before the sensor array can be activated.

  • No scriptable methods recorded yet

Watch out: Deploying the generator and skipping the battery. The tutorial step covers both machines, and the power-on narration follows the pair rather than the generator alone.

In-game docs, read on camera

Companion guide →

Sensor

Clock

Where the sun angle comes from.

A recorded session went looking for the sun angle and found it here: "I think it is the clock that has — get time, get day, get elevation." Solar tracking reads the elevation and turns it into a panel tilt, which is why the clock is the second component a power build touches.

  • get_component("clock")
  • clock.get_elevation()

Watch out: Building a day-length model by hand. The recording that reached full panel efficiency settled on the difference between elevation and a fixed angle.

Recorded session · published tracking pattern

Companion guide →

Biology

Bio collector

Does the same job as the manual collect button, with one cargo slot.

Scan returns candidate sites — one recorded run listed 16 of them, each with coordinates and a distance — and collecting fills the machine's single cargo slot with a specimen. It is the recommended first credit path after the uplink because it is a short script you can watch finish.

  • self.cargo
  • self.scan()
  • sites[0]
  • self.collect(target.coords)

Watch out: It has exactly one cargo slot. If it already holds a specimen the next step belongs to the biology lab, so the shape you want is "if cargo is not empty, wait" rather than scanning and collecting again.

In-game docs, read on camera · recorded session · published starter script

Companion guide →

Biology

Biology lab

The second half of the loop, and its own script.

Analyses the specimen the collector brought back, reads the recipe, loads the matching reagents and extracts the sample. The recipe arrives as a dictionary of reagent to quantity, which is why the biology loop is where dictionaries stop being abstract.

  • self.take_from(collector)
  • analyse / load / extract (self-only actions)

Watch out: Writing the lab's actions into the collector's script. Analyse, load and extract are machine-local, so the lab needs its own script slot and self has to be the lab when those lines run.

In-game docs, read on camera · recorded session

Companion guide →

Atmosphere

Pressure generator

An atmosphere machine the recordings mention but do not explain.

A single recorded session shows a pressure generator card and reads its action as compressing the atmosphere. There is no recorded script for it here yet and no guide on this site covers it, so treat this row as unconfirmed rather than as a pattern you can copy.

  • compress — unconfirmed action name, do not script from this entry

Watch out: Assuming it behaves like the sensor repairs. Nothing on camera yet shows its inputs, its outputs, or whether it needs its own script slot.

Unconfirmed — one fragment in a single recording

Patch tracker →

Unlock path

Shop, inventory and Manage

Not a machine — the three screens you need before any bought component can run code.

The tutorial hands off with 1,000 credits, the shop and the biology lab unlocked, and a written checklist: repair the pre-deployed sensors, then buy the solar generator and battery and deploy both from inventory. Every bought machine gets its script from the Manage button on its own card, which is why "I bought it but it does nothing" is a missing script slot rather than a bug.

  • shop (left sidebar) → inventory → deploy → Manage

Watch out: Buying a machine and expecting automation. A machine runs nothing until a script is attached to that specific card.

In-game docs, read on camera

Companion guide →

Check the current component card

Names and available methods depend on the component and game version. Open the machine card before copying a script, then use the debugging reference for failures and the patch notes for changed behavior.

Advertisement