Doors¶
This page documents hooks in the doors category.
CanPlayerAccessDoor(client, door, access)View Source
Purpose
Allows modules to explicitly grant door access before the normal Lilia door access table is checked.
Category
Doors
Realm
Shared
Parameters
Player client The player attempting to access the door.
Entity door The door entity being checked.
number access The required access level, such as `DOOR_GUEST` or `DOOR_TENANT`.
Returns
boolean|nil Return true to grant access immediately. Returning nil allows the default door access checks to continue.
Example Usage
hook.Add("CanPlayerAccessDoor", "liaExampleCanPlayerAccessDoor", function(client, door, access)
if access == DOOR_TENANT and client:IsAdmin() then
return true
end
end)
CanPlayerLock(client, door)View Source
Purpose
Determines whether a player is allowed to start the key-based door or vehicle locking action.
Category
Doors
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.
Example Usage
hook.Add("CanPlayerLock", "liaExampleCanPlayerLock", function(client, door)
if IsValid(client) and client:IsAdmin() then
return true
end
end)
CanPlayerUnlock(client, door)View Source
Purpose
Determines whether a player is allowed to start the key-based door or vehicle unlocking action.
Category
Doors
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.
Example Usage
hook.Add("CanPlayerUnlock", "liaExampleCanPlayerUnlock", function(client, door)
if IsValid(client) and client:IsAdmin() then
return true
end
end)
CanPlayerUseDoor(client, door)View Source
Purpose
Determines whether a player may use a door before the module applies its default interaction handling.
Category
Doors
Realm
Server
Parameters
Returns
boolean|nil Return false to deny the use attempt. Returning nil allows the default door-use flow to continue.
Example Usage
hook.Add("CanPlayerUseDoor", "liaExampleCanPlayerUseDoor", function(client, door)
if IsValid(client) and client:IsAdmin() then
return true
end
end)
CollectDoorDataFields(fields)View Source
Purpose
Allows plugins or modules to register additional door data fields before default door data is built.
Category
Doors
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`.
Example Usage
hook.Add("CollectDoorDataFields", "liaExampleCollectDoorDataFields", function(fields)
fields[#fields + 1] = {
key = "exampleFlag",
name = "Example Flag"
}
end)
DoorDataReceived(door, syncData)View Source
Purpose
Runs after door data has been synchronized to a clientside door entity.
Category
Doors
Realm
Client
Parameters
Entity door The door entity that received synchronized data.
table syncData The synchronized door data table.
Example Usage
hook.Add("DoorDataReceived", "liaExampleDoorDataReceived", function(door, syncData)
print("[Doors] Received data for", door)
end)
DoorLockToggled(client, door, state)View Source
Purpose
Called after a door or supported vehicle has been locked or unlocked through the keys system.
Category
Doors
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.
Example Usage
hook.Add("DoorLockToggled", "liaExampleDoorLockToggled", function(client, door, state)
if not IsValid(client) then return end
print(string.format("[MyModule] handled DoorLockToggled for %s", client:Name()))
end)
FilterDoorInfo(entity, doorData, doorInfo)View Source
Purpose
Runs after door information entries are assembled so client code can adjust the final list before it is rendered.
Category
Doors
Realm
Client
Parameters
Entity entity The door entity currently being inspected.
table doorData The cached door data resolved for the entity.
table doorInfo The mutable list of formatted door information entries that will be rendered.
Example Usage
hook.Add("FilterDoorInfo", "liaExampleFilterDoorInfo", function(entity, doorData, doorInfo)
if not (doorData.hidden and doorInfo[1]) then return end
doorInfo[#doorInfo + 1] = {
text = "Hidden door"
}
end)
GetDoorInfo(entity, doorData, doorInfo)View Source
Purpose
Populates the mutable clientside door information list that is shown when the player looks at a visible door.
Category
Doors
Realm
Client
Parameters
Entity entity The door entity currently being inspected.
table doorData The cached door data resolved for the entity.
table doorInfo The mutable list that receives formatted entries with `text` and optional `color` fields.
Example Usage
hook.Add("GetDoorInfo", "liaExampleGetDoorInfo", function(entity, doorData, doorInfo)
if IsValid(entity) and doorData.title and doorData.title ~= "" then
doorInfo[#doorInfo + 1] = {
text = "Internal title: " .. doorData.title
}
end
end)
GetDoorInfoForAdminStick(target, extraInfo)View Source
Purpose
Allows clientside code to append extra door-specific text lines to the admin stick HUD output.
Category
Doors
Realm
Client
Parameters
Entity target The door entity currently targeted by the admin stick.
table extraInfo The mutable array of additional text lines that will be appended to the admin stick HUD.
Example Usage
hook.Add("GetDoorInfoForAdminStick", "liaExampleGetDoorInfoForAdminStick", function(target, extraInfo)
if IsValid(target) and target:isDoor() then
extraInfo[#extraInfo + 1] = "Map ID: " .. target:MapCreationID()
end
end)
KeyLock(client, door, time)View Source
Purpose
Called when the keys weapon requests a lock action for a targeted door or supported vehicle.
Category
Doors
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.
Example Usage
hook.Add("KeyLock", "liaExampleKeyLock", function(client, door, time)
if not IsValid(client) then return end
print(string.format("[MyModule] handled KeyLock for %s", client:Name()))
end)
KeyUnlock(client, door, time)View Source
Purpose
Called when the keys weapon requests an unlock action for a targeted door or supported vehicle.
Category
Doors
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.
Example Usage
hook.Add("KeyUnlock", "liaExampleKeyUnlock", function(client, door, time)
if not IsValid(client) then return end
print(string.format("[MyModule] handled KeyUnlock for %s", client:Name()))
end)
PlayerUseDoor(client, door)View Source
Purpose
Runs after door-use permission checks succeed, allowing modules to override the final use result.
Category
Doors
Realm
Server
Parameters
Returns
boolean|nil Return a non-nil value to override the final result of the use attempt. Returning nil leaves the default behavior unchanged.
Example Usage
hook.Add("PlayerUseDoor", "liaExamplePlayerUseDoor", function(client, door)
if IsValid(client) and client:IsAdmin() then
return true
end
end)
PostDoorDataLoad(ent, doorData)View Source
Purpose
Called after persisted or preset door data is assembled, before it is cached on the entity.
Category
Doors
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.
Example Usage
hook.Add("PostDoorDataLoad", "liaExamplePostDoorDataLoad", function(ent, doorData)
return {
{name = "Example", value = 1}
}
end)
PreDoorDataSave(door, doorData)View Source
Purpose
Called before cached door data is normalized and written back to persistent storage.
Category
Doors
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.
Example Usage
hook.Add("PreDoorDataSave", "liaExamplePreDoorDataSave", function(door, doorData)
return {
{name = "Example", value = 1}
}
end)