CFrobDoor: Difference between revisions
From The DarkMod Wiki
Jump to navigationJump to search
Line 44: | Line 44: | ||
: 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. | : 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. | : Note: Shouldn't be called directly by scripters, call handle->Tap() instead. Unless you know what you're doing. | ||
; scriptEvent entity GetDoorhandle(); | ; scriptEvent entity GetDoorhandle(); | ||
: Returns the handle entity of this door. Can return NULL (== $null_entity) | : Returns the handle entity of this door. Can return NULL (== $null_entity) |
Revision as of 09:55, 25 March 2009
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'.
- pickable (1/0) If set to 1, is pickable by the player.
- 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).
- 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. It's also possible to define a star "*", which matches all lockpick types.
- lock_pins (string) Defines the number of samples per pin to be created for this lock, example: "56" will create two patterns, one with 5 samples, the other with 6 samples. The minimum is 5.
- snd_lockpick_pin_NN (soundshader) Defines the sample sound for the pin with NN being in the range 00..14. The number must have a leading zero in it (e.g. '02').
- snd_lockpick_pin_sweetspot (soundshader) Defines the sweet spot sound to be inserted into a pattern.
- snd_lockpick_lock_picked (soundshader) Is played when the entire lock is successfully picked.
- snd_lockpick_pin_success (soundshader) Is played when a single pin is successfully picked.
- snd_lockpick_pin_fail (soundshader) Is played when the player fails to pick a pin.
- snd_lockpick_pick_wrong (soundshader) Is played when the user either attempts to use the wrong lockpick type or the door is not locked or already picked.
- 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.