Doors

Hook Documentation for Doors Module.

Functions

MODULE:CanPlayerAccessDoor(client, door, access)

Called when a player tries to use abilities on the door, such as locking.

Parameters

  • client Player

    The client trying something on the door.

  • door Entity

    The door entity itself.

  • access Integer

    The access level used when called.

Returns

  • bool

    Whether or not to allow the client access.

Example Usage

function MODULE:CanPlayerAccessDoor(client, door, access)
    return true -- Always allow access.
end

MODULE:CanPlayerUseDoor(client, entity)

Determines whether a player is allowed to use a door entity. This hook can be used to implement custom checks to determine if a player is allowed to use a specific door entity.

Parameters

  • client Player

    The player attempting to use the door

  • entity Entity

    The door entity being considered for use

Returns

  • bool

    Whether the player is allowed to use the door

MODULE:KeyLock(owner, entity, time)

Called when a player attempts to lock a door. This hook is used to handle the locking action on a door entity.

Parameters

  • owner Player

    The player attempting to lock the door.

  • entity Entity

    The door entity being locked.

  • time Float

    The time taken to perform the lock action.

MODULE:KeyUnlock(owner, entity, time)

Called when a player attempts to unlock a door. This hook is used to handle the unlocking action on a door entity.

Parameters

  • owner Player

    The player attempting to unlock the door.

  • entity Entity

    The door entity being unlocked.

  • time Float

    The time taken to perform the unlock action.

MODULE:OnPlayerPurchaseDoor(client, entity, buying, CallOnDoorChild)

Called when a player purchases a door.

Parameters

  • client Player

    The player who purchased the door.

  • entity Entity

    The door entity that was purchased.

  • buying Boolean

    True if the player is buying the door, false if selling.

  • CallOnDoorChild Function

    A function to call on door children.

MODULE:PlayerUseDoor(client, entity)

Called when a player attempts to use a door entity. This hook can be used to perform additional actions or checks when a player interacts with a door entity.

Parameters

  • client Player

    The player attempting to use the door.

  • entity Entity

    The door entity being considered for use.

Returns

  • bool or nil

    Return false to disallow the use, return true to allow, or return nil to defer to other hooks.

MODULE:ToggleLock(client, door, state)

Toggles the lock state of a door. This hook is used to change the lock state of a door entity.

Parameters

  • client Player

    The player toggling the lock state.

  • door Entity

    The door entity being locked or unlocked.

  • state Boolean

    The new lock state, true for locked and false for unlocked.

MODULE:callOnDoorChildren(entity, callback)

Calls a function on all child entities of a door. This hook is used to perform actions on all child entities associated with a door.

Parameters

  • entity Entity

    The parent door entity.

  • callback Function

    The function to call on each child entity.

MODULE:copyParentDoor(child)

Copies the parent door's properties to a child door. This hook is used to synchronize properties from a parent door to a child door.

Parameters

  • child Entity

    The child door entity.