Hooks hooks
Hooks called by Catwork
Summary
Hooks
#Hint_ hint.GM:CalcView; does nothing by default.GM:Initialize.cw.core:CreateConVar has changed.GM:Initialize.GM:InitPostEntity; does nothing by default.cw.bans:Load.cw.database:Error.use_free_aiming it follows where the weapon actually aims.cw.class:GetAppropriateModel for their team.cw.class:GetAppropriateModel for their team.OnNetworkDataUpdated.OnMenuClosed on each menu panel and closes tooltips and Derma menus.OnMenuOpened on each menu panel that has it.GM:PlayerThink.cw.OneSecondTimer timer.false to stop the default draw.cw_hands, to adjust the delay before the next punch; does nothing by default.Player:Give; return false to block it./SetClass; refuses during the class change cooldown.false delays the shot./CharGetUp; always allows it.cw_hands hits an entity, to check whether it damages it; never does by default.cw_hands hits a player, to check whether it knocks them out.cwAdminESP ConVar.cwStatus, to get the status line shown for them.cw_hands; always allows it.+zoom; always allows it.cw.storage:SyncCash.cw.player:HasDoorAccess to check whether a player has an access level on a door.cw.player:HasFlags to check whether a player has a flag they do not hold themselves.Player:GetHoldingEntity to get the entity a player is holding.false to keep the cash from being given.cw.storage:SyncItem.Player:SetModel, on both realms.Whitelisted exists.Whitelisted table.use or delete; does nothing by default.GM:PlayerSpawn.Hooks
Called when entity outlines should be added; outlines the entity whose entity menu is open.
Parameters
- outlines Map The
cw.outlinelibrary; calloutlines:Add(entity, color)
Called from
Call sites
Called when GMod shows a notification; passes it to the base gamemode unless it is a #Hint_ hint.
Parameters
- text String The notification text
- class Number The notification type (
NOTIFY_*) - length Number How long it stays
Call sites
Called to add ammo types that are saved with the character; adds the HL2 ammo types.
Parameters
- ammoTable Map Ammo types to check, as
{ [ammoType] = true }, modified in place
Called from
Call sites
No documentation available.
Arguments
chatbox
Called from
Call sites
AdjustCModelHandsInfo(model, info)
shared gamemodes/catwork/gamemode/core/libraries/sh_animation.lua:833No documentation available.
Arguments
modelinfo
Called from
Call sites
No documentation available.
Arguments
defaultSensitivity
Called from
Call sites
AdjustRollNumber(player, roll, number, (PVPMode and target) or nil)
shared gamemodes/catwork/gamemode/core/commands/sh_roll.lua:29No documentation available.
Arguments
playerrollnumber(PVPMode and target) or nil
Called from
Call sites
No documentation available.
Arguments
groups
Called from
Call sites
Called to adjust the final view table from GM:CalcView; does nothing by default.
Parameters
- view Map The view table, with
origin,anglesandfov, modified in place
Called from
Call sites
Called to check whether the Catwork crosshair is drawn; never by default.
Parameters
- weapon Weapon The local player's active weapon
Returns
- Boolean Whether the crosshair is drawn
Called from
Call sites
Called before the main menu is opened or closed with the scoreboard key; always allows it.
Returns
- Boolean Whether the menu opens or closes
Called from
Call sites
CashEntityDraw(self)
client gamemodes/catwork/gamemode/core/entities/entities/cw_cash/cl_init.lua:18No documentation available.
Arguments
self
Called from
Call sites
CharacterScreenSortFactionCharacters(k, a, b)
client gamemodes/catwork/gamemode/core/libraries/cl_character.lua:312Called to sort the characters within a faction on the character screen; sorts them by name.
Parameters
- faction String The faction name
- a Map The first character's screen info
- b Map The second character's screen info
Returns
- Boolean Whether
acomes beforeb
Call sites
No documentation available.
Arguments
listenersmessage
Called from
Call sites
ChatboxAdjustMessageInfo(message, listeners)
server gamemodes/catwork/gamemode/core/libraries/sv_chatbox.lua:387No documentation available.
Arguments
messagelisteners
Called from
Call sites
ChatBoxClosed(chatbox.GetCurrentText())
client gamemodes/catwork/gamemode/core/libraries/cl_chatbox.lua:1305Called when the chat box is closed; does nothing by default.
Parameters
- textTyped String The text left in the chat box
Called from
Call sites
ChatboxEntryPaint(self, 0, 0, w, h)
client gamemodes/catwork/gamemode/core/libraries/cl_chatbox.lua:1136No documentation available.
Arguments
self00wh
Called from
Call sites
ChatBoxKeyCodeTyped(code, self:GetValue())
client gamemodes/catwork/gamemode/core/libraries/cl_chatbox.lua:1200Called when a key is typed in the chat box; up and down cycle through the remembered messages.
Parameters
- code Number The key code (
KEY_*) - text String The current chat box text
Returns
- String Text to replace the chat box contents with, or
nil
Called from
Call sites
No documentation available.
Arguments
message
Called from
Call sites
ChatboxPlayerSay(player, message)
server gamemodes/catwork/gamemode/core/libraries/sv_chatbox.lua:553No documentation available.
Arguments
playermessage
Call sites
No documentation available.
Arguments
messageData
Called from
Call sites
ChatBoxTextChanged(self.previousText or '', text)
client gamemodes/catwork/gamemode/core/libraries/cl_chatbox.lua:1174Called when the chat box text has changed; does nothing by default.
Parameters
- previousText String The previous text
- newText String The new text
Called from
Call sites
Called when chat box text has been sent; remembers the last 25 messages for the up and down keys.
Parameters
- text String The text sent
Called from
Call sites
ClockworkConfigChanged(self.key, self.data, previousValue, self.data.value)
shared gamemodes/catwork/gamemode/core/libraries/sh_config.lua:694Called when a config value has changed.
Applies the change to connected players: gives or takes the physgun and toolgun when the
p/t default flags change, shows or hides the group commands for use_own_group_system,
resets OOC cooldowns for ooc_interval and updates movement for crouched_speed,
jump_power, walk_speed and run_speed.
Parameters
- key String The config key
- data Map The config entry
- previousValue Any The previous value
- newValue Any The new value
Called from
Call sites
ClockworkConfigInitialized(k, v.value)
shared gamemodes/catwork/gamemode/core/libraries/sh_config.lua:728Called for each config key once the config has initialized, from GM:Initialize.
Zeroes every item's cost when cash_enabled is off and turns off sv_alltalk when
local_voice is on.
Parameters
- key String The config key
- value Any The config value
Called from
Call sites
ClockworkConVarChanged(conVar, previousValue, newValue)
shared gamemodes/catwork/gamemode/core/cl_kernel.lua:305Called when a ConVar created with cw.core:CreateConVar has changed.
Sets sv_alltalk to 1 when the changed ConVar is local_voice and the new value is truthy.
Parameters
- name String The ConVar name
- previousValue String The previous value
- newValue String The new value
Call sites
Called when the directory is rebuilt; lists help only for the commands the local player has the flags for.
Parameters
- panel Panel The directory panel
Called from
Call sites
Called when Catwork has initialized, at the end of GM:Initialize.
Hides the cash commands and zeroes prop and door costs when cash is disabled, hides the group
commands when use_own_group_system is set, adds the gradient, schema logo and intro image
materials to the download list, registers Catwork tools with gmod_tool and sets sv_maxrate
to 80000.
Called from
Call sites
Called after Catwork has processed the map entities in GM:InitPostEntity; does nothing by default.
Called from
Call sites
No documentation available.
Arguments
v
Called from
Call sites
No documentation available.
Call sites
No documentation available.
Arguments
textunixTime
Called from
Call sites
ClockworkPostItemsInitialized(itemsTable)
shared gamemodes/catwork/gamemode/core/libraries/sh_item.lua:850No documentation available.
Arguments
itemsTable
Called from
Call sites
No documentation available.
Call sites
Called when the Catwork database has connected; loads the ban list with cw.bans:Load.
Called from
Call sites
DatabaseConnectionFailed(errorText)
server gamemodes/catwork/gamemode/core/libraries/sv_database.lua:1040Called when the Catwork database connection fails; reports it with cw.database:Error.
Parameters
- errText String The error message from the database module
Called from
Call sites
Called after the HUD bars are collected, so bars can be removed; does nothing by default.
Parameters
- bars Map The
cw.barslibrary
Called from
Call sites
Called after the player info text is collected, so lines can be removed; does nothing by default.
Parameters
- playerInfoText Map
cw.PlayerInfoText
Called from
Call sites
DestroyTargetPlayerText(entity, cw.TargetPlayerText)
client gamemodes/catwork/gamemode/hooks/cl_hooks.lua:1578Called after the target player text is collected, so lines can be removed; does nothing by default.
Parameters
- player Player The player looked at
- targetPlayerText Map
cw.TargetPlayerText
Called from
Call sites
DoPlayerDeath(player, attacker, damageInfo)
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:4276Called just before a player dies.
Drops the player's weapons, clears action and drunkenness, turns the body into a knocked out
ragdoll that decays after body_decay_time (600 seconds when that is 0), clears recognised
names and the name when the death hooks allow, plays the death sound, strips weapons and ammo,
adds a death and gives the killer a frag when PlayerCanGainFrag allows.
Parameters
- player Player The player
- attacker Entity The killer
- damageInfo CTakeDamageInfo The fatal damage
Called from
Call sites
No documentation available.
Arguments
barInfo
Called from
Call sites
DrawPlayerCrosshair(info.x, info.y, info.color)
client gamemodes/catwork/gamemode/hooks/cl_hooks.lua:2869Called when the local player's crosshair should be drawn; draws five small dots.
Parameters
- x Number The crosshair x position
- y Number The crosshair y position
- color Color The crosshair colour
Returns
- Boolean Stored in
cw.CustomCrosshair;truewhen a custom crosshair was drawn
Called from
Call sites
DrawPlayerStatusExtra(entity, alpha, x, y)
client gamemodes/catwork/gamemode/hooks/cl_hooks.lua:1580No documentation available.
Arguments
entityalphaxy
Called from
Call sites
Called when the local player's vignette should be drawn.
The vignette darkens when something is above the player, checked once a second.
Called from
Call sites
DrawTargetPlayerStatus(entity, alpha, x, y)
client gamemodes/catwork/gamemode/hooks/cl_hooks.lua:1581Called to draw a looked at player's status below their target ID; shows that they are deceased.
Parameters
- target Player The player looked at
- alpha Number The text alpha
- x Number The text x position
- y Number The text y position
Returns
- Number The y position below what was drawn
Called from
Call sites
Called when an entity fires bullets; overridden to do nothing.
Parameters
- entity Entity The entity firing
- bulletInfo Map The
Bulletstructure
Called from
Call sites
EntityHandleMenuOption(player, entity, option, arguments)
server gamemodes/catwork/gamemode/hooks/sv_nethooks.lua:98Called when a player picks an option from an entity's menu.
Handles taking, using, examining and unloading ammo from cw_item entities (refusing to
take, use or unload items dropped by another character, and running PlayerPickupItem),
forwards other item options to the item's EntityHandleMenuOption, opens cw_belongings and
cw_shipment storage, and takes cw_cash.
Parameters
- player Player The player
- entity Entity The entity
- option String The option's display name
- arguments String The option's argument, such as
cw.itemTake
Call sites
Called when an entity takes damage; Catwork's central damage handler.
Lets cw.core:DoEntityTakeDamageHook handle it first. With prop_kill_protection, damage from
immune or held props is cancelled. Damage to players and player ragdolls is scaled by
GM:ScaleDamageByHitGroup and applied through cw.core:CalculatePlayerDamage; fatal damage
runs DoPlayerDeath and PlayerDeath, other damage runs PlayerTakeDamage, plays
PlayerPlayPainSound and is logged. Ragdoll damage is filtered by
PlayerRagdollCanTakeDamage. Plain ragdolls bleed and are disintegrated by combine balls, and
crowbar damage to NPCs is quartered.
Parameters
- entity Entity The damaged entity
- damageInfo CTakeDamageInfo The damage
Called from
Call sites
No documentation available.
Called from
Call sites
GearEntityDraw(self)
client gamemodes/catwork/gamemode/core/entities/entities/cw_gear/cl_init.lua:80No documentation available.
Arguments
self
Called from
Call sites
Called each tick when the HUD bars are collected; does nothing by default.
Parameters
- bars Map The
cw.barslibrary; add bars with its functions
Called from
Call sites
Called to get how long the character loading screen lasts; 8 seconds.
Returns
- Number The loading time in seconds
Called from
Call sites
GetCharacterPanelLabels(labels, self.customData)
client gamemodes/catwork/gamemode/core/derma/cl_character.lua:883No documentation available.
Arguments
labelsself.customData
Called from
Call sites
GetCharacterPanelSequence(modelPanel.Entity, self.customData.charTable)
client gamemodes/catwork/gamemode/core/derma/cl_character.lua:922No documentation available.
Arguments
modelPanel.Entityself.customData.charTable
Called from
Call sites
GetCharacterPanelToolTip(self, self.customData.charTable)
client gamemodes/catwork/gamemode/core/derma/cl_character.lua:1109Called to get the tooltip of a character in the character menu.
When there is more than one faction it shows how many players are in the character's faction and the faction's limit.
Parameters
- panel Panel The character panel
- character Map The character's screen info
Returns
- String The tooltip, or
nilfor none
Called from
Call sites
GetCharacterPanelWeaponModel(self, self.customData.charTable)
client gamemodes/catwork/gamemode/core/derma/cl_character.lua:1106No documentation available.
Arguments
selfself.customData.charTable
Called from
Call sites
Called when the cinematic intro info is needed; uses the schema's author, name and description.
Returns
- Map
credits,titleandtextof the intro
Called from
Call sites
GetCustomCharacterButtons(self.customData.charTable, buttonsList)
client gamemodes/catwork/gamemode/core/derma/cl_character.lua:944No documentation available.
Arguments
self.customData.charTablebuttonsList
Called from
Call sites
GetCustomCharacterOptions(self.customData.charTable, options)
client gamemodes/catwork/gamemode/core/derma/cl_character.lua:1018No documentation available.
Arguments
self.customData.charTableoptions
Call sites
Called when a piece of information about a door is needed for its 3D2D text.
For DOOR_INFO_NAME it returns the door's name or a default; for DOOR_INFO_TEXT its text,
or whether it is unownable, can be bought or owned, or has been bought or owned (depending on
door_cost). Hidden and false doors show nothing.
Parameters
- door Entity The door
- information Number What is needed,
DOOR_INFO_NAMEorDOOR_INFO_TEXT
Returns
- String The text, or
falseto show nothing
Called from
Call sites
Called to get who is holding an entity.
Parameters
- entity Entity The entity
Returns
- Any The player holding it with a gravity or physics gun, or whether a player holds it with use
Called from
Call sites
Called when an entity's menu options are needed.
Adds use (when the item has OnUse), take and examine options for cw_item entities plus the
item's own GetEntityMenuOptions, open for cw_belongings and cw_shipment, and take for
cw_cash. The values are sent to the server's GM:EntityHandleMenuOption.
Parameters
- entity Entity The entity
- options Map Option names mapped to their argument strings, modified in place
Called from
Call sites
Called to get the fall damage a player takes.
Damage grows above 464 units/s and is scaled by scale_fall_damage. With wood_breaks_fall,
landing on a wooden physics prop breaks it and cuts the damage to a quarter. Falls dealing more
than 30 damage make the player fall over.
Parameters
- player Player The falling player
- velocity Number The fall speed
Returns
- Number The damage to deal
Called from
Call sites
GetModelSelectSequence(modelPanel.Entity, model)
client gamemodes/catwork/gamemode/core/derma/cl_character.lua:258No documentation available.
Arguments
modelPanel.Entitymodel
Called from
Call sites
No documentation available.
Arguments
model
Called from
Call sites
GetPersuasionChoices(self.customChoices)
shared gamemodes/catwork/gamemode/core/derma/cl_character.lua:2051No documentation available.
Arguments
self.customChoices
Called from
cw.characterStageOne:Initcw.player:CreateCharacterFromDataGetCustomCreationFields
Call sites
GetPlayerCharacterScreenFaction(v)
client gamemodes/catwork/gamemode/core/libraries/cl_character.lua:304Called to get which faction group a character is shown under on the character screen; uses its faction.
Parameters
- character Map The character's screen info
Returns
- String The faction name
Called from
Call sites
Called each frame to check whether the character screen is visible.
When the quiz is enabled, it stays hidden until the quiz is completed.
Parameters
- panel Panel The character menu
Returns
- Boolean Whether the character screen is visible
Called from
Call sites
Called to position the local player's crosshair; with use_free_aiming it follows where the weapon actually aims.
Parameters
- info Map
color,xandyof the crosshair, modified in place
Called from
Call sites
GetPlayerDefaultInventory(player, character, character.inventory)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3721Called to fill a new character's starting inventory.
Adds the items in the character's faction startingInv table ({ [uniqueID] = amount }).
Parameters
- player Player The player creating the character
- character Character The character being created
- inventory Inventory The inventory to add items to
Called from
Call sites
Called to get a player's default model, from cw.class:GetAppropriateModel for their team.
Parameters
- player Player The player to get the model for
Returns
- String The default model path
Called from
Call sites
Called to get a player's default skin, from cw.class:GetAppropriateModel for their team.
Parameters
- player Player The player to get the skin for
Returns
- Number The default skin
Called from
Call sites
GetPlayerDoorAccessName(v, door, owner)
client gamemodes/catwork/gamemode/core/derma/cl_door.lua:180Called to get the name a player is listed under in the door access menu; uses their name.
Parameters
- player Player The player listed
- door Entity The door
- owner Player The door's owner
Returns
- String The name shown
Called from
Call sites
Called when the local player's info text (shown in the F1 menu) is needed.
Adds cash and wages when cash is enabled, and the player's name and class as sub text.
Parameters
- playerInfoText Map
cw.PlayerInfoText; call itsAdd(id, text)andAddSub(id, text, priority)
Called from
Call sites
GetPlayerPhysDescOverride(player, physDesc)
shared gamemodes/catwork/gamemode/core/libraries/cl_player.lua:584No documentation available.
Arguments
playerphysDesc
Called from
Call sites
Called to get the scoreboard group a player is listed under; uses their team name.
Parameters
- player Player The player
Returns
- String The group name
Called from
Call sites
GetPlayerScoreboardOptions(info.player, options)
client gamemodes/catwork/gamemode/core/derma/cl_scoreboard.lua:218Called when the admin options for a player on the scoreboard are needed.
Adds ban, kick, flag, name, item, user group, demote and whitelist options for the commands the local player has access to. Each option runs the matching command, asking for text first where the command needs it.
Parameters
- player Player The player the options act on
- options Map Option names mapped to callbacks, or to nested option maps for submenus
- menu Panel Unused; the callers do not pass it
Call sites
GetPlayerScoreboardText(info.player)
client gamemodes/catwork/gamemode/core/derma/cl_scoreboard.lua:180Called to get the text under a player's name on the scoreboard.
Shows the physical description (cut to 64 characters) of recognised players and a generic line for others.
Parameters
- player Player The player
Returns
- String The text
Called from
Call sites
No documentation available.
Called from
Call sites
Called to get the progress bar shown in the middle of the screen.
Shows locking and unlocking progress, getting up progress while ragdolled, and the get up
prompt while fallen over when PlayerCanGetUp allows. Nothing is shown while waiting to
respawn.
Returns
- Map
text,percentage,flash,isBlockyandblocksAmtof the bar, ornilfor no bar
Called from
Call sites
Called to get the text shown in the middle of the screen; shows a notice while the character is banned.
Returns
- Map
title,textandalphaof the text, ornilto show nothing
Called from
Call sites
Called to get a player's status lines for the admin ESP.
Adds the player's current action (locking, unlocking, getting up, dead or another action) and whether they have fallen over.
Parameters
- player Player The player
- text List<String> The status lines, added to in place
Called from
Call sites
Called to get how far away a player's target ID text stays visible; 4096 units by default.
Parameters
- player Player The player looked at
Returns
- Number The fade distance
Called from
Call sites
Called to get the name drawn on a recognised player's target ID; uses their name.
Parameters
- player Player The player looked at
Returns
- String The name, which may contain newlines
Called from
Call sites
GetTargetPlayerText(entity, cw.TargetPlayerText)
client gamemodes/catwork/gamemode/hooks/cl_hooks.lua:1577Called when the text below a looked at player's name is needed.
Adds the wrapped physical description of recognised players, or a prompt to look at them for unrecognised living players.
Parameters
- player Player The player looked at
- targetPlayerText Map
cw.TargetPlayerText; call itsAdd(id, text)
Called from
Call sites
GetWeaponLoweredViewInfo(itemTable, weapon, viewInfo)
client gamemodes/catwork/gamemode/hooks/cl_hooks.lua:724Called to adjust a weapon's lowered view model pose; does nothing by default.
Parameters
- itemTable Item The weapon's item, or
nil - weapon Weapon The weapon
- viewInfo Map
origin(Vector) andangles(Angle) of the lowered pose, which can be changed
Called from
Call sites
Called every half second; every 3 seconds it fades timed attribute boosts and removes expired ones.
Call sites
HUDPaintCharacterLoading(math.Clamp((255 / cw.CharacterLoadingDelay) * (cw.CharacterLoadingFinishTime - c…)
client gamemodes/catwork/gamemode/hooks/cl_hooks.lua:2713No documentation available.
Arguments
math.Clamp((255 / cw.CharacterLoadingDelay) * (cw.CharacterLoadingFinishTime - c…
Called from
Call sites
No documentation available.
Called from
Call sites
HUDPaintEntityTargetID(ent, { alpha = alpha, x = x, y = y })
client gamemodes/catwork/gamemode/hooks/cl_hooks.lua:1618No documentation available.
Arguments
ent{ alpha = alpha, x = x, y = y }
Called from
Call sites
Called when the foreground HUD should be painted.
Draws the hook error notice, the fallen over and underwater blur, the progress bar from
GetProgressBarInfo (or GetPostProgressBarInfo), the admin ESP when PlayerCanSeeAdminESP
allows, the GetScreenTextInfo text, the top bars and the death screen with the respawn
countdown, then runs HUDPaintTopScreen.
Called from
Call sites
No documentation available.
Called from
Call sites
No documentation available.
Arguments
info
Called from
Call sites
ItemEntityDestroyed(self, itemTable)
server gamemodes/catwork/gamemode/core/entities/entities/cw_item/init.lua:113Called when an item entity has been destroyed by damage, before it explodes; does nothing by default.
Parameters
- itemEntity Entity The
cw_itementity - itemTable Item The item
Called from
Call sites
ItemEntityDraw(itemTable, self)
client gamemodes/catwork/gamemode/core/entities/entities/cw_item/cl_init.lua:76No documentation available.
Arguments
itemTableself
Called from
Call sites
ItemEntityTakeDamage(self, itemTable, damageInfo)
server gamemodes/catwork/gamemode/core/entities/entities/cw_item/init.lua:101Called when an item entity has taken damage, before its health drops; does nothing by default.
Parameters
- itemEntity Entity The
cw_itementity - itemTable Item The item
- damageInfo CTakeDamageInfo The damage, which can be changed
Returns
- Boolean The return value is ignored
Called from
Call sites
ItemEntityThink(itemTable, self)
client gamemodes/catwork/gamemode/core/entities/entities/cw_item/cl_init.lua:65No documentation available.
Arguments
itemTableself
Called from
Call sites
ItemGetNetworkObservers(itemTable, info)
server gamemodes/catwork/gamemode/core/libraries/sh_item.lua:1064Called when an item's data changes, to pick who receives the update.
Items with a world entity are sent to everyone; otherwise the players who carry the item, hold it as a weapon or have it in their open storage are added as observers.
Parameters
- itemTable Item The item
- info Map
observers(aMapof player to player) andsendToAll, which can be changed
Returns
- Boolean
trueto send the update to everyone
Called from
Call sites
ItemNetworkDataUpdated(itemTable, data.data)
client gamemodes/catwork/gamemode/core/libraries/sh_inventory.lua:482Called when an item's network data has been updated; runs the item's OnNetworkDataUpdated.
Parameters
- itemTable Item The item
- newData Map The updated data fields
Call sites
No documentation available.
Call sites
Called when the local player entity has been created.
Watches the Clothes network variable to keep cw.ClothesData and the inventory up to date,
and tells the server a second later with the LocalPlayerCreated message.
Called from
Call sites
Called when the main menu is closed; runs OnMenuClosed on each menu panel and closes tooltips and Derma menus.
Called from
Call sites
Called when the main menu's items should be added.
Adds the settings, system, scoreboard, inventory, directory and attributes tabs, named by the
schema's name_* options.
Parameters
- menuItems Map The
cw.menuitemslibrary; call itsAdd(name, panel, tip, icon)
Called from
Call sites
Called after the main menu's items are added, so they can be removed; does nothing by default.
Parameters
- menuItems Map The
cw.menuitemslibrary
Called from
Call sites
Called when the main menu is opened; runs OnMenuOpened on each menu panel that has it.
Called from
Call sites
Called when the next wages payout is scheduled, to change the interval; does nothing by default.
Parameters
- info Map Has
interval, the seconds until the next payout, which can be changed
Called from
Call sites
Called before a notification from the server is shown, to adjust it; shows every notification.
Parameters
- info Map
text,classandsoundof the notification, which can be changed
Returns
- Boolean Whether the notification is shown
Call sites
OnAttributeProgress(player, attribute, amount)
server gamemodes/catwork/gamemode/core/libraries/sh_attributes.lua:45Called when an attribute is progressed, before the amount is applied.
Catwork multiplies amount by the scale_attribute_progress config.
Parameters
- player Player The player who progressed the attribute
- attribute String The attribute's unique ID
- amount Number The amount it is progressed by
Returns
- Number The amount to progress the attribute by instead
Called from
Call sites
No documentation available.
Call sites
Called about once a second for every initialized player, after GM:PlayerThink.
Handles attribute progress and boosts, networks the player's flags, model, name, cash and
drunk level, networks or removes clothes, runs PlayerHealthRegenerate when health
regeneration is enabled and PlayerShouldHealthRegenerate allows it and expires drunk
entries. When cash is disabled it zeroes the character's cash and wages.
Parameters
- player Player The player being updated
- curTime Number The current
CurTime() - infoTable Map The player's per-think info table (
player.cwInfoTable); fields such aswages,runSpeedandinventoryWeightcan be changed to affect the player
Called from
Call sites
Called once a second on the server, from the cw.OneSecondTimer timer.
Distributes hints every hint_interval and wages every wages_interval (adjustable through
ModifyWagesInterval), advances the in-game clock every minute_time, runs PreSaveData,
SaveData and PostSaveData every save_data_interval, and changes to the same map after
20 minutes with no players.
Call sites
Called when a hook errors; shows the hook error notice on the HUD for 3 seconds.
Parameters
- name String The hook name
- isGM Boolean Whether the error was in a gamemode hook
- message String The error message
Called from
Call sites
No documentation available.
Arguments
sNewMap
Call sites
No documentation available.
Arguments
selfuserGroup
Called from
Call sites
PaintChatboxBackground(0, 0, w, h, self.alpha)
client gamemodes/catwork/gamemode/core/libraries/cl_chatbox.lua:1015No documentation available.
Arguments
00whself.alpha
Called from
Call sites
No documentation available.
Arguments
infoData
Called from
Call sites
PaintItemTargetID(x, y, alpha, itemTable)
client gamemodes/catwork/gamemode/core/entities/entities/cw_item/cl_init.lua:17Called before an item entity's target ID is drawn; return false to stop the default draw.
Parameters
- x Number The text x position
- y Number The text y position
- alpha Number The text alpha
- itemTable Item The item
Returns
- Boolean Whether the default target ID is drawn
Called from
Call sites
PlayerAddToSavedInventory(player, character, function(itemTable) cw.inventory:AddInstance(inventory, itemTable) end)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3865Called when a player's inventory is being saved, to add items that are not in it.
Catwork adds the item of every weapon the player is holding, so equipped weapons are saved.
Parameters
- player Player The player whose inventory is saved
- character Character The character being saved
- Callback Function Call with an
Itemto add it to the saved inventory
Called from
Call sites
Called when a player fires bullets, to adjust the bullet table in place; does nothing by default.
Parameters
- player Player The player firing
- bulletInfo Map The
Bulletstructure passed toEntity:FireBullets
Called from
Call sites
PlayerAdjustBusinessItemTable(self.itemTable)
client gamemodes/catwork/gamemode/core/derma/cl_business.lua:219Called to adjust an item shown in the business menu; does nothing by default.
Parameters
- itemTable Item The item, which can be changed
Called from
Call sites
PlayerAdjustCharacterCreationInfo(player, info, data)
shared gamemodes/catwork/gamemode/core/libraries/cl_character.lua:193Called when a player creates a character, to adjust or refuse the new character; does nothing by default.
Parameters
- player Player The player
- info Map The new character, which can be changed
- data Map The data the client sent
Returns
- Any
falseto refuse with a generic fault, or a fault string to refuse with that message
Called from
Call sites
PlayerAdjustCharacterScreenInfo(player, character, info)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3634Called before a character is sent to the character menu, to adjust how it is shown.
Catwork uses the faction rank's model if it has one.
Parameters
- player Player The player
- character Character The character
- info Map What the menu shows:
name,model,banned,faction,characterID,detailsand so on
Called from
Call sites
Called for each of a player's characters as they are loaded into the character menu; does nothing by default.
Parameters
- player Player The player
- character Character The character, which can be changed
Returns
- Boolean
trueto delete the character instead of listing it
Call sites
PlayerAdjustClassModelInfo(self.classTable.index, info)
client gamemodes/catwork/gamemode/core/derma/cl_classes.lua:168Called to adjust the model shown for a class in the classes menu; does nothing by default.
Parameters
- class Number The class index
- info Map
modelandskin, which can be changed
Called from
Call sites
Called to adjust the local player's colour modification; does nothing by default.
Parameters
- colorModify Map The
$pp_colour_*values, modified in place
Called from
Call sites
Called when a player dies, to adjust their respawn time; does nothing by default.
Parameters
- player Player The player
- info Map
attacker,inflictor,damageInfoandspawnTime, which can be changed
Called from
Call sites
PlayerAdjustDropWeaponInfo(player, info)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3442Called for each weapon a dead player drops, to adjust how it is dropped.
Parameters
- player Player The player
- info Map
itemTable,positionandanglesof the dropped item, which can be changed
Returns
- Boolean Whether the weapon item entity is created
Called from
Call sites
Called to adjust the local player's headbob.
Speeds up and strengthens the bob while walking and running, scaled by cwHeadbobScale, and
sways it further the more drunk the player is.
Parameters
- info Map
speed,yawandrollof the headbob, modified in place
Called from
Call sites
PlayerAdjustItemFunctions(itemTable, itemFunctions)
client gamemodes/catwork/gamemode/core/cl_kernel.lua:2158Called to adjust the functions offered for an item in the inventory; does nothing by default.
Parameters
- itemTable Item The item
- itemFunctions List<Map> The functions, as
{ title = ..., name = ... }entries, modified in place
Called from
Call sites
PlayerAdjustItemMenu(itemTable, itemMenu, itemFunctions)
client gamemodes/catwork/gamemode/core/cl_kernel.lua:2202No documentation available.
Arguments
itemTableitemMenuitemFunctions
Called from
Call sites
No documentation available.
Arguments
selfspace
Called from
Call sites
No documentation available.
Arguments
selfweight
Called from
Call sites
Called to adjust the local player's motion blur; does nothing by default.
Parameters
- motionBlurs Map
enabledandblurTable(blur amounts by name, the lowest is used), modified in place
Called from
Call sites
PlayerAdjustNextPunchInfo(self:GetOwner(), info)
server gamemodes/catwork/gamemode/core/entities/weapons/cw_hands/shared.lua:173Called after a player punches with cw_hands, to adjust the delay before the next punch; does nothing by default.
Parameters
- player Player The player
- info Map
primaryFireandsecondaryFire, the delays in seconds, which can be changed
Called from
Call sites
PlayerAdjustPropCostInfo(player, entity, info)
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:3209Called when a player spawns a prop that costs cash, to adjust the cost; does nothing by default.
Parameters
- player Player The player
- entity Entity The prop
- info Map
costandname(the reason shown for the payment), which can be changed
Called from
Call sites
PlayerAdjustRadioInfo(player, info)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:1951Called when a player speaks on the radio, to choose who hears it; does nothing by default.
Parameters
- player Player The player
- info Map
text,noEavesdropandlisteners; add players tolistenersto let them hear it
Called from
Call sites
Called when a player's armor is set; keeps a ragdolled player's stored armor in sync.
Parameters
- player Player The player
- newArmor Number The new armor
- oldArmor Number The previous armor
Called from
Call sites
PlayerAttributeUpdated(player, attributeTable, amount)
server gamemodes/catwork/gamemode/core/libraries/sh_attributes.lua:141No documentation available.
Arguments
playerattributeTableamount
Called from
Call sites
No documentation available.
Arguments
vdurationreason
Called from
Call sites
PlayerBusinessRebuilt(self, categories)
client gamemodes/catwork/gamemode/core/derma/cl_business.lua:63No documentation available.
Arguments
selfcategories
Called from
Call sites
PlayerCanBeGivenWeapon(self, class, itemTable)
server gamemodes/catwork/gamemode/core/sv_kernel.lua:1165Called before a player is given a weapon with Player:Give; return false to block it.
Parameters
- player Player The player receiving the weapon
- class String The weapon class
- itemTable Item The weapon's item, or
nil
Returns
- Boolean Whether the weapon can be given
Called from
Call sites
PlayerCanBypassClassLimit(target, class.index)
shared gamemodes/catwork/gamemode/core/commands/sh_setclass.lua:57Called to check whether a player can join a class that is at its player limit; never by default.
Parameters
- player Player The player joining
- class Number The class index
Returns
- Boolean
trueto ignore the class limit
Called from
Call sites
PlayerCanBypassFactionLimit(player, character)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:2232Called to check whether a player can use a character in a faction that is at its player limit; never by default.
Parameters
- player Player The player choosing the character
- character Character The character being used
Returns
- Boolean
trueto ignore the faction limit
Called from
Call sites
PlayerCanChangeClass(target, class)
shared gamemodes/catwork/gamemode/core/commands/sh_setclass.lua:71Called when a player attempts to change class with /SetClass; refuses during the class change cooldown.
Parameters
- player Player The player
- class Class The class
Returns
- Boolean Whether the class can be changed
Called from
Call sites
PlayerCanCreateCharacter(player, character, characterID)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3726Called when a player attempts to create a character.
Catwork refuses while the quiz is enabled and not completed.
Parameters
- player Player The player creating the character
- character Character The new character's data
- characterID Number The ID the character will get
Returns
- Any
falseto refuse with a generic fault, a fault string to refuse with that message, ortrueto allow
Called from
Call sites
PlayerCanDeathClearName(player, attacker, damageInfo)
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:3889Called when a player dies, to check whether everyone forgets their name; never by default.
Parameters
- player Player The player who died
- attacker Entity The killer
- damageInfo CTakeDamageInfo The fatal damage
Returns
- Boolean
trueto clear the name withcw.player:ClearName
Called from
Call sites
PlayerCanDeathClearRecognisedNames(player, attacker, damageInfo)
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:3885Called when a player dies, to check whether they forget everyone they recognised; never by default.
Parameters
- player Player The player who died
- attacker Entity The killer
- damageInfo CTakeDamageInfo The fatal damage
Returns
- Boolean
trueto clear the player's recognised names
Called from
Call sites
PlayerCanDeleteCharacter(player, character)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:2178Called when a player attempts to delete a character; allows it by default.
Parameters
- player Player The player
- character Character The character to delete
Returns
- Any
nilortrueto allow; anything else refuses, and a string is shown as the reason
Called from
Call sites
PlayerCanDestroyItem(player, itemTable)
shared gamemodes/catwork/gamemode/core/commands/sh_invaction.lua:39Called when a player attempts to destroy an item; always allows it.
Return false to block it.
Parameters
- player Player The player
- itemTable Item The item
- bNoMsg Boolean Whether to skip notifying the player
Returns
- Boolean Whether the item can be destroyed
Called from
Call sites
PlayerCanDropItem(player, itemTable, position)
shared gamemodes/catwork/gamemode/core/commands/sh_invaction.lua:46Called when a player attempts to drop an item; always allows it.
Return false to block the drop.
Parameters
- player Player The player
- itemTable Item The item
- bNoMsg Any Whether to skip notifying the player; the inventory command passes the drop position here
Returns
- Boolean Whether the item can be dropped
Called from
Call sites
PlayerCanDropWeapon(player, itemTable, NULL, true)
shared gamemodes/catwork/gamemode/core/commands/sh_dropweapon.lua:25Called when a player attempts to drop a weapon.
Spawn weapons cannot be dropped; otherwise the item's own CanDropWeapon decides when it has
one.
Parameters
- player Player The player
- itemTable Item The weapon's item
- weapon Weapon The weapon
- bNoMsg Boolean Whether to skip notifying the player
Returns
- Boolean Whether the weapon can be dropped
Called from
DropWeapon:OnRunsh_grenade_base:OnPlayerUnequippedsh_weapon_base:OnPlayerUnequippedcw.player:DropWeapons
Call sites
- gamemodes/catwork/gamemode/core/commands/sh_dropweapon.lua:25 shared
- gamemodes/catwork/gamemode/core/items/sh_grenade_base.lua:61 shared
- gamemodes/catwork/gamemode/core/items/sh_weapon_base.lua:138 shared
- gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3432 server
- gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3455 server
Called on each wages payout, to check whether a player earns wages; always allows it.
Parameters
- player Player The player
- cash Number The wages amount
Returns
- Boolean Whether the player earns wages;
PlayerEarnWagesCashonly runs when allowed
Called from
Call sites
PlayerCanFireWeapon(player, bIsRaised, weapon, true)
server gamemodes/catwork/gamemode/core/sv_kernel.lua:520Called to check whether a player can fire their weapon; returning false delays the shot.
Catwork blocks firing when the player lacks the stamina a melee weapon needs, is sprinting with
sprint_lowers_weapon set, holds the weapon lowered and PlayerCanUseLoweredWeapon refuses,
or is still on player.cwNextShootTime. With limb damage enabled, arm damage randomly stops
the player from firing for a while.
Parameters
- player Player The player firing
- bIsRaised Boolean Whether the weapon is raised
- weapon Weapon The weapon being fired
- bIsSecondary Boolean optional, defaults to
nilWhether this is the secondary attack
Returns
- Boolean Whether the weapon can fire
Called from
Call sites
Called when a player kills another player, to check whether the killer gains a frag; always allows it.
Parameters
- player Player The killer
- victim Player The victim
Returns
- Boolean Whether a frag is added
Called from
Call sites
Called when a player who has fallen over attempts to get up with /CharGetUp; always allows it.
On the client it is called without a player to decide whether to show the get up hint.
Parameters
- player Player The player getting up
Returns
- Boolean Whether the player can get up
Called from
Call sites
PlayerCanGiveToStorage(player, storageTable, itemTable)
server gamemodes/catwork/gamemode/core/libraries/sv_storage.lua:445Called to check whether a player can put an item in storage.
Catwork always allows it and tags the item with the character's key and unique ID so other characters cannot take it back out.
Parameters
- player Player The player storing the item
- storageTable Map The open storage
- itemTable Item The item being stored
Returns
- Boolean Return
falseto block storing the item
Called from
Call sites
PlayerCanHolsterWeapon(player, itemTable, v, true, true)
shared gamemodes/catwork/gamemode/core/items/sh_grenade_base.lua:53Called when a player attempts to holster a weapon back into their inventory.
Spawn weapons (from the faction or rank) cannot be holstered; otherwise the item's own
CanHolsterWeapon decides when it has one.
Parameters
- player Player The player
- itemTable Item The weapon's item
- weapon Weapon The weapon
- bForce Boolean Whether the holster is forced
- bNoMsg Boolean Whether to skip notifying the player
Returns
- Boolean Whether the weapon can be holstered
Called from
Call sites
PlayerCanInteractCharacter(player, action, character)
server gamemodes/catwork/gamemode/hooks/sv_nethooks.lua:183Called when a player attempts to use, delete or otherwise act on one of their characters from the menu.
Catwork refuses while the quiz is enabled and the player has not completed it.
The caller only reads the first return value, so return the fault string itself to show it;
false shows the generic CharFault_CannotInteract fault.
Parameters
- player Player The player acting
- action String The action, such as
useordelete - character Character The character acted on
Returns
- Any
falseor a fault string to refuse, anything else to allow
Call sites
PlayerCanKnockOnDoor(self:GetOwner(), trace.Entity)
server gamemodes/catwork/gamemode/core/entities/weapons/cw_hands/shared.lua:198No documentation available.
Arguments
self:GetOwner()trace.Entity
Called from
Call sites
Called when a player attempts to own a door; refuses doors marked unownable.
Parameters
- player Player The player
- door Entity The door
Returns
- Boolean Whether the door can be owned
Call sites
PlayerCanPunchEntity(self:GetOwner(), trace.Entity)
server gamemodes/catwork/gamemode/core/entities/weapons/cw_hands/shared.lua:140Called when a punch with cw_hands hits an entity, to check whether it damages it; never does by default.
Parameters
- player Player The player punching
- entity Entity The entity hit
Returns
- Boolean Whether the punch damages the entity
Called from
Call sites
PlayerCanPunchKnockout(self:GetOwner(), trace.Entity, trace)
server gamemodes/catwork/gamemode/core/entities/weapons/cw_hands/shared.lua:137Called when a punch with cw_hands hits a player, to check whether it knocks them out.
Catwork allows it on head hits. A knockout ragdolls the target for 15 seconds and runs
PlayerPunchKnockout.
Parameters
- player Player The player punching
- target Player The player hit
- trace Map The punch trace result
Returns
- Boolean
trueto knock the target out
Called from
Call sites
PlayerCanQuickRaise(player, player:GetActiveWeapon())
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:4502Called when a player presses the quick raise key, to check whether they can toggle their weapon; always allows it.
Parameters
- player Player The player raising their weapon
- weapon Weapon The player's active weapon
Returns
- Boolean Whether the weapon raise toggles
Called from
Call sites
PlayerCanRadio(player, info.text, listeners, eavesdroppers)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:1975Called when a player attempts to speak on the radio; always allows it.
Return false to block the message.
Parameters
- player Player The player speaking
- text String The message
- listeners List<Player> Players who will hear it over the radio, can be changed
- eavesdroppers List<Player> Players nearby who will overhear it, can be changed
Returns
- Boolean Whether the message is sent
Called from
Call sites
PlayerCanRagdoll(player, state, delay, decay, player.cwRagdollTab)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3216Called when a player attempts to be ragdolled; always allows it.
Parameters
- player Player The player
- state Number The ragdoll state (
RAGDOLL_*) - delay Number Seconds until the player gets up, or
nil - decay Number Seconds until the ragdoll decays, or
nil - ragdoll Map The existing ragdoll table when changing state while ragdolled, otherwise
nil
Returns
- Boolean Whether the player is ragdolled
Called from
Call sites
PlayerCanRagdollDecay(player, ragdoll, decayTime)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3168Called when a dead player's ragdoll is about to be set to decay; always allows it.
Parameters
- player Player The player
- ragdoll Entity The ragdoll
- seconds Number The decay time
Returns
- Boolean Whether the ragdoll decays
Called from
Call sites
PlayerCanRestoreRecognisedName(player, target)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:2339Called to check whether a saved recognised name is restored when both players are on.
When it does not return true the saved name is forgotten. Catwork allows it for anyone but
the player themselves.
Parameters
- player Player The player who recognised the target
- target Player The player who was recognised
Returns
- Boolean
trueto restore the name
Called from
Call sites
PlayerCanSaveRecognisedName(player, target)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:2385Called to check whether a recognised name may be saved with the character.
Only asked when save_recognised_names is enabled and a player recognises someone with
RECOGNISE_SAVE; when it does not return true the recognition only lasts for the session
(RECOGNISE_TOTAL). Catwork allows it for anyone but the player themselves.
Parameters
- player Player The player recognising
- target Player The player being recognised
Returns
- Boolean
trueto save the name
Called from
Call sites
PlayerCanSayIC(player, message.text)
server gamemodes/catwork/gamemode/core/libraries/sv_chatbox.lua:611Called when a player attempts to say something in character.
Dead or fallen over players cannot talk, unless they have a death code (for the death code
prompt). Return false to block the message.
Parameters
- player Player The player
- text String The message
Returns
- Boolean Whether the message is sent
Call sites
PlayerCanSayLOOC(player, message.text)
server gamemodes/catwork/gamemode/core/libraries/sv_chatbox.lua:598Called when a player attempts to say something local out of character; always allows it.
Parameters
- player Player The player
- text String The message
Returns
- Boolean Whether the message is sent
Call sites
PlayerCanSayOOC(player, message.text)
server gamemodes/catwork/gamemode/core/libraries/sv_chatbox.lua:585Called when a player attempts to say something out of character; always allows it.
Parameters
- player Player The player
- text String The message
Returns
- Boolean Whether the message is sent
Call sites
Called to check whether an admin local player sees the admin ESP; follows the cwAdminESP ConVar.
Returns
- Boolean Whether the ESP is drawn
Called from
Call sites
Called to check whether the local player sees a group of HUD bars.
tab bars show in the info menu (when cwTopBars is off), top bars show while alive (when
cwTopBars is on), and other groups always show.
Parameters
- class String The bar group, such as
toportab
Returns
- Boolean Whether the bars are drawn
Called from
Call sites
Called to check whether an item is listed in the business menu; always lists it.
Parameters
- itemTable Item The item
Returns
- Boolean Whether the item is listed
Called from
Call sites
Called to check whether the local player sees the center hints; always shows them.
Returns
- Boolean Whether the hints are drawn
Called from
Call sites
Called to check whether a class is listed in the classes menu; always lists it.
Parameters
- class Class The class
Returns
- Boolean Whether the class is listed
Called from
Call sites
Called to check whether the local player sees the date and time; shown in the info menu.
Returns
- Boolean Whether the date and time are drawn
Called from
Call sites
Called to check whether the local player sees the top hints; always shows them.
Returns
- Boolean Whether the hints are drawn
Called from
Call sites
Called to check whether the local player sees their limb damage.
It is shown in the info menu when limb_damage_system is enabled.
Returns
- Boolean Whether the limb damage is drawn
Called from
Call sites
Called to check whether the local player sees their player info text; shown in the info menu.
Returns
- Boolean Whether the player info is drawn
Called from
Call sites
Called for every initialized player when an admin runs cwStatus, to get the status line shown for them.
Parameters
- player Player The admin running the command
- target Player The player listed
Returns
- String The line to print (user ID, name
- Steam name
- Steam ID and IP), or
nilto hide the player
Call sites
Called to check whether the local player can see while unconscious; never by default, so the screen goes black.
Returns
- Boolean Whether the player can see
Called from
Call sites
PlayerCanShowUnrecognised(entity, x, y, unrecognisedName, teamColor, alpha, flashAlpha)
client gamemodes/catwork/gamemode/hooks/cl_hooks.lua:1538Called when the target ID of an unrecognised player is drawn; draws the unrecognised name.
GM:HUDDrawTargetID passes the arguments as (player, x, y, unrecognisedName, teamColor, alpha, flashAlpha), so from color onwards they are shifted by one compared to these names.
Parameters
- player Player The player looked at
- x Number The text x position
- y Number The text y position
- color String The unrecognised name (see above)
- alpha Color The team colour (see above)
- flashAlpha Number The text alpha (see above)
Returns
- Any
trueto draw the unrecognised name, a string to draw that text instead, a number to draw nothing and continue at that y position
Called from
Call sites
PlayerCanSwitchCharacter(player, character)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:2240Called when a player who already has a character loaded attempts to switch to another.
Refuses while dead (unless the character menu was reset or the character is banned) and while knocked out.
Parameters
- player Player The player
- character Character The character to switch to
Returns
- Any
nilortrueto allow; anything else refuses, and a string is shown as the reason
Called from
Call sites
PlayerCanTakeFromStorage(player, storageTable, itemTable)
server gamemodes/catwork/gamemode/core/libraries/sv_storage.lua:530Called to check whether a player can take an item out of storage.
Refuses, with a notification and a log entry, when the item was stored by another character
(see cw.entity:BelongsToAnotherCharacter); otherwise clears the item's owner tag.
Parameters
- player Player The player taking the item
- storageTable Map The open storage
- itemTable Item The item being taken
Returns
- Boolean Whether the item can be taken
Called from
Call sites
PlayerCanThrowPunch(self:GetOwner())
server gamemodes/catwork/gamemode/core/entities/weapons/cw_hands/shared.lua:120Called when a player attempts to throw a punch with cw_hands; always allows it.
Parameters
- player Player The player punching
Returns
- Boolean Whether the punch is thrown
Called from
Call sites
PlayerCanUnlockEntity(player, door)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:1914Called when a player attempts to unlock an entity with the keys; doors need door access, other entities are allowed.
Parameters
- player Player The player
- entity Entity The entity
Returns
- Boolean Whether the entity can be unlocked
Called from
Call sites
PlayerCanUnragdoll(player, state, ragdollTable)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3343Called when a player attempts to be unragdolled; always allows it.
Parameters
- player Player The player
- state Number The ragdoll state (
RAGDOLL_*) - ragdoll Map The player's ragdoll table
Returns
- Boolean Whether the player gets up
Called from
Call sites
PlayerCanUseCharacter(player, character)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:2222Called when a player attempts to use a character.
Refuses banned characters and characters whose faction or faction rank is at its
playerLimit.
Parameters
- player Player The player
- character Character The character to use
Returns
- Any
nilortrueto allow; anything else refuses, and a string is shown as the reason
Called from
Call sites
PlayerCanUseCommand(player, commandTable, arguments)
server gamemodes/catwork/gamemode/core/libraries/sh_command.lua:237Called when a player attempts to use a command, before argument and access checks; always allows it.
Parameters
- player Player The player
- commandTable Command The command
- arguments List<String> The command arguments
Returns
- Boolean Whether the command runs
Called from
Call sites
Called when a player presses use on a door, to check whether they can open it.
Owned doors need door access and false doors cannot be used. When allowed, PlayerUseDoor
runs and the door is opened.
Parameters
- player Player The player
- door Entity The door
Returns
- Boolean Whether the door opens
Called from
Call sites
PlayerCanUseEntityInVehicle(player, trace.Entity, vehicle)
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:2504Called to check whether a player in a vehicle can use the entity they look at.
Allowed for doors and entities with UsableInVehicle set; while it returns true for the
looked at entity, the use key does not exit the vehicle.
Parameters
- player Player The player
- entity Entity The entity looked at
- vehicle Vehicle The player's vehicle
Returns
- Boolean Whether the entity can be used
Called from
Call sites
PlayerCanUseItem(player, itemTable)
shared gamemodes/catwork/gamemode/core/commands/sh_invaction.lua:59Called when a player attempts to use an item from their inventory.
Catwork refuses, with a notification unless bNoMsg is set, when the item is a weapon the
player already has as a spawn weapon. Return false to block the use.
Parameters
- player Player The player
- itemTable Item The item
- bNoMsg Boolean optional, defaults to
nilWhether to skip notifying the player
Returns
- Boolean Whether the item can be used
Called from
Call sites
PlayerCanUseLoweredWeapon(player, weapon, bIsSecondary)
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:468Called to check whether a player can fire a weapon while it is lowered.
Allowed when the weapon, or its Primary/Secondary table, has NeverRaised set.
Parameters
- player Player The player firing
- weapon Weapon The lowered weapon
- secondary Boolean Whether this is the secondary attack
Returns
- Boolean Whether the lowered weapon can fire
Called from
Call sites
Called when a player attempts to view a door's menu; refuses doors marked unownable.
Parameters
- player Player The player
- door Entity The door
Returns
- Boolean Whether the door menu opens
Called from
Call sites
Called when the local player attempts to zoom with +zoom; always allows it.
Returns
- Boolean Whether the zoom bind runs
Called from
Call sites
PlayerCashUpdated(player, roundedAmount, reason, bNoMsg)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:2730Called after a player's cash has changed; syncs it with their open storage via cw.storage:SyncCash.
Parameters
- player Player The player whose cash changed
- amount Number The amount given (negative when taken)
- reason String Why the cash changed, or
nil - bNoMsg Boolean Whether the change should be silent
Called from
Call sites
PlayerCharacterCreated(player, character)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3741Called after a player has created a character, before it is added to the character menu; does nothing by default.
Parameters
- player Player The player
- character Character The new character
Call sites
PlayerCharacterDataChanged(self, key, oldValue, value)
server gamemodes/catwork/gamemode/core/sv_kernel.lua:3132No documentation available.
Arguments
selfkeyoldValuevalue
Called from
Call sites
Called when a player's character has initialized, while it loads.
Clears and resends the player's inventory, attributes and limb damage, assigns the default
class when needed, queues the starter hints, sends CharacterInit to the client, and sets the
faction rank (the default or lowest one, or SCN when the name contains SCN), applying the
rank's class and model.
Parameters
- player Player The player
Called from
Call sites
Called when a player's character has loaded.
Resets the player's per-character state and movement values, runs
PlayerRestoreCharacterData and PlayerCharacterInitialized, restores recognised names and
property, and marks the player initialized. Clears any stored OnNextLoad payload without
running it, runs each item's OnRestorePlayerGear, gives the saved player flags and restores
the saved class.
Parameters
- player Player The player
Called from
Call sites
PlayerCharacterScreenCreated(cw.character.panel)
client gamemodes/catwork/gamemode/hooks/cl_hooks.lua:937Called when the local player's character screen is created; asks the server for the quiz status.
The status is only requested when the quiz is enabled.
Parameters
- panel Panel The character menu
Called from
Call sites
Called when a player's character has unloaded.
Schedules the character's property for removal, disables it, resets the ragdoll, closes
storage and unassigns the team. When called by GM:PlayerDisconnected, returning true
keeps the character from being saved.
Parameters
- player Player The player
Called from
Call sites
PlayerClassSet(player, newClass, oldClass, noRespawn, addDelay, noModelChange)
server gamemodes/catwork/gamemode/core/libraries/sh_class.lua:336Called after a player's class has been set; saves the class name in the character data.
Parameters
- player Player The player
- newClass Class The new class
- oldClass Class The previous class
- noRespawn Boolean Whether the player is not respawned
- addDelay Boolean Whether a class change delay is added
- noModelChange Boolean Whether the model is kept
Called from
Call sites
Called when the config has been sent to a player.
Runs PlayerSendDataStreamInfo, then tells clients to start data streaming; bots skip
straight to PlayerDataStreamInfoSent.
Parameters
- player Player The player
Called from
Call sites
PlayerDataChanged(self, key, oldValue, value)
server gamemodes/catwork/gamemode/core/sv_kernel.lua:3152No documentation available.
Arguments
selfkeyoldValuevalue
Called from
Call sites
Called when a player's data has loaded.
Shows the Catwork intro once per player when clockwork_intro_enabled is set.
Parameters
- player Player The player whose data loaded
Call sites
Called after a player's initial data stream info has been sent.
Bots get a random faction, gender and model and load a character straight away. Real players
have their data loaded (running PlayerDataLoaded), their whitelists sent and their characters
added to the character menu. A character for which PlayerAdjustCharacterTable returns true
is deleted instead.
Parameters
- player Player The player the data was sent to
Called from
Call sites
PlayerDeath(player, inflictor, attacker, damageInfo)
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:4277Called when a player dies.
Starts the respawn timer with cw.core:CalculateSpawnTime, disintegrates the ragdoll when
killed by a combine ball, and logs the kill.
Parameters
- player Player The player
- inflictor Entity The inflictor
- attacker Entity The killer
- damageInfo CTakeDamageInfo The fatal damage, or
nil
Called from
Call sites
PlayerDeathCodeUsed(player, commandTable, arguments)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:1852Called when a player has used their death code, before it is taken; does nothing by default.
Parameters
- player Player The player
- commandTable Command The command that used the death code
- arguments List<String> The command arguments
Called from
Call sites
PlayerDeleteCharacter(player, character)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:2155Called after a player deletes a character; does nothing by default.
Parameters
- player Player The player
- character Character The deleted character
Called from
Call sites
PlayerDestroyItem(player, itemTable)
server gamemodes/catwork/gamemode/core/libraries/sh_item.lua:996Called after a player destroys an item; does nothing by default.
Parameters
- player Player The player who destroyed it
- itemTable Item The item
Called from
Call sites
PlayerDoesHaveDoorAccess(player, doorParent, access, isAccurate)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:2650Called by cw.player:HasDoorAccess to check whether a player has an access level on a door.
The door's owner always has access; other characters need an entry in door.accessList.
Parameters
- player Player The player
- door Entity The door, or the door's parent when it has one
- access Number The access level required (
DOOR_ACCESS_*) - isAccurate Boolean
trueto require exactly that level instead of at least it
Returns
- Boolean Whether the player has the access
Called from
Call sites
Called by cw.player:HasFlags to check whether a player has a flag they do not hold themselves.
Catwork grants the flags in the default_flags config to everyone.
Parameters
- player Player The player
- flag String A single flag
Returns
- Boolean
trueto grant the flag,falseto deny it,nilto fall through
Called from
Call sites
- gamemodes/catwork/gamemode/core/libraries/cl_player.lua:656 client
- gamemodes/catwork/gamemode/core/libraries/cl_player.lua:722 client
- gamemodes/catwork/gamemode/core/libraries/cl_player.lua:754 client
- gamemodes/catwork/gamemode/core/libraries/sv_player.lua:1716 server
- gamemodes/catwork/gamemode/core/libraries/sv_player.lua:1776 server
- gamemodes/catwork/gamemode/core/libraries/sv_player.lua:1808 server
PlayerDoesRecognisePlayer(player, target, status, isAccurate, realValue)
shared gamemodes/catwork/gamemode/core/libraries/cl_player.lua:529Called after recognition is worked out, to override whether a player recognises another.
Catwork returns the computed value unchanged.
Parameters
- player Player The player who may recognise the target
- target Player The player who may be recognised
- status Number The recognition level asked about (
RECOGNISE_*) - isAccurate Boolean Whether the level must match exactly
- realValue Boolean Whether the player recognises the target according to the saved names
Returns
- Boolean Whether the player recognises the target
Called from
Call sites
No documentation available.
Arguments
playerdoor
Called from
Call sites
No documentation available.
Arguments
playerdoor
Called from
Call sites
PlayerDropItem(player, itemTable, position, entity)
server gamemodes/catwork/gamemode/core/libraries/sh_item.lua:965Called after a player drops an item; does nothing by default.
Parameters
- player Player The player who dropped it
- itemTable Item The item
- position Vector Where it was dropped
- entity Entity The spawned item entity
Called from
Call sites
PlayerDropWeapon(player, itemTable, entity, weapon)
shared gamemodes/catwork/gamemode/core/commands/sh_dropweapon.lua:36Called after a player drops a weapon; saves the weapon's clip ammo on its item.
Parameters
- player Player The player who dropped it
- itemTable Item The weapon's item
- entity Entity The spawned item entity
- weapon Weapon The weapon that was dropped
Called from
DropWeapon:OnRunsh_grenade_base:OnPlayerUnequippedsh_weapon_base:OnPlayerUnequippedcw.player:DropWeapons
Call sites
- gamemodes/catwork/gamemode/core/commands/sh_dropweapon.lua:36 shared
- gamemodes/catwork/gamemode/core/items/sh_grenade_base.lua:69 shared
- gamemodes/catwork/gamemode/core/items/sh_weapon_base.lua:146 shared
- gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3446 server
- gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3468 server
Called after a player has earned wages; does nothing by default.
Parameters
- player Player The player
- cash Number The wages amount
Called from
Call sites
PlayerFireWeapon(self, activeWeapon, CLIP_ONE, activeWeapon:GetPrimaryAmmoType())
server gamemodes/catwork/gamemode/core/sv_kernel.lua:1515No documentation available.
Arguments
selfactiveWeaponCLIP_ONEactiveWeapon:GetPrimaryAmmoType()
Called from
Call sites
Called when a player has been given flags.
Gives the physgun for p and the toolgun for t if the player is alive, and networks the
player's flags.
Parameters
- player Player The player given the flags
- flags String The flags that were given
Called from
Call sites
Called when a player has had flags taken.
Takes the physgun for p and the toolgun for t unless the player still has the flag (for
example from the default flags), and networks the player's flags.
Parameters
- player Player The player whose flags were taken
- flags String The flags that were taken
Called from
Call sites
Called by Player:GetHoldingEntity to get the entity a player is holding.
Return an entity to override player.cwIsHoldingEnt.
Parameters
- player Player The player
Returns
- Entity The held entity, or
nilto use the default
Called from
Call sites
Called after a player has been given a weapon.
Rebuilds the inventory menu and attaches visible gear for weapon items: Throwable, Melee,
Secondary (weight 2 or less) or Primary.
Parameters
- player Player The player given the weapon
- class String The weapon class
- itemTable Item The weapon's item, or
nil
Called from
Call sites
PlayerGiveToStorage(player, storageTable, itemTable)
server gamemodes/catwork/gamemode/core/libraries/sv_storage.lua:469Called after a player has put an item in storage; takes it off if it was worn as clothes or an accessory.
Parameters
- player Player The player who stored the item
- storageTable Map The open storage
- itemTable Item The stored item
Called from
Call sites
PlayerGiveWagesCash(v, info.wages, v:GetWagesName())
server gamemodes/catwork/gamemode/core/sv_kernel.lua:817Called before positive wages are given to a player; return false to keep the cash from being given.
Parameters
- player Player The player
- cash Number The wages amount
- wagesName String The name the wages are given under
Returns
- Boolean Whether the cash is given
Called from
Call sites
Called when a player's spawn weapons should be given; gives the weapons listed by their faction rank and faction.
Parameters
- player Player The player
Called from
Call sites
PlayerHealthRegenerate(player, player:Health(), player:GetMaxHealth())
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:155Called once a second to regenerate a living player's health.
Heals 2 health every 5 seconds while above half health, otherwise every 10 seconds.
Parameters
- player Player The player to heal
- health Number The player's health
- maxHealth Number The player's maximum health
Called from
Call sites
Called when a player's health is set.
Healing also heals limb damage by half the amount gained; reaching full health heals every limb and removes decals from the player and their ragdoll. Keeps a ragdolled player's stored health in sync.
Parameters
- player Player The player
- newHealth Number The new health
- oldHealth Number The previous health
Called from
Call sites
PlayerHolsterWeapon(player, itemTable, v, true)
shared gamemodes/catwork/gamemode/core/items/sh_grenade_base.lua:55No documentation available.
Arguments
playeritemTablevtrue
Called from
Call sites
PlayerInventoryRebuilt(self, categories)
client gamemodes/catwork/gamemode/core/derma/cl_inventory.lua:147No documentation available.
Arguments
selfcategories
Called from
Call sites
PlayerItemGiven(self, itemTable, bForce)
shared gamemodes/catwork/gamemode/core/libraries/sh_inventory.lua:472Called after a player is given an item; syncs it with their open storage via cw.storage:SyncItem.
Parameters
- player Player The player given the item
- itemTable Item The item given
- bForce Boolean Whether the item was forced into the inventory regardless of weight
Called from
Call sites
PlayerItemTaken(self, itemTable)
shared gamemodes/catwork/gamemode/core/libraries/sh_inventory.lua:507Called after a player has an item taken.
Syncs the item with their open storage and takes it off if it was worn as clothes or an accessory.
Parameters
- player Player The player the item was taken from
- itemTable Item The item taken
Called from
Call sites
PlayerKnockOnDoor(self:GetOwner(), trace.Entity)
server gamemodes/catwork/gamemode/core/entities/weapons/cw_hands/shared.lua:204No documentation available.
Arguments
self:GetOwner()trace.Entity
Called from
Call sites
PlayerLimbDamageHealed(player, hitGroup, newAmount)
shared gamemodes/catwork/gamemode/core/libraries/sh_limb.lua:109Called when a player's limb damage is healed; does nothing by default.
Parameters
- player Player The healed player
- hitGroup Number The hit group (
HITGROUP_*) - amount Number The limb's new damage amount
Called from
Call sites
Called when the local player's limb damage is received from the server; does nothing by default.
Call sites
Called when a player's limb damage is reset; does nothing by default.
Parameters
- player Player The player whose limb damage was reset
Called from
Call sites
PlayerLimbTakeDamage(player, hitGroup, newDamage)
shared gamemodes/catwork/gamemode/core/libraries/sh_limb.lua:66Called when a player's limb takes damage; does nothing by default.
Parameters
- player Player The hurt player
- hitGroup Number The hit group (
HITGROUP_*) - damage Number The damage taken
Called from
Call sites
Called when a player's spawn weapons should be given.
Gives the toolgun and physgun for the t and p flags (with the player's weapon colour when
custom_weapon_color is set), the gravity gun, cw_hands and cw_keys when configured, and
the class's weapons and ammo, then runs PlayerGiveWeapons and selects the hands.
Parameters
- player Player The player
Call sites
PlayerModelChanged(player, sNewModel, sOldModel)
shared gamemodes/catwork/gamemode/core/sh_kernel.lua:1372Called after a player's model is changed with Player:SetModel, on both realms.
Catwork caches the model's animation table from cw.animation:GetTable and stores it as
player.cwAnimTable, which GM:TranslateActivity uses. On the client it also disables IK.
Parameters
- player Player The player whose model changed
- strNewModel String Path of the new model
- strOldModel String Path of the previous model
Called from
Call sites
Called before a player is paid wages, to change the amount; does nothing by default.
Parameters
- player Player The player being paid
- info Map Has
wages, the amount to pay, which can be changed
Called from
Call sites
PlayerNameChanged(player, previousName, newName)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:2528No documentation available.
Arguments
playerpreviousNamenewName
Called from
Call sites
PlayerNameCleared(player, status, isAccurate)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:2482No documentation available.
Arguments
playerstatusisAccurate
Called from
Call sites
PlayerPickupItem(player, itemTable, entity, bQuickUse)
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:3059Called after a player picks up an item entity; does nothing by default.
Parameters
- player Player The player who picked it up
- itemTable Item The item
- itemEntity Entity The item entity that was picked up
- bQuickUse Boolean Whether the item was used straight away instead of taken
Called from
Call sites
PlayerPlayDeathSound(player, player:GetGender())
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:3864Called to choose the sound a player makes when they die; returns a random HL2 citizen pain line.
Parameters
- player Player The dying player
- gender String The player's gender
Returns
- String The sound path, or
nilfor no sound
Called from
Call sites
PlayerPlayPainSound(player, player:GetGender(), damageInfo, lastHitGroup)
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:4282Called to choose the pain sound a player makes when hurt.
Half of bullet hits play a hit group specific HL2 citizen line (head, gut, leg, arm, gear);
everything else plays a random pain line.
Parameters
- player Player The hurt player
- gender String The player's gender,
maleorfemale - damageInfo CTakeDamageInfo The damage taken
- hitGroup Number The hit group (
HITGROUP_*)
Returns
- String The sound path, or
nilfor no sound
Called from
Call sites
PlayerPreRebuildStorage(storagePanel)
client gamemodes/catwork/gamemode/core/derma/cl_storage.lua:75No documentation available.
Arguments
storagePanel
Called from
Call sites
PlayerPropertyGiven(player, entity, networked, removeDelay)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:950No documentation available.
Arguments
playerentitynetworkedremoveDelay
Called from
Call sites
PlayerPropertyGivenOffline(key, uniqueID, entity, networked, removeDelay)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:1003No documentation available.
Arguments
keyuniqueIDentitynetworkedremoveDelay
Called from
Call sites
PlayerPropertyTaken(player, entity)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:1067No documentation available.
Arguments
playerentity
Called from
Call sites
PlayerPropertyTakenOffline(key, uniqueID, entity)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:1040No documentation available.
Arguments
keyuniqueIDentity
Called from
Call sites
PlayerPunchEntity(self:GetOwner(), trace.Entity)
server gamemodes/catwork/gamemode/core/entities/weapons/cw_hands/shared.lua:142No documentation available.
Arguments
self:GetOwner()trace.Entity
Called from
Call sites
PlayerPunchKnockout(self:GetOwner(), trace.Entity)
server gamemodes/catwork/gamemode/core/entities/weapons/cw_hands/shared.lua:139No documentation available.
Arguments
self:GetOwner()trace.Entity
Called from
Call sites
PlayerPunchThrown(self:GetOwner())
server gamemodes/catwork/gamemode/core/entities/weapons/cw_hands/shared.lua:166No documentation available.
Arguments
self:GetOwner()
Called from
Call sites
PlayerRadioUsed(player, info.text, listeners, eavesdroppers)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:2001Called after a player has spoken on the radio; does nothing by default.
Parameters
- player Player The player
- text String The message
- listeners List<Player> Players who heard it over the radio
- eavesdroppers List<Player> Players nearby who overheard it
Called from
Call sites
PlayerRagdollCanTakeDamage(player, entity, inflictor, attacker, hitGroup, damageInfo)
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:4323Called when a ragdolled player's ragdoll attempts to take damage.
Damage from non-players is ignored while the ragdoll's immunity time has not passed.
Parameters
- player Player The ragdolled player
- ragdoll Entity The ragdoll
- inflictor Entity The inflictor
- attacker Entity The attacker
- hitGroup Number The hit group (
HITGROUP_*) - damageInfo CTakeDamageInfo The damage
Returns
- Boolean Whether the damage is applied to the player
Called from
Call sites
PlayerRagdolled(player, state, player.cwRagdollTab)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3221Called after a player has been ragdolled; clears the fallen over flag.
Parameters
- player Player The player
- state Number The ragdoll state (
RAGDOLL_*) - ragdoll Map The player's ragdoll table
Called from
Call sites
PlayerRecognisedNamesCleared(player, status, isAccurate)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:2463No documentation available.
Arguments
playerstatusisAccurate
Called from
Call sites
PlayerRestoreCharacterData(player, player:QueryCharacter('Data'))
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:3608Called when a player's character data is restored as the character loads.
Cleans up the physical description and makes sure LimbData, Clothes and Accessories
exist before passing the data to cw.player:RestoreCharacterData.
Parameters
- player Player The player loading the character
- data Map The character's saved data, modified in place
Called from
Call sites
PlayerRestoreData(player, player.cwData)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3963Called when a player's (not character's) data is restored; makes sure Whitelisted exists.
Parameters
- player Player The player
- data Map The player's saved data, modified in place
Call sites
Called after a player's property has been returned to their character; does nothing by default.
Parameters
- player Player The player
Called from
Call sites
PlayerSaveCharacterData(player, data)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3833Called when a player's character data is about to be saved.
Saves attribute boosts when save_attribute_boosts is set, and health and armor when they are
above 1.
Parameters
- player Player The player whose character is saved
- data Map The character data to save, modified in place
Called from
Call sites
Called when a player's (not character's) data is about to be saved; drops an empty Whitelisted table.
Parameters
- player Player The player whose data is saved
- data Map The player data to save, modified in place
Called from
Call sites
PlayerScaleDamageByHitGroup(player, attacker, hitGroup, damageInfo, baseDamage)
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:4631Called to scale damage a player takes by hit group.
Catwork cuts damage from vehicles and from players in vehicles to a quarter.
Parameters
- player Player The player taking damage
- attacker Entity The attacker
- hitGroup Number The hit group (
HITGROUP_*) - damageInfo CTakeDamageInfo The damage to scale in place
- baseDamage Number The damage before scaling
Called from
Call sites
PlayerSelectCustomCharacterOption(player, action, character)
server gamemodes/catwork/gamemode/hooks/sv_nethooks.lua:200Called when a player picks a character menu action other than use or delete; does nothing by default.
Parameters
- player Player The player
- action String The action
- character Character The character
Call sites
Called when a player's initial data stream info should be sent; sends the shared tables and any colour mod override.
Parameters
- player Player The player to send the data to
Called from
Call sites
PlayerSetDefaultColorModify(cw.ColorModify)
client gamemodes/catwork/gamemode/hooks/cl_hooks.lua:2326Called to set the local player's default colour modification when no override is active; does nothing by default.
Parameters
- colorModify Map The
$pp_colour_*values, modified in place
Called from
Call sites
Called when a player's model should be set; applies their default model and skin.
Parameters
- player Player The player
Called from
Call sites
Called once a second, when health regeneration is enabled, to check whether a player regenerates.
Always allows it.
Parameters
- player Player The player
Returns
- Boolean Whether
PlayerHealthRegenerateruns for the player
Called from
Call sites
PlayerShouldShowOnDoorAccessList(v, door, owner)
client gamemodes/catwork/gamemode/core/derma/cl_door.lua:179Called to check whether a player appears in the door access menu; always shows them.
Parameters
- player Player The player
- door Entity The door
- owner Player The door's owner
Returns
- Boolean Whether the player is listed
Called from
Call sites
Called to check whether a player appears on the scoreboard; always shows them.
Parameters
- player Player The player
Returns
- Boolean Whether the player is listed
Called from
Call sites
PlayerShouldTakeDamage(player, attacker, inflictor, damageInfo)
server gamemodes/catwork/gamemode/core/sv_kernel.lua:948Called when a player would take damage; players in noclip take none.
Parameters
- player Player The player
- attacker Entity The attacker
- inflictor Entity The inflictor
- damageInfo CTakeDamageInfo The damage
Returns
- Boolean Whether the damage is applied
Called from
Call sites
No documentation available.
Arguments
selfskin
Called from
Call sites
PlayerStorageRebuilt(storagePanel, categories)
client gamemodes/catwork/gamemode/core/derma/cl_storage.lua:156No documentation available.
Arguments
storagePanelcategories
Called from
Call sites
PlayerStorageShouldClose(player, storageTable)
server gamemodes/catwork/gamemode/core/libraries/sv_storage.lua:16Called every player think while a player has storage open, to check whether it should close.
Closes it when the player is ragdolled or dead, the storage entity is gone or out of
storageTable.distance, or the storage's own ShouldClose callback returns true.
Parameters
- player Player The player with storage open
- storageTable Map The open storage
Returns
- Boolean
trueto close the storage
Called from
CheckStillUsableGM:PlayerThink
Call sites
PlayerTakeDamage(player, inflictor, attacker, lastHitGroup, damageInfo)
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:4281Called when a player (or their ragdoll) takes damage that does not kill them.
With limb damage stumbling enabled, a bullet to the legs while both legs are above 50 damage makes the player fall over for 8 seconds.
Parameters
- player Player The player
- inflictor Entity The inflictor
- attacker Entity The attacker
- hitGroup Number The hit group (
HITGROUP_*) - damageInfo CTakeDamageInfo The damage
Returns
- Boolean
trueto suppress the pain sound
Called from
Call sites
PlayerTakeFromStorage(player, storageTable, itemTable)
server gamemodes/catwork/gamemode/core/libraries/sv_storage.lua:547No documentation available.
Arguments
playerstorageTableitemTable
Called from
Call sites
Called every 0.15 seconds for every initialized player.
GM:Tick resets infoTable to the defaults before calling this, so plugins can adjust it
here. Catwork tracks how long the player has been underwater, keeps ragdolled players in
observer movement, closes storage when PlayerStorageShouldClose says so, networks inventory
weight, space and wages, slows the player for leg damage and when walking backwards, updates
weapon raising and saves the active weapon item's clip ammo.
Parameters
- player Player The player being updated
- curTime Number The current
CurTime() - infoTable Map The player's info table with
inventoryWeight,inventorySpace,crouchedSpeed,jumpPower,walkSpeed,runSpeed,isRunning,isJumpingandwages
Called from
Call sites
PlayerUnragdolled(player, state, ragdollTable)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3408Called after a player has been unragdolled; clears the fallen over flag.
Parameters
- player Player The player
- state Number The ragdoll state (
RAGDOLL_*) - ragdoll Map The player's ragdoll table
Called from
Call sites
Called when a player attempts to use an entity; players who have fallen over cannot use anything.
Parameters
- player Player The player using the entity
- entity Entity The entity being used
Returns
- Boolean Whether the use is allowed
Called from
Call sites
Called when a player opens a door with use, just before it opens; does nothing by default.
Parameters
- player Player The player
- door Entity The door
Called from
Call sites
PlayerUseItem(player, itemTable, itemEntity)
server gamemodes/catwork/gamemode/core/libraries/sh_item.lua:905Called after a player uses an item; does nothing by default.
Parameters
- player Player The player who used it
- itemTable Item The item
- itemEntity Entity The item entity it was used from, or
nilwhen used from the inventory
Called from
Call sites
PlayerUseUnknownItemFunction(player, itemTable, itemAction)
shared gamemodes/catwork/gamemode/core/commands/sh_invaction.lua:63Called when a player runs an inventory action that Catwork does not handle; does nothing by default.
Parameters
- player Player The player
- itemTable Item The item
- itemFunction String The action name
Called from
Call sites
No documentation available.
Arguments
parsed
Called from
Call sites
PostCModelHandsSet(player, model, entity, info)
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:1194No documentation available.
Arguments
playermodelentityinfo
Called from
Call sites
PostCommandUsed(player, commandTable, arguments)
server gamemodes/catwork/gamemode/core/libraries/sh_command.lua:275Called after a player uses a command; does nothing by default.
Parameters
- player Player The player who used the command
- command Command The command used
- arguments List<String> The arguments given with the command, if any
Called from
Call sites
Called just after the background blurs have been drawn.
Draws the selected faction's image on the character screen, the title box of a titled menu and the date and time.
Called from
Call sites
Called just after a HUD bar is drawn; does nothing by default.
Parameters
- barInfo Map The bar's position, size, colour, text and progress
Returns
- Boolean
trueto skip drawing the bar's text
Called from
Call sites
Called just after the date and time box is drawn in the info menu; does nothing by default.
Parameters
- info Map The box's
x,yandwidth
Called from
Call sites
PostDrawPlayerInfo(boxInfo, information, subInformation)
client gamemodes/catwork/gamemode/core/cl_kernel.lua:1913Called just after the local player's information box is drawn; does nothing by default.
Parameters
- boxInfo Map The box position and size
- information Map The player info text lines
- subInformation Map The player info sub text lines
Called from
Call sites
PostPlayerGiveToStorage(player, storageTable, itemTable)
server gamemodes/catwork/gamemode/core/libraries/sv_storage.lua:501No documentation available.
Arguments
playerstorageTableitemTable
Called from
Call sites
PostPlayerLightSpawn(player, weapons, ammo, false)
server gamemodes/catwork/gamemode/core/libraries/sv_player.lua:3546No documentation available.
Arguments
playerweaponsammofalse
Call sites
PostPlayerSpawn(player, player.cwLightSpawn, player.cwChangeClass, player.cwFirstSpawn)
server gamemodes/catwork/gamemode/hooks/sv_hooks.lua:1137Called just after a player spawns, from GM:PlayerSpawn.
On the first spawn of a character it restores saved health, armor and attribute boosts; later spawns clear them from the character data. Sets the player's target name to their faction.
Parameters
- player Player The player
- lightSpawn Boolean Whether this was a light spawn
- changeClass Boolean Whether the spawn is from a class change
- firstSpawn Boolean Whether this is the character's first spawn
Called from
Call sites
PostPlayerTakeFromStorage(player, storageTable, itemTable)
server gamemodes/catwork/gamemode/core/libraries/sv_storage.lua:578No documentation available.
Arguments
playerstorageTableitemTable
Called from
Call sites
No documentation available.
Called from
Call sites
No documentation available.
Arguments
messageData
Called from
Call sites
Called just before a HUD bar is drawn; does nothing by default.
Parameters
- barInfo Map The bar's position, size, colour, text and progress
Returns
- Boolean
trueto skip drawing the bar's background and fill
Called from
Call sites
PreDrawPlayerInfo(boxInfo, information, subInformation)
client gamemodes/catwork/gamemode/core/cl_kernel.lua:1889Called just before the local player's information box is drawn in the info menu; does nothing by default.
Parameters
- boxInfo Map The box position and size
- information Map The player info text lines
- subInformation Map The player info sub text lines
Returns
- Boolean
trueto skip drawing the box
Called from
Call sites
PreGearEntityDraw(self)
client gamemodes/catwork/gamemode/core/entities/entities/cw_gear/cl_init.lua:39No documentation available.
Arguments
self
Called from
Call sites
PrePlayerTakeDamage(player, attacker, inflictor, damageInfo)
server gamemodes/catwork/gamemode/core/sv_kernel.lua:946Called just before a player would take damage; does nothing by default.
Parameters
- player Player The player
- attacker Entity The attacker
- inflictor Entity The inflictor
- damageInfo CTakeDamageInfo The damage
Called from
Call sites
No documentation available.
Called from
Call sites
No documentation available.
Arguments
self
Called from
Call sites
No documentation available.
Arguments
self
Called from
Call sites
Called when Catwork data is saved.
Saves every initialized player's character and, unless they follow the machine clock, the in-game time and date.
Called from
Call sites
Called to adjust a player's scoreboard entry; does nothing by default.
Parameters
- info Map The entry, with
player,textand the other fields the scoreboard shows
Called from
Call sites
ScoreboardSortClassPlayers(k, a, b)
client gamemodes/catwork/gamemode/core/derma/cl_scoreboard.lua:55Called to sort the players within a class on the scoreboard.
Players the local player recognises come first, and recognised players are sorted by team.
Parameters
- class String The class name
- a Player The first player
- b Player The second player
Returns
- Boolean Whether
acomes beforeb
Call sites
ShipmentEntityDraw(self)
client gamemodes/catwork/gamemode/core/entities/entities/cw_shipment/cl_init.lua:20No documentation available.
Arguments
self
Called from
Call sites
Called to check whether the character menu can be created yet; waits while the intro is fading out.
Returns
- Boolean Whether the character menu is created
Called from
Call sites
Called to check whether the background blurs are drawn; always draws them.
Returns
- Boolean Whether the blurs are drawn
Called from
Call sites
Called to check whether the black character menu background is drawn; always draws it.
Returns
- Boolean Whether the background is drawn
Called from
Call sites
ShouldDrawCharacterBackgroundBlur()
client gamemodes/catwork/gamemode/core/derma/cl_character.lua:516Called to check whether the character menu background blur is drawn; always draws it.
Returns
- Boolean Whether the blur is drawn
Called from
Call sites
Called to check whether a looked at player's target ID is drawn; always draws it.
Parameters
- player Player The player looked at
Returns
- Boolean Whether the target ID is drawn
Called from
Call sites
Called to check whether the local player's screen fades to black.
Fades while dead or fallen over, unless PlayerCanSeeUnconscious allows seeing.
Returns
- Boolean Whether the screen fades to black
Called from
Call sites
No documentation available.
Arguments
TIME_MINUTE
Called from
Call sites
TopLevelPlayerBindPress(player, bind, bPress)
client gamemodes/catwork/gamemode/hooks/cl_hooks.lua:513No documentation available.
Arguments
playerbindbPress
Called from
Call sites
Defined in
- gamemodes/catwork/gamemode/core/cl_kernel.lua
- gamemodes/catwork/gamemode/core/sv_kernel.lua
- gamemodes/catwork/gamemode/core/commands/sh_chargetup.lua
- gamemodes/catwork/gamemode/hooks/cl_hooks.lua
- gamemodes/catwork/gamemode/core/commands/sh_dropweapon.lua
- gamemodes/catwork/gamemode/core/items/sh_grenade_base.lua
- gamemodes/catwork/gamemode/core/items/sh_weapon_base.lua
- gamemodes/catwork/gamemode/core/libraries/sv_player.lua
- gamemodes/catwork/gamemode/core/commands/sh_invaction.lua
- gamemodes/catwork/gamemode/core/commands/sh_mapchange.lua
- gamemodes/catwork/gamemode/core/commands/sh_maprestart.lua
- gamemodes/catwork/gamemode/hooks/sv_hooks.lua
- gamemodes/catwork/gamemode/core/commands/sh_roll.lua
- gamemodes/catwork/gamemode/core/commands/sh_setclass.lua
- gamemodes/catwork/gamemode/core/derma/cl_business.lua
- gamemodes/catwork/gamemode/core/derma/cl_character.lua
- gamemodes/catwork/gamemode/hooks/sv_nethooks.lua
- gamemodes/catwork/gamemode/core/derma/cl_classes.lua
- gamemodes/catwork/gamemode/core/derma/cl_directory.lua
- gamemodes/catwork/gamemode/core/derma/cl_door.lua
- gamemodes/catwork/gamemode/core/derma/cl_inventory.lua
- gamemodes/catwork/gamemode/core/derma/cl_menu.lua
- gamemodes/catwork/gamemode/core/derma/cl_scoreboard.lua
- gamemodes/catwork/gamemode/core/system/cl_manage_players.lua
- gamemodes/catwork/gamemode/core/derma/cl_storage.lua
- gamemodes/catwork/gamemode/core/entities/entities/cw_cash/cl_init.lua
- gamemodes/catwork/gamemode/core/entities/entities/cw_gear/cl_init.lua
- gamemodes/catwork/gamemode/core/entities/entities/cw_item/cl_init.lua
- gamemodes/catwork/gamemode/core/entities/entities/cw_item/init.lua
- gamemodes/catwork/gamemode/core/entities/entities/cw_shipment/cl_init.lua
- gamemodes/catwork/gamemode/core/entities/weapons/cw_hands/shared.lua
- gamemodes/catwork/gamemode/core/libraries/cl_character.lua
- gamemodes/catwork/gamemode/core/libraries/cl_chatbox.lua
- gamemodes/catwork/gamemode/core/libraries/sv_chatbox.lua
- gamemodes/catwork/gamemode/core/libraries/cl_outline.lua
- gamemodes/catwork/gamemode/core/libraries/cl_player.lua
- gamemodes/catwork/gamemode/core/libraries/sh_animation.lua
- gamemodes/catwork/gamemode/core/libraries/sh_attributes.lua
- gamemodes/catwork/gamemode/core/libraries/sh_class.lua
- gamemodes/catwork/gamemode/core/libraries/sh_command.lua
- gamemodes/catwork/gamemode/core/libraries/sh_config.lua
- gamemodes/catwork/gamemode/core/libraries/sh_inventory.lua
- gamemodes/catwork/gamemode/core/libraries/sh_item.lua
- gamemodes/catwork/gamemode/core/libraries/sh_limb.lua
- gamemodes/catwork/gamemode/core/libraries/sh_plugin.lua
- gamemodes/catwork/gamemode/core/libraries/sh_voices.lua
- gamemodes/catwork/gamemode/core/libraries/sv_bans.lua
- gamemodes/catwork/gamemode/core/libraries/sv_database.lua
- gamemodes/catwork/gamemode/core/libraries/sv_storage.lua
- gamemodes/catwork/gamemode/core/sh_kernel.lua
- gamemodes/catwork/gamemode/hooks/sh_hooks.lua
- gamemodes/catwork/gamemode/hooks/cl_nethooks.lua
- gamemodes/catwork/gamemode/shared.lua