r4824 - in trunk/data/qcsrc/server: . tturrets/include tturrets/system

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Oct 23 02:05:13 EDT 2008


Author: div0
Date: 2008-10-23 02:05:13 -0400 (Thu, 23 Oct 2008)
New Revision: 4824

Modified:
   trunk/data/qcsrc/server/mode_onslaught.qc
   trunk/data/qcsrc/server/tturrets/include/turret_tturrets_early.qh
   trunk/data/qcsrc/server/tturrets/system/turret_system_damage.qc
   trunk/data/qcsrc/server/tturrets/system/turret_system_main.qc
Log:
fix turrets for onslaught: default them to have no team and attack nobody if not powered, make them not shoot at control point (that's the players' job!)


Modified: trunk/data/qcsrc/server/mode_onslaught.qc
===================================================================
--- trunk/data/qcsrc/server/mode_onslaught.qc	2008-10-22 17:32:19 UTC (rev 4823)
+++ trunk/data/qcsrc/server/mode_onslaught.qc	2008-10-23 06:05:13 UTC (rev 4824)
@@ -602,6 +602,7 @@
 	self.isshielded = TRUE;
 	// spawn shield model which indicates whether this can be damaged
 	self.enemy = e = spawn();
+	e.classname = "onslaught_generator_shield";
 	e.solid = SOLID_NOT;
 	e.movetype = MOVETYPE_NONE;
 	e.effects = EF_ADDITIVE;
@@ -742,6 +743,7 @@
 	// so start building the captured point icon (which only captures this
 	// point if it successfully builds without being destroyed first)
 	self.goalentity = e = spawn();
+	e.classname = "onslaught_controlpoint_icon";
 	e.owner = self;
 	e.max_health = cvar("g_onslaught_cp_health");
 	e.health = e.max_health * 0.1;
@@ -803,6 +805,7 @@
 	self.isshielded = TRUE;
 	// spawn shield model which indicates whether this can be damaged
 	self.enemy = e = spawn();
+	e.classname = "onslaught_controlpoint_shield";
 	e.solid = SOLID_NOT;
 	e.movetype = MOVETYPE_NONE;
 	e.effects = EF_ADDITIVE;

Modified: trunk/data/qcsrc/server/tturrets/include/turret_tturrets_early.qh
===================================================================
--- trunk/data/qcsrc/server/tturrets/include/turret_tturrets_early.qh	2008-10-22 17:32:19 UTC (rev 4823)
+++ trunk/data/qcsrc/server/tturrets/include/turret_tturrets_early.qh	2008-10-23 06:05:13 UTC (rev 4824)
@@ -30,6 +30,8 @@
 #define TFL_TARGETSELECT_NOBUILTIN     256
 /// TFL_TARGETSELECT_TEAMCHECK is inverted (selects only mebers of own .team)
 #define TFL_TARGETSELECT_OWNTEAM       2048
+/// Turrets are valid targets
+#define TFL_TARGETSELECT_TURRETS       128
 
 /// aim flags
 .float aim_flags;

Modified: trunk/data/qcsrc/server/tturrets/system/turret_system_damage.qc
===================================================================
--- trunk/data/qcsrc/server/tturrets/system/turret_system_damage.qc	2008-10-22 17:32:19 UTC (rev 4823)
+++ trunk/data/qcsrc/server/tturrets/system/turret_system_damage.qc	2008-10-23 06:05:13 UTC (rev 4824)
@@ -199,8 +199,12 @@
     // Make sure all parts belong to the same team since
     // this function doubles as "teamchange" function.
     self.tur_head.team = self.team;
-    if (self.team == COLOR_TEAM1) self.colormod = '1.4 0.8 0.8';
-    if (self.team == COLOR_TEAM2) self.colormod = '0.8 0.8 1.4';
+	if (self.team == COLOR_TEAM1)
+		self.colormod = '1.4 0.8 0.8';
+	else if (self.team == COLOR_TEAM2)
+		self.colormod = '0.8 0.8 1.4';
+	else
+		self.colormod = '0 0 0'; // reset
 
     self.deadflag = DEAD_NO;
     self.tur_head.deadflag = self.deadflag;
@@ -254,7 +258,7 @@
     {
         if (self.team == attacker.team)
         {
-            sprint(attacker,"Turret: Im on your team!\n");
+            sprint(attacker, "\{1}Turret tells you: I'm on your team!\n");
             return;
         }
         else

Modified: trunk/data/qcsrc/server/tturrets/system/turret_system_main.qc
===================================================================
--- trunk/data/qcsrc/server/tturrets/system/turret_system_main.qc	2008-10-22 17:32:19 UTC (rev 4823)
+++ trunk/data/qcsrc/server/tturrets/system/turret_system_main.qc	2008-10-23 06:05:13 UTC (rev 4824)
@@ -367,6 +367,10 @@
     if (e_target.classname == "grapplinghook")
         return - 1.5;
 
+	if(g_onslaught)
+		if (substring(e_target.classname, 0, 10) == "onslaught_") // don't attack onslaught targets, that's the player's job!
+			return - 1.75;
+
     if (validate_flags & TFL_TARGETSELECT_NO)
         return -2;
 
@@ -388,6 +392,13 @@
             return -6;
     }
 
+	// enemy turrets
+	if (e_target.turret_firefunc || e_target.owner.tur_head == e_target)
+	{
+		if (!(validate_flags & TFL_TARGETSELECT_TURRETS))
+			return -5.5;
+	}
+
     // Missile
     if (e_target.flags & FL_PROJECTILE)
     {
@@ -515,7 +526,6 @@
     {
         if(g_onslaught)
         {
-
             /*
             // see turret_stdproc_use()
             if(self.targetname)
@@ -523,7 +533,8 @@
                 e = find(world,target,self.targetname);
                 if(e != world)
                     self.team = e.team;
-            }*/
+            }
+			*/
         }
         else
         {
@@ -725,6 +736,8 @@
 */
 float turret_stdproc_init (string cvar_base_name)
 {
+	entity e;
+
     // Are turrets allowed atm?
     if (cvar("g_turrets") == 0) return 0;
 
@@ -751,9 +764,16 @@
         if (!self.team)
             self.team = 14; // Assume turrets are on the defending side if not explicitly set otehrwize
     }
-    else
-        if ((!teamplay) || (!self.team))
-            self.team = MAX_SHOT_DISTANCE;
+    else if (!teamplay)
+		self.team = MAX_SHOT_DISTANCE;
+	else if(g_onslaught && self.targetname)
+	{
+		e = find(world,target,self.targetname);
+		if(e != world)
+			self.team = e.team;
+	}
+	else if(!self.team)
+		self.team = MAX_SHOT_DISTANCE;
 
 
     /*




More information about the nexuiz-commits mailing list