r2602 - trunk/data/qcsrc/server

savagex at icculus.org savagex at icculus.org
Sat May 19 08:46:40 EDT 2007


Author: savagex
Date: 2007-05-19 08:46:40 -0400 (Sat, 19 May 2007)
New Revision: 2602

Modified:
   trunk/data/qcsrc/server/assault.qc
Log:
target_objective_decrease that are assigned to an active 
target_objective and that haven't fired yet now show a "HERE" sprite 
(crude way to show players what to attack/defend, needs get replaced 
with div0's nice waypoint system sooner or later)


Modified: trunk/data/qcsrc/server/assault.qc
===================================================================
--- trunk/data/qcsrc/server/assault.qc	2007-05-18 21:36:17 UTC (rev 2601)
+++ trunk/data/qcsrc/server/assault.qc	2007-05-19 12:46:40 UTC (rev 2602)
@@ -31,7 +31,7 @@
 void assault_objective_think() {
 	local entity oldself;	
 	if(self.health < 0) {
-		self.effects = 0;
+		//self.effects = 0;
 		local entity ent;
 		ent = find(world, targetname, self.target);
 		while(ent) {
@@ -43,7 +43,7 @@
 			
 		}
 	} else {
-		self.effects = EF_STARDUST;
+		//self.effects = EF_STARDUST;
 		self.nextthink = time + 0.1;
 	}
 	
@@ -56,6 +56,39 @@
 	assault_objective_reset();
 }
 
+
+void assault_objective_decrease_think() {
+
+	local entity objective;
+	local float found;
+	found = 0;
+	objective = find(world, targetname, self.target);
+	while(objective && found == 0) {
+		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) { 
+					// decrease was fired already, but objective did recover (round reset)
+					self.cnt = 0;
+				}
+			} else { // objective isn't active
+				self.cnt = 1;
+			}
+			self.max_health = objective.health; // save current objective status for next think
+		}
+	}
+
+	if(self.cnt == 0) {
+		if(self.model != self.mdl)
+			setmodel(self, self.mdl);
+	} else {
+		self.model = "";
+	}
+
+	self.nextthink = time + 0.2;
+}
+
+
 // decrease the health of targeted objectives
 void assault_objective_decrease() {
 
@@ -78,7 +111,14 @@
 	if(!self.dmg) {
 		self.dmg = 101;
 	}
+	self.cnt = 0; // not used yet
 	self.use = assault_objective_decrease;
+	self.mdl = "models/sprites/here.sp2";
+	self.effects = EF_NODEPTHTEST;
+	self.health = ASSAULT_VALUE_INACTIVE;
+	self.max_health = ASSAULT_VALUE_INACTIVE;
+	self.think = assault_objective_decrease_think;
+	self.nextthink = time;
 }
 
 
@@ -188,6 +228,14 @@
 		ent = find(ent, classname, "target_objective");
 	} 
 
+	// reset all target_object_decrease
+	ent = find(world, classname, "target_objective_decrease");
+	while (ent)
+	{
+		ent.cnt = 0;
+		ent = find(ent, classname, "target_objective_decrease");
+	} 
+
 	// reset all func_assault_destructible
 	ent = find(world, classname, "func_assault_destructible");
 	while (ent)




More information about the nexuiz-commits mailing list