Filename: DCK_AirLock.zip
Date    : 2001-05-24
Author  : Decker
E-mail  : decker@post1.tele.dk
Homepage: http://home1.inet.tele.dk/decker/
Files   : .map - Raw mapfile readable by all editors
          .qrk - Usable for QuArK map-editor only
QuArK   : http://www.planetquake.com/quark


How the AirLock works
---------------------

Each door is controlled by multisource and env_global entities.

To open the (I)nner closed airlock-door, the player first activates the trigger_multiple. This tells the multisource to try to close the (O)uter func_door, if the global-state is in its ON position.

  trigger_multiple(I) -> multisource(I) --'if ON'--> func_door(O) 'closing'
                          ^
                          |
                         global-state(I)

When the (O)uter func_door has closed, it will fire a multi_manager for the (I)nner door, which in turn will fire four entities; at 0.0 seconds the env_global for the (I)nner door will toggle its position, at 0.1 seconds the func_water will rise, then we wait to 12 seconds for the water before opening the (I)nner func_door, and at 15 seconds we toggle the env_global for the (O)uter door.

  func_door(O) 'closed' -> multi_manager(I) ---0.0-> env_global(I) 'toggle to OFF'
                                             \-0.1-> func_water 'rising'
                                             \-12--> func_door(I) 'opening'
                                             \-15--> env_global(O) 'toggle to ON'

If the player now tries to activate the (I)nner trigger_multiple, which fires the (I)nner multisource, the multisource won't fire the door, since the global-state is in the OFF position.

Here's how it will work to open the (O)uter closed airlock-door

  trigger_multiple(O) -> multisource(O) --'if ON'--> func_door(I) 'closing'
                          ^
                          |
                         global-state(O)

  func_door(I) 'closed' -> multi_manager(O) ---0.0-> env_global(O) 'toggle to OFF'
                                             \-0.1-> func_water 'draining'
                                             \-12--> func_door(O) 'opening'
                                             \-15--> env_global(I) 'toggle to ON'

Note
----

You might want to syncronize the wait-times in the multi_managers, if you change the opening/closing speeds of the doors and the rising/draining water. Otherwise it will look strange that the door opens before the water have drained.

Also, if you want more than just one trigger that activates the multisource, you should put a trigger_relay in between, as else the multisource requires all who targets it, to be active:

  trigger_multiple(x) --'OR'-> trigger_relay(x) -> multisource(x)
  func_button(x)      -/
