Func bomb target: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Tried out creating more than two of these entities.)
(BombDefused is not working correctly?)
Line 2: Line 2:
{{base brush multi|func_bomb_target|game1=Counter-Strike: Source|game2=Counter-Strike: Global Offensive}}
{{base brush multi|func_bomb_target|game1=Counter-Strike: Source|game2=Counter-Strike: Global Offensive}}


It marks where [[weapon_c4|C4 entities]] can be planted. [[Player]]s holding the bomb must touch the volume of any <code>func_bomb_target</code> to plant.
{{code class|CBombTarget|func_bomb_target.cpp}}
 
==Entity Description==
 
The existence of this entity makes a map a [[Creating a Bomb Defusal Map|bomb defusal scenario]].
It marks where [[weapon_c4|C4 entities]] can be planted.
 
* [[Player]]s must touch the volume of any [[func_bomb_target]] in order to plant a [[weapon_c4|C4 entity]].
* As soon as a C4 entity is planted inside this entity's volume or as soon as it receives the input '''<code>BombPlanted</code>''', this entity will no longer allow players to plant a C4 entity inside it.
* If a C4 entity is planted inside this entity's volume, this entity fires the outputs '''<code>BombPlanted</code>''', '''<code>BombDefused</code>''' and/or '''<code>BombExplode</code>''' for this specific C4 entity.
** {{csgo}} When planting outside any [[func_bomb_target]] with {{ent|mp_plant_c4_anywhere|1}}, there is still a [[func_bomb_target]] entity chosen that does the above, even if all existing [[func_bomb_target]]s are already consumed.
** {{Bug | {{csgo}} The '''<code>BombDefused</code>''' output is '''NOT''' fired when a bomb is defused. {{Todo|What about {{css}}?}}}}


The radar will automatically label a <code>func_bomb_target</code> as either '''A''' or '''B''', depending on which one was created first.
* The radar will automatically label a <code>func_bomb_target</code> as either '''A''' or '''B''', depending on which one was created first.
In {{csgo}}, if there are more than two of these entities, only two of them will be labelled with '''A''' and '''B''' (often the second and third entity).
** {{csgo}} If there are more than two of these entities, only two of them will be labelled with '''A''' and '''B''' (often the second and third entity).


{{code class|CBombTarget|func_bomb_target.cpp}}
 
{{Note | This entity is part of [[S_PreserveEnts]]. Instead of <code>kill</code>ing it, one can also fire the '''<code>BombPlanted</code>''' input to "disable" it for a round.}}


==Keyvalues==
==Keyvalues==
Line 18: Line 30:
{{IO|BombExplode|nofgd=1|Pretend the bomb exploded; fires the <code>BombExplode</code> output.}}
{{IO|BombExplode|nofgd=1|Pretend the bomb exploded; fires the <code>BombExplode</code> output.}}
{{IO|BombDefused|nofgd=1|Pretend the bomb was defused; fires the <code>BombDefused</code> output.}}
{{IO|BombDefused|nofgd=1|Pretend the bomb was defused; fires the <code>BombDefused</code> output.}}
{{IO|BombPlanted|nofgd=1|Pretend the bomb was planted; fires the <code>BombPlanted</code> output.}}
{{IO|BombPlanted|nofgd=1|Pretend the bomb was planted; fires the <code>BombPlanted</code> output and removes this entity's volume from the planting zones.}}
{{I BaseTrigger|notf2=1}}
{{I BaseTrigger|notf2=1}}
{{I BaseEntity}}
{{I BaseEntity}}
Line 24: Line 36:
==Outputs==
==Outputs==
{{IO|BombExplode|Fires when the bomb explodes.}}
{{IO|BombExplode|Fires when the bomb explodes.}}
{{IO|BombDefused|Fires when the bomb is defused.}}
{{IO|BombDefused|Fires when the bomb is defused. {{Bug | {{csgo}} Is not fired by normal gameplay, only with the '''<code>BombDefused</code>''' input.}} }}
{{IO|BombPlanted|Fires when the bomb is planted.}}
{{IO|BombPlanted|Fires when the bomb is planted.}}
{{O BaseTrigger}}
{{O BaseTrigger}}
{{O BaseEntity}}
{{O BaseEntity}}

Revision as of 10:51, 1 August 2021

English (en)Translate (Translate)

Template:Base brush multi

C++ In code, it is represented by theCBombTargetclass, defined in thefunc_bomb_target.cppfile.

Entity Description

The existence of this entity makes a map a bomb defusal scenario. It marks where C4 entities can be planted.

  • Players must touch the volume of any func_bomb_target in order to plant a C4 entity.
  • As soon as a C4 entity is planted inside this entity's volume or as soon as it receives the input BombPlanted, this entity will no longer allow players to plant a C4 entity inside it.
  • If a C4 entity is planted inside this entity's volume, this entity fires the outputs BombPlanted, BombDefused and/or BombExplode for this specific C4 entity.
  • The radar will automatically label a func_bomb_target as either A or B, depending on which one was created first.
    • Counter-Strike: Global Offensive If there are more than two of these entities, only two of them will be labelled with A and B (often the second and third entity).


Note.pngNote: This entity is part of S_PreserveEnts. Instead of killing it, one can also fire the BombPlanted input to "disable" it for a round.

Keyvalues

Heist Mode bomb Target (heistbomb) ([todo internal name (i)]) <boolean>
Tells the bomb target that it's designed for the Heist game mode.
Bomb Mount Target ([todo internal name (i)]) <targetname>
Optionally, have the bomb be forced to a specific position and orientation after being planted. The position and angles are determined by the ones of a specified info_target.
BaseTrigger
Filter Name (filtername) <filter>
A filter entity to test potential activators against.
Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).


Inputs

BombExplode  !FGD
Pretend the bomb exploded; fires the BombExplode output.
BombDefused  !FGD
Pretend the bomb was defused; fires the BombDefused output.
BombPlanted  !FGD
Pretend the bomb was planted; fires the BombPlanted output and removes this entity's volume from the planting zones.
BaseTrigger
Toggle
Toggles this trigger between enabled and disabled states.
Enable
Enable trigger
Disable
Disable trigger
TouchTest  (in all games since Source 2007)
Triggers either the OnTouching or OnNotTouching outputs for whether anything is touching this entity.
Icon-Bug.pngBug:Sleeping prop_physics will never fire "OnTouching". Also applies to entities using prop_physics as base.  (tested in: Half-Life 2)
StartTouch  (in all games since Source 2007) !FGD
Behave as if the !caller entity had just entered the trigger volume. Accepts non-physical entities.
EndTouch  (in all games since Source 2007) !FGD
Behave as if !caller had just exited the trigger volume.
DisableAndEndTouch  (only in Source 2013 MultiplayerTeam Fortress 2 branch)
Disables this trigger and calls EndTouch on all currently-touching entities.


Outputs

BombExplode
Fires when the bomb explodes.
BombDefused
Fires when the bomb is defused.
Icon-Bug.pngBug: Counter-Strike: Global Offensive Is not fired by normal gameplay, only with the BombDefused input.  [todo tested in ?]
BombPlanted
Fires when the bomb is planted.
BaseTrigger
OnStartTouch
!activator = entity that caused this output
!caller = this entity
Fired when a valid entity starts touching this trigger.
OnStartTouchAll
!activator = entity that caused this output
!caller = this entity
Fired when a valid entity starts touching this trigger, and no other entities are touching it. If there are any other entities touching the trigger when a new one begins to touch, only OnStartTouch will fire.
OnEndTouch
!activator = entity that caused this output
!caller = this entity
Fired when a valid entity stops touching this trigger.
Note.pngNote:Will also fire for entities touching it when trigger is disabled via Disable input
Warning.pngWarning:This includes entities which are deleted while inside the trigger. In this case !activator will be invalid.
Warning.pngWarning:OnEndTouch can fire before OnStartTouch under certain circumstances[How?] where both are fired on the same tick and each have the same delay.
Note.pngFix:Add a slight delay to OnEndTouch.
OnEndTouchAll
!activator = entity that caused this output
!caller = this entity
Fired when all valid entities stop touching this trigger.
OnTouching  (in all games since Source 2007)
!activator = !caller = this entity
Fired if something is currently touching this trigger when TouchTest is fired.
OnNotTouching  (in all games since Source 2007)
!activator = !caller = this entity
Fired if nothing is currently touching this trigger when TouchTest is fired.