Main file of the Combine Civil Authority plugin, which aliases it as cca, includes its files and defines the civil record log.

cca.AppendLog adds an entry to a player's civil record, stored in the CCA_Logs character data and networked as a net var of the same name; cca.TrimLogs keeps the record to its newest 50 entries. cca.AddLogType and cca.GetLogType set how each entry type (loyalty, crime and work points, jail and unjail) is colored and highlighted.

Summary

Hooks

Called when a PDA player card is created; adds the status, residence, job, points and jail buttons.
Registers how a type of civil record entry is displayed.
Adds an entry to a player's civil record.
Returns the display options of a civil record entry type.
Called when a citizen status is picked on a PDA player card; asks the server to set it.
Called when crime points are issued on a PDA player card; asks the server to add them.
Called when crime points are removed on a PDA player card; asks the server to remove them.
Called when jailing is confirmed on a PDA player card; asks the server to jail the target.
Called when a new job is entered on a PDA player card; asks the server to set it.
Called when work points are issued on a PDA player card; asks the server to add them.
Called when loyalty points are issued on a PDA player card; asks the server to add them.
Called when loyalty points are removed on a PDA player card; asks the server to remove them.
Called when a new residence is entered on a PDA player card; asks the server to set it.
Called when unjailing is confirmed on a PDA player card; asks the server to release the target.
Called when the main menu items are added; adds the Combine PDA for Combine and CWU players.
Called when a player's character has loaded; networks the character's civil record.
Drops the oldest entries of a civil record until it holds no more than 50.

Hooks

cca:AddCombinePDAButons(pda)

client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:91

Implements hook AddCombinePDAButons

Called when a PDA player card is created; adds the status, residence, job, points and jail buttons.

Each button opens a prompt and passes the answer to the matching Handle... hook through plugin.Call. Points and jail buttons are flagged Combine only, and CWU players can only pick the Unverified and Citizen statuses.

Parameters

cca.AddLogType(type, data)

shared gamemodes/cwhl2rp/plugins/cca/plugin/sh_plugin.lua:36

Registers how a type of civil record entry is displayed.

cca.AddLogType('jail', {
  color = Color(240, 130, 130),
  important = true
})

Parameters

  • type String Name of the entry type, as passed to cca.AppendLog
  • data Map Display options: color (Color of the entry) and important (Boolean, highlights the entry)

See also

cca.AppendLog(appender, player, entry, type)

shared gamemodes/cwhl2rp/plugins/cca/plugin/sh_plugin.lua:77

Adds an entry to a player's civil record.

The record is stored in the CCA_Logs character data and networked to clients as the CCA_Logs net var; only its newest 50 entries are kept. On the server a valid appender is told to refresh their PDA. Does nothing when player is not valid.

cca.AppendLog(officer, citizen, L('PDA_Log_Jail'), 'jail')

Parameters

  • appender Player The player who writes the entry; entries without a valid player are signed by Overwatch
  • player Player The player whose record gets the entry
  • entry String Text of the entry
  • type String Entry type, registered with cca.AddLogType

Returns the display options of a civil record entry type.

Parameters

  • type String Name of the entry type

Returns

  • Map The type's options, or those of the default type when it is not registered

cca:HandleCitizenStatusButton(panel, id)

client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:19

Implements hook HandleCitizenStatusButton

Called when a citizen status is picked on a PDA player card; asks the server to set it.

Parameters

  • panel Panel The cwCombinePlayerCard panel; its player field is the target
  • id String The status: Unverified, Citizen, AntiCitizen or NoData

cca:HandleCrimePointsIssue(panel, value)

client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:47

Implements hook HandleCrimePointsIssue

Called when crime points are issued on a PDA player card; asks the server to add them.

Parameters

  • panel Panel The cwCombinePlayerCard panel; its player field is the target
  • value Number The points to add

cca:HandleCrimePointsSubstract(panel, value)

client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:61

Implements hook HandleCrimePointsSubstract

Called when crime points are removed on a PDA player card; asks the server to remove them.

Parameters

  • panel Panel The cwCombinePlayerCard panel; its player field is the target
  • value Number The change, as a negative number

cca:HandleJailButton(panel)

client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:74

Implements hook HandleJailButton

Called when jailing is confirmed on a PDA player card; asks the server to jail the target.

Parameters

cca:HandleJobChangeButton(panel, value)

client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:33

Implements hook HandleJobChangeButton

Called when a new job is entered on a PDA player card; asks the server to set it.

Parameters

  • panel Panel The cwCombinePlayerCard panel; its player field is the target
  • value String The new job

cca:HandleJobPointsIssue(panel, value)

client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:68

Implements hook HandleJobPointsIssue

Called when work points are issued on a PDA player card; asks the server to add them.

Parameters

  • panel Panel The cwCombinePlayerCard panel; its player field is the target
  • value Number The points to add

cca:HandleLoyaltyPointsIssue(panel, value)

client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:40

Implements hook HandleLoyaltyPointsIssue

Called when loyalty points are issued on a PDA player card; asks the server to add them.

Parameters

  • panel Panel The cwCombinePlayerCard panel; its player field is the target
  • value Number The points to add

cca:HandleLoyaltyPointsSubstract(panel, value)

client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:54

Implements hook HandleLoyaltyPointsSubstract

Called when loyalty points are removed on a PDA player card; asks the server to remove them.

Parameters

  • panel Panel The cwCombinePlayerCard panel; its player field is the target
  • value Number The change, as a negative number

cca:HandleResidenceChangeButton(panel, value)

client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:26

Implements hook HandleResidenceChangeButton

Called when a new residence is entered on a PDA player card; asks the server to set it.

Parameters

  • panel Panel The cwCombinePlayerCard panel; its player field is the target
  • value String The new residence address

cca:HandleUnjailButton(panel)

client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:80

Implements hook HandleUnjailButton

Called when unjailing is confirmed on a PDA player card; asks the server to release the target.

Parameters

cca:PlayerCharacterLoaded(player)

server gamemodes/cwhl2rp/plugins/cca/plugin/sv_plugin.lua:44

Implements hook PlayerCharacterLoaded

Called when a player's character has loaded; networks the character's civil record.

Parameters

  • player Player The player whose character loaded

Drops the oldest entries of a civil record until it holds no more than 50.

Parameters

  • logs List The record, oldest entry first; changed in place

Returns

  • List The same record

Defined in