CFrobDoor

From The DarkMod Wiki
Revision as of 14:31, 22 June 2008 by Greebo (talk | contribs) (New page: == CFrobDoor == The corresponding entityDef is '''atdm:mover_door''' See also the Doors article for a tutorial approach. This is the most sophisticated BinaryFrobMover. A door extend...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

CFrobDoor

The corresponding entityDef is atdm:mover_door

See also the Doors article for a tutorial approach.

This is the most sophisticated BinaryFrobMover. A door extends the functionality by a lot of code to open/close visportals, controlling double doors, attaching handles, lockpicking and peer relationships to other doors.

Note: A door works closely together with the CFrobDoorHandle class, but it can function as well without a handle.

Spawnargs

  • auto_setup_door_handles (1/0) If set to 1 (which is the default), the door will automatically search for bound door handles and set them up.
  • auto_setup_double_door (1/0) If set to 1 (which is the default), the door will automatically search for double doors and add it as open_peer and lock_peer.
  • door_handle (entity name) Set to the entity name that is a handle for this door. (Note: this is not required if auto_setup_door_handles is set to true (in which case the handle just needs to be bound to the door).
  • door_handle_bind_flag (1/0) If set to "1", the entity specified in 'door_handle' will be bound to this door. Default is "1".
  • open_peer_N (entity name) Specifies the name of another door which should be opened and closed along with this one. Multiple spawnargs are allowed, as long as their prefix is 'open_peer'.
  • lock_peer_N (entity name) Specifies the name of another door which should be locked and unlocked along with this one. Multiple spawnargs are allowed, as long as their prefix is 'lock_peer'.
  • pickable (1/0) If set to 1, is pickable by the player.
  • used_by (list) Contains a list of entity names (of keys) that unlock/lock this door, separated by semicola ';'.
  • loss_open (float) Soundprop: Acoustical loss applied to sounds going thru the door when it is open (default 1 dB).
  • loss_closed (float) Soundprop: Acoustical loss applied to sounds going thru the door when it is completely closed (default 15 dB).
  • loss_double_open (float) Soundprop: Acoustical loss applied to sounds going thru a set of double doors when one is open and the other is closed (defaults to 1 dB).
  • lock_pins (string) Defines the number of pin patterns to be created for this lock.
  • lockpick_pin_ (???) (greebo: TODO)
  • lock_picktype (string) This is a sequence of characters defining the lockpick types which need to be used on this door. For instance, 'bs' means that the player must use the "bent" lockpick ('b') and the "snake" lockpick ('s') - in this order - to pick this lock.
  • lockpick_bar (entity name) The entity which should be used as lockpick bar. This is the moveable part which wiggles around when the player is picking the lock.
  • lockpick_bar_bind_flag (1/0) If set to '1', the entity specified in 'lockpick_bar' will be bound to this door. Default is '1'.
  • lockpick_rotate (angles) The full rotation angles the lockpick bar should rotate while picking. This is the full rotation, the rotation per lock pin is automatically calculated.
  • lockpick_translate (vector) The full translation the lockpick bar should move while picking. This is the full translation, the translation per lock pin is automatically calculated.
  • lockpick_lock_picked (soundshader) (greebo: TODO: Needs to be changed to use the snd_ prefix).
  • lockpick_pin_success (soundshader)(greebo: TODO: Needs to be changed to use the snd_ prefix).
  • lockpick_pin_fail (soundshader) (greebo: TODO: Needs to be changed to use the snd_ prefix).
  • lockpick_pick_wrong (soundshader) (greebo: TODO: Needs to be changed to use the snd_ prefix).
  • snd_wrong_key (sound shader) The sound to be played when the player is using the wrong key on this door.

Script Events

scriptEvent void OpenDoor(float Master);
The OpenDoor method is necessary to give the FrobDoorHandles a "low level" open routine. The CFrobDoor::Open() call is re-routed to the FrobDoorHandle::Tap() method, so there must be a way to actually let the door open. Which is what this method does.
Note: Shouldn't be called directly by scripters, call handle->Tap() instead. Unless you know what you're doing.
scriptEvent float IsPickable();
Returns true (nonzero) if this door is pickable.
scriptEvent entity GetDoorhandle();
Returns the handle entity of this door. Can return NULL (== $null_entity)

C++ Methods and Events

Most of the setup work is done in the virtual override of CBinaryFrobMover::PostSpawn(). The CFrobDoor::PostSpawn() override sets up the double doors, binds the doorhandles and sets up the lock_ and open_peers.