Repository navigation
Signals and Programmable Interface
The signal network lets your factory react to itself: chests report their contents, tanks their fill level, and you switch Grabbers, pumps, boilers, lamps and Train Stops on and off. Instead of Factorio's combinators you write small programs in a Programmable Interface. Both arrive in Epoch 3.
| Signal Cable | Programmable Interface | |
|---|---|---|
| Epoch | 3 | 3 |
| Unlocked by | Circuit Network | Programmable Interface |
| Size | – | 1 × 1 |
| Recipe | 1 Electronic Circuit + 5 Copper Cable | 5 Advanced Circuit + 5 Electronic Circuit + 5 Steel Plate |
- Hold the Signal Cable and Use a building, then Use a second one. A green wire connects them. The cable is a tool and is not used up.
- A wire reaches at most 10 blocks.
- Use the same building twice to remove all its wires.
- You can only wire buildings of your own team.
All buildings joined by wires form one signal network. Every network adds up the signals of its members each tick.
| Signal | Who reports it | Value |
|---|---|---|
an item, e.g. BF_Iron_Plate
|
chests and other storage | how many of that item it holds |
a fluid, e.g. Crude_Oil
|
Storage Tanks and every building with fluid tanks | units in its tanks |
power |
any building on a power grid | satisfaction of that grid in percent (100 = enough power); each wired building on a grid adds its own value, so wire only one of them if you want a plain percentage |
train |
Train Stop | 1 while a train is halted there, otherwise 0 |
unrest |
the whole world, once per network | current unrest × 100 (see Noise and Unrest) |
| your own names | Programmable Interfaces | whatever their program sets with out
|
Item signals use the item's internal ID (BF_ plus the name with underscores, for example BF_Coal or BF_Advanced_Circuit); the Items reference lists them. Fluid signals are Water, Steam, Crude_Oil, Heavy_Oil, Light_Oil, Petroleum_Gas, Lubricant and Sulfuric_Acid. Machines that burn fuel or craft do not report their slots, only their fluid tanks.
| Building | Listens to |
|---|---|
| Coal Grabber, Grabber T1 to T4, Long Grabber | grabber |
| Water Boiler | boiler |
| Water Pump, Oil Pumpjack | pump |
| Train Stop |
stop (trains do not head for a stop that is off) |
| Lamp | lamp |
| Nuclear Reactor, Heat Exchanger |
on only |
A wired building runs only while its signal is greater than 0. If its own signal is missing from the network, it listens to on instead, which switches everything at once. If neither signal exists, it runs as if it had no wire.
Use the interface to open its editor: a code field, a Save button, three example programs, and a live view of the network signals and the interface's outputs. Save checks the program and names the line of any error. The interface shows whether its program runs or has an error.
The program runs once per tick with the signals its network had in the last tick. Its outputs enter the network in the next tick.
One statement per line. Everything after # is a comment.
| Statement | Meaning |
|---|---|
name = expression |
set a variable |
out name = expression |
send signal name into the network |
if expression … elif expression … else … end
|
run lines only if the value is not 0; elif and else are optional, end is required |
Values are whole numbers. / drops the remainder, % gives it.
Reading: $name reads a network signal (0 if missing). A plain name reads a variable. Variables start at 0 and keep their value from tick to tick, until you save the program again or the server restarts.
Outputs are set fresh every run: an out that does not run in this tick sends nothing.
Operators, from strongest to weakest binding:
| Operators | Notes |
|---|---|
( ) |
grouping |
-x |
negative |
* / %
|
multiply, divide, remainder |
+ -
|
add, subtract |
== != < <= > >=
|
give 1 (true) or 0 (false); only one comparison per term, so write a < b and b < c
|
not |
1 if the value is 0, otherwise 0 |
and |
1 if both are not 0 |
or |
1 if one is not 0 |
Names start with a letter or _ and may contain letters, digits and _. They are case sensitive; the keywords if, elif, else, end, and, or, not and out are not. A program may have up to 200 lines and 1000 steps per tick. A runtime error (division by zero, too many steps) stops the program until you save it again.
Run the boilers only while the coal chest holds more than 20 Coal (one of the built-in examples):
# Boilers by coal in the chest
out boiler = $BF_Coal > 20
Keep an oil tank between 5,000 and 20,000 units. Wire the interface to the Storage Tank and the Oil Pumpjacks. The variable remembers whether the pumps are filling, so they do not flicker on and off at one threshold:
if $Crude_Oil < 5000
filling = 1
elif $Crude_Oil > 20000
filling = 0
end
out pump = filling
Open a station only when the iron chest next to it runs low. Wire the interface to the chest and the Train Stop; trains for that stop name then go elsewhere while it is closed:
# Station on demand
if $BF_Iron_Plate < 200
out stop = 1
else
out stop = 0
end
A counter that sends a one-tick pulse every 30 ticks (one second):
t = t + 1
if t >= 30
t = 0
out pulse = 1
end
BlockFactory is in active development; values on these pages may change. Found a mistake? Report it · Want BlockFactory in your language? Translate it
Getting Started
Basics
- Controls and Building
- Gathering by Hand
- Crafting
- Field Manual
- The World
- The Bunker
- Status Icons and Warnings
Progression
- Epochs
- Research
- Knowledge Scrolls
- Outlander Test Site
- Research Capsules
- Portal of the Ancient
- Great Portal
Factory
- Belts
- Grabbers
- Storage
- Mining
- Smelting
- Fabricators
- Power
- Fluids
- Oil Processing
- Railways
- Signals and Programmable Interface
- Rune Modules
- Nuclear Power
- Floors and Landfill
- Hunting and Farming
Creatures
Danger
Multiplayer
Reference
Story
- Lore (spoilers)
Project