Clothes Base item
Item defined in core/items/sh_clothes_base.lua
Defines the clothes_base base item for clothing, which changes the player's model while worn and restores the
default model when taken off.
The model comes from the item's GetReplacement, its replacement, or its group, a citizen model folder matched
to the player's own model. A whitelist of factions and an optional CanPlayerWear restrict who can wear the
clothes, and they cannot be dropped while worn.
Summary
Methods
GetReplacement, replacement, or the group citizen model.whitelist and CanPlayerWear allows it.Methods
Returns the tooltip line saying whether the local player is wearing the clothes.
Returns
- String Translated wearing state, or
nilfor a non-instance item
Returns the model to show for the item in menus: GetReplacement, replacement, or the group citizen model.
Returns
- String The model path, or
nilto use the item's own model
ITEM:GetModelName(player, group)
shared gamemodes/catwork/gamemode/core/items/sh_clothes_base.lua:23Returns the citizen model file name matching the player's default model, for building a clothes model path.
Strips the folders from the player's default model. If that model is not a male/female citizen model, it
falls back to male_05.mdl or female_04.mdl by gender.
Parameters
- player Player optional, defaults to
cw.clientThe player whose default model is used - group Boolean optional, defaults to
nilKeep the group folder in the result (fallback becomesgroup05/...)
Returns
- String The model file name, with its group folder when
groupis set
ITEM:HasPlayerEquipped(player, bIsValidWeapon)
shared gamemodes/catwork/gamemode/core/items/sh_clothes_base.lua:103Returns whether the player is wearing these clothes; on the client it checks the local player.
Parameters
- player
- bIsValidWeapon
Returns
- Boolean Whether the clothes are worn
ITEM:OnChangeClothes(player, bIsWearing)
shared gamemodes/catwork/gamemode/core/items/sh_clothes_base.lua:76Sets the player's model to the clothes model when worn and restores the default model and skin when removed.
Calls the item's optional OnChangedClothes(player, bIsWearing) afterwards.
Parameters
- player Player The player changing clothes
- bIsWearing Boolean
truewhen the clothes are put on,falsewhen they are taken off
Called when a player drops the clothes; blocks the drop while they are worn.
Parameters
- player
- position
Returns
- Boolean
falsewhile the player wears the clothes, otherwisenil
ITEM:OnPlayerUnequipped(player, extraData)
shared gamemodes/catwork/gamemode/core/items/sh_clothes_base.lua:112Takes the clothes off the player.
Parameters
- player
- extraData
Dresses the player in the clothes if their faction is on the whitelist and CanPlayerWear allows it.
Parameters
- player
- itemEntity
Returns
- Boolean
truewhen worn (the item stays in the inventory),falseotherwise