Skip to content

Doors

This page documents the hooks defined by the doors module.


CanPlayerLock(client, door)View Source

Purpose

Determines whether a player is allowed to start the key-based door or vehicle locking action.

Realm

Server

Parameters

Player client The player attempting to lock the target entity.

Entity door The targeted door, vehicle, or simfphys vehicle.

Returns

boolean|nil Return false to block the locking action. Returning nil allows the default permission checks to continue.


CanPlayerUnlock(client, door)View Source

Purpose

Determines whether a player is allowed to start the key-based door or vehicle unlocking action.

Realm

Server

Parameters

Player client The player attempting to unlock the target entity.

Entity door The targeted door, vehicle, or simfphys vehicle.

Returns

boolean|nil Return false to block the unlocking action. Returning nil allows the default permission checks to continue.


CanPlayerUseDoor(client, door)View Source

Purpose

Determines whether a player may use a door before the module applies its default interaction handling.

Realm

Server

Parameters

Player client The player trying to use the door.

Entity door The door entity being used.

Returns

boolean|nil Return false to deny the use attempt. Returning nil allows the default door-use flow to continue.


CollectDoorDataFields(fields)View Source

Purpose

Allows plugins or modules to register additional door data fields before default door data is built.

Realm

Shared

Parameters

table fields Mutable table that should be populated with custom field definitions. Each key should map to field information such as `default` and, when database-backed, `type`.


DoorLockToggled(client, door, state)View Source

Purpose

Called after a door or supported vehicle has been locked or unlocked through the keys system.

Realm

Server

Parameters

Player client The player who triggered the lock state change.

Entity door The entity whose lock state was changed.

boolean state The new lock state. True means locked and false means unlocked.


FilterDoorInfo(entity, doorData, doorInfo)View Source

Purpose

Lets clientside code adjust or filter the assembled door information list before it is rendered.

Realm

Client

Parameters

Entity entity The door entity currently being inspected.

table doorData The resolved cached door data for the entity.

table doorInfo The mutable list of display entries that will be converted into the door info box text.


GetDoorInfo(entity, doorData, doorInfo)View Source

Purpose

Populates the clientside door information list that is shown when looking at a visible door.

Realm

Client

Parameters

Entity entity The door entity currently being inspected.

table doorData The resolved cached door data for the entity.

table doorInfo The mutable list that should receive formatted door information entries.


GetDoorInfoForAdminStick(target, extraInfo)View Source

Purpose

Adds extra clientside admin-stick information lines for a targeted door.

Realm

Client

Parameters

Entity target The door entity currently targeted by the admin stick.

table extraInfo The mutable list of additional text lines to append to the admin stick HUD output.


KeyLock(client, door, time)View Source

Purpose

Called when the keys weapon requests a lock action for a targeted door or supported vehicle.

Realm

Server

Parameters

Player client The player using the keys weapon.

Entity door The targeted door, vehicle, or simfphys vehicle.

number time The action duration, in seconds, used for the stared lock interaction.


KeyUnlock(client, door, time)View Source

Purpose

Called when the keys weapon requests an unlock action for a targeted door or supported vehicle.

Realm

Server

Parameters

Player client The player using the keys weapon.

Entity door The targeted door, vehicle, or simfphys vehicle.

number time The action duration, in seconds, used for the stared unlock interaction.


PlayerUseDoor(client, door)View Source

Purpose

Runs after door-use permission checks succeed, allowing modules to override the final use result.

Realm

Server

Parameters

Player client The player trying to use the door.

Entity door The door entity being used.

Returns

boolean|nil Return a non-nil value to override the final result of the use attempt. Returning nil leaves the default behavior unchanged.


PostDoorDataLoad(ent, doorData)View Source

Purpose

Called after persisted or preset door data is assembled, before it is cached on the entity.

Realm

Server

Parameters

Entity ent The door entity receiving the loaded data.

table doorData The resolved door data table about to be cached.

Returns

table|nil Return a replacement door data table to modify the loaded values, or nil to keep the original table.


PreDoorDataSave(door, doorData)View Source

Purpose

Called before cached door data is normalized and written back to persistent storage.

Realm

Server

Parameters

Entity door The door entity whose data is about to be saved.

table doorData The current resolved door data table that will be serialized.

Returns

table|nil Return a replacement door data table to change what gets saved, or nil to keep the current values.