diff --git a/[gamemodes]/[deathmatch]/deathmatch/client/main.lua b/[gamemodes]/[deathmatch]/deathmatch/client/main.lua index b514199bc..e5542912d 100644 --- a/[gamemodes]/[deathmatch]/deathmatch/client/main.lua +++ b/[gamemodes]/[deathmatch]/deathmatch/client/main.lua @@ -102,7 +102,7 @@ local function stopGamemodeRound(winner, draw, aborted) toggleAllControls(true, true, false) end -- begin fading out the screen - fadeCamera(false, CAMERA_LOAD_DELAY/1000) + fadeCamera(false, ROUND_START_DELAY/1000) -- show end screen and scoreboard _hud.endScreen:update(winner, draw, aborted) _hud.endScreen:setVisible(true) diff --git a/[gamemodes]/[deathmatch]/deathmatch/server/main.lua b/[gamemodes]/[deathmatch]/deathmatch/server/main.lua index 63d124198..486dd94b0 100644 --- a/[gamemodes]/[deathmatch]/deathmatch/server/main.lua +++ b/[gamemodes]/[deathmatch]/deathmatch/server/main.lua @@ -74,7 +74,8 @@ local function startGamemodeMap(mapResource) end end -- schedule round to begin - setTimer(beginRound, CAMERA_LOAD_DELAY, 1) + _startTimer = exports.missiontimer:createMissionTimer(ROUND_START_DELAY, true, "Next round begins in %s seconds", 0.5, 20, true, "default-bold", 1) + addEventHandler("onMissionTimerElapsed", _startTimer, beginRound) end addEventHandler("onGamemodeMapStart", root, startGamemodeMap) @@ -82,6 +83,10 @@ addEventHandler("onGamemodeMapStart", root, startGamemodeMap) -- stopGamemodeMap: cleans up a gamemode map -- local function stopGamemodeMap(mapResource) + -- kill start timer, if it exists + if isElement(_startTimer) then + destroyElement(_startTimer) + end -- end the round endRound(false, false, true) -- update game state diff --git a/[gamemodes]/[deathmatch]/deathmatch/server/round.lua b/[gamemodes]/[deathmatch]/deathmatch/server/round.lua index 778f48e7e..622e6e66f 100644 --- a/[gamemodes]/[deathmatch]/deathmatch/server/round.lua +++ b/[gamemodes]/[deathmatch]/deathmatch/server/round.lua @@ -2,9 +2,11 @@ -- beginRound: begins the round -- function beginRound() + -- destroy start timer + destroyElement(_startTimer) -- start round timer if _timeLimit > 0 then - _missionTimer = exports.missiontimer:createMissionTimer(_timeLimit, true, true, 0.5, 20, true, "default-bold", 1) + _missionTimer = exports.missiontimer:createMissionTimer(_timeLimit, true, "%m:%s", 0.5, 20, true, "default-bold", 1) addEventHandler("onMissionTimerElapsed", _missionTimer, onTimeElapsed) end -- attach player wasted handler diff --git a/[gamemodes]/[deathmatch]/deathmatch/shared/shared.lua b/[gamemodes]/[deathmatch]/deathmatch/shared/shared.lua index ab84255bf..b83743a0a 100644 --- a/[gamemodes]/[deathmatch]/deathmatch/shared/shared.lua +++ b/[gamemodes]/[deathmatch]/deathmatch/shared/shared.lua @@ -1,4 +1,4 @@ -CAMERA_LOAD_DELAY = 5000 -- delay used at beginning and end of round (ms) +ROUND_START_DELAY = 5000 -- delay used at beginning and end of round (ms) -- -- enum: creates a c-style enum