Skip to content

Entity

Base class for entities.

Entities are all interactible objects on the server. Learn more here

Networking Methods

Entity:sendNetVar (key, receiver)
Entity:sendNetVar

Sends a network variable from an entity to a specific receiver.

Parameters:

string key Name of the variable

Client receiver Client or list of clients to receive the data

Entity:clearNetVars (receiver)
Entity:clearNetVars

Clears all network variables associated with this entity. Notifies the client(s) to remove them.

Parameters:

Client receiver Client or list of clients to receive deletion info

Entity:setNetVar (key, value, receiver)
Entity:setNetVar

Sets a network variable on the entity and notifies the receiver.

Parameters:

string key Variable name

vararg value Variable value

Client receiver optional Client or list of clients to receive update

Entity:getNetVar (key, default)
Entity:getNetVar

Retrieves a networked variable from the entity. The clientside version of the function can only return data that was previously networked to the client. Returns a default value if the variable is not set.

Parameters:

string key The variable name

vararg default optional A fallback value to return if the key is not present

Returns:

vararg The stored value or the default

Entity Door Utilities

Provides utility methods for door detection and logic.

Entity:isDoor ()
Entity:isDoor

Checks if an entity is a door by comparing its class.

Returns:

bool True if the entity is a door

Entity:getDoorPartner ()
Entity:getDoorPartner

Returns the door's partner entity (slave or parent).

Returns:

entity The partner door entity if found

Or

nil If the door has no partner

Entity:isLocked ()
Entity:isLocked

Checks if the door or vehicle is locked. Reads from the entity's internal save table.

Returns:

bool True if the entity is locked, false otherwise

Or

nil If no lock data is available

Entity:getBlocker ()
Entity:getBlocker

Returns the entity that is blocking the door's sequence. Typically another entity preventing the door from moving.

Returns:

entity Blocker entity if present

Or

nil If no blocker is present

Entity:blastDoor (velocity, lifeTime, ignorePartner)
Entity:blastDoor

Simulates the door being blasted open by replacing it with a physics dummy. The original door is hidden and later restored. Optionally applies to a partner door.

Parameters:

Vector velocity optional Velocity applied to the dummy object

number lifeTime optional. default: 120 Duration in seconds before restoring the door

boolean ignorePartner optional. default: false If true, skips blasting the partner door

Returns:

entity The created dummy physics entity replacing the door

Entity Chair Utilities

Provides helper functions to determine whether an entity is considered a chair.

Entity:isChair ()
Entity:isChair

Whether or not a vehicle is a chair by checking its model with the chair list.

Returns:

bool True if the entity is a chair