Player extensions of the Raise Weapon plugin: reading and changing the raised state of the player's active weapon. The state is a data table variable of the player, so it is read on both realms, but it is only changed on the server.

Summary

Methods

Checks whether the player's active weapon is raised.
Raises or lowers the player's active weapon and runs the OnWeaponRaised hook.
Raises the player's active weapon if it is lowered and lowers it if it is raised.

Methods

Player:is_weapon_raised()

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

Checks whether the player's active weapon is raised. Without a valid weapon this is false. The physgun, gravity gun, tool gun, camera and the weapons marked as always raised are always raised, and the weapons marked as never raised never are. Otherwise the ShouldWeaponBeRaised hook decides. If it does not, the weapon of a running player is lowered when the sprint_lowers_weapon config is on, any other weapon is raised when the weapon_raise_enabled config is off, and the networked state is used in the end.

Returns

  • Boolean

Player:set_weapon_raised(raised)

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

Raises or lowers the player's active weapon and runs the OnWeaponRaised hook. Does nothing clientside. The CanPlayerRaiseWeapon hook can veto the change, and a weapon that is never raised (see the never_raised item field and the NeverRaised weapon field) is not raised.

Parameters

  • raised Boolean true to raise the weapon, false to lower it

Player:toggle_weapon_raised()

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

Raises the player's active weapon if it is lowered and lowers it if it is raised. Does nothing clientside.

Defined in