Weapon frag: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
 
(34 intermediate revisions by 24 users not shown)
Line 1: Line 1:
{{wrongtitle|title=weapon_frag}}
{{tabsBar|main=weapon_frag}}
{{this is a|model entity|internal=1|name=weapon_frag|game=Half-Life 2 series}} The game's frag grenade.
{{CD|CWeaponFrag|base=CBaseHLCombatWeapon|file1=1}}


==Entity Description==
[[File:weapon_frag_hl2.PNG|thumb|right|175px|weapon_frag in HL2]]
A frag grenade. When first picked up, the player is given one grenade. Up to 5 grenades can be carried (including one carried by the player). In {{hl2dm|4}} all players spawn with two grenades.<br>
A live grenade can be placed into a map with [[npc_grenade_frag]].
Before it is picked up, the grenade also follows all physics rules as if it were a [[prop_physics]].<br>


[[Image:hammerfrag.jpg|frame|right|Frag Grenade]]
{{BasicWeapon}}


The weapon_frag entity can be used to place a fragmenting grenade in a map. When picked up, the player is given 1 additional grenade, up to 5 total. The grenade also follows all physics rules as if it were a [[prop_physics]]. In [[Half-Life 2 Deathmatch]], the player spawns with 2 grenades by default.
== See also ==
* {{dods}} {{ent|grenade_frag_us}} and {{ent|grenade_frag_ger}}


{{basicweapon}}
[[Category:Half-Life 2 Weapons|F]]
 
[[Category:Entities]]
[[Category:Weapons]]

Latest revision as of 00:15, 10 June 2025

edit

weapon_frag is an internal model entity available in Half-Life 2 series Half-Life 2 series. The game's frag grenade.

C++ Class hierarchy
CWeaponFrag
CBaseHLCombatWeapon
CBaseCombatWeapon
CBaseAnimating
CBaseEntity
C++ weapon_frag.cpp
weapon_frag in HL2

A frag grenade. When first picked up, the player is given one grenade. Up to 5 grenades can be carried (including one carried by the player). In Half-Life 2: Deathmatch Half-Life 2: Deathmatch all players spawn with two grenades.
A live grenade can be placed into a map with npc_grenade_frag. Before it is picked up, the grenade also follows all physics rules as if it were a prop_physics.

Flags

Start Constrained : [1]
Prevents the model from moving.
Deny player pickup (reserve for NPC) : [2]
Not puntable by Gravity Gun : [4]

Inputs

HideWeapon  !FGD
If this weapon is being held, hide the worldmodel and/or viewmodel via EF_NODRAW. Weapon will still be useable. The weapon will become visible again if the holder is to switch between weapons in their inventory.

Outputs

OnNPCPickup
Fires when an NPC picks up this weapon. (!activator is the NPC.)
OnPlayerUse
Fires when the player +uses this weapon. (!activator is the player.)
OnPlayerPickup
Fires when a player picks up this weapon. (!activator is the player.)
OnCacheInteraction
Fires when the player 'proves' they've found this weapon. Fires on: Player Touch, +USE pickup, Physcannon pickup, Physcannon punt.

See also