Shared hooks of the FA:S 2.0 & CW 2.0 Integration plugin that tie FA:S 2.0, CW 2.0 and SXBase weapons into Catwork's weapon raising.

Raising or lowering such a weapon switches it between the safe fire mode and its second fire mode, and it counts as raised whenever it is not on safe. Toggling is blocked while the weapon is busy, and the weapon selection menu while it is being customized.

Summary

Hooks

Called to check whether a weapon can be raised or lowered; blocks it while a FA:S 2, SXBase or CW 2.0 weapon is busy (not idle).
Called when a player raises or lowers a weapon; toggles FA:S 2, CW 2.0 and SXBase weapons between the safe fire mode and their second fire mode.
Called to check whether a weapon counts as raised; FA:S 2, CW 2.0 and SXBase weapons are raised unless they are in the safe fire mode.
Called to check whether the weapon selection menu may open; blocks it while a FA:S 2, SXBase or CW 2.0 weapon is being customized.

Hooks

PLUGIN:CanWeaponBeToggled(player, weapon)

shared gamemodes/catwork/plugins/fascwcompatibility/plugin/sh_plugin.lua:60

Implements hook CanWeaponBeToggled

Called to check whether a weapon can be raised or lowered; blocks it while a FA:S 2, SXBase or CW 2.0 weapon is busy (not idle).

Parameters

  • player Player The weapon's owner
  • weapon Weapon The weapon to toggle

Returns

  • Boolean False while the weapon is busy, otherwise nil

PLUGIN:OnWeaponRaised(player, weapon, bIsRaised)

shared gamemodes/catwork/plugins/fascwcompatibility/plugin/sh_plugin.lua:30

Implements hook OnWeaponRaised

Called when a player raises or lowers a weapon; toggles FA:S 2, CW 2.0 and SXBase weapons between the safe fire mode and their second fire mode.

Parameters

  • player Player The player toggling the weapon
  • weapon Weapon The weapon being toggled
  • bIsRaised Boolean Whether the weapon is now raised

PLUGIN:ShouldWeaponBeRaised(player, weapon)

shared gamemodes/catwork/plugins/fascwcompatibility/plugin/sh_plugin.lua:48

Implements hook ShouldWeaponBeRaised

Called to check whether a weapon counts as raised; FA:S 2, CW 2.0 and SXBase weapons are raised unless they are in the safe fire mode.

Parameters

  • player Player The weapon's owner
  • weapon Weapon The weapon to check

Returns

  • Boolean Whether the weapon is raised, or nil for weapons of other bases

PLUGIN:ShouldWeaponMenuOpen(player, oldIndex, newIndex)

shared gamemodes/catwork/plugins/fascwcompatibility/plugin/sh_plugin.lua:15

Implements hook ShouldWeaponMenuOpen

Called to check whether the weapon selection menu may open; blocks it while a FA:S 2, SXBase or CW 2.0 weapon is being customized.

Parameters

  • player Player The player switching weapons
  • oldIndex Number Previously selected slot index
  • newIndex Number Newly selected slot index

Returns

  • Boolean False to keep the menu closed, or nil to leave the decision to other hooks

Defined in