Flash weapon
Weapon defined in entities/weapons/cw_flashgrenade
Defines the cw_flashgrenade weapon (Flash), a thrown grenade that blinds every player within 768 units who can see
it.
Holding primary fire charges the throw and releasing it throws a prop_physics grenade that explodes after four
seconds and sends the Flashed Cable message to the affected players. Each throw uses up one grenade, and the
weapon is stripped when none are left.
Summary
Methods
SWEP:Think releases.Methods
SWEP:CreateGrenade(power)
shared gamemodes/cwhl2rp/schema/entities/weapons/cw_flashgrenade/shared.lua:145Throws a flash grenade that, after four seconds, explodes and blinds every player within 768 units who can see it.
Runs only on the server. The grenade spawns 64 units ahead of the owner, or just short of a surface
closer than 80 units, and is thrown with a force of 800 + power.
Parameters
- power Number Extra throw force, 40 per second the attack key was held, up to 400
Plays the draw animation and cancels any throw in progress.
Returns
- Boolean Always
trueto allow the deploy
Reports the weapon as raised while throwing and for two seconds after.
Returns
- Boolean
truewhile raised, otherwisenil
SWEP:Holster(switchingTo)
shared gamemodes/cwhl2rp/schema/entities/weapons/cw_flashgrenade/shared.lua:110Plays the holster animation and cancels any throw in progress.
Refused right after a throw, until SWEP:Think has stripped the weapon if it was the last grenade;
an empty weapon that was put away could otherwise be drawn and thrown again.
Parameters
- switchingTo
Returns
- Boolean Whether the weapon may be holstered
Sets the grenade hold type on the server.
SWEP:PrimaryAttack()
shared gamemodes/cwhl2rp/schema/entities/weapons/cw_flashgrenade/shared.lua:212Pulls the grenade back to start a throw, which SWEP:Think releases.
Returns
- Boolean Always
false
SWEP:SecondaryAttack()
shared gamemodes/cwhl2rp/schema/entities/weapons/cw_flashgrenade/shared.lua:227Does nothing.
Throws the grenade once the attack key is released, using up one grenade, and strips the weapon after the throw when none are left.