[nexuiz-commits] r8370 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Dec 5 05:11:31 EST 2009


Author: fruitiex
Date: 2009-12-05 05:11:31 -0500 (Sat, 05 Dec 2009)
New Revision: 8370

Modified:
   trunk/data/qcsrc/server/t_quake3.qc
Log:
support defrag weapon/item give entity


Modified: trunk/data/qcsrc/server/t_quake3.qc
===================================================================
--- trunk/data/qcsrc/server/t_quake3.qc	2009-12-05 10:00:03 UTC (rev 8369)
+++ trunk/data/qcsrc/server/t_quake3.qc	2009-12-05 10:11:31 UTC (rev 8370)
@@ -40,7 +40,53 @@
 void spawnfunc_item_enviro()         { spawnfunc_item_invincible();    }
 
 // weapon remove ent from defrag
-void spawnfunc_target_init()         { spawnfunc_target_items();       }
+void spawnfunc_target_init()         
+{
+	self.spawnflags = 0; // remove all weapons except the ones listed below
+	self.netname = "laser uzi"; // keep these weapons through the remove trigger
+	spawnfunc_target_items();
+}
+
+// weapon give ent from defrag
+void spawnfunc_target_give()
+{
+	entity targ;
+	for (targ = world; (targ = find(targ, targetname, self.target)); ) {
+		if (targ.classname == "weapon_rocketlauncher") {
+			self.ammo_rockets += targ.count * cvar("g_balance_rocketlauncher_ammo");
+			self.netname = "rocketlauncher";
+		}
+		if (targ.classname == "weapon_plasmagun") {
+			self.ammo_rockets += targ.count * cvar("g_balance_hagar_primary_ammo");
+			if(self.netname == "")
+				self.netname = "hagar";
+			else
+				self.netname = strcat(self.netname, " hagar");
+		}
+		if (targ.classname == "weapon_bfg") {
+			self.ammo_cells += targ.count * cvar("g_balance_crylink_primary_ammo");
+			if(self.netname == "")
+				self.netname = "crylink";
+			else
+				self.netname = strcat(self.netname, " crylink");
+		}
+		if (targ.classname == "weapon_grenadelauncher") {
+			self.ammo_rockets += targ.count * cvar("g_balance_grenadelauncher_primary_ammo");
+			if(self.netname == "")
+				self.netname = "grenadelauncher";
+			else
+				self.netname = strcat(self.netname, " grenadelauncher");
+		}
+		if (targ.classname == "item_armor_body")
+			self.armorvalue = 100;
+		if (targ.classname == "item_health_mega")
+			self.health = 200;
+		remove(targ);
+	}
+	self.spawnflags = 2;
+	spawnfunc_target_items();
+}
+
 //void spawnfunc_item_flight()       /* not supported */
 //void spawnfunc_item_haste()        /* not supported */
 //void spawnfunc_item_health()       /* handled in t_quake.qc */



More information about the nexuiz-commits mailing list