r2628 - trunk/data/qcsrc/server

savagex at icculus.org savagex at icculus.org
Sun May 20 09:13:35 EDT 2007


Author: savagex
Date: 2007-05-20 09:13:35 -0400 (Sun, 20 May 2007)
New Revision: 2628

Modified:
   trunk/data/qcsrc/server/assault.qc
Log:
func_assault_destructible now show their damage with color tinting. 
Health <= 75%: yellow, health <= 25%: red


Modified: trunk/data/qcsrc/server/assault.qc
===================================================================
--- trunk/data/qcsrc/server/assault.qc	2007-05-20 12:45:25 UTC (rev 2627)
+++ trunk/data/qcsrc/server/assault.qc	2007-05-20 13:13:35 UTC (rev 2628)
@@ -131,6 +131,7 @@
 	self.health = self.max_health;
 	self.model = self.mdl;
 	self.solid = SOLID_BSP;
+	self.colormod = '1 1 1';
 	self.cnt = 0; // not active
 	if(self.spawnflags)
 		self.use();
@@ -162,6 +163,12 @@
 
 	if(self.cnt > 0 && assault_attacker_team == attacker.team) {
 		self.health = self.health - damage;
+		if(self.health / self.max_health < 0.25)
+			self.colormod = '1 0 0';
+		else if(self.health / self.max_health < 0.75)
+			self.colormod = '1 1 0';
+		else
+			self.colormod = '1 1 1';
 	}
 
 	if(self.health < 0) {
@@ -201,6 +208,22 @@
 	local entity ent;
 	local entity oldself;
 
+	// reward attackers for winning the round
+	ent = find(world, classname, "player");
+	while(ent) {
+		if(ent.team == assault_attacker_team) {
+			UpdateFrags(ent, 10);
+		}
+		ent = find(ent, classname, "player");
+	}
+
+	// swap attacker/defender roles
+	if(assault_attacker_team == COLOR_TEAM1) {
+		assault_attacker_team = COLOR_TEAM2;
+	} else {
+		assault_attacker_team = COLOR_TEAM1;
+	}
+
 	ent = find(world, classname, "info_player_deathmatch");
 	while (ent)
 	{
@@ -262,20 +285,12 @@
 	while(ent) {
 		oldself = self;
 		self = ent;
-		if(self.team == assault_attacker_team) {
-			UpdateFrags(self, 10);
-		}
 		PutClientInServer();
 		self = oldself;
 		ent = find(ent, classname, "player");
 	}
 
-	// swap attacker/defender roles
-	if(assault_attacker_team == COLOR_TEAM1) {
-		assault_attacker_team = COLOR_TEAM2;
-	} else {
-		assault_attacker_team = COLOR_TEAM1;
-	}
+
 }
 
 void target_assault_roundend() {




More information about the nexuiz-commits mailing list