]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/trigger/impulse.qc
Merge branch 'master' into terencehill/menu_gametype_tooltips_2
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / trigger / impulse.qc
index 89ca2e03d6fdc1911d47e722550dd18f031b3346..c40fed3a8387bc1da25a54f180de0efdafa3c197 100644 (file)
@@ -1,6 +1,6 @@
 // targeted (directional) mode
 void trigger_impulse_touch1()
-{
+{SELFPARAM();
        entity targ;
        float pushdeltatime;
        float str;
@@ -35,7 +35,17 @@ void trigger_impulse_touch1()
        other.lastpushtime = time;
        if(!pushdeltatime) return;
 
-       other.velocity = other.velocity + normalize(targ.origin - self.origin) * str * pushdeltatime;
+       if(self.spawnflags & 64)
+       {
+               float addspeed = str - other.velocity * normalize(targ.origin - self.origin);
+               if (addspeed > 0)
+               {
+                       float accelspeed = min(8 * pushdeltatime * str, addspeed);
+                       other.velocity += accelspeed * normalize(targ.origin - self.origin);
+               }
+       }
+       else
+               other.velocity = other.velocity + normalize(targ.origin - self.origin) * str * pushdeltatime;
        other.flags &= ~FL_ONGROUND;
 #ifdef SVQC
        UpdateCSQCProjectile(other);
@@ -44,7 +54,7 @@ void trigger_impulse_touch1()
 
 // Directionless (accelerator/decelerator) mode
 void trigger_impulse_touch2()
-{
+{SELFPARAM();
        float pushdeltatime;
 
        if (self.active != ACTIVE_ACTIVE)
@@ -69,7 +79,7 @@ void trigger_impulse_touch2()
 
 // Spherical (gravity/repulsor) mode
 void trigger_impulse_touch3()
-{
+{SELFPARAM();
        float pushdeltatime;
        float str;
 
@@ -122,7 +132,7 @@ in directional and sperical mode. For damper/accelerator mode this is not nesses
 */
 #ifdef SVQC
 bool trigger_impulse_send(entity to, int sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_IMPULSE);
 
        WriteCoord(MSG_ENTITY, self.radius);
@@ -137,10 +147,10 @@ bool trigger_impulse_send(entity to, int sf)
 
 void trigger_impulse_link()
 {
-       Net_LinkEntity(self, 0, false, trigger_impulse_send);
+       //Net_LinkEntity(self, 0, false, trigger_impulse_send);
 }
 
-void spawnfunc_trigger_impulse()
+spawnfunc(trigger_impulse)
 {
        self.active = ACTIVE_ACTIVE;
 
@@ -171,7 +181,7 @@ void spawnfunc_trigger_impulse()
 }
 #elif defined(CSQC)
 void ent_trigger_impulse()
-{
+{SELFPARAM();
        self.radius = ReadCoord();
        self.strength = ReadCoord();
        self.falloff = ReadByte();