Skip to content

Commit 883ce7f

Browse files
committed
Reset timers on load & grab time from serverinfo.
1 parent 499e211 commit 883ce7f

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/itemtimer.qc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ void(float timestamp) PipResetTimers =
6565
for (int i = 0; i < MAX_POWERUPS; i++) {
6666
itemtimer_t *timer = &timers[i];
6767
timer->respawn = timestamp;
68+
timer->entnum = 0;
69+
timer->playernum = 0;
70+
timer->took = 0;
71+
timer->respawn = 0;
72+
timer->item = nil;
73+
6874
}
6975
}
7076

src/main.qc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,15 @@ void() CSQC_WorldLoaded =
303303
deltalisten("progs/player.mdl", PipNewPlayer, 0);
304304
}
305305
306+
match_start_time = 0;
306307
camera_index = -1;
307308
camera_start = CAMERA_START_RESET;
308309
camera_start_transition = CAMERA_START_RESET;
309310
camera_end = CAMERA_END_RESET;
310311
camera_end_transition = CAMERA_END_RESET;
311312
313+
PipResetTimers(0);
314+
312315
if (PipLoadItems()) {
313316
deltalisten("progs/quaddama.mdl", PipPowerupSpawnListener, RSES_NOLERP);
314317
deltalisten("progs/invulner.mdl", PipPowerupSpawnListener, RSES_NOLERP);
@@ -326,7 +329,14 @@ void() CSQC_ServerInfoChanged =
326329
return;
327330
}
328331
329-
match_start_time = time;
332+
println(status);
333+
float argc = tokenize(status);
334+
if (argc == 3 && argv(1) == "mins" && argv(2) == "left") {
335+
float minutes = stof(argv(0));
336+
match_start_time = time - minutes * 60;
337+
} else {
338+
match_start_time = time;
339+
}
330340
331341
PipResetTimers(match_start_time);
332342

0 commit comments

Comments
 (0)