CodeLock
Description
Adds digital locks with numeric passwords, ownership and saved player access. Server administrators can configure installation and raiding separately for gates, compatible building doors, pitched tents and storage barrels. The lock does not require a battery.
Configuration
Default configuration
CodeLock.json
{
"m_Enable": 0,
"m_Logging": 1,
"m_KeepAccess": 0,
"m_Gates": {
"m_CanAttach": 1,
"m_CanRaid": 0,
"m_RaidTime": 600,
"m_RaidIncrements": 3,
"m_DeleteLockOnRaid": 1,
"m_ToolDamageOnRaid": 100,
"m_OwnerOnlyDismantle": 1
},
"m_Buildings": {
"m_CanAttach": 0,
"m_CanRaid": 0,
"m_RaidTime": 600,
"m_RaidIncrements": 3,
"m_DeleteLockOnRaid": 1,
"m_ToolDamageOnRaid": 100
},
"m_Tents": {
"m_CanAttach": 1,
"m_CanRaid": 0,
"m_RaidTime": 300,
"m_RaidIncrements": 3,
"m_DeleteLockOnRaid": 1,
"m_ToolDamageOnRaid": 100
},
"m_Barrels": {
"m_CanAttach": 1,
"m_CanRaid": 0,
"m_RaidTime": 300,
"m_RaidIncrements": 3,
"m_DeleteLockOnRaid": 1,
"m_ToolDamageOnRaid": 100
}
}Options
| Option | Type | Description |
|---|---|---|
m_Enable | bool | 0: disables protection, menus and raiding; 1: enables the module. Disabling preserves locks, passwords, owners and saved access. |
m_Logging | bool | 0: disables module logs; 1: records actions without passwords. |
m_KeepAccess | bool | 0: changing the password revokes previous access; 1: preserves authorized users. Removing the lock always clears access. |
m_Gates | object | Built Fence gates. |
m_Buildings | object | Compatible map doors and native rebuildable doors. |
m_Tents | object | Pitched MediumTent, LargeTent, CarTent and PartyTent. |
m_Barrels | object | Storage barrels derived from Barrel_ColorBase; excludes fire barrels. |
m_Gates
| Option | Type | Description |
|---|---|---|
m_CanAttach | bool | 0: blocks new regular installations; 1: allows installation. Super admins bypass this flag while the module is enabled. |
m_CanRaid | bool | 0: disables raiding for this target type; 1: enables it. |
m_RaidTime | int | Seconds per completed raid stage. Values of 0 or lower prevent raiding. |
m_RaidIncrements | int | Required completed stages in the same action. Values of 0 or lower prevent raiding. Total duration is this value multiplied by m_RaidTime. |
m_DeleteLockOnRaid | bool | 0: drops the lock with credentials cleared; 1: deletes it when the raid finishes. |
m_ToolDamageOnRaid | int | Tool damage on completion, as a percentage of maximum health, clamped between 0 and 100. |
m_OwnerOnlyDismantle | bool | 1: only the owner or a super admin can dismantle; 0: also allows authorized players. Native dismantling conditions still apply. |
m_Buildings
| Option | Type | Description |
|---|---|---|
m_CanAttach | bool | 0: blocks new regular installations; 1: allows installation. Super admins bypass this flag while the module is enabled. |
m_CanRaid | bool | 0: disables raiding for this target type; 1: enables it. |
m_RaidTime | int | Seconds per completed raid stage. Values of 0 or lower prevent raiding. |
m_RaidIncrements | int | Required completed stages in the same action. Values of 0 or lower prevent raiding. Total duration is this value multiplied by m_RaidTime. |
m_DeleteLockOnRaid | bool | 0: drops the lock with credentials cleared; 1: deletes it when the raid finishes. |
m_ToolDamageOnRaid | int | Tool damage on completion, as a percentage of maximum health, clamped between 0 and 100. |
m_Tents
| Option | Type | Description |
|---|---|---|
m_CanAttach | bool | 0: blocks new regular installations; 1: allows installation. Super admins bypass this flag while the module is enabled. |
m_CanRaid | bool | 0: disables raiding for this target type; 1: enables it. |
m_RaidTime | int | Seconds per completed raid stage. Values of 0 or lower prevent raiding. |
m_RaidIncrements | int | Required completed stages in the same action. Values of 0 or lower prevent raiding. Total duration is this value multiplied by m_RaidTime. |
m_DeleteLockOnRaid | bool | 0: drops the lock with credentials cleared; 1: deletes it when the raid finishes. |
m_ToolDamageOnRaid | int | Tool damage on completion, as a percentage of maximum health, clamped between 0 and 100. |
m_Barrels
| Option | Type | Description |
|---|---|---|
m_CanAttach | bool | 0: blocks new regular installations; 1: allows installation. Super admins bypass this flag while the module is enabled. |
m_CanRaid | bool | 0: disables raiding for this target type; 1: enables it. |
m_RaidTime | int | Seconds per completed raid stage. Values of 0 or lower prevent raiding. |
m_RaidIncrements | int | Required completed stages in the same action. Values of 0 or lower prevent raiding. Total duration is this value multiplied by m_RaidTime. |
m_DeleteLockOnRaid | bool | 0: drops the lock with credentials cleared; 1: deletes it when the raid finishes. |
m_ToolDamageOnRaid | int | Tool damage on completion, as a percentage of maximum health, clamped between 0 and 100. |
Installation requires an intact, uninstalled AC_Codelock in hand and a free compatible slot. Gates must be complete and closed; building doors must be closed and lockable. Tents must be pitched and have compatible entrances. Barrels must be closed, on the ground, intact and not processing contents. Special doors that cannot be locked and shelters without entrances are not supported.
If an existing configuration has no m_Buildings, loading copies the shared fields from m_Gates into that group. Review those values when upgrading.
Types
types.xml
<type name="AC_Codelock">
<lifetime>7200</lifetime>
<flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0" />
</type>
<type name="AC_Codelock_RaidTool">
<lifetime>7200</lifetime>
<flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0" />
</type>AC_Codelock is the digital lock. AC_Codelock_RaidTool is the raid tool; a vanilla Screwdriver cannot perform this action.
Controls
| Control | Action |
|---|---|
| Install action | Aim at a compatible target with the lock in hand. Set a numeric password of 4–8 digits; leading zeros are preserved. The lock stays in hand until confirmation. Cancelling leaves it in hand. |
| Open/close action | Players without access enter the password to open; a correct password saves access. Closing requires no password and does not grant access. Native door restrictions still apply. |
| Hold interaction | Opens management for the owner or a super admin while aiming at the protected target or installed lock within reach. |
| Enter / Numpad Enter | Confirms the password in the keypad. |
| Raid action | Hold the action with AC_Codelock_RaidTool or a derived tool in hand, targeting a closed protected structure. Requires enabled raiding for that target, a usable tool and being outside SafeZone when present. |
Management lists authorized users and allows revoking access, changing the password and removing the lock with confirmation. Removal unlocks the target, clears credentials and drops the same item at the player’s feet. A completed raid also clears credentials and applies the target group’s deletion and tool damage settings.
A barrel with a lock attached cannot be transported, even while the module is disabled. Remove the lock through management before moving the barrel or packing a tent. Closed protected tents and barrels also block inventory access.
The access light is green for the owner, authorized players and super admins, and red for other players, independently of whether the target is open. It is off when the module is disabled or the lock is loose, unconfigured or ruined.
Permissions
The installing player becomes the owner. Entering the correct password grants saved opening access without management rights. Only the owner or a super admin can manage the lock. Super admin access is checked through ac_IsSuper() and follows the general Permissions configuration. Gate dismantling additionally follows m_Gates.m_OwnerOnlyDismantle; native construction restrictions remain in effect.
