Summary

Hooks

Called when the view model position is calculated; tilts the view model away while the weapon is lowered.
Called when a player presses a key; holding reload for one second toggles their weapon.
Called when a player releases a key; releasing reload cancels the pending weapon toggle.
Called to check whether a player's model should animate with a raised weapon.
Called when a player raises or lowers a weapon; runs the UpdateWeaponRaised hook with the current time.
Called when a player's data tables are set up; registers the WeaponRaised boolean.
Called when a player switches weapons; lowers the weapon if it was raised.
Called periodically for every player; keeps pushing back the next fire time of lowered weapons.
Called after a weapon is raised or lowered; lets raised weapons fire and blocks lowered ones.

Hooks

PLUGIN:CalcViewModelView(weapon, viewModel, oldEyePos, oldEyeAngles, eyePos, eyeAngles)

client gamemodes/catwork/plugins/sh_raisegun.lua:208

Called when the view model position is calculated; tilts the view model away while the weapon is lowered.

The tilt eases in and out and uses a per-weapon rotation (fists and hands differ from the default). The weapon's own GetViewModelPosition and CalcViewModelView methods are applied afterwards.

Parameters

  • weapon Weapon The local player's active weapon
  • viewModel Entity The view model
  • oldEyePos Vector The original eye position
  • oldEyeAngles Angle The original eye angles
  • eyePos Vector The current eye position
  • eyeAngles Angle The current eye angles, rotated in place

Returns

  • Vector The view model position
  • Angle The view model angles

PLUGIN:KeyPress(player, key)

shared gamemodes/catwork/plugins/sh_raisegun.lua:148

Called when a player presses a key; holding reload for one second toggles their weapon.

Parameters

  • player Player The player pressing the key
  • key Number The IN_* key enum

PLUGIN:KeyRelease(player, key)

shared gamemodes/catwork/plugins/sh_raisegun.lua:162

Called when a player releases a key; releasing reload cancels the pending weapon toggle.

Parameters

  • player Player The player releasing the key
  • key Number The IN_* key enum

PLUGIN:ModelWeaponRaised(player, model)

shared gamemodes/catwork/plugins/sh_raisegun.lua:173

Called to check whether a player's model should animate with a raised weapon.

Parameters

  • player Player The player being animated
  • model String The player's model

Returns

  • Boolean Whether the player's weapon is raised

PLUGIN:OnWeaponRaised(player, weapon, bIsRaised)

shared gamemodes/catwork/plugins/sh_raisegun.lua:94

Implements hook OnWeaponRaised

Called when a player raises or lowers a weapon; runs the UpdateWeaponRaised hook with the current time.

Parameters

  • player Player The player toggling the weapon
  • weapon Weapon The player's active weapon
  • bIsRaised Boolean Whether the weapon is now raised

PLUGIN:PlayerSetupDataTables(player)

shared gamemodes/catwork/plugins/sh_raisegun.lua:191

Called when a player's data tables are set up; registers the WeaponRaised boolean.

Parameters

  • player Player The player whose data tables are set up

PLUGIN:PlayerSwitchWeapon(player, oldWeapon, newWeapon)

shared gamemodes/catwork/plugins/sh_raisegun.lua:182

Called when a player switches weapons; lowers the weapon if it was raised.

Parameters

  • player Player The player switching weapons
  • oldWeapon Weapon The previous weapon
  • newWeapon Weapon The new weapon

PLUGIN:PlayerThink(player, curTime)

shared gamemodes/catwork/plugins/sh_raisegun.lua:133

Implements hook PlayerThink

Called periodically for every player; keeps pushing back the next fire time of lowered weapons.

Parameters

  • player Player The player being updated
  • curTime Number The current time

PLUGIN:UpdateWeaponRaised(player, weapon, bIsRaised, curTime)

shared gamemodes/catwork/plugins/sh_raisegun.lua:111

Implements hook UpdateWeaponRaised

Called after a weapon is raised or lowered; lets raised weapons fire and blocks lowered ones.

Raised weapons (and always-raised tools) can fire at once and get their OnRaised method called; lowered weapons cannot fire for 60 seconds and get their OnLowered method called.

Parameters

  • player Player The weapon's owner
  • weapon Weapon The weapon that changed state
  • bIsRaised Boolean Whether the weapon is now raised
  • curTime Number The current time

Defined in