Func bomb target: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(That's cool! Just that they're !FGD... Added picture because yes.)
(Moved notes from Creating a Bomb Defusal Map here and added back-button to that page. Added FGD code to fix missing EnableDisable, missing Bomb[...] inputs and value type of bomb_mount_target.)
Line 1: Line 1:
{{lang|Func bomb target}}
{{lang|Func bomb target}}
[[File:Func_bomb_target_de_dust2_css.jpg|thumb|right|500px|The use of func_bomb_target on ''de_dust2'' in CS:S.]]
[[File:Func_bomb_target_de_dust2_css.jpg|thumb|right|500px|The use of func_bomb_target on ''de_dust2'' in CS:S.]]
{{back|Creating a Bomb Defusal Map}}
<br>
{{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}}


{{Note | The <code>StartDisabled</code> keyvalue and the <code>Enable/Disable</code> inputs are {{not in FGD}} and can be used!}}
{{Note | This entity is part of [[S_PreserveEnts]]. <code>Kill</code>ing this entity removes it for all subsequent rounds! Use the <code>Enable/Disable</code> inputs instead.}}
{{Note | This entity is part of [[S_PreserveEnts]]. <code>Kill</code>ing this entity removes it for all subsequent rounds! Use the <code>Enable/Disable</code> inputs instead.}}
{{Note | The <code>Heist Mode bomb Target</code> keyvalue (<code>heistbomb</code>) is an unused value and should be ignored.}}
{{Note | The <code>StartDisabled</code> keyvalue and the <code>Enable/Disable</code> inputs are {{not in FGD}} and can be used! See [[#FGD Code|below]] for a fix.}}


{{code class|CBombTarget|func_bomb_target.cpp}}
{{code class|CBombTarget|func_bomb_target.cpp}}
Line 15: Line 18:
* [[Player]]s must touch the volume of any [[func_bomb_target]] in order to plant a [[weapon_c4|C4 entity]].
* [[Player]]s must touch the volume of any [[func_bomb_target]] in order to plant a [[weapon_c4|C4 entity]].
* {{csgo}} 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.
* {{csgo}} 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.
* 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>''' in response to this specific C4 entity.
** {{Bug | The '''<code>BombDefused</code>''' output is '''NOT''' fired when a bomb is defused.}}
** {{Bug | The '''<code>BombDefused</code>''' output is '''NOT''' fired when a bomb is defused.}}
** {{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.
** {{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.


* The radar will automatically label a [[func_bomb_target]] as either '''A''' or '''B''', depending on which one was created first. If there are more than two of these entities, only two of them will be labelled with '''A''' and '''B'''.
=== Bombsite A and B ===
The bombsites are assigned '''A''' and '''B''' in the order in which their brush(es) were tied to an entity (!).
The order in which their classname is changed to [[func_bomb_target]] does not affect the labelling!
If there are more than two of these entities, only two of them will be labelled with '''A''' and '''B'''.
 
To swap '''A''' and '''B''', you can
* move the corresponding brushes of the [[func_bomb_target]]s manually.
* move both [[func_bomb_target]]s to the world by selecting them and pressing {{Key|Crtl}}+{{Key|Shift}}+{{Key|W}}. Then, tie the brush(es) for '''A''' to an entity using {{Key|Ctrl}}+{{Key|T}} and after that, do the same for '''B'''. Finally, change the entity classnames.


==Keyvalues==
==Keyvalues==
{{KV|Heist Mode bomb Target (heistbomb)|bool|Tells the bomb target that it's designed for the Heist game mode.}}
{{KV|Heist Mode bomb Target|bool|intn=heistbomb|Tells the bomb target that it's designed for the Heist game mode.}}
{{KV|Bomb Mount Target|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 {{ent|info_target}}.}}
{{KV|Bomb Mount Target|targetname|intn=bomb_mount_target|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 {{ent|info_target}}. {{Bug | In [[Hammer]], this value's type is a string by default. See [[#FGD Code|below]] for a fix.}} }}
{{KV BaseTrigger}}
{{KV BaseTrigger}}
{{KV BaseEntity}}
{{KV BaseEntity}}


==Inputs==
==Inputs==
{{IO|BombExplode|nofgd=1|Pretend the bomb exploded; fires the <code>BombExplode</code> output.}}
{{IO|BombExplode|nofgd=1|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|Fires the <code>BombDefused</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.}}
{{IO|BombPlanted|nofgd=1|Fires the <code>BombPlanted</code> output and removes this entity's volume from the planting zones until next round.}}
{{I BaseTrigger|notf2=1}}
{{I BaseTrigger|notf2=1}}
{{I BaseEntity}}
{{I BaseEntity}}
Line 40: Line 50:
{{O BaseTrigger}}
{{O BaseTrigger}}
{{O BaseEntity}}
{{O BaseEntity}}
==[[FGD]] Code==
This code
* adds the <code>EnableDisable</code> base class to inherit the keyvalue <code>StartDisabled</code> and the inputs <code>Enable/Disable</code>.
* adds the inputs <code>BombExplode/BombDefused/BombPlanted</code> with the above description.
* corrects the type of <code>bomb_mount_target</code> from <code>string</code> to <code>target_destination</code>.
Replace the corresponding lines of {{ent|cstrike.fgd}} or {{ent|csgo.fgd}} with this.
<source>
@SolidClass base(Targetname, Parentname, EnableDisable ) = func_bomb_target: 
"Bomb Target. The terrorists can place C4 explosives while standing in this zone.\n\n" +
"When the bomb is planted and explodes inside this area, the BombExplode outputs are fired. The game handles " +
"all of the bomb planting and scoring logic – the BombExplode outputs are provided to add visual and damage effects."
[
input BombExplode(void): "Fires the BombExplode output"
input BombPlanted(void): "Fires the BombPlanted output and removes this entity's volume from the planting zones until next round"
input BombDefused(void): "Fires the BombDefused output"
output BombExplode(void): "Fires when C4 explodes"
output BombPlanted(void): "Fires when a C4 is planted"
output BombDefused(void): "Fires when a C4 is defused"
heistbomb(boolean) : "Heist Mode bomb target" : 0 : "This is a Bomb Target designed for the Heist game mode."
bomb_mount_target(target_destination) : "Bomb Mount Target"
]
</source>

Revision as of 18:07, 27 August 2021

English (en)Translate (Translate)
The use of func_bomb_target on de_dust2 in CS:S.
Creating a Bomb Defusal Map


Template:Base brush multi

Note.pngNote: This entity is part of S_PreserveEnts. Killing this entity removes it for all subsequent rounds! Use the Enable/Disable inputs instead.
Note.pngNote: The Heist Mode bomb Target keyvalue (heistbomb) is an unused value and should be ignored.
Note.pngNote: The StartDisabled keyvalue and the Enable/Disable inputs are !FGD and can be used! See below for a fix.
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.
  • Counter-Strike: Global Offensive 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 in response to this specific C4 entity.

Bombsite A and B

The bombsites are assigned A and B in the order in which their brush(es) were tied to an entity (!). The order in which their classname is changed to func_bomb_target does not affect the labelling! If there are more than two of these entities, only two of them will be labelled with A and B.

To swap A and B, you can

  • move the corresponding brushes of the func_bomb_targets manually.
  • move both func_bomb_targets to the world by selecting them and pressing Crtl+ Shift+W. Then, tie the brush(es) for A to an entity using Ctrl+T and after that, do the same for B. Finally, change the entity classnames.

Keyvalues

Heist Mode bomb Target (heistbomb) <boolean>
Tells the bomb target that it's designed for the Heist game mode.
Bomb Mount Target (bomb_mount_target) <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.
Icon-Bug.pngBug: In Hammer, this value's type is a string by default. See below for a fix.  [todo tested in ?]
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
Fires the BombExplode output.
BombDefused  !FGD
Fires the BombDefused output.
BombPlanted  !FGD
Fires the BombPlanted output and removes this entity's volume from the planting zones until next round.
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: 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.


FGD Code

This code

  • adds the EnableDisable base class to inherit the keyvalue StartDisabled and the inputs Enable/Disable.
  • adds the inputs BombExplode/BombDefused/BombPlanted with the above description.
  • corrects the type of bomb_mount_target from string to target_destination.

Replace the corresponding lines of cstrike.fgd or csgo.fgd with this.

@SolidClass base(Targetname, Parentname, EnableDisable ) = func_bomb_target:  
	"Bomb Target. The terrorists can place C4 explosives while standing in this zone.\n\n" +
	"When the bomb is planted and explodes inside this area, the BombExplode outputs are fired. The game handles " +
	"all of the bomb planting and scoring logic – the BombExplode outputs are provided to add visual and damage effects."
[
	input BombExplode(void): "Fires the BombExplode output"
	input BombPlanted(void): "Fires the BombPlanted output and removes this entity's volume from the planting zones until next round"
	input BombDefused(void): "Fires the BombDefused output"

	output BombExplode(void): "Fires when C4 explodes"
	output BombPlanted(void): "Fires when a C4 is planted"
	output BombDefused(void): "Fires when a C4 is defused"

	heistbomb(boolean) : "Heist Mode bomb target" : 0 : "This is a Bomb Target designed for the Heist game mode."

	bomb_mount_target(target_destination) : "Bomb Mount Target" 
]