What you learn today
- Mining modules
- Cargo bay
- Return when full
Out in the asteroid belt your rocket is drilling while you lay cables in the base. Sooner or later the hold is full or the drill head is blunt. Then it should come home – without you walking to the launch pad for it.
The devices
| Device | Prefab | important values |
|---|---|---|
| rocket miner | StructureRocketMiner | On, DrillCondition, slot 0 output, slot 1 drill head |
| cargo storage | StructureCargoStorageSmall (52 slots) or …Medium (102 slots) | Quantity |
| avionics | StructureRocketAvionics | CurrentCode, DestinationCode, MinedQuantity, TotalQuantity |
According to the game the rocket miner gathers the resources at the rocket's current location. DrillCondition is the condition of the drill head from 0 to 1 – a worn head no longer drills. The avionics additionally knows how much there is to get at the destination in total (TotalQuantity) and how much has already been mined there (MinedQuantity).
When is it over?
Two reasons end the work: the cargo storage reaches your limit, or the drill head drops below its wear limit. How many pieces count as “full” depends on what you mine and how big the stacks are – that is why VOLL is a define you adapt to your rocket.
Returning
On the launch pad a chip remembers the home address in a Logic Memory:
lbn address AVIONIK HASH("Avionik") CurrentCode Average
sbn SPEICHER HASH("Heimat") Setting address # on the launch pad: remember home
Out there it sets the destination to this address exactly once when the hold is full:
lbn address SPEICHER HASH("Heimat") Setting Average
sbn AVIONIK HASH("Avionik") DestinationCode address # course for home
“Exactly once” matters: a chip that writes a destination every tick also overwrites every change you make to the avionics yourself.
A missing cargo storage or miner returns NaN. Then the chip does not know whether the hold is full – it stops drilling and reports the return. Better one trip too early than a rocket that keeps working with a broken drill head.
Exercise
Task
Build the mining control. The miner “Bohrer” works while the cargo storage “Laderaum” is below 400 pieces and the drill head is above 10 %. Otherwise: miner off, flashing light “Heimflug” on and set DestinationCode of the avionics “Avionik” once to the address from the Logic Memory “Heimat”. The display “Ladung” shows the count. If miner or cargo storage is missing: miner off, return on, display -1.
Hints
Hint 1
Return: sge for the full hold, sle for the drill head, combined with or.
Hint 2
Whether both devices are present shows in the sum: add tmp cond cargo is NaN as soon as one is missing.
Hint 3
For “exactly once” a register sent: only write when home = 1 and sent = 0, then set it to 1.
Quiz
3 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