r3512 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Mar 17 09:04:54 EDT 2008


Author: blub0
Date: 2008-03-17 09:04:52 -0400 (Mon, 17 Mar 2008)
New Revision: 3512

Modified:
   trunk/data/qcsrc/server/arena.qc
   trunk/data/qcsrc/server/clientcommands.qc
   trunk/data/qcsrc/server/mode_onslaught.qc
Log:
onslaught ready reset code, all those who promised to test it haven't reported any bugs with it, I couldn't find any either, so I assume it is working :P

Modified: trunk/data/qcsrc/server/arena.qc
===================================================================
--- trunk/data/qcsrc/server/arena.qc	2008-03-16 10:18:28 UTC (rev 3511)
+++ trunk/data/qcsrc/server/arena.qc	2008-03-17 13:04:52 UTC (rev 3512)
@@ -16,6 +16,8 @@
 void(entity e) ReturnFlag;
 void(entity e) removedecor;
 void dom_controlpoint_setup();
+void onslaught_generator_reset();
+void onslaught_controlpoint_reset();
 
 void reset_map()
 {
@@ -29,26 +31,8 @@
 	self = nextent(world);
 	while(self)
 	{
-		if(self.flags & FL_CLIENT)				// reset all players
+		if(self.classname == STR_ITEM_KH_KEY)
 		{
-			if(time < restart_countdown)
-			{
-				self.frags = (g_lms)?LMS_NewPlayerLives():0;
-				self.deaths = 0;
-				self.killcount = 0;
-				self.classname = "player";
-				PutClientInServer();
-			}
-			else if(g_arena)
-			{
-				if(self.spawned)
-					PutClientInServer();
-				else
-					PutObserverInServer();
-			}
-		}
-		else if(self.classname == STR_ITEM_KH_KEY)
-		{
 			kh_Key_AssignTo(self, world);
 			//if(self.owner)
 			//	kh_Key_DropAll(self.owner, TRUE);
@@ -81,10 +65,6 @@
 		{
 			dom_controlpoint_setup();
 		}
-		else if(self.classname == "info_player_deathmatch")
-		{
-			self.team = self.team_saved; // reset spawns to their original state too!
-		}
 		else if(self.flags & FL_ITEM)			// reset items
 		{
 			self.model = self.mdl;
@@ -103,10 +83,46 @@
 			removedecor(self);
 		}
 		// TODO properly reset Onslaught
+		else if(self.classname == "onslaught_generator")
+		{
+			onslaught_generator_reset();
+		}
+		else if(self.classname == "onslaught_controlpoint")
+		{
+			onslaught_controlpoint_reset();
+		}
 		// TODO properly reset Assault
+		// General teambased game modes
+		else if(self.classname == "info_player_deathmatch")
+		{
+			self.team = self.team_saved;
+		}
 		self = nextent(self);
 	}
 
+	// Moving the player reset code here since the player-reset depends
+	// on spawnpoint entities which have to be reset first --blub
+	FOR_EACH_CLIENT(self) {
+		if(self.flags & FL_CLIENT)				// reset all players
+		{
+			if(time < restart_countdown)
+			{
+				self.frags = (g_lms)?LMS_NewPlayerLives():0;
+				self.deaths = 0;
+				self.killcount = 0;
+				self.classname = "player";
+				PutClientInServer();
+			}
+			else if(g_arena)
+			{
+				if(self.spawned)
+					PutClientInServer();
+				else
+					PutObserverInServer();
+			}
+		}
+	}
+
 	if(g_keyhunt)
 		kh_Controller_SetThink(cvar("g_balance_keyhunt_delay_round")+RESTART_COUNTDOWN, "", kh_StartRound);
 

Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc	2008-03-16 10:18:28 UTC (rev 3511)
+++ trunk/data/qcsrc/server/clientcommands.qc	2008-03-17 13:04:52 UTC (rev 3512)
@@ -829,8 +829,8 @@
 
 	bprint("^1Server is restarting...\n");
 
-	// no arena, assault & onslaught support yet...
-	if(g_arena | g_assault | g_onslaught | gameover | intermission_running)
+	// no arena, assault support yet...
+	if(g_arena | g_assault | gameover | intermission_running)
 		localcmd("restart\n");
 
 	restart_countdown = time + RESTART_COUNTDOWN;

Modified: trunk/data/qcsrc/server/mode_onslaught.qc
===================================================================
--- trunk/data/qcsrc/server/mode_onslaught.qc	2008-03-16 10:18:28 UTC (rev 3511)
+++ trunk/data/qcsrc/server/mode_onslaught.qc	2008-03-17 13:04:52 UTC (rev 3512)
@@ -548,6 +548,7 @@
 	precache_sound("sound/onslaught/generator_underattack.wav");
 	if (!self.team)
 		objerror("team must be set");
+	self.team_saved = self.team;
 	self.colormap = 1024 + (self.team - 1) * 17;
 	self.solid = SOLID_BSP;
 	self.movetype = MOVETYPE_NONE;
@@ -578,6 +579,20 @@
 	self.sprite.waypointsprite_for_player = onslaught_generator_waypointsprite_for_player;
 };
 
+void() onslaught_generator_reset =
+{
+	self.team = self.team_saved;
+	self.lasthealth = self.max_health = self.health = cvar("g_onslaught_gen_health");
+	self.takedamage = DAMAGE_AIM;
+	self.bot_attack = TRUE;
+	self.iscaptured = TRUE;
+	self.islinked = TRUE;
+	self.isshielded = TRUE;
+	self.enemy.solid = SOLID_NOT;
+	self.think = onslaught_generator_delayed;
+	self.nextthink = time + 0.2;
+}
+
 void(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) onslaught_controlpoint_icon_damage =
 {
 	entity oself;
@@ -763,6 +778,27 @@
 	self.sprite.waypointsprite_for_player = onslaught_controlpoint_waypointsprite_for_player;
 };
 
+void() onslaught_controlpoint_reset =
+{
+	if(self.goalentity && self.goalentity != world)
+		remove(self.goalentity);
+	self.goalentity = world;
+	self.team = 0;
+	self.colormap = 1024;
+	self.iscaptured = FALSE;
+	self.islinked = FALSE;
+	self.isshielded = TRUE;
+	self.enemy.solid = SOLID_NOT;
+	self.enemy.colormap = self.colormap;
+	self.think = self.enemy.think = SUB_Null;
+	self.nextthink = 0; // don't like SUB_Null :P
+	
+	onslaught_updatelinks();
+
+	activator = self;
+	SUB_UseTargets(); // to reset the structures, playerspawns etc.
+}
+
 void() onslaught_link_delayed =
 {
 	self.goalentity = find(world, targetname, self.target);




More information about the nexuiz-commits mailing list