r4797 - in trunk/data: . qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Oct 21 13:45:13 EDT 2008
Author: div0
Date: 2008-10-21 13:45:12 -0400 (Tue, 21 Oct 2008)
New Revision: 4797
Modified:
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/server/clientcommands.qc
trunk/data/qcsrc/server/miscfunctions.qc
trunk/data/qcsrc/server/teamplay.qc
Log:
experimental g_start_delay cvar to wait for other players to join
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2008-10-21 17:21:36 UTC (rev 4796)
+++ trunk/data/defaultNexuiz.cfg 2008-10-21 17:45:12 UTC (rev 4797)
@@ -1163,3 +1163,5 @@
alias cl_teamradar_rotate "toggle cl_teamradar_rotation 0 1 2 3 4"
set g_maplist_allow_hidden 1 // allow hidden maps to be, e.g., voted for and in the maplist
+
+set g_start_delay 0 // delay before the game starts, so everyone can join; recommended to set this to like 15 on a public server
Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc 2008-10-21 17:21:36 UTC (rev 4796)
+++ trunk/data/qcsrc/server/clientcommands.qc 2008-10-21 17:45:12 UTC (rev 4797)
@@ -221,6 +221,7 @@
}
//float ctf_clientcommand();
+float readyrestart_happened;
void SV_ParseClientCommand(string s) {
local string cmd;
local float i, j, tokens;
@@ -330,13 +331,16 @@
return sprint(self, "^1You cannot reset the game while a timeout is active!\n");
}
- if(game_starttime == 0 || cvar("sv_ready_restart_repeatable"))
+ //if(!restartAnnouncer)
{
- self.ready = TRUE;
- bprint(self.netname, "^2 is ready\n");
- ReadyCount();
- } else {
- sprint(self, "^1game has already been restarted\n");
+ if(!readyrestart_happened || cvar("sv_ready_restart_repeatable"))
+ {
+ self.ready = TRUE;
+ bprint(self.netname, "^2 is ready\n");
+ ReadyCount();
+ } else {
+ sprint(self, "^1game has already been restarted\n");
+ }
}
}
} else if(argv(0) == "maplist") {
@@ -461,6 +465,7 @@
if(checkrules_overtimeend)
checkrules_overtimeend = 0;
+ readyrestart_happened = 1;
game_starttime = time + RESTART_COUNTDOWN;
restart_mapalreadyrestarted = 0; //reset this var, needed when cvar sv_ready_restart_repeatable is in use
@@ -488,7 +493,7 @@
restartAnnouncer = spawn();
restartAnnouncer.think = restartAnnouncer_Think;
restartAnnouncer.nextthink = time;
- restartAnnouncer.cnt = RESTART_COUNTDOWN;
+ restartAnnouncer.spawnflags = !!cvar("sv_ready_restart_after_countdown");
//after a restart every players number of allowed timeouts gets reset, too
if(cvar("sv_timeout"))
@@ -552,8 +557,12 @@
void restartAnnouncer_Think() {
local entity plr;
local string s;
- if(self.cnt <= 0) { //show the "Begin" message and
- if (cvar("sv_ready_restart_after_countdown")) {
+ float f, c;
+ c = game_starttime - time;
+ f = floor(0.5 + c);
+ if(c <= 0) { //show the "Begin" message and
+ if(self.spawnflags & 1)
+ {
restart_mapalreadyrestarted = 1;
reset_map();
}
@@ -572,16 +581,15 @@
else {
FOR_EACH_REALCLIENT(plr) {
if(plr.classname == "player") {
- s = strcat(NEWLINES, "^1Game starts in ", ftos(self.cnt), " seconds");
+ s = strcat(NEWLINES, "^1Game starts in ", ftos(f), " seconds");
centerprint(plr, s);
}
}
- if(self.cnt <= 3) {
- play2all(strcat("announcer/robotic/", ftos(self.cnt), ".ogg"));
+ if(f <= 3) {
+ play2all(strcat("announcer/robotic/", ftos(f), ".ogg"));
}
- self.nextthink = time + 1;
- self.cnt -= 1;
+ self.nextthink = game_starttime - (f - 1);
}
}
Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc 2008-10-21 17:21:36 UTC (rev 4796)
+++ trunk/data/qcsrc/server/miscfunctions.qc 2008-10-21 17:45:12 UTC (rev 4797)
@@ -911,6 +911,18 @@
g_pickup_healthmega = cvar("g_pickup_healthmega");
g_pickup_healthmega_max = cvar("g_pickup_healthmega_max");
+ if not(inWarmupStage)
+ {
+ game_starttime = cvar("g_start_delay");
+ if(game_starttime)
+ {
+ restartAnnouncer = spawn();
+ restartAnnouncer.think = restartAnnouncer_Think;
+ restartAnnouncer.nextthink = time + 0.1;
+ restartAnnouncer.spawnflags = 0;
+ }
+ }
+
readplayerstartcvars();
}
Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc 2008-10-21 17:21:36 UTC (rev 4796)
+++ trunk/data/qcsrc/server/teamplay.qc 2008-10-21 17:45:12 UTC (rev 4797)
@@ -392,7 +392,7 @@
local string specString;
specString = NEWLINES;
if(time < game_starttime) //also show the countdown when being a spectator
- specString = strcat(specString, "\n\n^1Game starts in ", ftos(restartAnnouncer.cnt + 1), " seconds^7");
+ specString = strcat(specString, "\n\n^1Game starts in ", ftos(ceil(game_starttime - time)), " seconds^7");
else if (timeoutStatus != 0)
specString = strcat(specString, "\n\n", getTimeoutText(1));
else
More information about the nexuiz-commits
mailing list