Defines the accessory_base base item for accessories, wearable items shown attached to a bone of the player's model.

Using the item wears it, unless its optional CanPlayerWear refuses, and unequipping takes it off; it cannot be dropped while worn. By default it attaches to the head bone.

Summary

Methods

Returns the tooltip line saying whether the local player is wearing the accessory.
Returns whether the player is wearing this accessory; on the client it checks the local player.
Called when a player drops the accessory; blocks the drop while it is worn.
Takes the accessory off the player.
Puts the accessory on a living, standing player if the item's optional CanPlayerWear allows it.
Called when a player puts the accessory on or takes it off; does nothing in the base.

Methods

Returns the tooltip line saying whether the local player is wearing the accessory.

Returns

  • String Language key for the wearing state, or nil for a non-instance item

ITEM:HasPlayerEquipped(player, bIsValidWeapon)

shared gamemodes/catwork/gamemode/core/items/sh_accessory_base.lua:26

Returns whether the player is wearing this accessory; on the client it checks the local player.

Parameters

  • player
  • bIsValidWeapon

Returns

  • Boolean Whether the accessory is worn

Called when a player drops the accessory; blocks the drop while it is worn.

Parameters

  • player
  • position

Returns

  • Boolean false while the player wears the accessory, otherwise nil

ITEM:OnPlayerUnequipped(player, extraData)

shared gamemodes/catwork/gamemode/core/items/sh_accessory_base.lua:35

Takes the accessory off the player.

Parameters

  • player
  • extraData

Puts the accessory on a living, standing player if the item's optional CanPlayerWear allows it.

Parameters

  • player
  • itemEntity

Returns

  • Boolean true when worn (the item stays in the inventory), false otherwise

ITEM:OnWearAccessory(player, bIsWearing)

shared gamemodes/catwork/gamemode/core/items/sh_accessory_base.lua:22

Called when a player puts the accessory on or takes it off; does nothing in the base.

Parameters

  • player Player The player wearing the accessory
  • bIsWearing Boolean true when the accessory was put on, false when it was taken off

Defined in