Prop interactions

From Valve Developer Community
Revision as of 22:38, 30 June 2017 by Blixibon (talk | contribs) (Changed example and made some other adjustments)
Jump to navigation Jump to search

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. Most are defined in props_shared.h and props_shared.cpp.

Warning.pngWarning:Having more than one key 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.


Example

$keyvalues
{
	physgun_interactions
	{
	 	preferred_carryangles 	"-90 0 0"
	 	onworldimpact 		stick
	 	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 comes into play with any collision regardless if it is first or not, 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 we are picked up by the gravity gun or sometimes +USE.
onpickup create_flare
Emit a flare from the "fuse" attachment when picked up.
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