// targeted (directional) mode
void trigger_impulse_touch1()
-{
+{SELFPARAM();
entity targ;
float pushdeltatime;
float str;
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);
// Directionless (accelerator/decelerator) mode
void trigger_impulse_touch2()
-{
+{SELFPARAM();
float pushdeltatime;
if (self.active != ACTIVE_ACTIVE)
// Spherical (gravity/repulsor) mode
void trigger_impulse_touch3()
-{
+{SELFPARAM();
float pushdeltatime;
float str;
*/
#ifdef SVQC
bool trigger_impulse_send(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_IMPULSE);
WriteCoord(MSG_ENTITY, self.radius);
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;
}
#elif defined(CSQC)
void ent_trigger_impulse()
-{
+{SELFPARAM();
self.radius = ReadCoord();
self.strength = ReadCoord();
self.falloff = ReadByte();