r2588 - trunk/data/qcsrc/server

savagex at icculus.org savagex at icculus.org
Fri May 18 07:23:14 EDT 2007


Author: savagex
Date: 2007-05-18 07:23:13 -0400 (Fri, 18 May 2007)
New Revision: 2588

Added:
   trunk/data/qcsrc/server/assault.qc
Modified:
   trunk/data/qcsrc/server/progs.src
Log:
my try at implementing a few assault basics. NOT WORKING YET. Some key 
parts are missing. Bad overall style. It rains rotten flesh.


Added: trunk/data/qcsrc/server/assault.qc
===================================================================
--- trunk/data/qcsrc/server/assault.qc	                        (rev 0)
+++ trunk/data/qcsrc/server/assault.qc	2007-05-18 11:23:13 UTC (rev 2588)
@@ -0,0 +1,88 @@
+float MAGIC_VALUE_INACTIVE = 1000;
+
+// attacker spawn point
+void info_player_attacker() {
+	self.team = COLOR_TEAM1; // red, gets swapped every round
+	info_player_deathmatch();
+}
+
+// defender spawn point
+void info_player_defender() {
+	self.team = COLOR_TEAM2; // blue, gets swapped every round
+	info_player_deathmatch();
+}
+
+// reset this objective. Used when spawning an objective
+// and when a new round starts
+void assault_objective_reset() {
+	if(self.spawnflags) { // first objective
+		self.health = 100;
+		self.nextthink = time + 0.1;
+	} else {
+		self.health = MAGIC_VALUE_INACTIVE;
+	}
+}
+
+void assault_objective_use() {
+	// activate objective
+	self.health = 100; 
+	self.nextthink = time + 0.1;
+}
+
+void assault_objective_think() {
+	
+	if(self.health < 0) {
+		local entity ent;
+		ent = find(world, targetname, self.target);
+		self = ent;
+		self.use();
+	} else {
+		self.nextthink = time + 0.1;
+	}
+	
+}
+
+void func_objective() {
+	self.classname = "func_objective";
+	self.think = assault_objective_think;
+	self.use = assault_objective_use;
+	assault_objective_reset();
+}
+
+
+void assault_new_round() {
+
+	// swap spawn point teams
+	local entity ent;
+	local entity oldself;
+
+	ent = find(world, classname, "info_player_deathmatch");
+	while (ent)
+	{
+		oldself = self;
+		self = ent;
+		if(self.team == COLOR_TEAM1) {
+			self.team = COLOR_TEAM2;
+		} else {
+			self.team = COLOR_TEAM1;
+		}
+		self = oldself;
+
+		ent = find(ent, classname, "info_player_deathmatch");
+	} 
+
+	// reset all objectives
+
+	ent = find(world, classname, "func_objective");
+	while (ent)
+	{
+		oldself = self;
+		self = ent;
+		assault_objective_reset();
+		self = oldself;
+
+		ent = find(ent, classname, "func_objective");
+	} 
+
+	// actually restart round... how to do that?
+}

Modified: trunk/data/qcsrc/server/progs.src
===================================================================
--- trunk/data/qcsrc/server/progs.src	2007-05-18 10:12:51 UTC (rev 2587)
+++ trunk/data/qcsrc/server/progs.src	2007-05-18 11:23:13 UTC (rev 2588)
@@ -88,3 +88,5 @@
 gamecommand.qc
 
 keyhunt.qc
+
+assault.qc




More information about the nexuiz-commits mailing list