Smoke weapon
Weapon defined in entities/weapons/cw_smokegrenade
Defines the cw_smokegrenade weapon (Smoke), a thrown grenade that explodes into a cw_effect_smoke cloud after
four seconds.
It shares its throw logic with cw_flashgrenade: holding primary fire charges the throw, releasing it throws a
prop_physics grenade, and each throw uses up one grenade until the weapon is stripped.
Summary
Methods
cw_effect_smoke cloud.SWEP:Think releases.Methods
SWEP:CreateGrenade(power)
shared gamemodes/cwhl2rp/schema/entities/weapons/cw_smokegrenade/shared.lua:143Throws a smoke grenade that, after four seconds, explodes into a cw_effect_smoke cloud.
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_smokegrenade/shared.lua:109Plays 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_smokegrenade/shared.lua:206Pulls the grenade back to start a throw, which SWEP:Think releases.
Returns
- Boolean Always
false
SWEP:SecondaryAttack()
shared gamemodes/cwhl2rp/schema/entities/weapons/cw_smokegrenade/shared.lua:221Does 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.