* // begin locking automatic doors se->nw

#Door_NW = #Position.X,#Position.Y
* // note: is also RoomTriggerEnter position
#Door_SE = #Position.X,#Position.Y
* // note: is also RoomFurrePosition
#HallFurrePosition = #Position.X,#Position.Y
#RoomTriggerExit = #Position.X,#Position.Y

#LockTrigger = #Position.X,#Position.Y
#LockPosition = #Position.X,#Position.Y
#LockedIndicator = #ObjectType
#UnLockedIndicator = #ObjectType

#Nothing = #ObjectType
#OpenedDoorType = #ObjectType
#LockedDoorType = #ObjectType
#UnLockedDoorType = #ObjectType

* // toggle the lock, only if door is closed
* // we test this real simply by checking the hall door.

(0:7) When somebody moves into position (#LockTrigger),
(1:1014) and position (#Door_NW) is not object type #Nothing,
  (3:2) at position (#LockPosition) on the map,
    (5:6) swap object types #UnLockedIndicator and #LockedIndicator.

* // unlock the doors

(0:7) When somebody moves into position (#LockTrigger),
(1:54) and 2 step(s) NE & 1 step(s) NW from the triggering furre is object #UnLockedIndicator,
  (3:2) at position (#Door_SE) on the map,
    (5:5) change object type #LockedDoorType to type #UnLockedDoorType.
  (3:2) at position (#Door_NW) on the map,
    (5:5) change object type #LockedDoorType to type #UnLockedDoorType.

* // lock the doors

(0:7) When somebody moves into position (#LockTrigger),
(1:54) and 2 step(s) NE & 1 step(s) NW from the triggering furre is object #LockedIndicator,
  (3:2) at position (#Door_SE) on the map,
    (5:5) change object type #UnLockedDoorType to type #LockedDoorType.
  (3:2) at position (#Door_NW) on the map,
    (5:5) change object type #UnLockedDoorType to type #LockedDoorType.

* // if door is locked and trying to get out, unlock the door if needed,
* // then switch to opened door state

(0:7) When somebody moves into position (#Door_SE),
(1:16) and the triggering furre is facing northwest (up and left),
  (3:2) at position (#LockPosition) on the map,
    (5:5) change object type #LockedIndicator to type #UnLockedIndicator.
  (3:2) at position (#Door_SE) on the map,
    (5:5) change object type #LockedDoorType to type #OpenedDoorType.
    (5:5) change object type #UnLockedDoorType to type #OpenedDoorType.
  (3:2) at position (#Door_NW) on the map,
    (5:5) change object type #LockedDoorType to type #Nothing.
    (5:5) change object type #UnLockedDoorType to type #Nothing.

* // when inside the room, bump the furre back if they walk into the open door,
* // then close the door.

(0:1) Whenever somebody moves,
(1:19) and they (moved from/are standing at) position (#Door_SE),
(1:13) and the triggering furre is facing northeast (up and right),
(1:1013) and position (#Door_SE) is object type #OpenedDoorType,
    (5:18) move the triggering furre back where they came from.
  (3:2) at position (#Door_SE) on the map,
    (5:5) change object type #OpenedDoorType to type #UnLockedDoorType.
  (3:2) at position (#Door_NW) on the map,
    (5:5) change object type #Nothing to type #UnLockedDoorType.

* // open the door only if a furre appoaches the door straight on,
* // prevents doors from popping open as furres pass them

(0:7) When somebody moves into position (#HallFurrePosition),
(1:14) and the triggering furre is facing southeast (down and right),
(1:1101) and there's no furre at (#Door_SE),
(1:1013) and position (#LockPosition) is object type #UnLockedIndicator,
  (3:2) at position (#Door_SE) on the map,
    (5:5) change object type #UnLockedDoorType to type #OpenedDoorType.
  (3:2) at position (#Door_NW) on the map,
    (5:5) change object type #UnLockedDoorType to type #Nothing.

* // only if the is door open, allow a furre to exit the room.
* // note that the design of this code, prevents a furre from leaving
* // if the space outside in the hall is occupied,
* // but will attempt to clear the hallway square of any furres.

(0:7) When somebody moves into position (#RoomTriggerExit),
(1:1013) and position (#Door_SE) is object type #OpenedDoorType,
    (5:14) move the triggering furre to (#HallFurrePosition) if there's nobody already there.

(0:7) When somebody moves into position (#RoomTriggerExit),
(1:1013) and position (#Door_SE) is object type #OpenedDoorType,
(1:1100) and there's a furre at (#Door_SE),
  (3:2) at position (#HallFurrePosition) on the map,
    (5:83) move any furre present 1 step(s) northwest (up and left) if there's nobody already there.
    (5:80) move any furre present 1 step(s) northeast (up and right) if there's nobody already there.
    (5:82) move any furre present 1 step(s) southwest (down and left) if there's nobody already there.

* // otherwise open the door
* // if door is locked, unlock and open

(0:7) When somebody moves into position (#RoomTriggerExit),
(1:16) and the triggering furre is facing northwest (up and left),
  (3:2) at position (#LockPosition) on the map,
    (5:5) change object type #LockedIndicator to type #UnLockedIndicator.
  (3:2) at position (#Door_SE) on the map,
    (5:5) change object type #LockedDoorType to type #UnLockedDoorType.
    (5:5) change object type #UnLockedDoorType to type #OpenedDoorType.
  (3:2) at position (#Door_NW) on the map,
    (5:5) change object type #LockedDoorType to type #UnLockedDoorType.
    (5:5) change object type #UnLockedDoorType to type #Nothing.

* // enter the room if door is unlocked,
* // can always enter without throwing door open first.
* // again, code design is to prevent a furre from entering
* // if the space just inside the door occupied,
* // code attempts to clear space.

(0:7) When somebody moves into position (#Door_NW),
(1:1013) and position (#LockPosition) is object type #UnLockedIndicator,
    (5:14) move the triggering furre to (#Door_SE) if there's nobody already there.
  (3:2) at position (#Door_NW) on the map,
    (5:5) change object type #UnLockedDoorType to type #Nothing.
  (3:2) at position (#Door_SE) on the map,
    (5:5) change object type #UnLockedDoorType to type #OpenedDoorType.

(0:7) When somebody moves into position (#Door_NW),
(1:1013) and position (#LockPosition) is object type #UnLockedIndicator,
(1:1100) and there's a furre at (#HallFurrePosition),
  (3:2) at position (#Door_SE) on the map,
    (5:81) move any furre present 1 step(s) southeast (down and right) if there's nobody already there.
    (5:82) move any furre present 1 step(s) southwest (down and left) if there's nobody already there.

* // here for completeness, not possible in the test dream for this door,
* // but this closes the inside door if run into from the opposite side.

(0:7) When somebody moves into position (#Door_SE),
(1:15) and the triggering furre is facing southwest (down and left),
(1:5) and they successfully moved,
  (3:2) at position (#Door_SE) on the map,
    (5:5) change object type #OpenedDoorType to type #UnLockedDoorType.
  (3:2) at position (#Door_NW) on the map,
    (5:5) change object type #Nothing to type #UnLockedDoorType.

* // close the door, furre leaves the target area on inside,
* // not going through the door, not running into door.

(0:1) Whenever somebody moves,
(1:19) and they (moved from/are standing at) position (#Door_SE),
(1:113) and the triggering furre is not facing northeast (up and right),
(1:116) and the triggering furre is not facing northwest (up and left),
(1:1101) and there's no furre at (#HallFurrePosition),
  (3:2) at position (#Door_SE) on the map,
    (5:5) change object type #OpenedDoorType to type #UnLockedDoorType.
  (3:2) at position (#Door_NW) on the map,
    (5:5) change object type #Nothing to type #UnLockedDoorType.

* // close the door, when the furre leaves the target area out in the hallway.
* // note that neither section will trigger if another furre steps
* // into the trigger square on the other side of the door.

(0:1) Whenever somebody moves,
(1:19) and they (moved from/are standing at) position (#HallFurrePosition),
(1:114) and the triggering furre is not facing southeast (down and right),
(1:1101) and there's no furre at (#Door_SE),
  (3:2) at position (#Door_SE) on the map,
    (5:5) change object type #OpenedDoorType to type #UnLockedDoorType.
  (3:2) at position (#Door_NW) on the map,
    (5:5) change object type #Nothing to type #UnLockedDoorType.

* // end locking automatic doors


Generated by DragonSpeak Editor, Jun. 21 2004, 22:49