r5494 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Jan 12 04:10:41 EST 2009


Author: div0
Date: 2009-01-12 04:10:27 -0500 (Mon, 12 Jan 2009)
New Revision: 5494

Modified:
   trunk/data/qcsrc/server/miscfunctions.qc
   trunk/data/qcsrc/server/t_items.qc
Log:
new mode: g_weapon_stay 2

players start with one ammo pickup full of ammo for each of the ammo types
picking up weapons won't gain any ammo at all


Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2009-01-12 07:28:31 UTC (rev 5493)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2009-01-12 09:10:27 UTC (rev 5494)
@@ -735,6 +735,7 @@
 float warmup_start_ammo_cells;
 float warmup_start_health;
 float warmup_start_armorvalue;
+float g_weapon_stay;
 
 entity get_weaponinfo(float w);
 
@@ -917,6 +918,28 @@
 		start_weapons &~= WEPBIT_HOOK;
 		warmup_start_weapons &~= WEPBIT_HOOK;
 	}
+
+	if(g_weapon_stay == 2)
+	{
+		if(!start_ammo_shells) start_ammo_shells = g_pickup_shells;
+		if(!start_ammo_nails) start_ammo_shells = g_pickup_nails;
+		if(!start_ammo_cells) start_ammo_shells = g_pickup_cells;
+		if(!start_ammo_rockets) start_ammo_shells = g_pickup_rockets;
+		if(!warmup_start_ammo_shells) warmup_start_ammo_shells = g_pickup_shells;
+		if(!warmup_start_ammo_nails) warmup_start_ammo_shells = g_pickup_nails;
+		if(!warmup_start_ammo_cells) warmup_start_ammo_shells = g_pickup_cells;
+		if(!warmup_start_ammo_rockets) warmup_start_ammo_shells = g_pickup_rockets;
+	}
+
+	start_ammo_shells = max(0, start_ammo_shells);
+	start_ammo_nails = max(0, start_ammo_nails);
+	start_ammo_cells = max(0, start_ammo_cells);
+	start_ammo_rockets = max(0, start_ammo_rockets);
+
+	warmup_start_ammo_shells = max(0, warmup_start_ammo_shells);
+	warmup_start_ammo_nails = max(0, warmup_start_ammo_nails);
+	warmup_start_ammo_cells = max(0, warmup_start_ammo_cells);
+	warmup_start_ammo_rockets = max(0, warmup_start_ammo_rockets);
 }
 
 float g_bugrigs;
@@ -1029,6 +1052,10 @@
 	g_pickup_healthmega                = cvar("g_pickup_healthmega");
 	g_pickup_healthmega_max            = cvar("g_pickup_healthmega_max");
 
+	g_weapon_stay = cvar("g_weapon_stay");
+	if(!g_weapon_stay && (cvar("deathmatch") == 2))
+		g_weapon_stay = 1;
+
 	if not(inWarmupStage)
 	{
 		game_starttime                 = cvar("g_start_delay");

Modified: trunk/data/qcsrc/server/t_items.qc
===================================================================
--- trunk/data/qcsrc/server/t_items.qc	2009-01-12 07:28:31 UTC (rev 5493)
+++ trunk/data/qcsrc/server/t_items.qc	2009-01-12 09:10:27 UTC (rev 5494)
@@ -108,12 +108,12 @@
 	}
 	else
 	{
-		if (cvar("deathmatch") == 2 || cvar("g_weapon_stay"))
+		if (g_weapon_stay == 1)
 		{
 			if (item.flags & FL_WEAPON && player.weapons & item.weapons && item.classname != "droppedweapon")
-				return 0;
+				goto skip;
 			if (player.weapons & item.weapons && item.flags & FL_TOSSED)	// don't let players stack ammo by tossing weapons
-				return 0;
+				goto skip;
 		}
 
 		// in case the player has autoswitch enabled do the following:
@@ -200,6 +200,7 @@
 		}
 	}
 
+:skip
 	// always eat teamed entities
 	if(item.team)
 		pickedup = TRUE;
@@ -238,7 +239,7 @@
 
 	if (self.classname == "droppedweapon")
 		remove (self);
-	else if((self.flags & FL_WEAPON) && !self.team && (cvar("deathmatch") == 2 || cvar("g_weapon_stay")))
+	else if((self.flags & FL_WEAPON) && !self.team && g_weapon_stay)
 		return;
 	else
 	{
@@ -687,6 +688,16 @@
 			self.ammofield = cvar(strcat("g_pickup_", Item_CounterFieldName(e.items)));
 	}
 
+	if(g_weapon_stay == 2)
+	{
+		self.ammo_shells = 0;
+		self.ammo_nails = 0;
+		self.ammo_cells = 0;
+		self.ammo_rockets = 0;
+		// weapon stay 2: don't use ammo on weapon pickups; instead
+		// initialize all ammo types to the pickup ammo unless set by g_start_ammo_*
+	}
+
 	StartItem(e.model, "weapons/weaponpickup.wav", self.respawntime, e.message, 0, e.weapons, FL_WEAPON, weapon_pickupevalfunc, e.bot_pickupbasevalue);
 	if (self.modelindex) // don't precache if self was removed
 		weapon_action(e.weapon, WR_PRECACHE);




More information about the nexuiz-commits mailing list