r4234 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Aug 29 08:55:20 EDT 2008
Author: div0
Date: 2008-08-29 08:55:20 -0400 (Fri, 29 Aug 2008)
New Revision: 4234
Modified:
trunk/data/qcsrc/server/g_hook.qc
Log:
hook: when something gets in the way, cut the hook off. Helps a bit with moving around.
Modified: trunk/data/qcsrc/server/g_hook.qc
===================================================================
--- trunk/data/qcsrc/server/g_hook.qc 2008-08-29 09:25:46 UTC (rev 4233)
+++ trunk/data/qcsrc/server/g_hook.qc 2008-08-29 12:55:20 UTC (rev 4234)
@@ -60,6 +60,12 @@
ent.aiment_classname = strzone(e.classname);
ent.aiment_deadflag = e.deadflag;
}
+void UnsetMovetypeFollow(entity ent)
+{
+ ent.movetype = MOVETYPE_FLY;
+ ent.solid = SOLID_BBOX;
+ ent.aiment = world;
+}
float LostMovetypeFollow(entity ent)
{
if(ent.aiment)
@@ -109,6 +115,23 @@
makevectors(self.owner.v_angle);
org = self.owner.origin + self.owner.view_ofs + v_forward * 8 - v_right * 8 + v_up * -12;
+ 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
+ if(trace_fraction < 1 && !self.aiment || trace_ent != self.aiment)
+ {
+ // 1. detach the hook
+ if(self.aiment)
+ UnsetMovetypeFollow(self);
+
+ // 2. cut it off
+ self.origin = trace_endpos;
+
+ // 3. reattach the hook
+ if(trace_ent)
+ if(trace_ent.movetype != MOVETYPE_NONE)
+ SetMovetypeFollow(self, trace_ent);
+ }
+
if(self.rope_length < 0)
self.rope_length = vlen(org - self.origin);
More information about the nexuiz-commits
mailing list