r2606 - trunk/data/qcsrc/server

savagex at icculus.org savagex at icculus.org
Sat May 19 11:32:57 EDT 2007


Author: savagex
Date: 2007-05-19 11:32:57 -0400 (Sat, 19 May 2007)
New Revision: 2606

Modified:
   trunk/data/qcsrc/server/assault.qc
Log:
added target_assault_roundstart which is triggered whenever a new round 
is started and which triggers all targets (to activate the first 
target_objective etc.)


Modified: trunk/data/qcsrc/server/assault.qc
===================================================================
--- trunk/data/qcsrc/server/assault.qc	2007-05-19 14:32:27 UTC (rev 2605)
+++ trunk/data/qcsrc/server/assault.qc	2007-05-19 15:32:57 UTC (rev 2606)
@@ -14,12 +14,7 @@
 // reset this objective. Used when spawning an objective
 // and when a new round starts
 void assault_objective_reset() {
-	if(self.spawnflags) { // first objective
-		self.health = 100;
-		self.nextthink = time + 0.1;
-	} else {
-		self.health = ASSAULT_VALUE_INACTIVE;
-	}
+	self.health = ASSAULT_VALUE_INACTIVE;
 }
 
 void assault_objective_use() {
@@ -64,7 +59,7 @@
 	found = 0;
 	objective = find(world, targetname, self.target);
 	while(objective && found == 0) {
-		if(objective.classname = "target_objective") {
+		if(objective.classname == "target_objective") {
 			found = 1;
 			if(objective.health < ASSAULT_VALUE_INACTIVE) { // targeted objective is active
 				if(self.cnt == 1 && self.max_health >= ASSAULT_VALUE_INACTIVE) { 
@@ -185,8 +180,6 @@
 	self.use = assault_destructible_use;
 	self.event_damage = assault_destructible_damage;
 
-	if(self.spawnflags) // active from start
-		self.use();
 }
 
 
@@ -247,6 +240,16 @@
 		ent = find(ent, classname, "func_assault_destructible");
 	}
 
+	ent = find(world, classname, "target_assault_roundstart");
+	while (ent)
+	{
+		oldself = self;
+		self = ent;
+		self.use();
+		self = oldself;
+		ent = find(ent, classname, "target_assault_roundstart");
+	}
+
 	// actually restart round... how to do that?
 }
 
@@ -256,4 +259,24 @@
 	self.use = assault_new_round;
 }
 
+void assault_roundstart_use() {
+	local entity ent;
+	local entity oldself;
+	ent = find(world, targetname, self.target);
+	while(ent) {
+		oldself = self;
+		self = ent;
+		self.use();
+		self = oldself;
+		ent = find(ent, targetname, self.target);
+	}
+}
 
+void target_assault_roundstart() {
+	self.classname = "target_assault_roundstart";
+	self.use = assault_roundstart_use;
+	self.think = assault_roundstart_use;
+	self.nextthink = time + 0.1;
+}
+
+




More information about the nexuiz-commits mailing list