r4265 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Aug 30 13:02:48 EDT 2008


Author: div0
Date: 2008-08-30 13:02:48 -0400 (Sat, 30 Aug 2008)
New Revision: 4265

Modified:
   trunk/data/qcsrc/server/g_hook.qc
   trunk/data/qcsrc/server/t_teleporters.qc
Log:
hook: always enter the pulling state right
hook: detach when teleporting


Modified: trunk/data/qcsrc/server/g_hook.qc
===================================================================
--- trunk/data/qcsrc/server/g_hook.qc	2008-08-30 16:49:03 UTC (rev 4264)
+++ trunk/data/qcsrc/server/g_hook.qc	2008-08-30 17:02:48 UTC (rev 4265)
@@ -95,6 +95,21 @@
 	//pl.disableclientprediction = FALSE;
 }
 
+void GrapplingHookThink();
+void GrapplingHook_Stop()
+{
+	pointparticles(particleeffectnum("grapple_impact"), self.origin, '0 0 0', 1);
+	sound (self, CHAN_PROJECTILE, "weapons/hook_impact.wav", VOL_BASE, ATTN_NORM);
+
+	self.state = 1;
+	self.think = GrapplingHookThink;
+	self.nextthink = time;
+	self.touch = SUB_Null;
+	self.velocity = '0 0 0';
+	self.movetype = MOVETYPE_NONE;
+	self.rope_length = -1;
+}
+
 void GrapplingHookThink()
 {
 	float spd, dist, minlength, pullspeed, ropestretch, ropeairfriction, rubberforce, newlength, rubberforce_overstretch;
@@ -117,8 +132,14 @@
 
 	tracebox(org, self.mins, self.maxs, self.origin, MOVE_NOMONSTERS, self.owner);
 	// do not hit players with this, as they tend to get in the way just too often
+	// NOTE: this assumes sky brushes cannot get in the way
+	// if they can, assume the map is broken! :P
 	if(trace_fraction < 1 && (!self.aiment || trace_ent != self.aiment))
 	{
+		// 0. stop it
+		if(self.state != 1)
+			GrapplingHook_Stop();
+
 		// 1. detach the hook
 		if(self.aiment)
 			UnsetMovetypeFollow(self);
@@ -251,21 +272,11 @@
 		}
 	}
 
-	pointparticles(particleeffectnum("grapple_impact"), self.origin, '0 0 0', 1);
-	sound (self, CHAN_PROJECTILE, "weapons/hook_impact.wav", VOL_BASE, ATTN_NORM);
-
-	self.state = 1;
-	self.think = GrapplingHookThink;
-	self.nextthink = time;
-	self.touch = SUB_Null;
-	self.velocity = '0 0 0';
-	self.movetype = MOVETYPE_NONE;
-	self.rope_length = -1;
-
 	if(other)
 		if(other.movetype != MOVETYPE_NONE)
 			SetMovetypeFollow(self, other);
 
+	GrapplingHook_Stop();
 	//self.owner.disableclientprediction = TRUE;
 }
 

Modified: trunk/data/qcsrc/server/t_teleporters.qc
===================================================================
--- trunk/data/qcsrc/server/t_teleporters.qc	2008-08-30 16:49:03 UTC (rev 4264)
+++ trunk/data/qcsrc/server/t_teleporters.qc	2008-08-30 17:02:48 UTC (rev 4265)
@@ -30,6 +30,7 @@
 	other.angles = self.enemy.mangle;
 	other.fixangle = TRUE;
 	other.velocity = v_forward * vlen(other.velocity);
+	RemoveGrapplingHook(other);
 
 	// Kill anyone else in the teleporter box (NO MORE TDEATH)
 	if(other.takedamage && !g_race)




More information about the nexuiz-commits mailing list