r5780 - in trunk/data: models/weapons qcsrc/server scripts

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Feb 6 08:30:56 EST 2009


Author: div0
Date: 2009-02-06 08:30:56 -0500 (Fri, 06 Feb 2009)
New Revision: 5780

Added:
   trunk/data/models/weapons/g_laser.md3
Modified:
   trunk/data/qcsrc/server/cl_weapons.qc
   trunk/data/qcsrc/server/w_laser.qc
   trunk/data/scripts/entities.def
Log:
add laser pickup model; make laser optionally throwable

To throw a laser, do:

g_start_weapon_laser 0
sv_cheats 1
map basement
impulse 99
impulse 1
impulse 17


Added: trunk/data/models/weapons/g_laser.md3
===================================================================
(Binary files differ)


Property changes on: trunk/data/models/weapons/g_laser.md3
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/data/qcsrc/server/cl_weapons.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weapons.qc	2009-02-06 11:59:35 UTC (rev 5779)
+++ trunk/data/qcsrc/server/cl_weapons.qc	2009-02-06 13:30:56 UTC (rev 5780)
@@ -232,8 +232,6 @@
 	w = self.weapon;
 	if (w == 0)
 		return; // just in case
-	if (w == WEP_LASER)
-		return; // just in case
 	if (g_weaponarena)
 		return;
 	if (g_lms)
@@ -255,6 +253,7 @@
 			return;
 		if(wa != IT_SUPERWEAPON && start_items & IT_UNLIMITED_WEAPON_AMMO)
 			return;
+		// start weapons that take no ammo can't be dropped (this prevents dropping the laser, as long as it continues to use no ammo)
 		if(wa == 0)
 			return;
 	}
@@ -379,30 +378,19 @@
 
 void Nixnex_ChooseNextWeapon()
 {
-	float numberof, id;
-	numberof = WEP_LAST - WEP_FIRST; // all but the current one
-	if(g_nixnex_with_laser)
-		numberof = numberof - 1;
-	id = WEP_FIRST + floor(random() * numberof);
+	float j;
+	entity e;
 
-	if(g_nixnex_with_laser) // skip the laser if needed
-		id = id + 1;
-
-	if(id >= nixnex_weapon) // skip the current weapon
-		id = id + 1;
-
-	if(id < WEP_FIRST) // can't happen, but to be sure...
+	RandomSelection_Init();
+	for(j = WEP_FIRST; j <= WEP_LAST; ++j)
 	{
-		dprint("Won't happen (id < WEP_FIRST)\n");
-		id = WEP_FIRST;
+		if(j == WEP_LASER && g_nixnex_with_laser)
+			continue;
+		if(!e.weapons) // skip dummies
+			continue;
+		RandomSelection_Add(world, j, 1, 0);
 	}
-	if(id > WEP_LAST) // either
-	{
-		dprint("Won't happen (id > WEP_LAST)\n");
-		id = WEP_LAST;
-	}
-
-	nixnex_nextweapon = id;
+	nixnex_nextweapon = RandomSelection_chosen_float;
 }
 
 void Nixnex_GiveCurrentWeapon()

Modified: trunk/data/qcsrc/server/w_laser.qc
===================================================================
--- trunk/data/qcsrc/server/w_laser.qc	2009-02-06 11:59:35 UTC (rev 5779)
+++ trunk/data/qcsrc/server/w_laser.qc	2009-02-06 13:30:56 UTC (rev 5780)
@@ -103,6 +103,7 @@
 	}
 	else if (req == WR_PRECACHE)
 	{
+		precache_model ("models/weapons/g_laser.md3");
 		precache_model ("models/weapons/v_laser.md3");
 		precache_model ("models/weapons/w_laser.zym");
 		precache_sound ("weapons/lasergun_fire.wav");

Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def	2009-02-06 11:59:35 UTC (rev 5779)
+++ trunk/data/scripts/entities.def	2009-02-06 13:30:56 UTC (rev 5780)
@@ -974,6 +974,20 @@
 model="models/weapons/g_hagar.md3"
 */
 
+/*QUAKED weapon_laser (1 0 .5) (-30 -30 0) (30 30 32) FLOATING
+the Laser. Note that unless you use
+  settemp_for_type all g_start_weapon_laser 0
+in your mapinfo file, everyone will already spawn with one, making this pickup useless.
+-------- KEYS --------
+respawntime: time till it respawns (default: 15)
+team: out of items with the same value here, only one (random one) will spawn. Useful to put multiple items on one spot.
+cnt: weight of this item for random selection using "team". Set to a lower value for items you want to see less likely.
+-------- SPAWNFLAGS --------
+FLOATING: the item will float in air, instead of aligning to the floor by falling
+-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
+model="models/weapons/g_laser.md3"
+*/
+
 /*QUAKED weapon_nex (1 0 .5) (-30 -30 0) (30 30 32) FLOATING
 the Nex
 In Minstagib, this turns into an item_minst_cells if no explicit item_minst_cells have been placed.
@@ -1003,7 +1017,9 @@
 */
 
 /*QUAKED weapon_shotgun (1 0 .5) (-30 -30 0) (30 30 32) FLOATING
-the Shotgun
+the Shotgun. Note that unless you use
+  settemp_for_type all g_start_weapon_shotgun 0
+in your mapinfo file, everyone will already spawn with one, making this pickup useless.
 -------- KEYS --------
 ammo_shells: initial shells of the weapon (if unset, g_pickup_shells is used)
 respawntime: time till it respawns (default: 15)




More information about the nexuiz-commits mailing list