r4132 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Aug 13 11:52:35 EDT 2008


Author: div0
Date: 2008-08-13 11:52:35 -0400 (Wed, 13 Aug 2008)
New Revision: 4132

Modified:
   trunk/data/qcsrc/server/g_hook.qc
Log:
hook: use MOVETYPE_FOLLOW. You know what for.


Modified: trunk/data/qcsrc/server/g_hook.qc
===================================================================
--- trunk/data/qcsrc/server/g_hook.qc	2008-08-13 15:06:59 UTC (rev 4131)
+++ trunk/data/qcsrc/server/g_hook.qc	2008-08-13 15:52:35 UTC (rev 4132)
@@ -47,6 +47,25 @@
 
 ============================================*/
 
+.string aiment_classname;
+void SetMovetypeFollow(entity ent, entity e)
+{
+	ent.movetype = MOVETYPE_FOLLOW; // make the hole follow
+	ent.solid = SOLID_NOT; // MOVETYPE_FOLLOW is always non-solid
+	ent.aiment = e; // make the hole follow bmodel
+	ent.punchangle = e.angles; // the original angles of bmodel
+	ent.view_ofs = ent.origin - e.origin; // relative origin
+	ent.v_angle = ent.angles - e.angles; // relative angles
+	ent.aiment_classname = strzone(e.classname);
+}
+float LostMovetypeFollow(entity ent)
+{
+	if(ent.aiment)
+		if(ent.aiment.classname != ent.aiment_classname)
+			return 1;
+	return 0;
+}
+
 .float rope_length;
 .float button6_pressed_before;
 
@@ -73,6 +92,11 @@
 		remove(self);
 		return;
 	}
+	if(LostMovetypeFollow(self))
+	{
+		remove(self);
+		return;
+	}
 
 	self.nextthink = time;
 
@@ -195,6 +219,10 @@
 	self.movetype = MOVETYPE_NONE;
 	self.rope_length = -1;
 
+	if(other)
+		if(other.movetype != MOVETYPE_NONE)
+			SetMovetypeFollow(self, other);
+
 	//self.owner.disableclientprediction = TRUE;
 }
 




More information about the nexuiz-commits mailing list