stationeers.de Mod workshop · Dominik1199
DE Sign in
  1. Home
  2. IC10 academy
  3. Day 33

Day 33 of 365 · Beginner · Month 2: Order and data network

Finding prefabs

Where prefab names come from, which typos the game itself makes and how to store the hash cleanly as a define.

Lesson 10 min Week 5

What you learn today

  • Find prefab names in the prefab search
  • Know the game's typos
  • Store the hash as a define

In the game the thing is called “Lever” – and in code StructureLogicSwitch. Guessing prefab names often goes wrong. And a wrong name gives no error message: HASH("StructureLever") is a valid number, there is just no device that belongs to it.

Display name and prefab name

StationpediaPrefab
LeverStructureLogicSwitch
SwitchStructureLogicSwitch2
ButtonStructureLogicButton
LED Display (Small)StructureConsoleLED5
Station BatteryStructureBattery
Gas SensorStructureGasSensor

You find the names in the prefab search of the IC10 coder: type the English or German name, read off prefab and hash.

The game's typos

Some prefabs are misspelt in the game itself. You have to copy them exactly like that:

DevicePrefab
Pipe AnalyzerStructurePipeAnalysizer
Heat exchanger gas to gasStructureHeatExchangerGastoGas
Wall (Geometry Straight)StructureWallGeometryStreight

Upper and lower case count as well: HASH("structuregassensor") is an entirely different number.

Looking it up in the game

Every device with logic reports its own hash in the LogicType PrefabHash. Attach an unknown device to a pin and the housing shows you the number:

l r0 d0 PrefabHash
s db Setting r0      # hash of the device on d0

You compare the number with the prefab search – or store it directly as a define.

Storing the hash as a define

Two notations, same result:

define SENSOR HASH("StructureGasSensor")   # Gas Sensor
define SENSOR2 -1252983604                 # Gas Sensor

The chip computes HASH("…") on load, you never need to know the number. For the character limit, though, the written long form counts: the number is shorter, the name more readable. In the workshop style either one is used – the name inside HASH or the number – always with the English device name in the comment.

Warning

A typo in the prefab name goes unnoticed. lbn with Average then returns NaN, sbn writes into no device. So check new defines once with the prefab search.

Tip

Never a raw hash number in the body. Whoever reads -1252983604 in the middle of the code has no idea what is meant. With a define the name sits next to it.

Diagram

Devices on the data network with type and name IC housing IC10 StructureGasSensor „Lager“ StructureGasSensor „Werkstatt“ StructureWallHeater „Lagerheizung“ StructureWallHeater „Lagerheizung“ StructureWallHeater „Werkstattheizung“ lbn SENSOR HASH("Lager") reads only this sensor sbn HEATER HASH("Lagerheizung") switches both at once
lbn and sbn select devices by type hash and name. If the prefab name is wrong, the chip finds not a single device.

Exercise

Task

This tank display shows nothing: all three prefab names were guessed wrong. The network holds a Pipe Analyzer “Tank”, a Lever “Freigabe” and an LED Display (Small) “Tankdruck”.

Fix the three defines. The display then shows the tank pressure while the lever is flipped, otherwise 0.

Hints

Hint 1

The prefab search of the IC10 coder finds all three by their English name.

Hint 2

The Pipe Analyzer has a typo in the game – “Analysizer”.

Hint 3

Lever is StructureLogicSwitch, the small LED display StructureConsoleLED5.

Quiz

4 questions. You pass from 60 % – the server does the grading.

Complete the day

  • Passed the simulator exercise
  • Passed the quiz with at least 60 %

Without an account progress is saved in this browser only.

Report a mistake in this lesson

Please sign in to report. Sign in

Esc
↑ ↓ selectEnter open/ opens search anywhere