From 333afdc0f5940881b7702e78aa295a24e5167702 Mon Sep 17 00:00:00 2001 From: savagex Date: Mon, 21 May 2007 12:53:06 +0000 Subject: [PATCH] assault rounds now last 300 seconds by default (can be overridden with the health field of target_assault_roundend) git-svn-id: svn://svn.icculus.org/nexuiz/trunk@2647 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/assault.qc | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/data/qcsrc/server/assault.qc b/data/qcsrc/server/assault.qc index 28fa9f149..2c53638ea 100644 --- a/data/qcsrc/server/assault.qc +++ b/data/qcsrc/server/assault.qc @@ -296,8 +296,10 @@ void func_assault_wall() { // reset objectives, toggle spawnpoints, reset triggers, ... void assault_new_round() { - // this assumes self.classname == "func_assault_roundend"! - self.cnt = self.cnt + 1; + // up round counter + self.winning = self.winning + 1; + // set end time for next round + self.cnt = time + self.health; // swap spawn point teams local entity ent; @@ -388,10 +390,35 @@ void assault_new_round() { } +void assault_roundend_think() { + if(time > self.cnt) + assault_new_round(); + + local float timeleft; + timeleft = self.cnt - time; + timeleft = ceil(timeleft); + + if(timeleft <= 10) { + local entity ent; + ent = find(world, classname, "player"); + while(ent) { + centerprint(ent, ftos(timeleft)); + ent = find(ent, classname, "player"); + } + } + + self.nextthink = time + 0.25; +} + void target_assault_roundend() { - self.cnt = 0; // round counter + if(!self.health) + self.health = 300; // 5 minutes + self.winning = 0; // round counter + self.cnt = time + self.max_health; // time when this round ends self.classname = "target_assault_roundend"; self.use = assault_new_round; + self.think = assault_roundend_think; + self.nextthink = time; } void assault_roundstart_use() { -- 2.39.2