Hooks called by Raise Weapon

Summary

Hooks

Lets plugins change the lowered pose of a weapon.
Asks whether the local player may attack.
Asks whether the raised state of a player's weapon may be changed.
Called on the server after the raised state of a player's weapon has been set.
Lets plugins force a player's weapon to count as raised or as lowered.
Called on the server when the raised state of a player's valid weapon has been set.
Called on the server after a player's weapon has been lowered and its fire has been blocked.
Called on the server after a player's weapon has been raised.

Hooks

AdjustWeaponLoweredView(weapon, angles, origin, item_obj)

client plugins/raisegun/plugin/cl_hooks.lua:42

Lets plugins change the lowered pose of a weapon. Called on the client on every frame the view model of the local player's weapon is positioned while the weapon is lowered or on its way up or down; not while it is fully raised. The angles and the origin that are passed in are shared between calls: return new ones rather than changing them.

Parameters

  • weapon Weapon The active weapon of the local player
  • angles Angle How far the lowered view model is turned around the up (pitch field), forward (yaw field) and right (roll field) axes of the view
  • origin Vector How far the lowered view model is moved to the right (x), forward (y) and up (z)
  • item_obj Item Template of the item that gives the weapon, nil if there is none

Returns

  • Angle Angles to use instead
  • Vector Origin to use instead. The origin can be left out to keep it; a handler that only changes the origin has to return the angles it was given in front of it, since a nil first value counts as no answer

Called from

  • lowered_view

Call sites

CanPlayerAttack()

client plugins/raisegun/plugin/cl_hooks.lua:130

Asks whether the local player may attack. Called on the client for every user command that is built; the plugin's own handler denies it while the weapon is lowered.

Returns

  • Boolean Return false to strip the primary and secondary attack keys from the command

Called from

Call sites

CanPlayerRaiseWeapon(self, raised)

server plugins/raisegun/plugin/lib/meta/sh_player.lua:28

Asks whether the raised state of a player's weapon may be changed. Called on the server by Player:set_weapon_raised, for lowering as well as for raising. It is not asked about raising a weapon that is never raised.

Parameters

  • actor Player The player holding the weapon
  • raised Boolean True if the weapon is about to be raised and false if it is about to be lowered

Returns

  • Boolean Return false to leave the weapon as it is

Called from

Call sites

OnWeaponRaised(self, weapon, raised)

server plugins/raisegun/plugin/lib/meta/sh_player.lua:37

Called on the server after the raised state of a player's weapon has been set. The gamemode plays the raise or lower gesture from it, and the plugin runs UpdateWeaponRaised.

Parameters

  • actor Player The player holding the weapon
  • weapon Weapon The active weapon of the player, which may not be valid
  • raised Boolean Whether the weapon is now raised

Called from

Call sites

ShouldWeaponBeRaised(self, weapon)

shared plugins/raisegun/plugin/lib/meta/sh_player.lua:70

Lets plugins force a player's weapon to count as raised or as lowered. Called on both realms every time Player:is_weapon_raised is asked about a weapon that can be both raised and lowered: not for the physgun, gravity gun, tool gun and camera, nor for the weapons marked as always or never raised.

Parameters

  • actor Player The player holding the weapon
  • weapon Weapon The active weapon of the player

Returns

  • Boolean Return true or false to override the state; the configs of the plugin and the networked state are used when nothing is returned

Called from

Call sites

UpdateWeaponRaised(actor, weapon, raised, CurTime())

server plugins/raisegun/plugin/sv_hooks.lua:25

Called on the server when the raised state of a player's valid weapon has been set. The plugin's own handler lets the weapon fire or blocks its fire, then runs WeaponRaised or WeaponLowered.

Parameters

  • actor Player The player holding the weapon
  • weapon Weapon The active weapon of the player
  • raised Boolean Whether the weapon is now raised
  • cur_time Number CurTime() of the change

Called from

Call sites

WeaponLowered(actor, weapon)

server plugins/raisegun/plugin/sv_hooks.lua:79

Called on the server after a player's weapon has been lowered and its fire has been blocked. The fire of a weapon that is never raised is left alone.

Parameters

  • actor Player The player holding the weapon
  • weapon Weapon The weapon that has been lowered

Called from

Call sites

WeaponRaised(actor, weapon)

server plugins/raisegun/plugin/sv_hooks.lua:63

Called on the server after a player's weapon has been raised. It can fire again, unless the player is running while the sprint_lowers_weapon config is on or a ShouldWeaponBeRaised handler keeps the weapon lowered. For the weapons that cannot be lowered (physgun, gravity gun, tool gun, camera and the weapons marked as always raised) it is called whichever state was set.

Parameters

  • actor Player The player holding the weapon
  • weapon Weapon The weapon that has been raised

Called from

Call sites

Defined in