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

Returns the tooltip line saying whether the local player is wearing the clothes.
Returns the model to show for the item in menus: GetReplacement, replacement, or the group citizen model.
Returns the citizen model file name matching the player's default model, for building a clothes model path.
Returns whether the player is wearing these clothes; on the client it checks the local player.
Sets the player's model to the clothes model when worn and restores the default model and skin when removed.
Called when a player drops the clothes; blocks the drop while they are worn.
Takes the clothes off the player.
Dresses the player in the clothes if their faction is on the 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 nil for 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 nil to use the item's own model

ITEM:GetModelName(player, group)

shared gamemodes/catwork/gamemode/core/items/sh_clothes_base.lua:23

Returns 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.client The player whose default model is used
  • group Boolean optional, defaults to nil Keep the group folder in the result (fallback becomes group05/...)

Returns

  • String The model file name, with its group folder when group is set

ITEM:HasPlayerEquipped(player, bIsValidWeapon)

shared gamemodes/catwork/gamemode/core/items/sh_clothes_base.lua:103

Returns 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:76

Sets 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 true when the clothes are put on, false when they are taken off

Called when a player drops the clothes; blocks the drop while they are worn.

Parameters

  • player
  • position

Returns

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

ITEM:OnPlayerUnequipped(player, extraData)

shared gamemodes/catwork/gamemode/core/items/sh_clothes_base.lua:112

Takes 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 true when worn (the item stays in the inventory), false otherwise

Defined in