Accessory Base item
Item defined in core/items/sh_accessory_base.lua
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
CanPlayerWear allows it.Methods
Returns the tooltip line saying whether the local player is wearing the accessory.
Returns
- String Language key for the wearing state, or
nilfor a non-instance item
ITEM:HasPlayerEquipped(player, bIsValidWeapon)
shared gamemodes/catwork/gamemode/core/items/sh_accessory_base.lua:26Returns 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
falsewhile the player wears the accessory, otherwisenil
ITEM:OnPlayerUnequipped(player, extraData)
shared gamemodes/catwork/gamemode/core/items/sh_accessory_base.lua:35Takes the accessory off the player.
Parameters
- player
- extraData
ITEM:OnUse(player, itemEntity)
shared gamemodes/catwork/gamemode/core/items/sh_accessory_base.lua:50Puts the accessory on a living, standing player if the item's optional CanPlayerWear allows it.
Parameters
- player
- itemEntity
Returns
- Boolean
truewhen worn (the item stays in the inventory),falseotherwise
ITEM:OnWearAccessory(player, bIsWearing)
shared gamemodes/catwork/gamemode/core/items/sh_accessory_base.lua:22Called 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
truewhen the accessory was put on,falsewhen it was taken off