+#include "impulse.qh"
// targeted (directional) mode
void trigger_impulse_touch1(entity this, entity toucher)
{
if(!targ)
{
objerror(this, "trigger_force without a (valid) .target!\n");
- remove(this);
+ delete(this);
return;
}
-#ifdef SVQC
str = min(this.radius, vlen(this.origin - toucher.origin));
-#elif defined(CSQC)
- str = min(this.radius, vlen(this.origin - toucher.move_origin));
-#endif
if(this.falloff == 1)
str = (str / this.radius) * this.strength;
if(this.spawnflags & 64)
{
-#ifdef SVQC
float addspeed = str - toucher.velocity * normalize(targ.origin - this.origin);
if (addspeed > 0)
{
float accelspeed = min(8 * pushdeltatime * str, addspeed);
toucher.velocity += accelspeed * normalize(targ.origin - this.origin);
}
-#elif defined(CSQC)
- float addspeed = str - toucher.move_velocity * normalize(targ.origin - this.origin);
- if (addspeed > 0)
- {
- float accelspeed = min(8 * pushdeltatime * str, addspeed);
- toucher.move_velocity += accelspeed * normalize(targ.origin - this.origin);
- }
-#endif
}
else
-#ifdef SVQC
toucher.velocity = toucher.velocity + normalize(targ.origin - this.origin) * str * pushdeltatime;
-#elif defined(CSQC)
- toucher.move_velocity = toucher.move_velocity + normalize(targ.origin - this.origin) * str * pushdeltatime;
-#endif
-#ifdef SVQC
UNSET_ONGROUND(toucher);
+#ifdef SVQC
UpdateCSQCProjectile(toucher);
-#elif defined(CSQC)
- toucher.move_flags &= ~FL_ONGROUND;
#endif
}
if(!pushdeltatime) return;
// div0: ticrate independent, 1 = identity (not 20)
-#ifdef SVQC
- toucher.velocity = toucher.velocity * pow(this.strength, pushdeltatime);
+ toucher.velocity = toucher.velocity * (this.strength ** pushdeltatime);
+#ifdef SVQC
UpdateCSQCProjectile(toucher);
-#elif defined(CSQC)
- toucher.move_velocity = toucher.move_velocity * pow(this.strength, pushdeltatime);
#endif
}
setsize(this, '-1 -1 -1' * this.radius,'1 1 1' * this.radius);
-#ifdef SVQC
str = min(this.radius, vlen(this.origin - toucher.origin));
-#elif defined(CSQC)
- str = min(this.radius, vlen(this.origin - toucher.move_origin));
-#endif
if(this.falloff == 1)
str = (1 - str / this.radius) * this.strength; // 1 in the inside
else
str = this.strength;
-#ifdef SVQC
toucher.velocity = toucher.velocity + normalize(toucher.origin - this.origin) * str * pushdeltatime;
+#ifdef SVQC
UpdateCSQCProjectile(toucher);
-#elif defined(CSQC)
- toucher.move_velocity = toucher.move_velocity + normalize(toucher.move_origin - this.origin) * str * pushdeltatime;
#endif
}
else
{
if(!this.strength) this.strength = 0.9;
- this.strength = pow(this.strength, autocvar_g_triggerimpulse_accel_power) * autocvar_g_triggerimpulse_accel_multiplier;
+ this.strength = (this.strength ** autocvar_g_triggerimpulse_accel_power) * autocvar_g_triggerimpulse_accel_multiplier;
settouch(this, trigger_impulse_touch2);
}
}