From 3a38de2264a5aba07d413e16923f7b8b0e63fafb Mon Sep 17 00:00:00 2001 From: div0 Date: Wed, 13 Aug 2008 15:52:35 +0000 Subject: [PATCH] hook: use MOVETYPE_FOLLOW. You know what for. git-svn-id: svn://svn.icculus.org/nexuiz/trunk@4132 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/g_hook.qc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/data/qcsrc/server/g_hook.qc b/data/qcsrc/server/g_hook.qc index 44ec1d638..4774ba98a 100644 --- a/data/qcsrc/server/g_hook.qc +++ b/data/qcsrc/server/g_hook.qc @@ -47,6 +47,25 @@ And you should be done! ============================================*/ +.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 @@ void GrapplingHookThink() remove(self); return; } + if(LostMovetypeFollow(self)) + { + remove(self); + return; + } self.nextthink = time; @@ -195,6 +219,10 @@ void GrapplingHookTouch (void) self.movetype = MOVETYPE_NONE; self.rope_length = -1; + if(other) + if(other.movetype != MOVETYPE_NONE) + SetMovetypeFollow(self, other); + //self.owner.disableclientprediction = TRUE; } -- 2.39.2