Summary

Methods

Removes all networked variables of the entity on the server and on clients.
Plays a body hit sound from the entity, followed a few frames later by another sound.
Fires bullets from the entity after letting hooks adjust them.
Returns the value of a networked variable on the entity.
Returns the character key of the entity's owner.
Returns the position the entity was at when it was recorded as spawned.
Returns whether a player is holding the entity, as answered by the GetEntityBeingHeld hook.
Returns whether the entity was created by the map.
IsStuck()shared
Returns whether the entity is stuck inside something at its current position.
Sends the entity's current value of a networked variable to clients.
Sets the entity's color, also applying it to a ragdolled player's ragdoll.
Sets the entity's material, also applying it to a ragdolled player's ragdoll.
Sets the entity's model; for players also updates their ragdoll's saved model.
Sets a networked variable on the entity and sends it to clients.
Sets the character key of the entity's owner.
Sets the entity's skin; for players also updates their ragdoll's saved skin.

Methods

Removes all networked variables of the entity on the server and on clients.

Called automatically when the entity is removed.

Parameters

  • receiver Player optional, defaults to nil A player or list of players to tell; nil tells everyone

Entity:EmitHitSound(sound)

server gamemodes/catwork/gamemode/core/sv_kernel.lua:1299

Plays a body hit sound from the entity, followed a few frames later by another sound.

Parameters

  • sound String Sound to play after the hit sound

Entity:FireBullets(bulletInfo, ...)

shared gamemodes/catwork/gamemode/core/sv_kernel.lua:1108

On the server

Fires bullets from the entity after letting hooks adjust them.

Runs PlayerAdjustBulletInfo for players and EntityFireBullets for every entity, both with the bullet table, then calls the engine function, kept as Entity:ClockworkFireBullets.

Parameters

  • bulletInfo Map Bullet structure, as for the engine's Entity:FireBullets
  • ... Any Extra arguments passed to the engine function

On the client

Fires bullets from the entity after letting hooks adjust them.

Runs PlayerAdjustBulletInfo for players and EntityFireBullets for every entity, then calls the engine method, kept as Entity:ClockworkFireBullets.

Parameters

  • bulletInfo Map The bullet table, which hooks may change
  • ... Any Extra arguments for the engine method

Defined in

Entity:GetNetVar(key, default)

shared gamemodes/catwork/gamemode/core/libraries/sv_netvars.lua:164

On the server

Returns the value of a networked variable on the entity.

On the server this also returns local variables set with Player:SetLocalVar.

Parameters

  • key String Name of the variable
  • default Any optional, defaults to nil Value to return if the variable is not set

Returns

  • Any The value, or default

Aliases

  • Player.GetLocalVar

On the client

Returns the value of a networked variable on the entity, as received from the server.

For the local player this also returns the variables set with Player:SetLocalVar.

Parameters

  • key String Name of the variable
  • default Any optional, defaults to nil Value to return if the variable is not set

Returns

  • Any The value, or default

Aliases

  • Player.GetNetVar
  • Player.GetLocalVar

Defined in

Returns the character key of the entity's owner.

Returns

  • Number The owner's character key, or nil if the entity has no owner

Entity:GetStartPosition()

server gamemodes/catwork/gamemode/core/sv_kernel.lua:1293

Returns the position the entity was at when it was recorded as spawned.

Returns

  • Vector The start position, or nil if none was stored

See also

Returns whether a player is holding the entity, as answered by the GetEntityBeingHeld hook.

Returns

  • Boolean Whether the entity is being held, or nil for an invalid entity

Returns whether the entity was created by the map.

Returns

  • Boolean Whether the entity is a map entity

See also

Returns whether the entity is stuck inside something at its current position.

Traces the entity's own hull from its position to the same position, ignoring itself.

Returns

  • Boolean Whether the trace starts in a solid

Entity:SendNetVar(key, receiver)

server gamemodes/catwork/gamemode/core/libraries/sv_netvars.lua:114

Sends the entity's current value of a networked variable to clients.

Parameters

  • key String Name of the variable
  • receiver Player optional, defaults to nil A player or list of players to send it to; nil sends it to everyone

Sets the entity's color, also applying it to a ragdolled player's ragdoll.

Parameters

  • color Color The new color

Entity:SetMaterial(material)

server gamemodes/catwork/gamemode/core/sv_kernel.lua:1313

Sets the entity's material, also applying it to a ragdolled player's ragdoll.

Parameters

  • material String Material path; '' restores the default

Sets the entity's model; for players also updates their ragdoll's saved model.

Runs the PlayerModelChanged hook for players.

Parameters

  • model String Model path

Entity:SetNetVar(key, value, receiver)

server gamemodes/catwork/gamemode/core/libraries/sv_netvars.lua:143

Sets a networked variable on the entity and sends it to clients.

Does nothing if a non-table value is unchanged, or if the value contains a function (which prints an error). Tables are always resent.

entity:SetNetVar('Locked', true)

Parameters

  • key String Name of the variable
  • value Any The new value; must not be or contain a function
  • receiver Player optional, defaults to nil A player or list of players to send the change to; nil sends it to everyone

See also

Sets the character key of the entity's owner.

Parameters

Sets the entity's skin; for players also updates their ragdoll's saved skin.

Runs the PlayerSkinChanged hook for players.

Parameters

  • skin Number Skin index

Defined in