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
Hooks
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
- pda Panel The
cwCombinePlayerCardpanel
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) andimportant(Boolean, highlights the entry)
See also
cca.AppendLog(appender, player, entry, type)
shared gamemodes/cwhl2rp/plugins/cca/plugin/sh_plugin.lua:77Adds 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
defaulttype when it is not registered
cca:HandleCitizenStatusButton(panel, id)
client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:19Implements hook HandleCitizenStatusButton
Called when a citizen status is picked on a PDA player card; asks the server to set it.
Parameters
- panel Panel The
cwCombinePlayerCardpanel; itsplayerfield is the target - id String The status:
Unverified,Citizen,AntiCitizenorNoData
cca:HandleCrimePointsIssue(panel, value)
client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:47Implements hook HandleCrimePointsIssue
Called when crime points are issued on a PDA player card; asks the server to add them.
Parameters
- panel Panel The
cwCombinePlayerCardpanel; itsplayerfield is the target - value Number The points to add
cca:HandleCrimePointsSubstract(panel, value)
client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:61Implements hook HandleCrimePointsSubstract
Called when crime points are removed on a PDA player card; asks the server to remove them.
Parameters
- panel Panel The
cwCombinePlayerCardpanel; itsplayerfield is the target - value Number The change, as a negative number
Implements hook HandleJailButton
Called when jailing is confirmed on a PDA player card; asks the server to jail the target.
Parameters
- panel Panel The
cwCombinePlayerCardpanel; itsplayerfield is the target
cca:HandleJobChangeButton(panel, value)
client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:33Implements hook HandleJobChangeButton
Called when a new job is entered on a PDA player card; asks the server to set it.
Parameters
- panel Panel The
cwCombinePlayerCardpanel; itsplayerfield is the target - value String The new job
Implements hook HandleJobPointsIssue
Called when work points are issued on a PDA player card; asks the server to add them.
Parameters
- panel Panel The
cwCombinePlayerCardpanel; itsplayerfield is the target - value Number The points to add
cca:HandleLoyaltyPointsIssue(panel, value)
client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:40Implements hook HandleLoyaltyPointsIssue
Called when loyalty points are issued on a PDA player card; asks the server to add them.
Parameters
- panel Panel The
cwCombinePlayerCardpanel; itsplayerfield is the target - value Number The points to add
cca:HandleLoyaltyPointsSubstract(panel, value)
client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:54Implements hook HandleLoyaltyPointsSubstract
Called when loyalty points are removed on a PDA player card; asks the server to remove them.
Parameters
- panel Panel The
cwCombinePlayerCardpanel; itsplayerfield is the target - value Number The change, as a negative number
cca:HandleResidenceChangeButton(panel, value)
client gamemodes/cwhl2rp/plugins/cca/plugin/cl_plugin.lua:26Implements hook HandleResidenceChangeButton
Called when a new residence is entered on a PDA player card; asks the server to set it.
Parameters
- panel Panel The
cwCombinePlayerCardpanel; itsplayerfield is the target - value String The new residence address
Implements hook HandleUnjailButton
Called when unjailing is confirmed on a PDA player card; asks the server to release the target.
Parameters
- panel Panel The
cwCombinePlayerCardpanel; itsplayerfield is the target
Implements hook MenuItemsAdd
Called when the main menu items are added; adds the Combine PDA for Combine and CWU players.
Parameters
- menuItems Map The menu item list, with an
Addmethod
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