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

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

Doors: Open and Lock

Open and close doors through Open, lock them with Lock, read the state back and close a door again after a fixed time.

Lesson 12 min Week 8

What you learn today

  • Open and lock doors
  • Read the state back
  • Close a door after a while

The storage door is open again. Somebody opened it and walked on, and now the warm air drifts into the cold corridor. A chip closes it reliably – and, if needed, does not let it open in the first place.

A door's LogicTypes

Composite door, glass door, interior doors and airlock door share the same important values:

LogicTypeMeaning
Open1 = open, 0 = closed. Read and write.
Lock1 = locked: it can no longer be operated by hand.
Power1 = the door has power
Idle1 while the door stands still, 0 while it moves
Modewhat a click on the door does: 0 opens and closes, 1 only sets Setting
sbn DOOR HASH("Lagertuer") Open 1    # open
sbn DOOR HASH("Lagertuer") Lock 1    # lock manual operation

Reading the state back

Somebody can also open a door by hand. So a good controller does not write blindly but first reads how the door stands right now:

lbn open DOOR HASH("Lagertuer") Open Average

Now the chip knows whether the door is open – whether it opened it itself or a fellow player did.

Closing after a while

No sleep: the chip should keep reading buttons in the meantime. A counter runs while the door is open and is reset as soon as it is closed:

select time open time 0      # door closed: counter to 0
add time time open           # door open: one more tick
sge tmp time TIME            # time up?
seqz tmp tmp
and open open tmp            # then close

With define TIME 10 the door stays open for five seconds.

Locking

Lock keeps players out – or in. A locked door cannot be opened by hand from either side. So only lock when real danger waits behind it, and release the door as soon as it is over.

Warning

If the device that decides about locking is missing, NaN must not end up in Lock. Decide beforehand what is safe: for a storage door “not locked” is the better choice, for an airlock to vacuum rather “locked”.

A click as a request: Mode 1

If a door is set to Mode 1 (Logic), a click does not open it. The click only sets Setting: 1 if it is currently closed, 0 if it is open. The chip reads that as a request and decides itself whether it writes Open – for example only once the pressure behind it is right. With Mode 0 (Operate) the click opens and closes as usual.

Tip

A door needs power to move. If it stays shut despite Open 1, check Power. With the crowbar it can only be forced when it has no power or is off (On 0) – and never while it is locked.

Exercise

Task

A storage door with automatics. On the network: composite door “Lagertuer”, button “Tueroeffner”, lever “Sperre”.

  • The button opens the door.
  • The door closes 5 seconds (define TIME 10 ticks) after it was opened – also when it was opened by hand.
  • Lever flipped: door closed and Lock = 1, the button has no effect. Otherwise Lock = 0.
  • If the lever is missing, it counts as not flipped.

Hints

Hint 1

Missing lever: snanz tmp lock, then select lock tmp lock 0.

Hint 2

Opening: button and not locked, or into open.

Hint 3

Counter as in the lesson, then apply the lock with seqz and and.

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