electro/hook: add a safeguard to stop the sound 10 seconds after last update
authorRudolf Polzer <divVerent@alientrap.org>
Fri, 17 Sep 2010 12:15:50 +0000 (14:15 +0200)
committerRudolf Polzer <divVerent@alientrap.org>
Fri, 17 Sep 2010 12:15:50 +0000 (14:15 +0200)
qcsrc/client/hook.qc

index 06858d5..b22dba8 100644 (file)
@@ -63,6 +63,13 @@ void Draw_GrapplingHook()
        vector vs;
        float intensity, offset;
 
        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");
        InterpolateOrigin_Do();
 
        s = cvar("cl_gunalign");
@@ -274,6 +281,8 @@ void Ent_ReadHook(float bIsNew, float type)
                                break;
                }
        }
                                break;
                }
        }
+
+       self.teleport_time = time + 10;
 }
 
 void Hook_Precache()
 }
 
 void Hook_Precache()