Func healthcharger: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(charging sound bug)
 
(45 intermediate revisions by 15 users not shown)
Line 1: Line 1:
{{wrongtitle|title=func_healthcharger}}
{{tabsBar|main=func_healthcharger}}
{{CD|CWallHealth|file1=hl2/item_healthkit.cpp}}
{{for|about=the brush entity|the point entity|<tt>[[item_healthcharger]]</tt>}}
{{this is a|brush entity|name=func_healthcharger|game=Half-Life 2 series}} A brush-based version of {{ent|item_healthcharger}}.


==Entity Description==
{{stray ent|{{portal}}}}
A [[brush entity]] wall health recharger (as opposed to a model-based [[item_healthcharger]]).
{{important|Unlike its [[func_healthcharger (Half-Life: Source)|Half-Life: Source counterpart]], this entity has no visual indication of when it is depleted.
{{code fix|Do both of the following:
# Add {{code|[[SetTextureFrameIndex]](0)}} to {{mono|CWallHealth::Recharge()}} and {{mono|CWallHealth::Spawn()}}
# Add {{code|[[SetTextureFrameIndex]](1)}} to {{mono|CWallHealth::Off()}}
This will make all textures on the brush with the [[List Of Material Proxies#Entity integration|ToggleTexture]] material proxy use frame 0 when charge is remaining, and frame 1 when the charger is depleted.}}}}


==Availability==
{{Bug|[[Kill|Killing]] a charger while it is being used will make the charging sound loop indefintely.|hidetested=1}}
{{in game|brush}} {{game|HL2}}
{{in code|class=class_c_wall_health.html CWallHealth|file=item__healthkit_8cpp-source.html hl2_dll\item_healthkit.cpp}}


==Keyvalues==
==Keyvalues==
{{no_targetname}}
{{Brush rendering note}}
*{{kv parentname}}
{{KV Targetname}}
*{{kv enabledisable}}
{{KV|Deathmatch recharge delay|intn=dmdelay|integer}}
*{{kv origin}}
*{{kv global}}
*; _minlight <string>
: Minimum light level.
 
==Inputs==
*{{i parentname}}
*{{i enabledisable}}


==Outputs==
==Outputs==
*; OnPlayerUse
{{O|OutRemainingCharge|param=float|Fires once for ''every single'' point of health given to the player. That means it will not fire when the charger is depleted or when the player is at full health. {{outadd|the amount of points remaining in the charger{{confirm}}}}}}
: Fired when the player +USEs the charger.
{{O|OnPlayerUse|Fired when the player tries to {{ent|+use}} the healthcharger.}}
*; OutRemainingHealth
:


[[Category:Entities]][[Category:Brush Entities]]
==See also==
*{{ent|func_recharge}}, a brush-based recharger meant for suit power.

Latest revision as of 14:37, 16 May 2025

edit
C++ Class hierarchy
CWallHealth
CBaseToggle
CBaseEntity
C++ item_healthkit.cpp
This article is about the brush entity. For the point entity, see item_healthcharger.

func_healthcharger is a brush entity available in Half-Life 2 series Half-Life 2 series. A brush-based version of item_healthcharger.

Note.pngNote:This entity is also in the code for Portal. Its functionality is not guaranteed.
Icon-Important.pngImportant:Unlike its Half-Life: Source counterpart, this entity has no visual indication of when it is depleted.
Cpp.pngCode Fix:Do both of the following:
  1. Add SetTextureFrameIndex(0) to CWallHealth::Recharge() and CWallHealth::Spawn()
  2. Add SetTextureFrameIndex(1) to CWallHealth::Off()
This will make all textures on the brush with the ToggleTexture material proxy use frame 0 when charge is remaining, and frame 1 when the charger is depleted.
Icon-Bug.pngBug:Killing a charger while it is being used will make the charging sound loop indefintely.

Keyvalues

Note.pngNote:For Keyvalues and Inputs affecting brush rendering, see Brush entity/Rendering related keyvalues and inputs
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

Deathmatch recharge delay (dmdelay) <integer>

Outputs

OutRemainingCharge <floatRedirectOutput/float>
Fires once for every single point of health given to the player. That means it will not fire when the charger is depleted or when the player is at full health. This output automatically puts the amount of points remaining in the charger[confirm] into the parameter box for inputs, if the mapper does not override the parameter with something else.
OnPlayerUse
Fired when the player tries to +use the healthcharger.

See also