CFrobDoor

From The DarkMod Wiki
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 CBinaryFrobMover. 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. (Bound handles contain a "bind" keypair indicating the door, e.g., "bind" "door1")
  • 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 to the peers list. The sub-spawnargs 'auto_setup_double_door_open_peer', 'auto_setup_double_door_lock_peer' and 'auto_setup_double_door_frob_peer' define which peer lists are affected.
    • auto_setup_double_door_open_peer (1/0) This is only active if 'auto_setup_double_door' == '1'. If this is set to 1, the double door auto-setup code will automatically add the double door as open_peer.
    • auto_setup_double_door_lock_peer (1/0) This is only active if 'auto_setup_double_door' == '1'. If this is set to 1, the double door auto-setup code will automatically add the double door as lock_peer.
    • auto_setup_double_door_frob_peer (1/0) This is only active if 'auto_setup_double_door' == '1'. If this is set to 1, the double door auto-setup code will automatically add the double door as frob_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'.
  • used_by_N (entity name) Contains an entity name (of keys) that can unlock/lock this door. Multiple used_by keys are possible by numbering them (like used_by_3).
  • 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).
  • snd_wrong_key (soundshader) 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 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.