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

Day 253 of 365 · Pro · Month 9: Logistics and greenhouse

Hydroponics

Reading the hydroponics device: slots, Growth, Mature, Health and MaturityRatio, the −1 of an empty tray and recognising plants by hash.

Lesson 16 min Week 37

What you learn today

  • Trays and slots
  • Growth, Mature, Health
  • Recognise plants

The potatoes in the greenhouse are growing, but you only see whether they are ripe when you walk over. A chip can check that for you – if you built the right tray.

Two trays, only one talks

PartPrefabData port
Hydroponics trayStructureHydroponicsTraynone, it is a piece of pipe
Hydroponics deviceStructureHydroponicsTrayDatayes

Both need water through a liquid pipe and light. You can lay the plain tray in long rows, but no chip can look inside. The device has a data port, but you must not place two of them directly next to each other. For everything in these two weeks you need the device.

Two slots

Slot 0 is the plant, slot 1 the fertiliser. All values are read-only. You read them with ls through a pin or on the network with lbns:

Slot typemeanswithout a plant
Occupied1 if something is in the slot0
OccupantHashprefab hash of the plant0
Growthgrowth stage as a whole number−1
MaturityRatioprogress towards ripeness, 0 to 1−1
Mature1 ripe, 0 not yet−1
Healthhealth, 1 is undamaged−1
Efficiencyhow well it grows right now, roughly 0 to 1−1
define TRAY HASH("StructureHydroponicsTrayData") # hydroponics device
alias ripe r0
lbns ripe TRAY HASH("Beet") 0 Mature Average   # 1, 0 or -1
Warning

An empty tray returns −1 for Mature, Growth, Health and MaturityRatio, not 0. bnez ripe harvest therefore also jumps for an empty tray. Test for 1 explicitly: seq ripe ripe 1.

Growth stages

Growth counts the stages. According to the game data the potato grows in four stages of 1000 seconds each, stage 5 is ripe. MaturityRatio is the stage divided by the ripe stage – so the value jumps in steps of 0.2 and does not run smoothly. If the plant grows badly, each stage takes longer, but the value stays a stage.

Recognising plants

OccupantHash is the prefab hash of the plant: potatoes are ItemPotato, tomatoes ItemTomato, wheat ItemWheat. With a define and seq you know what is in the tray:

define POTATO HASH("ItemPotato") # potato plant
alias kind r1
lbns kind TRAY HASH("Beet") 0 OccupantHash Average
seq kind kind POTATO   # 1 = potato
Tip

Name every hydroponics device with the labeller, for example “Beet”. Then lbns reads exactly this tray, no matter how many others hang on the network.

Diagram

A locker with numbered slots Locker (d0) Slot 0 Iron ore Occ 1 Qty 5 Slot 1 Copper ore Occ 1 Qty 12 Slot 2 empty Occ 0 Qty 0 Slot 3 empty Occ 0 Qty 0 ls r0 d0 0 Occupied r0 = 1 ls r1 d0 1 Quantity r1 = 12 Slots count from 0. Values in a slot are called LogicSlotTypes.
Slot 0 holds the plant, slot 1 the fertiliser. A chip reads both through slot types.

Exercise

Task

The hydroponics device “Beet” is on the network. Write a chip that reads slot 0 every tick:

  • light “Reif” on when Mature is exactly 1
  • light “Kartoffel” on when a potato (ItemPotato) is in the tray
  • display “Wachstum” shows MaturityRatio in whole percent, −1 for an empty tray or a missing device

Hints

Hint 1

Three lbns on slot 0: Mature, MaturityRatio and OccupantHash.

Hint 2

seq ripe ripe 1 instead of snez – the empty tray returns −1.

Hint 3

For the display: combine snan and sltz with or, then select progress bad -1 progress.

Quiz

5 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