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

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Jan 25 12:10:24 EST 2010


Author: div0
Date: 2010-01-25 12:10:19 -0500 (Mon, 25 Jan 2010)
New Revision: 8566

Modified:
   trunk/data/qcsrc/server/cheats.qc
   trunk/data/qcsrc/server/t_items.qc
Log:
moved "give all" into items trigger code, so an items trigger can also cause it

Modified: trunk/data/qcsrc/server/cheats.qc
===================================================================
--- trunk/data/qcsrc/server/cheats.qc	2010-01-25 17:09:54 UTC (rev 8565)
+++ trunk/data/qcsrc/server/cheats.qc	2010-01-25 17:10:19 UTC (rev 8566)
@@ -61,9 +61,11 @@
 	cheating = 0
 #define DID_CHEAT() \
 	++cheating
+#define ADD_CHEATS(e,n) \
+	cheatcount_total += n; \
+	e.cheatcount += n
 #define END_CHEAT_FUNCTION() \
-	cheatcount_total += cheating; \
-	self.cheatcount += cheating; \
+	ADD_CHEATS(self,cheating); \
 	return cheating
 
 float CheatImpulse(float i)
@@ -243,11 +245,10 @@
 	cmd = argv(0);
 	switch(cmd)
 	{
-		entity e, wi;
-		float effectnum, f, j;
+		entity e;
+		float effectnum, f;
 		vector start, end;
 		entity oldself;
-		string s;
 
 		case "pointparticles":
 			if(argc == 5)
@@ -614,21 +615,8 @@
 			}
 			break;
 		case "give":
-			if(argv(1) == "all")
-			{
-				s = "jetpack cells shells nails rockets health armor fuel";
-				for(j = WEP_FIRST; j <= WEP_LAST; ++j)
-				{
-					wi = get_weaponinfo(j);
-					if(wi.weapon)
-						s = strcat(s, " ", wi.netname);
-				}
-				argc = tokenize_console(s);
-				GiveItems(self, 0, tokenize_console(s));
+			if(GiveItems(self, 1, argc))
 				DID_CHEAT();
-			}
-			else if(GiveItems(self, 1, argc))
-				DID_CHEAT();
 			break;
 	}
 

Modified: trunk/data/qcsrc/server/t_items.qc
===================================================================
--- trunk/data/qcsrc/server/t_items.qc	2010-01-25 17:09:54 UTC (rev 8565)
+++ trunk/data/qcsrc/server/t_items.qc	2010-01-25 17:10:19 UTC (rev 8566)
@@ -1653,6 +1653,34 @@
 			case "minus":
 				op = OP_MINUS;
 				continue;
+			case "all":
+				got += GiveBit(e, items, IT_UNLIMITED_AMMO | IT_JETPACK, op, val, "misc/powerup.wav", "misc/poweroff.wav");
+				got += GiveValue(e, ammo_cells, op, val, "misc/itempickup.wav", string_null);
+				got += GiveValue(e, ammo_shells, op, val, "misc/itempickup.wav", string_null);
+				got += GiveValue(e, ammo_nails, op, val, "misc/itempickup.wav", string_null);
+				got += GiveValue(e, ammo_rockets, op, val, "misc/itempickup.wav", string_null);
+				got += GiveValueRot(e, health, pauserothealth_finished, cvar("g_balance_pause_health_rot"), pauseregen_finished, cvar("g_balance_pause_health_regen"), op, val, "misc/megahealth.wav", string_null);
+				got += GiveValueRot(e, armorvalue, pauserotarmor_finished, cvar("g_balance_pause_armor_rot"), pauseregen_finished, cvar("g_balance_pause_health_regen"), op, val, "misc/armor25.wav", string_null);
+				got += GiveValueRot(e, ammo_fuel, pauserotfuel_finished, cvar("g_balance_pause_fuel_rot"), pauseregen_finished, cvar("g_balance_pause_fuel_regen"), op, val, "misc/itempickup.wav", string_null);
+				for(j = WEP_FIRST; j <= WEP_LAST; ++j)
+				{
+					wi = get_weaponinfo(j);
+					if(wi.weapons)
+					{
+						if(e.weapons & wi.weapons)
+						{
+							got += GiveBit(e, weapons, wi.weapons, op, val, "weapons/weaponpickup.wav", "");
+						}
+						else
+						{
+							got += GiveBit(e, weapons, wi.weapons, op, val, "weapons/weaponpickup.wav", "");
+							if(e.weapons & wi.weapons)
+								weapon_action(wi.weapon, WR_PRECACHE);
+						}
+						break;
+					}
+				}
+				break;
 			case "unlimited_ammo":
 				got += GiveBit(e, items, IT_UNLIMITED_AMMO, op, val, "misc/powerup.wav", "misc/poweroff.wav");
 				break;



More information about the nexuiz-commits mailing list