[nexuiz-commits] r7827 - in trunk/data: . qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Sep 17 09:28:40 EDT 2009


Author: div0
Date: 2009-09-17 09:28:39 -0400 (Thu, 17 Sep 2009)
New Revision: 7827

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/server/t_items.qc
Log:
new weapon-stay mode 3: make taken weapons ghosted, but they can then still be picked up for the gun (not for the ammo)


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2009-09-16 23:13:38 UTC (rev 7826)
+++ trunk/data/defaultNexuiz.cfg	2009-09-17 13:28:39 UTC (rev 7827)
@@ -440,7 +440,7 @@
 set g_shootfromcenter 0 "weapon gets moved to the center, shots still come from the barrel of your weapon; visual gun position can still be influenced by cl_gunalign 1 and 2"
 set g_shootfromfixedorigin "" "if set to a string like 0 y z, the gun is moved to the given y and z coordinates. If set to a string like x y z, the whole shot origin is used"
 set g_pinata 0 "if set to 1 you will not only drop your current weapon when you are killed, but you will drop all weapons that you possessed"
-set g_weapon_stay 0 "if set to 1 or 2, weapons stay after they were picked up (1: weapons you don't have yet give you ammo of their type, 2: weapons don't give ammo, but instead players start with one pickup-load of ammo by default)"
+set g_weapon_stay 0 "if set to 1 or 2, weapons stay after they were picked up (1: weapons you don't have yet give you ammo of their type, 2: weapons don't give ammo, but instead players start with one pickup-load of ammo by default, 3: weapons give ammo, weapons only stay as ammo-less ghosts)"
 set g_powerup_superhealth 1 "if set to 0 the mega health powerup will not spawn on the map"
 set g_powerup_strength 1 "if set to 0 the strength powerup will not spawn on the map"
 set g_powerup_shield 1 "if set to 0 the shield (invincibility) powerup will not spawn on the map"

Modified: trunk/data/qcsrc/server/t_items.qc
===================================================================
--- trunk/data/qcsrc/server/t_items.qc	2009-09-16 23:13:38 UTC (rev 7826)
+++ trunk/data/qcsrc/server/t_items.qc	2009-09-17 13:28:39 UTC (rev 7827)
@@ -43,48 +43,62 @@
 
 void Item_Show (entity e, float mode)
 {
+	e.effects &~= EF_ADDITIVE | EF_STARDUST | EF_FULLBRIGHT;
 	if (mode > 0)
 	{
 		// make the item look normal, and be touchable
 		e.model = e.mdl;
 		e.solid = SOLID_TRIGGER;
-		e.effects &~= EF_ADDITIVE;
 		//e.colormod = '0 0 0';
 		e.alpha = 0;
 
 		// special cases
-		if (e.strength_finished || e.invincible_finished)
-			e.effects = e.effects | EF_ADDITIVE | EF_FULLBRIGHT;
 		if (cvar("g_fullbrightitems"))
 			e.effects = e.effects | EF_FULLBRIGHT;
+
+		e.spawnshieldtime = 1;
 	}
 	else if (mode < 0)
 	{
 		// hide the item completely
 		e.model = string_null;
 		e.solid = SOLID_NOT;
-		e.effects &~= EF_ADDITIVE;
 		//e.colormod = '0 0 0';
 		e.alpha = 0;
+
+		e.spawnshieldtime = 1;
 	}
-	else
+	else if((e.flags & FL_WEAPON) && (g_weapon_stay == 3))
 	{
 		// make the item translucent green and not touchable
 		e.model = e.mdl;
-		e.solid = SOLID_NOT;
-		// e.effects |= EF_ADDITIVE;
-			// we need this to prevent weird display because of
-			// missing depth sorting - or maybe not
+		e.solid = SOLID_TRIGGER; // can STILL be picked up!
+		e.effects |= EF_STARDUST;
 		//e.colormod = '0.2 1 0.2';
-		e.alpha = 0.15;
+		e.alpha = 0.5;
 
 		// special cases
-		if (e.strength_finished || e.invincible_finished)
-			e.effects = e.effects | EF_ADDITIVE | EF_FULLBRIGHT;
 		if (cvar("g_fullbrightitems"))
 			e.effects = e.effects | EF_FULLBRIGHT;
+
+		e.spawnshieldtime = 0; // field indicates whether picking it up may give you anything other than the weapon
 	}
+	else
+	{
+		// make the item translucent green and not touchable
+		e.model = e.mdl;
+		e.solid = SOLID_NOT;
+		//e.colormod = '0.2 1 0.2';
+		e.alpha = 0.15;
 
+		e.spawnshieldtime = 1;
+	}
+
+	if (e.strength_finished || e.invincible_finished)
+		e.effects |= EF_ADDITIVE | EF_FULLBRIGHT;
+	if (cvar("g_fullbrightitems"))
+		e.effects |= EF_FULLBRIGHT;
+
 	// relink entity (because solid may have changed)
 	setorigin(e, e.origin);
 }
@@ -204,80 +218,82 @@
 
 	if (g_minstagib)
 	{
-		if (item.ammo_fuel)
-		if (player.ammo_fuel < g_pickup_fuel_max)
+		if(item.spawnshieldtime)
 		{
-			pickedup = TRUE;
-			player.ammo_fuel = min(player.ammo_fuel + item.ammo_fuel, g_pickup_fuel_max);
-			player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + cvar("g_balance_pause_fuel_rot"));
-		}
-		if((it = (item.items - (item.items & player.items)) & IT_PICKUPMASK))
-		{
-			pickedup = TRUE;
-			player.items |= it;
-			sprint (player, strcat("You got the ^2", item.netname, "\n"));
-		}
-
-		_switchweapon = TRUE;
-		if (item.ammo_cells)
-		{
-			pickedup = TRUE;
-			// play some cool sounds ;)
-			centerprint(player, "\n");
-			if (clienttype(player) == CLIENTTYPE_REAL)
+			if (item.ammo_fuel)
+			if (player.ammo_fuel < g_pickup_fuel_max)
 			{
-				if(player.health <= 5)
-					play2(player, "announcer/robotic/lastsecond.wav");
-				else if(player.health < 50)
-					play2(player, "announcer/robotic/narrowly.wav");
+				pickedup = TRUE;
+				player.ammo_fuel = min(player.ammo_fuel + item.ammo_fuel, g_pickup_fuel_max);
+				player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + cvar("g_balance_pause_fuel_rot"));
 			}
-			// sound not available
-			// else if(item.items == IT_CELLS)
-			//	play2(player, "announce/robotic/ammo.wav");
+			if((it = (item.items - (item.items & player.items)) & IT_PICKUPMASK))
+			{
+				pickedup = TRUE;
+				player.items |= it;
+				sprint (player, strcat("You got the ^2", item.netname, "\n"));
+			}
 
-			if (item.weapons & WEPBIT_MINSTANEX)
-				W_GiveWeapon (player, WEP_MINSTANEX, "Nex");
+			_switchweapon = TRUE;
 			if (item.ammo_cells)
-				player.ammo_cells = min (player.ammo_cells + cvar("g_minstagib_ammo_drop"), 999);
-			player.health = 100;
-		}
+			{
+				pickedup = TRUE;
+				// play some cool sounds ;)
+				centerprint(player, "\n");
+				if (clienttype(player) == CLIENTTYPE_REAL)
+				{
+					if(player.health <= 5)
+						play2(player, "announcer/robotic/lastsecond.wav");
+					else if(player.health < 50)
+						play2(player, "announcer/robotic/narrowly.wav");
+				}
+				// sound not available
+				// else if(item.items == IT_CELLS)
+				//	play2(player, "announce/robotic/ammo.wav");
 
-		// extralife powerup
-		if (item.max_health)
-		{
-			pickedup = TRUE;
-			// sound not available
-			// play2(player, "announce/robotic/extra.ogg\nplay2 announce/robotic/_lives.wav");
-			player.armorvalue = player.armorvalue + cvar("g_minstagib_extralives");
-			sprint(player, "^3You picked up some extra lives\n");
-		}
+				if (item.weapons & WEPBIT_MINSTANEX)
+					W_GiveWeapon (player, WEP_MINSTANEX, "Nex");
+				if (item.ammo_cells)
+					player.ammo_cells = min (player.ammo_cells + cvar("g_minstagib_ammo_drop"), 999);
+				player.health = 100;
+			}
 
-		// invis powerup
-		if (item.strength_finished)
-		{
-			pickedup = TRUE;
-			// sound not available
-			// play2(player, "announce/robotic/invisible.wav");
-			player.strength_finished = max(player.strength_finished, time) + cvar("g_balance_powerup_strength_time");
-		}
+			// extralife powerup
+			if (item.max_health)
+			{
+				pickedup = TRUE;
+				// sound not available
+				// play2(player, "announce/robotic/extra.ogg\nplay2 announce/robotic/_lives.wav");
+				player.armorvalue = player.armorvalue + cvar("g_minstagib_extralives");
+				sprint(player, "^3You picked up some extra lives\n");
+			}
 
-		// speed powerup
-		if (item.invincible_finished)
-		{
-			pickedup = TRUE;
-			// sound not available
-			// play2(player, "announce/robotic/speed.wav");
-			player.invincible_finished = max(player.invincible_finished, time) + cvar("g_balance_powerup_strength_time");
-		}
+			// invis powerup
+			if (item.strength_finished)
+			{
+				pickedup = TRUE;
+				// sound not available
+				// play2(player, "announce/robotic/invisible.wav");
+				player.strength_finished = max(player.strength_finished, time) + cvar("g_balance_powerup_strength_time");
+			}
 
-		if (item.ammo_fuel)
-		if (player.ammo_fuel < g_pickup_fuel_max)
-		{
-			pickedup = TRUE;
-			player.ammo_fuel = min(player.ammo_fuel + item.ammo_fuel, g_pickup_fuel_max);
-			player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + cvar("g_balance_pause_fuel_rot"));
+			// speed powerup
+			if (item.invincible_finished)
+			{
+				pickedup = TRUE;
+				// sound not available
+				// play2(player, "announce/robotic/speed.wav");
+				player.invincible_finished = max(player.invincible_finished, time) + cvar("g_balance_powerup_strength_time");
+			}
+
+			if (item.ammo_fuel)
+			if (player.ammo_fuel < g_pickup_fuel_max)
+			{
+				pickedup = TRUE;
+				player.ammo_fuel = min(player.ammo_fuel + item.ammo_fuel, g_pickup_fuel_max);
+				player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + cvar("g_balance_pause_fuel_rot"));
+			}
 		}
-
 	}
 	else
 	{
@@ -307,37 +323,40 @@
 		if not(player.weapons & W_WeaponBit(player.switchweapon))
 			_switchweapon = TRUE;
 
-		if (item.ammo_shells)
-		if (player.ammo_shells < g_pickup_shells_max)
+		if(item.spawnshieldtime)
 		{
-			pickedup = TRUE;
-			player.ammo_shells = min (player.ammo_shells + item.ammo_shells, g_pickup_shells_max);
+			if (item.ammo_shells)
+			if (player.ammo_shells < g_pickup_shells_max)
+			{
+				pickedup = TRUE;
+				player.ammo_shells = min (player.ammo_shells + item.ammo_shells, g_pickup_shells_max);
+			}
+			if (item.ammo_nails)
+			if (player.ammo_nails < g_pickup_nails_max)
+			{
+				pickedup = TRUE;
+				player.ammo_nails = min (player.ammo_nails + item.ammo_nails, g_pickup_nails_max);
+			}
+			if (item.ammo_rockets)
+			if (player.ammo_rockets < g_pickup_rockets_max)
+			{
+				pickedup = TRUE;
+				player.ammo_rockets = min (player.ammo_rockets + item.ammo_rockets, g_pickup_rockets_max);
+			}
+			if (item.ammo_cells)
+			if (player.ammo_cells < g_pickup_cells_max)
+			{
+				pickedup = TRUE;
+				player.ammo_cells = min (player.ammo_cells + item.ammo_cells, g_pickup_cells_max);
+			}
+			if (item.ammo_fuel)
+			if (player.ammo_fuel < g_pickup_fuel_max)
+			{
+				pickedup = TRUE;
+				player.ammo_fuel = min(player.ammo_fuel + item.ammo_fuel, g_pickup_fuel_max);
+				player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + cvar("g_balance_pause_fuel_rot"));
+			}
 		}
-		if (item.ammo_nails)
-		if (player.ammo_nails < g_pickup_nails_max)
-		{
-			pickedup = TRUE;
-			player.ammo_nails = min (player.ammo_nails + item.ammo_nails, g_pickup_nails_max);
-		}
-		if (item.ammo_rockets)
-		if (player.ammo_rockets < g_pickup_rockets_max)
-		{
-			pickedup = TRUE;
-			player.ammo_rockets = min (player.ammo_rockets + item.ammo_rockets, g_pickup_rockets_max);
-		}
-		if (item.ammo_cells)
-		if (player.ammo_cells < g_pickup_cells_max)
-		{
-			pickedup = TRUE;
-			player.ammo_cells = min (player.ammo_cells + item.ammo_cells, g_pickup_cells_max);
-		}
-		if (item.ammo_fuel)
-		if (player.ammo_fuel < g_pickup_fuel_max)
-		{
-			pickedup = TRUE;
-			player.ammo_fuel = min(player.ammo_fuel + item.ammo_fuel, g_pickup_fuel_max);
-			player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + cvar("g_balance_pause_fuel_rot"));
-		}
 
 		if (item.flags & FL_WEAPON)
 		if ((it = item.weapons - (item.weapons & player.weapons)))
@@ -358,41 +377,44 @@
 			sprint (player, strcat("You got the ^2", item.netname, "\n"));
 		}
 
-		if (item.strength_finished)
+		if(item.spawnshieldtime)
 		{
-			pickedup = TRUE;
-			player.strength_finished = max(player.strength_finished, time) + cvar("g_balance_powerup_strength_time");
-		}
-		if (item.invincible_finished)
-		{
-			pickedup = TRUE;
-			player.invincible_finished = max(player.invincible_finished, time) + cvar("g_balance_powerup_invincible_time");
-		}
-		//if (item.speed_finished)
-		//{
-		//	pickedup = TRUE;
-		//	player.speed_finished = max(player.speed_finished, time) + cvar("g_balance_powerup_speed_time");
-		//}
-		//if (item.slowmo_finished)
-		//{
-		//	pickedup = TRUE;
-		//	player.slowmo_finished = max(player.slowmo_finished, time) + (cvar("g_balance_powerup_slowmo_time") * cvar("g_balance_powerup_slowmo_speed"));
-		//}
+			if (item.strength_finished)
+			{
+				pickedup = TRUE;
+				player.strength_finished = max(player.strength_finished, time) + cvar("g_balance_powerup_strength_time");
+			}
+			if (item.invincible_finished)
+			{
+				pickedup = TRUE;
+				player.invincible_finished = max(player.invincible_finished, time) + cvar("g_balance_powerup_invincible_time");
+			}
+			//if (item.speed_finished)
+			//{
+			//	pickedup = TRUE;
+			//	player.speed_finished = max(player.speed_finished, time) + cvar("g_balance_powerup_speed_time");
+			//}
+			//if (item.slowmo_finished)
+			//{
+			//	pickedup = TRUE;
+			//	player.slowmo_finished = max(player.slowmo_finished, time) + (cvar("g_balance_powerup_slowmo_time") * cvar("g_balance_powerup_slowmo_speed"));
+			//}
 
-		if (item.health)
-		if (player.health < item.max_health)
-		{
-			pickedup = TRUE;
-			player.health = min(player.health + item.health, item.max_health);
-			player.pauserothealth_finished = max(player.pauserothealth_finished, time + cvar("g_balance_pause_health_rot"));
+			if (item.health)
+			if (player.health < item.max_health)
+			{
+				pickedup = TRUE;
+				player.health = min(player.health + item.health, item.max_health);
+				player.pauserothealth_finished = max(player.pauserothealth_finished, time + cvar("g_balance_pause_health_rot"));
+			}
+			if (item.armorvalue)
+			if (player.armorvalue < item.max_armorvalue)
+			{
+				pickedup = TRUE;
+				player.armorvalue = min(player.armorvalue + item.armorvalue, item.max_armorvalue);
+				player.pauserotarmor_finished = max(player.pauserotarmor_finished, time + cvar("g_balance_pause_armor_rot"));
+			}
 		}
-		if (item.armorvalue)
-		if (player.armorvalue < item.max_armorvalue)
-		{
-			pickedup = TRUE;
-			player.armorvalue = min(player.armorvalue + item.armorvalue, item.max_armorvalue);
-			player.pauserotarmor_finished = max(player.pauserotarmor_finished, time + cvar("g_balance_pause_armor_rot"));
-		}
 	}
 
 :skip
@@ -437,8 +459,10 @@
 
 	if (self.classname == "droppedweapon")
 		remove (self);
-	else if((self.flags & FL_WEAPON) && !(self.flags & FL_NO_WEAPON_STAY) && g_weapon_stay)
+	else if not(self.spawnshieldtime)
 		return;
+	else if((self.flags & FL_WEAPON) && !(self.flags & FL_NO_WEAPON_STAY) && (g_weapon_stay == 1 || g_weapon_stay == 2))
+		return;
 	else
 	{
 		if(self.team)
@@ -522,7 +546,7 @@
 	if(player.weapons & item.weapons == item.weapons)
 	{
 		// If I can pick it up
-		if(g_weapon_stay)
+		if(g_weapon_stay == 1 || g_weapon_stay == 2 || !item.spawnshieldtime)
 			c = 0;
 		else if(player.ammo_cells || player.ammo_shells || player.ammo_nails || player.ammo_rockets)
 		{



More information about the nexuiz-commits mailing list