Prop interactions: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Blixibon moved page Physgun interactions to Prop interactions: Merged with fire interactions, this name can apply to both.)
Line 28: Line 28:


== Physgun interactions ==
== 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.
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>explode_fire</code>, can be triggered by forces not related to the gravity gun.


===Options===
===Options===
Line 42: Line 42:
:: Non-functional interaction believed to have originally been a physics prop version of the below interaction of the same name.
:: 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 by the gravity gun.''
:; <code>break</code>
:; <code>break</code>
:: Breaks on colliding with anything after being launched.
:: Breaks on colliding with anything after being launched. {{tip|Use this with explosive props that should break after the player launches them.}}
:; <code>paintsplat</code>
:; <code>paintsplat</code>
:: 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.}}
:: 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.}}
Line 77: Line 77:
:; onpickup boogie
:; onpickup boogie
:: ''Ragdolls only.'' Begins ragdoll boogie when released, providing visible electricity effects and causing the ragdoll to flail rapidly.
:: ''Ragdolls only.'' Begins ragdoll boogie when released, providing visible electricity effects and causing the ragdoll to flail rapidly.


== Fire interactions ==
== Fire interactions ==

Revision as of 17:37, 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 explode_fire, 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 by the gravity gun.
break
Breaks on colliding with anything after being launched.
Tip.pngTip:Use this with explosive props that should break after the player launches them.
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