Entity class
Summary
Methods
GetEntityBeingHeld hook.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
nilA player or list of players to tell;niltells everyone
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
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
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
nilValue 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
nilValue to return if the variable is not set
Returns
- Any The value, or
default
Aliases
Player.GetNetVarPlayer.GetLocalVar
Defined in
Returns the character key of the entity's owner.
Returns
- Number The owner's character key, or
nilif the entity has no owner
Returns the position the entity was at when it was recorded as spawned.
Returns
- Vector The start position, or
nilif 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
nilfor 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:114Sends the entity's current value of a networked variable to clients.
Parameters
- key String Name of the variable
- receiver Player optional, defaults to
nilA player or list of players to send it to;nilsends it to everyone
Sets the entity's color, also applying it to a ragdolled player's ragdoll.
Parameters
- color Color The new color
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:143Sets 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
nilA player or list of players to send the change to;nilsends it to everyone
See also
Sets the character key of the entity's owner.
Parameters
- key Number The owner's character key, as returned by
Player:GetCharacterKey;nilclears it
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