Notes on the elevator logic

16 October 2009

Here's how it should work:

- If the player tries to activate the elevator, the flaps fall away, but the elevator does not rise.
- The player goes down to the lower area and moves a lever which opens the air vent. 
  - If the player had already made the flaps fall away, the elevator had left without them.
  - Else, the player can now ride the elevator to the top.
- When the player is at the top and hits the lever, the elevator returns to the bottom, and the flaps rise up.
- If the player is at the bottom of the shaft without the elevator, they can close the air vent, and the elevator will drift down.

SDL variables needed:

VAR BOOL AirVentOpen[1] DEFAULT=0    # 0 = closed, 1 = open
VAR BOOL FlapsDown[1] DEFAULT=0      # 0 = up, 1 = down
VAR BOOL ElevatorAtTop[1] DEFAULT=0  # 0 = at bottom, 1 = at top

A floor lever will need to be added to the air shaft vent.  And the
air vent needs an animation.  

When this lever is pulled, it will trigger a one shot animation.  When
that finishes, it will trigger a python mod to toggle the
state of AirVentOpen using xAgeSDLBoolToggle.  [I'm not sure how to do
this.]

A fall back is that there's no one-shot animation, nor an animation of
the lever.  Instead, just clicking on it will trigger the SDL toggle python mod.

The lever will also have a variant of xAgeSDLBoolRespond.  Here's
what it will do:
- If AirVentOpen is true, trigger the open vent animation responder
  - If FlapsDown is true and ElevatorAtTop is false, set ElevatorAtTop
  to true
- If AirVentOpen is false, trigger the close vent animation responder
  - If ElevatorAtTop is true, set ElevatorAtTop to false

Give the air vent two responders: one for open and one for close

Elevator_control will change so that it will trigger a python script:
- If ElevatorAtTop is false
  - set FlapsDOwn to true
  - if AirVentOpen is true, set ElevatorAtTop to true
- If ElevatorAtTop is true
  - set ElevatorAtTop to false

This will also have a variant of xAgeSDLBoolRespond:
- If ElevatorAtTop
...


Hold on.  The xAgeSDLBoolRespond should only trigger the animation
responders.  Some other Python script needs to do the SDL variable
manipulation based on conditions.

Note that responders cannot set SDL variables.  If there needs to be
one performed at the end of an animation, it would have to be done
through a timer that is set to the length of the animation.

19 October 2009

Lever will trigger the following python script:

- If AirVentOpen is currently false
  - set AirVentOpen to true
  - if FlapsDown is true and ElevatorAtTop is false
    - set a timer of duration = air vent open animation duration, with
    the callback setting ElevatorAtTop to false
- If AirVentOpen is currently true
  - set AirVentOpen to false
  - if ElevatorAtTop is true
    - set a timer of duration = air vent close animation duration,
    with the callback setting ElevatorAtTop to false
    - set a timer of duration = elevator lowering animation duration,
    with the callback setting FlapsDown to false

Lever will also contain an xAgeSDLBoolRespond for AirVentOpen that
triggers an animation responder for opening and closing the air vent.
These responders will be in the Lever's logic section, and they will
reference each of the 6 air vent flap objects.

Elevator_control will trigger the following python script:

- If ElevatorAtTop is currently false
  - set FlapsDown to true
  - if AirVentOpen is true
    - set a timer of duration = flaps down animation duration, with
    the callback setting ElevatorAtTop to true
- If ElevatorAtTop is true
  - set ElevatorAtTop to false
  - set a timer of duration = elevator lowering animation duration,
  with the callback setting FlapsDown to false

Elevator_control will also contain an xAgeSDLBoolRespond for
ElevatorAtTop that triggers an animation responder for raising and
lowering the elevator.  It will contain another xAgeSDLBoolRespond for
FlapsDown that triggers the appropriate animation responder.  These
responders will be in the Elevator_control's logic section.

There currently is a floor lever, which is part of the
'throttle_control' object.  It will need to be separated from the
object and made an actor in order to be clickable.

The 'throttle' object currently has no animation.  This should be
replaced with something resembling a camera iris.

Iris center: (9,3,-56.66)
