Combine Lock entity
Entity defined in entities/entities/cw_combinelock
Shared definition of the cw_combinelock entity (print name Combine Lock), a spawnable anim entity with its smoke
charge, flash and locked data table variables and the ENT:IsLocked getter.
Summary
Methods
combine_lock_access_* item for.Schema:PlayerHasCombineLockAccess checks for this lock.Methods
ENT:ActivateSmokeCharge(force)
server gamemodes/cwhl2rp/schema/entities/entities/cw_combinelock/init.lua:229Starts the 12 second smoke charge that busts the lock's rotating doors open.
Does nothing while a charge is already counting down. When the timer ends, each prop_door_rotating
is busted down with Schema:BustDownDoor and a smoke effect plays at the lock.
Parameters
- force Vector Force applied to the busted doors
ENT:CanTool(player, trace, tool)
server gamemodes/cwhl2rp/schema/entities/entities/cw_combinelock/init.lua:338Blocks every toolgun action on the lock.
Parameters
- player
- trace
- tool
Returns
- Boolean Always
false
Draws the lock model.
Plays one random Combine button sound from the lock and each of its doors.
Plays an explosion effect and impact sound at the lock.
Returns the lock's access level.
Returns
- Number The access level set with
ENT:SetAccess
Returns the Combine rank required by the lock.
Returns
- String The rank, or
nil
Sets up the lock model, physics, 800 health and the status light sprite.
Returns whether the lock is locked.
Returns
- Boolean Whether the lock is locked
Locks and closes the lock's doors and plays a random button sound.
Plays the explosion and unlocks the lock's doors.
ENT:OnTakeDamage(damageInfo)
server gamemodes/cwhl2rp/schema/entities/entities/cw_combinelock/init.lua:328Subtracts the damage from the lock's health and starts the smoke charge when it reaches 0.
Parameters
- damageInfo
Sets the access level a non-Combine player needs a matching combine_lock_access_* item for.
Parameters
- int Number The access level
Sets the Combine rank that Schema:PlayerHasCombineLockAccess checks for this lock.
Parameters
- str String The rank, or
nilto let every Combine use the lock
Attaches the lock to a door, together with its double door partner if it has one.
A partner is a door of the same class, model and skin 90 to 100 units away at the same height with a
different angle. The lock is removed with the door, and each locked door's combineLock field is set
to the lock.
Parameters
- entity Entity The door to lock
ENT:SetFlashDuration(duration)
server gamemodes/cwhl2rp/schema/entities/entities/cw_combinelock/init.lua:218Flashes the status light red and plays the denied sound.
Parameters
- duration Number How long the light flashes, in seconds
ENT:SetOverrideColor(color)
server gamemodes/cwhl2rp/schema/entities/entities/cw_combinelock/init.lua:121Sets the color the status light shows while the lock is locked.
Parameters
- color Color Light color, or
nilfor the default orange
ENT:SetupDataTables()
shared gamemodes/cwhl2rp/schema/entities/entities/cw_combinelock/shared.lua:16Declares the smoke charge time, flash time and locked state data table variables.
Keeps the doors locked or unlocked, updates the status light and keeps the lock frozen.
Removes the lock, which explodes in ENT:OnRemove, when its door is gone. With the
combine_lock_overrides config enabled, the lock state is forced onto its doors every think. The light
flashes red with a beep while a smoke charge counts down, is red during an access denied flash, orange
(or the override color) when locked and green when unlocked.
Locks the lock when it is unlocked and unlocks it when it is locked.
ENT:ToggleWithChecks(activator)
server gamemodes/cwhl2rp/schema/entities/entities/cw_combinelock/init.lua:301Toggles the lock if the player has access, or flashes it red if they do not.
Does nothing within 3 seconds of the last use, during a flash or while a smoke charge is counting down.
Access is checked with Schema:PlayerHasCombineLockAccess; admin faction players always have it.
Parameters
- activator Player The player using the lock
Unlocks the lock's doors and plays a random button sound.
ENT:UpdateTransmitState()
server gamemodes/cwhl2rp/schema/entities/entities/cw_combinelock/init.lua:41Always transmits the lock to every client.
ENT:Use(activator, caller)
server gamemodes/cwhl2rp/schema/entities/entities/cw_combinelock/init.lua:321Toggles the lock with access checks when a player uses it while looking at it.
Parameters
- activator
- caller