Func recharge: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(redid header, fixed TODOs,)
(charging sound bug)
 
(29 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:func_recharge}}
{{tabsBar|main=func_recharge}}
{{hl2 brush|func_recharge}} It's a brush-based version of [[item_suitcharger]].
{{CD|CRecharge|file1=hl2/func_recharge.cpp}}
{{toc-right}}
{{for|about=the brush entity|the point entity|<tt>[[item_suitcharger]]</tt>}}
{{this is a|brush entity|name=func_recharge|game=Half-Life 2 series}} It's a brush-based version of {{ent|item_suitcharger}}.


==Dedicated Console Variables==
{{stray ent|{{portal}} {{portal2}}}}
;sk_suitcharger <[[int]]>
{{important|Unlike its [[func_recharge (Half-Life: Source)|Half-Life: Source counterpart]], this entity has no visual indication of when it is depleted.
: Amount of healing points.(Default: 75 for HL2,30 for HL2:DM)
{{code fix|Do both of the following:
# Add {{code|[[SetTextureFrameIndex]](0)}} to {{mono|CRecharge::Recharge()}} and {{mono|CRecharge::Spawn()}}
# Add {{code|[[SetTextureFrameIndex]](1)}} to {{mono|CRecharge::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.}}}}


;sk_suitcharger_citadel <[[int]]>
{{Bug|[[Kill|Killing]] a charger while it is being used will make the charging sound loop indefintely.|hidetested=1}}
: Changes the total charge of suit points of the citadel charger (Default: 500 for HL2, 200 for HL2:DM.)
 
;sk_suitcharger_citadel_maxarmor <[[int]]>
: Changes the amount of Suit points you can hold when recharging with a citadel charger (Default: 200).  


==Keyvalues==
==Keyvalues==
{{Brush rendering note}}
{{KV Targetname}}
{{KV Targetname}}
{{KV Parentname}}
{{KV|Deathmatch recharge delay|intn=dmdelay|integer}}
{{KV Origin}}
{{KV|_minlight|float|Defines the minimum light level.}}


==Flags==
==Flags==
* 8192 : Citadel recharger
{{fl|8192|Citadel recharger}}


==Inputs==
==Inputs==
{{I Targetname}}
{{I|Recharge|Sets charge to maximum.}}
{{I Parentname}}
{{I|SetCharge|deprecated=1|param=int|Not present in code. Sets the remaining charge in the charger to the value specified.}}
{{IO|Recharge|Sets charge to maximum }}
{{IO|SetCharge|This sets the remaining charge in the charger to whatever value you specify.}}  


==Outputs==
==Outputs==
{{O Targetname}}
{{O|OutRemainingCharge|Fires once for every single point of power given to the suit. This means it will not fire when the charger is depleted or when the suit is at full power. {{outadd|the amount of charge remaining in the charger}}}}
{{IO|OutRemainingCharge|Fires once for every single point of power given to the suit. This means it will not fire when the charger is depleted or when the suit is at full power.}}
{{O|OnHalfEmpty|Fires when the "charge left" reaches 50% of its max.}}
{{IO|OnHalfEmpty|Executed when the "charge left" reaches 50% of its max.}}
{{O|OnEmpty|Fires when the charger is empty.}}
{{IO|OnEmpty|Executed when the Charger is empty.}}
{{O|OnFull|Fires when the charger gets recharged to the max.}}
{{IO|OnFull|Executed when player gets recharged to the max.}}
{{O|OnPlayerUse|Fires when a player {{ent|+use}}s the entity.}}
{{IO|OnPlayerUse|Executed when a player uses the entity (Def. E).}}


==See Also==
==ConVars/Commands==
*<code>[[func_healthcharger]]</code>, a version of this entity meant for health.
{{varcom|start}}
{{varcom|sk_suitcharger|75 (HL2) 30 (HL2DM)|Arbitrary number|Amount of power a normal charger may give.}}
{{varcom|sk_suitcharger_citadel|500 (HL2) 200 (HL2DM)|Arbitrary number|Amount of power a citadel charger may give.}}
{{varcom|sk_suitcharger_citadel_maxarmor|200|Arbitrary number|Amount of power the suit can be charged to via a citadel charger.}}
{{varcom|end}}


[[Category:Entities]][[Category:Brush Entities]]
==See also==
*{{ent|func_healthcharger}}, a version of this entity meant for health.

Latest revision as of 14:38, 16 May 2025

edit
C++ Class hierarchy
CRecharge
CBaseToggle
CBaseEntity
C++ func_recharge.cpp
This article is about the brush entity. For the point entity, see item_suitcharger.

func_recharge is a brush entity available in Half-Life 2 series Half-Life 2 series. It's a brush-based version of item_suitcharger.

Note.pngNote:This entity is also in the code for Portal Portal 2. 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 CRecharge::Recharge() and CRecharge::Spawn()
  2. Add SetTextureFrameIndex(1) to CRecharge::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>

Flags

Citadel recharger : [8192]

Inputs

Recharge
Sets charge to maximum.
SetCharge <integerRedirectInput/integer> Obsolete
Deprecated.
Not present in code. Sets the remaining charge in the charger to the value specified.

Outputs

OutRemainingCharge
Fires once for every single point of power given to the suit. This means it will not fire when the charger is depleted or when the suit is at full power. This output automatically puts the amount of charge remaining in the charger into the parameter box for inputs, if the mapper does not override the parameter with something else.
OnHalfEmpty
Fires when the "charge left" reaches 50% of its max.
OnEmpty
Fires when the charger is empty.
OnFull
Fires when the charger gets recharged to the max.
OnPlayerUse
Fires when a player +uses the entity.

ConVars/Commands

Cvar/Command Parameters or default value Descriptor Effect
sk_suitcharger 75 (HL2) 30 (HL2DM) Arbitrary number Amount of power a normal charger may give.
sk_suitcharger_citadel 500 (HL2) 200 (HL2DM) Arbitrary number Amount of power a citadel charger may give.
sk_suitcharger_citadel_maxarmor 200 Arbitrary number Amount of power the suit can be charged to via a citadel charger.

See also