Defines the cw.flag library, the registry of single-character player flags with their names and descriptions.

On the client every registered flag is listed on the Flags page of the directory. The file adds the framework's own flags, such as p for the physics gun, t for the tool gun and e for spawning props.

Summary

Methods

Registers a player flag.
Get(flag)shared
Returns a registered flag.
Returns a flag's details.
Finds a flag by its display name, ignoring case.
Returns a flag's display name.
Returns every registered flag.

Methods

cw.flag:Add(flag, name, details)

shared gamemodes/catwork/gamemode/core/libraries/sh_flag.lua:23

Registers a player flag.

On the client the flag is also added to the Flags page of the directory, shown in green when the local player has it. The details are translated when the page is shown.

cw.flag:Add('x', 'Voice Access', '#Flag_VoiceAccess_Details')

Parameters

  • flag String The single flag character
  • name String Display name of the flag
  • details String Description of what the flag allows, can be a language phrase

Returns a registered flag.

Parameters

  • flag String The flag character

Returns

  • Map The flag's name and details, or nil if it is not registered

cw.flag:GetDescription(flag, default)

shared gamemodes/catwork/gamemode/core/libraries/sh_flag.lua:81

Returns a flag's details.

Parameters

  • flag String The flag character
  • default Any optional, defaults to nil Value returned when the flag is not registered

Returns

  • String The flag's details, or default

cw.flag:GetFlagByName(name, default)

shared gamemodes/catwork/gamemode/core/libraries/sh_flag.lua:94

Finds a flag by its display name, ignoring case.

Parameters

  • name String Display name of the flag
  • default Any optional, defaults to nil Value returned when no flag has that name

Returns

  • String The flag character, or default

cw.flag:GetName(flag, default)

shared gamemodes/catwork/gamemode/core/libraries/sh_flag.lua:68

Returns a flag's display name.

Parameters

  • flag String The flag character
  • default Any optional, defaults to nil Value returned when the flag is not registered

Returns

  • String The flag's name, or default

Returns every registered flag.

Returns

  • Map<Map> Flag tables with name and details keys, keyed by flag character

Defined in