This article's documentation is for anything that uses the Source engine. Click here for more information.

item_sodacan

From Valve Developer Community
Jump to navigation Jump to search
Info.png
This entity is not in the FGD by default.
See below for instructions on making it available.
Class hierarchy
CItemSoda
CBaseAnimating
CBaseEntity
effects.cpp

item_sodacan is a point entity available in all Source Source games except Strata Source Strata Source. It's a soda can that falls out of env_beverage, healing 1 hit point when touched.

Note.pngNote:This uses 🖿models/can.mdl by default.
In most games except Half-Life: Source Half-Life: Source, Half-Life Deathmatch: Source Half-Life Deathmatch: Source, and Jabroni Brawl: Episode 3 Jabroni Brawl: Episode 3, you will need to provide your own model as this one is not present.
Additionally, the ItemSoda.Bounce soundscript should also be provided, which plays every time the soda can thinks.
Note.pngNote:In Black Mesa Black Mesa this entity is replaced with prop_soda.

Keyvalues

Name (targetname) <string>
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Pitch Yaw Roll (Y Z X) (angles) <angle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.
CBaseAnimating

Studiomodel:

Skin (skin) <integer>
Some models have multiple skins. This value selects from the index, starting with 0.
Tip.pngTip:Hammer's model browser automatically updates this value if you use it to view different skins.
Model Scale (modelscale) <float> (in all games since Alien Swarm) (also in Source 2013)
A multiplier for the size of the model.
Tip.pngTip:In Hammer++ Hammer++ with a prop selected in 3D view, hold Ctrl and scroll the mouse wheel to change the modelscale in increments of 0.5. Holding Shift will scale it in smaller increments of 0.05.
Bodygroup (body / SetBodyGroup) <integer>
Some models have multiple submodels. This value selects from the index, starting with 0. May be overridden by animations and/or game code.
Note.pngNote:If both body and SetBodyGroup are present (even if set to 0), body will be prioritized.
Sequence (sequence) <integer> !FGD
Default animation sequence for the model to be playing after spawning. May be overridden by game code.
Lighting Origin (lightingorigin) <targetname>
Select an entity (not info_lighting!) from which to sample lighting instead of the entity's origin or $illumposition.

Shadow:

Disable Shadows (disableshadows) <boolean>
Prevents the entity from creating cheap render-to-texture shadows, or lightmap shadows if the entity is a prop_static. Does not affect shadow mapping.
Disable Receiving Shadows (disablereceiveshadows) <boolean>
Prevent the entity from receiving dynamic shadows on itself.
Shadow Cast Distance (shadowcastdist) <integer> !FGD
Sets how far the entity casts dynamic shadows. 0 means default distance from the shadow_control entity.
Disable Shadow Depth (disableshadowdepth) <boolean> (in all games since Portal 2)
Used to disable rendering into shadow depth (for projected textures) for this entity.
Disable flashlight (disableflashlight) <boolean> (in all games since Portal 2)
Used to disable projected texture lighting and shadows on this entity.
Projected Texture Cache (shadowdepthnocache) <integer choices> (in all games since Portal 2)
Used to hint projected texture system whether it is sufficient to cache shadow volume of this entity or to force render it every frame instead.
Choices
  • 0 : Default
  • 1 : No cache - render every frame
  • 2 : Cache it - render only once
Render in Fast Reflections (drawinfastreflection) <boolean> (in all games since Portal 2)
If enabled, this entity will render in fast water reflections (i.e. when a water material specifies $reflectonlymarkedentities) and in the world impostor pass.

See also

FGD Code

Add the following entry to the bottom of base.fgd to place soda cans directly in the map:

@PointClass base(Targetname, Angles) size(-4 -4 -4, 4 4 4) studio("models/can.mdl") = item_sodacan : "Beverage; heals 1 HP."
[
	skin(choices) : "Beverage Type" : 0 = 
	[
		0 : "Coca-Cola"
		1 : "Sprite"
		2 : "Diet Coke"
		3 : "Orange"
		4 : "Surge"
		5 : "Moxie"
	]
	modelscale(float) : "Model Scale" : : "A multiplier for the size of the model."
	lightingorigin(target_destination) : "Lighting Origin" : : "Name of entity (not info_lighting!) from which to sample lighting instead of this entity's origin or $illumposition."

	disableshadows(choices) : "Disable Shadows" : "" : "Used to disable dynamic shadows on this entity." =
	[
		"" : "No"
		1 : "Yes"
	]
	disablereceiveshadows(choices) : "Disable Receiving Shadows" : "" : "Prevent the entity from receiving dynamic shadows on itself."=
	[
		"" : "No"
		1 : "Yes"
	]
	shadowcastdist(integer) : "Shadow Cast Distance" : : "Sets how far the entity casts dynamic shadows. 0 means default distance from the shadow_control entity."

	// Inputs
	input skin(integer) : "Changes the model skin to the specified number."
	input DisableShadow(void) : "Turn shadow off."
	input EnableShadow(void) : "Turn shadow on."
	input AlternativeSorting(bool) : "Used to attempt to fix sorting problems when rendering. True activates, false deactivates"
	input SetModelScale(string) : "Takes two values separated by a space. The first is the target model scale. The second value is the number of seconds the change in scale will be spread over."

	// Outputs
	output OnIgnite(void) : "Fired when this object catches fire."
]

External links