Skip to main content

Cooldown

The cooldown module exists on both client and server. The server owns definitions and authoritative state. Clients read synced state, request missing entries, decrement local display values, and ask the server to start or reset cooldowns.

Server define

Define each cooldown key on the server before clients request it.
server.lua
integer
required
The value assigned to a new position entry the first time it is requested.
integer
required
The value used when start(key, position) is called without an explicit duration.
integer
Optional millisecond value where countdowns pause until an external update changes the value.
integer
Optional number of one-second server ticks to wait at zero before resetting the entry to durationMs.

Client read and start

client.lua

Position keys

Cooldown entries are keyed by key plus a rounded vector3 position. Coordinates are rounded to two decimal places on both client and server to avoid floating point drift.

API by side

function
required
Registers a cooldown definition and creates storage for that key.
Client state is for display and convenience. Treat the server module as authoritative for gameplay decisions.