Module countdown

Countdown

These functions provide the ability to display a countdown timer that also locks players during countdown.

Countdown timer should be initialized and ticked server-side and drawn on client-side. Audio is played during countdown.

-- Example of typical usage
function server.init()
    countdownInit(3.0)
end

function server.tick(dt)
    if countdownTick(dt) then
        return -- Match hasn't started yet..
    end

    -- countdown is now done!
    -- do game logic.
end

function client.draw()
    countdownDraw()
end

Functions

countdownInit (countdownSeconds) Initialize count down timer (server)
countdownTick (dt) Tick down the timer (server)

Decrement the timer by dt.

countdownDraw () Draw the countdown timer (client)
countdownDone () Check if countdown is complete.
countdownGetTime () Get remaining time.


Functions

countdownInit (countdownSeconds)
Initialize count down timer (server) Initializes a count down timer that can be displayed for all players.

Parameters:

  • countdownSeconds number Time in seconds that represents the duration of the countdown.
countdownTick (dt)
Tick down the timer (server)

Decrement the timer by dt. Players are locked during countdown.

Parameters:

  • dt number Time in seconds that represents the duration of the countdown.

Returns:

    bool true if the timer is still active.
countdownDraw ()
Draw the countdown timer (client) Draws the countdown timer and a 'Match starts in...' label.

Returns:

    bool true if the timer is still active.
countdownDone ()
Check if countdown is complete.

Used to check if the countdown is finished or still progressing.

Returns:

    bool true if the countdown has reached 0.
countdownGetTime ()
Get remaining time.

Returns the remaining time, clamped to 0

Returns:

    number Remaining time.
generated by LDoc 1.5.0 Last updated 2025-12-09 10:41:23