Prop interactions: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Accounted for ragdolls, added lose_energy, made other minor edits)
(Overhaul that makes things less confusing, including a merge with fire_interactions under a new page name.)
Line 1: Line 1:
The '''physgun_interactions''' [[KeyValues]] block affects how a prop or ragdoll is handled by and responds to the [[weapon_physcannon|Gravity Gun]]. It is embedded in a model with the [[$keyvalues]] QC command.
'''Prop interactions''', also known as '''[[prop_data|propdata]] interactions''', are a group of independent [[KeyValues]] blocks that control how props handle interaction from outside forces, like being launched by the gravity gun, and how they should employ fire, like igniting after taking enough damage. They are embedded in a model with the [[$keyvalues]] QC command. They are defined in <code>props_shared.h</code> and <code>props_shared.cpp</code>.


== Example ==
{{warning|Having more than one subkey of the same name (e.g "'''onfirstimpact''' break" and "'''onfirstimpact''' paintsplat") may or may not cause all keyvalues forthwith to stop working. This requires more research.}}


* {{todo|Did any of this change between engine versions?}}
===Example===
  [[$keyvalues]]
  [[$keyvalues]]
  {
  {
Line 9: Line 14:
  preferred_carryangles "0 0 0"
  preferred_carryangles "0 0 0"
  onworldimpact stick
  onworldimpact stick
onfirstimpact break
  onfirstimpact paintsplat
  onfirstimpact paintsplat
  onlaunch spin_zaxis
  onlaunch spin_zaxis
  onbreak explode_fire
  onbreak explode_fire
  damage none
}
fire_interactions
{
  ignite      halfhealth
explosive_resist  yes
  flammable          yes
  }
  }
  }
  }


==Options==
 
== Physgun interactions ==
The '''physgun_interactions''' [[KeyValues]] block affects how a prop or ragdoll is handled by and responds to the [[weapon_physcannon|Gravity Gun]]. Despite the name, some interactions, like <code>create_flare</code>, can be triggered by forces not related to the gravity gun.
 
===Options===


;<code>preferred_carryangles <[[angles]]></code>
;<code>preferred_carryangles <[[angles]]></code>
Line 23: Line 36:
:This is used with the sawblades and propellers in [[Ravenholm]], as well as the turret NPCs in [[Nova Prospekt]].
:This is used with the sawblades and propellers in [[Ravenholm]], as well as the turret NPCs in [[Nova Prospekt]].
; <code>onworldimpact <choices></code>
; <code>onworldimpact <choices></code>
: ''When hitting something after being thrown by the gravity gun...'' (entities too, not just the world)
: ''When we hit the [[world]] after being thrown by the gravity gun.''
:; <code>stick</code>
:; <code>stick</code>
:: Cling to / embed in the surface.
:: Sticks to what we hit if we're traveling fast enough. {{note|Using the gravity gun to pick up a prop with this interaction automatically turns the prop into debris.}}
:; <code>bloodsplat</code>
:; <code>bloodsplat</code>
:: Create a blood [[decal]] {{todo|Is this onfirstimpact and/or exclusive to ragdolls?}}
:: Non-functional interaction believed to have originally been a physics prop version of the below interaction of the same name.
;<code>onfirstimpact <choices></code>
;<code>onfirstimpact <choices></code>
: ''When we first hit something after being thrown...''
: ''When we first hit something after being thrown.''
:; <code>break</code>
:; <code>break</code>
:: Break on colliding with anything after being launched.
:: Breaks on colliding with anything after being launched.
:; <code>paintsplat</code>
:; <code>paintsplat</code>
:: Applies paint decals to the first thing it hits after being launched.
:: Applies paint decals to the first thing we hit after being launched. {{note|They come in 3 colors (Red, Green, Blue) by default, but each prop should stick to one color.}}
:; <code>impale</code>
:; <code>impale</code>
:: Impales whatever it first collides with after being launched.
:: Sometimes impales the first NPC we hit and sticks it to the wall. {{warning|This interaction actually applies to any collisions after the first, so it occasionally runs several times per impact, which sometimes spawns too many ragdolls and/or crashes the game. This also has the stick interaction built-in, causing the prop to disappear sometimes due to the aforementioned collision rules.}}
:; <code>lose_energy</code>
:; <code>lose_energy</code>
:: Apparently non-functional. {{todo|Verify}}
:: Apparently non-functional. (Can be found in <code>sawblade001a</code>.)
:; <code>bloodsplat</code>
:: ''Ragdolls only.'' Creates a blood [[decal]] on the first thing we hit.
:; <code>alienbloodsplat</code>
:: ''Ragdolls only.'' Identical to <code>bloodsplat</code>, but uses alien blood instead.
;<code>onlaunch <choices></code>
;<code>onlaunch <choices></code>
: ''When flung by the gravity gun...''
: ''When we are flung by the gravity gun.''
:; Default
:; Default
:: Physgun applies random angular velocity to the prop as it launches.
:: Physgun applies random angular velocity to the prop as it launches.
Line 45: Line 62:
:: Prop does not spin when launched.
:: Prop does not spin when launched.
:; <code>spin_zaxis</code>
:; <code>spin_zaxis</code>
:: Prop should spin around the Z axis when launched by the physcannon. (e.g. Ravenholm propellers.)
:: Prop should spin around the Z axis when launched by the physcannon. (e.g. Ravenholm propellers.) {{note|This automatically adds slash damage to the prop, allowing it to slice zombies.}}
; <code>onbreak <choices></code>
; <code>onbreak <choices></code>
: ''When breaking because of being flung...''
: ''When we are broken after being flung by the gravity gun.''
:;explode_fire
:;explode_fire
:: Ignite nearby enemies (that are flammable)
:: Explodes in a fireball and ignites nearby enemies (that are flammable) {{tip|Use this in conjuction with ''fire_interactions'' to allow the prop to ignite before exploding and use [[prop_data]] to control explosive properties.}}
; <code>damage none</code>
; <code>damage none</code>
: Prop does not move when 'attacked' with the physgun. It may still take damage, but it won't move due to the impact.
: Prop does not deal impact damage, meaning it cannot deal any damage directly from hitting anything else. The prop can still deal damage with other interactions.
; <code>allow_overhead yes</code>
; <code>allow_overhead yes</code>
: Physgun can carry prop directly above wielder. {{note|Some entities don't need this to allow the prop to be carried overhead. See <code>CGrabController::IsObjectAllowedOverhead()</code>.}}
: Allows the gravity gun to carry the prop directly above the wielder. {{note|Some entities don't need this to allow the prop to be carried overhead. See <code>CGrabController::IsObjectAllowedOverhead()</code>.}}
; <code>onpickup <choices></code>
; <code>onpickup <choices></code>
: ''When picked up by the gravity gun...''
: ''When picked up by the gravity gun...''
:; onpickup create_flare
:; onpickup create_flare
:: Emit a flare from the "fuse" attachment when picked up by the gravity gun. {{note|<code>HL2_EPISODIC</code> DLLs only; see <code>CBreakableProp::OnPhysGunPickup()</code>.}}
:: Emit a flare from the "fuse" attachment when picked up by ''any means''. {{note|<code>HL2_EPISODIC</code> DLLs only; see <code>CBreakableProp::OnPhysGunPickup()</code>.}}
:; onpickup boogie
:; onpickup boogie
:: ''Ragdolls only.'' Begins ragdoll boogie, providing random  electrical effects to the ragdoll.
:: ''Ragdolls only.'' Begins ragdoll boogie when released, providing visible electricity effects and causing the ragdoll to flail rapidly.
 
 
== Fire interactions ==
 
The '''fire_interactions''' [[KeyValues]] block defines flammability. It is not required to make NPCs flammable.
 
* {{todo|confirm whether unbreakable (health 0) models can be flammable.}}
 
 
 
===Options===
 
;<code>flammable yes</code>
:Allows the prop to be ignited by fire and explosions.
;<code>ignite halfhealth</code>
:Causes the prop to ignite spontaneously upon reaching 50% health.
;<code>explosive_resist yes</code>
:Causes the prop to ignite instead of breaking when it is damaged by an explosion.
 
 


== See Also ==
== See Also ==

Revision as of 16:45, 30 June 2017

Prop interactions, also known as propdata interactions, are a group of independent KeyValues blocks that control how props handle interaction from outside forces, like being launched by the gravity gun, and how they should employ fire, like igniting after taking enough damage. They are embedded in a model with the $keyvalues QC command. They are defined in props_shared.h and props_shared.cpp.

Warning.pngWarning:Having more than one subkey of the same name (e.g "onfirstimpact break" and "onfirstimpact paintsplat") may or may not cause all keyvalues forthwith to stop working. This requires more research.
  • Todo: Did any of this change between engine versions?


Example

$keyvalues
{
	physgun_interactions
	{
	 	preferred_carryangles 	"0 0 0"
	 	onworldimpact 		stick
	 	onfirstimpact 		paintsplat
	 	onlaunch 		spin_zaxis
	 	onbreak 		explode_fire
	}
	fire_interactions
	{
	 	ignite      halfhealth
	 	explosive_resist   yes
 	 	flammable          yes
	}
}


Physgun interactions

The physgun_interactions KeyValues block affects how a prop or ragdoll is handled by and responds to the Gravity Gun. Despite the name, some interactions, like create_flare, can be triggered by forces not related to the gravity gun.

Options

preferred_carryangles <angles>
Sets the angles, relative to the player's orientation, at which the prop will be held when carried.
This is used with the sawblades and propellers in Ravenholm, as well as the turret NPCs in Nova Prospekt.
onworldimpact <choices>
When we hit the world after being thrown by the gravity gun.
stick
Sticks to what we hit if we're traveling fast enough.
Note.pngNote:Using the gravity gun to pick up a prop with this interaction automatically turns the prop into debris.
bloodsplat
Non-functional interaction believed to have originally been a physics prop version of the below interaction of the same name.
onfirstimpact <choices>
When we first hit something after being thrown.
break
Breaks on colliding with anything after being launched.
paintsplat
Applies paint decals to the first thing we hit after being launched.
Note.pngNote:They come in 3 colors (Red, Green, Blue) by default, but each prop should stick to one color.
impale
Sometimes impales the first NPC we hit and sticks it to the wall.
Warning.pngWarning:This interaction actually applies to any collisions after the first, so it occasionally runs several times per impact, which sometimes spawns too many ragdolls and/or crashes the game. This also has the stick interaction built-in, causing the prop to disappear sometimes due to the aforementioned collision rules.
lose_energy
Apparently non-functional. (Can be found in sawblade001a.)
bloodsplat
Ragdolls only. Creates a blood decal on the first thing we hit.
alienbloodsplat
Ragdolls only. Identical to bloodsplat, but uses alien blood instead.
onlaunch <choices>
When we are flung by the gravity gun.
Default
Physgun applies random angular velocity to the prop as it launches.
spin_none
Prop does not spin when launched.
spin_zaxis
Prop should spin around the Z axis when launched by the physcannon. (e.g. Ravenholm propellers.)
Note.pngNote:This automatically adds slash damage to the prop, allowing it to slice zombies.
onbreak <choices>
When we are broken after being flung by the gravity gun.
explode_fire
Explodes in a fireball and ignites nearby enemies (that are flammable)
Tip.pngTip:Use this in conjuction with fire_interactions to allow the prop to ignite before exploding and use prop_data to control explosive properties.
damage none
Prop does not deal impact damage, meaning it cannot deal any damage directly from hitting anything else. The prop can still deal damage with other interactions.
allow_overhead yes
Allows the gravity gun to carry the prop directly above the wielder.
Note.pngNote:Some entities don't need this to allow the prop to be carried overhead. See CGrabController::IsObjectAllowedOverhead().
onpickup <choices>
When picked up by the gravity gun...
onpickup create_flare
Emit a flare from the "fuse" attachment when picked up by any means.
Note.pngNote:HL2_EPISODIC DLLs only; see CBreakableProp::OnPhysGunPickup().
onpickup boogie
Ragdolls only. Begins ragdoll boogie when released, providing visible electricity effects and causing the ragdoll to flail rapidly.


Fire interactions

The fire_interactions KeyValues block defines flammability. It is not required to make NPCs flammable.

  • Todo: confirm whether unbreakable (health 0) models can be flammable.


Options

flammable yes
Allows the prop to be ignited by fire and explosions.
ignite halfhealth
Causes the prop to ignite spontaneously upon reaching 50% health.
explosive_resist yes
Causes the prop to ignite instead of breaking when it is damaged by an explosion.


See Also