r1959 - branches/nexuiz-2.0/data/qcsrc/server trunk/data/qcsrc/server

savagex at icculus.org savagex at icculus.org
Fri Dec 1 13:09:42 EST 2006


Author: savagex
Date: 2006-12-01 13:09:41 -0500 (Fri, 01 Dec 2006)
New Revision: 1959

Modified:
   branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc
   branches/nexuiz-2.0/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/cl_weaponsystem.qc
   trunk/data/qcsrc/server/defs.qh
Log:
add a nice patch from esteel to fix the rapid weapon switching "NexMG" 
exploit


Modified: branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc	2006-11-30 13:28:13 UTC (rev 1958)
+++ branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc	2006-12-01 18:09:41 UTC (rev 1959)
@@ -322,8 +322,8 @@
 	self.weapon = windex;
 	self.weaponname = wname;
 
-	// can fire immediately
-	self.attack_finished = time;
+	// might fire faster after switch
+	self.attack_finished = min(max(time, self.attack_finished_old + 1), self.attack_finished);
 };
 
 // perform weapon to attack (weaponstate and attack_finished check is here)
@@ -343,6 +343,7 @@
 	if (self.weaponentity.state != WS_READY)
 		return FALSE;
 	self.weaponentity.state = WS_INUSE;
+	self.attack_finished_old = self.attack_finished;
 	self.attack_finished = max(time, self.attack_finished + attacktime);
 	return TRUE;
 };

Modified: branches/nexuiz-2.0/data/qcsrc/server/defs.qh
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/defs.qh	2006-11-30 13:28:13 UTC (rev 1958)
+++ branches/nexuiz-2.0/data/qcsrc/server/defs.qh	2006-12-01 18:09:41 UTC (rev 1959)
@@ -41,6 +41,7 @@
 .vector	mangle;
 
 .float	attack_finished;
+.float	attack_finished_old;
 .float	pain_finished;			//Added by Supajoe
 .float	pain_frame;			//"
 .float	statdraintime;			// record the one-second intervals between draining health and armour when they're over 100

Modified: trunk/data/qcsrc/server/cl_weaponsystem.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weaponsystem.qc	2006-11-30 13:28:13 UTC (rev 1958)
+++ trunk/data/qcsrc/server/cl_weaponsystem.qc	2006-12-01 18:09:41 UTC (rev 1959)
@@ -325,8 +325,8 @@
 	self.weapon = windex;
 	self.weaponname = wname;
 
-	// can fire immediately
-	self.attack_finished = time;
+	// might fire faster after switch
+	self.attack_finished = min(max(time, self.attack_finished_old + 1), self.attack_finished);
 };
 
 // perform weapon to attack (weaponstate and attack_finished check is here)
@@ -346,6 +346,7 @@
 	if (self.weaponentity.state != WS_READY)
 		return FALSE;
 	self.weaponentity.state = WS_INUSE;
+	self.attack_finished_old = self.attack_finished;
 	self.attack_finished = max(time, self.attack_finished + attacktime);
 	return TRUE;
 };

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2006-11-30 13:28:13 UTC (rev 1958)
+++ trunk/data/qcsrc/server/defs.qh	2006-12-01 18:09:41 UTC (rev 1959)
@@ -41,6 +41,7 @@
 .vector	mangle;
 
 .float	attack_finished;
+.float	attack_finished_old;
 .float	pain_finished;			//Added by Supajoe
 .float	pain_frame;			//"
 .float	statdraintime;			// record the one-second intervals between draining health and armour when they're over 100




More information about the nexuiz-commits mailing list