Game weapon manager: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Robot: fixing template case.)
(Cleanup)
Line 1: Line 1:
{{wrongtitle|title=game_weapon_manager}}
{{base point|game_weapon_manager}} It is used to limit the number of a particular weapon type in the world. Useful in places where NPCs are spawning rapidly, dying, and dropping weapons.
{{base_point}}
 
==Entity Description==
An entity used to limit the number of a particular weapon type in the world. Useful in places where NPCs are spawning rapidly, dying, and dropping weapons.


{{map_properties}}
{{map_properties}}
Line 15: Line 11:
In code it is represented by class CGameWeaponManager, defined in basecombatweapon_shared.cpp.
In code it is represented by class CGameWeaponManager, defined in basecombatweapon_shared.cpp.


==Keyvalues==
== Keyvalues ==
*{{KV Targetname}}
{{KV|Weapon Classname|string|Classname of the weapon type to limit.}}
*'''weaponname'''
{{KV|Max Allowed in Level|integer|The maximum amount of the specified weapon type allowed in the world.}}
:<string> Classname of the weapon type to limit.
{{KV|Ammo modifier|float|Modifier for ammount of ammo dropped by a weapon.}}
*'''maxpieces'''
{{KV Targetname}}
:<integer> The maximum amount of the specified weapon type allowed in the world.
 
*'''{{EP1 add|ammomod}}'''
== Inputs ==
: <float> Modifier for amount of ammo dropped by a weapon.
{{IO|SetAmmoModifier|Adjust the ammo modifier.|param=float}}
==Inputs==
{{I Targetname}}
*{{I Targetname}}
 
* '''{{EP1 add|SetAmmoModifier}}'''
== Outputs ==
: <float> Adjust the ammo modifier.
{{O Targetname}}
==Outputs==
*{{O Targetname}}

Revision as of 06:56, 26 July 2011

Template:Base point It is used to limit the number of a particular weapon type in the world. Useful in places where NPCs are spawning rapidly, dying, and dropping weapons.

Template:Map properties

This entity conducts a count of all the weapons in the world of my type and see if we have a surplus. If there is a surplus, try to find suitable candidates for removal. Right now we just remove the first weapons we find that are behind the player, or are out of the player's PVS.

Note.pngNote:This code is designed to not remove weapons that are hand-placed by level designers. It should only clean up weapons dropped by dead NPCs, which is useful in situations where enemies are spawned in for a sustained period of time.
Warning.pngWarning:This entity is designed using UTIL_GetLocalPlayer, which returns NULL in any type of multiplayer game.

In code it is represented by class CGameWeaponManager, defined in basecombatweapon_shared.cpp.

Keyvalues

Weapon Classname ([todo internal name (i)]) <string>
Classname of the weapon type to limit.
Max Allowed in Level ([todo internal name (i)]) <integer>
The maximum amount of the specified weapon type allowed in the world.
Ammo modifier ([todo internal name (i)]) <float>
Modifier for ammount of ammo dropped by a weapon.
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

Inputs

SetAmmoModifier <floatRedirectInput/float>
Adjust the ammo modifier.


Outputs