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

Env beverage: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Fix internal name format)
No edit summary
 
(46 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{lang|Env beverage}}
{{languageBar}}
{{base point|env_beverage}} It is a [[Half-Life]] legacy entity: the beverage dispenser. This entity dispenses soda cans ({{ent|item_sodacan}}) when {{ent|+use}}d.
{{TabsBar|main=Env beverage}}
{{CD|CEnvBeverage|file1=effects.cpp}} {{ent not in fgd}}
{{this is a|point entity|name=env_beverage}} It is a {{hl1|4}} legacy entity: the beverage vending machine. This entity dispenses [[item_sodacan|soda cans]] when [[+use|used]].


These are not used for the dispensers in Half-Life 2. Those are done with a {{ent|func_button}} and {{ent|point_template}}.
{{Note|
 
* These are not used for the vending machines in {{hl2|2}}. Those are done with a {{ent|func_button}} and {{ent|point_template}}.
{{note|This uses <code>models/can.mdl</code> by default, you will need to provide your own model as this one is not present.}}
* This uses {{file|icon=file|models/can|mdl}} by default.<br>In most games except {{hls|2}}, {{hldms|2}}, and {{jbep3|2}}, you will need to provide your own model as this one is not present.<br>Additionally, the {{code|ItemSoda.Bounce}} [[soundscript]] and associated audio files should also be provided, which plays every time the soda can [[think]]s.
 
* Still exists in {{bms|2}}, but is deprecated by {{ent|env_dispenser}}.
{{code class|CEnvBeverage|effects.cpp}}  
}}


==Keyvalues==
==Keyvalues==
{{KV|Capacity|intn=health|integer|Number of cans in the dispenser.}}
[[File:Soda can skins.png|thumb|The six flavors of soft drinks in {{hls|2}}.]]
{{KV|Beverage Type|intn=beveragetype|choices|Type of the cans.
{{KV Targetname}}
:*0: Coca-Cola
{{KV|Pitch Yaw Roll (Y Z X)|intn=angles|QAngle|Which direction to dispense the pop.}}
:*1: Sprite
{{KV|Capacity|intn=health|integer|Number of cans in the dispenser. Default 10 (0 is treated as 10).}}
:*2: Diet Coke
{{KV|Beverage Type|intn=beveragetype|integer choices|Which [[skin]] to use for the spawned can. Vanilla {{hls}} skins described below:}}
:*3: Orange
:<ol start="0"><!--
:*4: Surge
--><li> '''"Coca-Cola"''' - A lime green can with what appears to be half a kiwifruit pictured, labelled "{{mono|HAI !}}". <!--
:*5: Moxie
--><li> '''"Sprite"''' - A brown can with yellow droplets pictured, labelled "{{mono|GLUB}}". <!--
:*6: Random}}
--><li> '''"Diet Coke"''' - A red/blue can with red berries pictured, labelled "{{mono|GRAPE}}". <!--
{{KV BaseEntity|css=1}}
--><li> '''"Orange"''' - A blue and green can with a lighter blue face pictured, labelled "{{mono|GUTHRIE}}". <!--
--><li> '''"Surge"''' - A dark green can with darker coloured ends, labelled "{{mono|YUCK}}". <!--
--><li> '''"Moxie"''' - A yellow/orange can with a fiery effect, labelled "{{mono|DANTE}}". <!--
--><li> '''Random''' - One of the first 6 skins found in the MDL will be chosen at random.
</ol>
:{{note|While skin 6 cannot be selected, skins 7 and higher can. Only skins 0-5 will be used by "random", however.}}


==Inputs==
==Inputs==
{{IO|Activate|Enable this dispenser. There is no way to deactivate it.}}
{{I|[[Use]] / Activate|param=void|Dispenses a can}}
{{I BaseEntity|prel4d=1}}
 
== FGD Code ==
<syntaxhighlight lang=cpp>
@PointClass base(Targetname, Angles) size(-4 -4 -4, 4 4 4) = env_beverage : "Beverage Dispenser"
[
health(integer) : "Capacity" : 10
beveragetype(choices) : "Beverage Type" : 0 : "Which skin to spawn. Skins 7 and higher can also be chosen, but only skins 0-5 will be used when set to 6 (random)." =
[
0 : "Coca-Cola"
1 : "Sprite"
2 : "Diet Coke"
3 : "Orange"
4 : "Surge"
5 : "Moxie"
6 : "Random"
]


==Outputs==
input Activate(void) : "Dispense a beverage."
{{O BaseEntity|l4d=1}}
]
</syntaxhighlight>

Latest revision as of 23:18, 28 May 2025

English (en)中文 (zh)Translate (Translate)
Source Engine ( General | Black Mesa )
edit
C++ Class hierarchy
CEnvBeverage
CBaseEntity
C++ effects.cpp
Icon-NotInFGD.png
This entity is not in the FGD by default.
See below for instructions on making it available.

env_beverage is a point entity available in all Source Source games. It is a Half-Life Half-Life legacy entity: the beverage vending machine. This entity dispenses soda cans when used.

Note.pngNote:

Keyvalues

The six flavors of soft drinks in Half-Life: Source Half-Life: Source.
Name (targetname) <string>[ Edit ]
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) <QAngle>
Which direction to dispense the pop.
Capacity (health) <integer>
Number of cans in the dispenser. Default 10 (0 is treated as 10).
Beverage Type (beveragetype) <integer choices>
Which skin to use for the spawned can. Vanilla Half-Life: Source skins described below:
  1. "Coca-Cola" - A lime green can with what appears to be half a kiwifruit pictured, labelled "HAI !".
  2. "Sprite" - A brown can with yellow droplets pictured, labelled "GLUB".
  3. "Diet Coke" - A red/blue can with red berries pictured, labelled "GRAPE".
  4. "Orange" - A blue and green can with a lighter blue face pictured, labelled "GUTHRIE".
  5. "Surge" - A dark green can with darker coloured ends, labelled "YUCK".
  6. "Moxie" - A yellow/orange can with a fiery effect, labelled "DANTE".
  7. Random - One of the first 6 skins found in the MDL will be chosen at random.
Note.pngNote:While skin 6 cannot be selected, skins 7 and higher can. Only skins 0-5 will be used by "random", however.

Inputs

Use / Activate <void>
Dispenses a can

FGD Code

@PointClass base(Targetname, Angles) size(-4 -4 -4, 4 4 4) = env_beverage : "Beverage Dispenser"
[
	health(integer) : "Capacity" : 10
	beveragetype(choices) : "Beverage Type" : 0 : "Which skin to spawn. Skins 7 and higher can also be chosen, but only skins 0-5 will be used when set to 6 (random)." = 
	[
		0 : "Coca-Cola"
		1 : "Sprite"
		2 : "Diet Coke"
		3 : "Orange"
		4 : "Surge"
		5 : "Moxie"
		6 : "Random"
	]

	input Activate(void) : "Dispense a beverage."
]