]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hook.qc
Do not execute the TrueAim code if the crosshair doesn't get drawn.
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hook.qc
index 06858d597aa917a126e1e46cc50354458973afa0..c1e8383aa6daf415356034b8b2bda1bc13193e7c 100644 (file)
@@ -53,6 +53,7 @@ void Draw_GrapplingHook_trace_callback(vector start, vector hit, vector end)
        Draw_GrapplingHook_trace_callback_rnd += 0.25 * vlen(hit - start) / 8;
 }
 
+.float teleport_time;
 void Draw_GrapplingHook()
 {
        vector a, b, atrans;
@@ -63,6 +64,13 @@ void Draw_GrapplingHook()
        vector vs;
        float intensity, offset;
 
+       if(self.teleport_time)
+       if(time > self.teleport_time)
+       {
+               sound (self, CHAN_PROJECTILE, "misc/null.wav", VOL_BASE, ATTN_NORM); // safeguard
+               self.teleport_time = 0;
+       }
+
        InterpolateOrigin_Do();
 
        s = cvar("cl_gunalign");
@@ -253,7 +261,7 @@ void Ent_ReadHook(float bIsNew, float type)
 
        InterpolateOrigin_Note();
 
-       if(bIsNew)
+       if(bIsNew || !self.teleport_time)
        {
                self.draw = Draw_GrapplingHook;
                self.entremove = Remove_GrapplingHook;
@@ -274,6 +282,8 @@ void Ent_ReadHook(float bIsNew, float type)
                                break;
                }
        }
+
+       self.teleport_time = time + 10;
 }
 
 void Hook_Precache()