r2590 - trunk/data/qcsrc/server

savagex at icculus.org savagex at icculus.org
Fri May 18 08:15:31 EDT 2007


Author: savagex
Date: 2007-05-18 08:15:31 -0400 (Fri, 18 May 2007)
New Revision: 2590

Modified:
   trunk/data/qcsrc/server/assault.qc
Log:
rename entities according to convention, introduce 
target_objective_decrease that if triggered decreases the health of 
targeted entities (that'd be target_objective entities)


Modified: trunk/data/qcsrc/server/assault.qc
===================================================================
--- trunk/data/qcsrc/server/assault.qc	2007-05-18 11:39:41 UTC (rev 2589)
+++ trunk/data/qcsrc/server/assault.qc	2007-05-18 12:15:31 UTC (rev 2590)
@@ -41,13 +41,33 @@
 	
 }
 
-void func_objective() {
-	self.classname = "func_objective";
+void target_objective() {
+	self.classname = "target_objective";
 	self.think = assault_objective_think;
 	self.use = assault_objective_use;
 	assault_objective_reset();
 }
 
+// decrease the health of targeted objectives
+void assault_objective_decrease() {
+
+	local entity ent;
+	local entity oldself;
+	ent = find(world, targetname, self.target);
+	while(ent) {
+		ent.health = ent.health - self.dmg;
+		ent = find(ent, targetname, self.target);
+	}
+}
+
+// this entity should target an objective and be targeted by triggers
+void target_objective_decrease() {
+	if(!self.dmg) {
+		self.dmg = 101;
+	}
+	self.use = assault_objective_decrease;
+}
+
 // trigger new round
 // reset objectives, toggle spawnpoints, reset triggers, ...
 void assault_new_round() {
@@ -76,7 +96,7 @@
 
 	// reset all objectives
 
-	ent = find(world, classname, "func_objective");
+	ent = find(world, classname, "target_objective");
 	while (ent)
 	{
 		oldself = self;
@@ -84,15 +104,15 @@
 		assault_objective_reset();
 		self = oldself;
 
-		ent = find(ent, classname, "func_objective");
+		ent = find(ent, classname, "target_objective");
 	} 
 
 	// actually restart round... how to do that?
 }
 
-void func_assault_roundend() {
+void target_assault_roundend() {
 	self.cnt = 0; // round counter
-	self.classname = "func_assault_roundend";
+	self.classname = "target_assault_roundend";
 	self.use = assault_new_round;
 	
 }




More information about the nexuiz-commits mailing list