// targeted (directional) mode
-void trigger_impulse_touch1(entity this)
+void trigger_impulse_touch1(entity this, entity toucher)
{
entity targ;
float pushdeltatime;
if (this.active != ACTIVE_ACTIVE)
return;
- if (!isPushable(other))
+ if (!isPushable(toucher))
return;
- EXACTTRIGGER_TOUCH;
+ EXACTTRIGGER_TOUCH(this, toucher);
targ = find(NULL, targetname, this.target);
if(!targ)
}
#ifdef SVQC
- str = min(this.radius, vlen(this.origin - other.origin));
+ str = min(this.radius, vlen(this.origin - toucher.origin));
#elif defined(CSQC)
- str = min(this.radius, vlen(this.origin - other.move_origin));
+ str = min(this.radius, vlen(this.origin - toucher.move_origin));
#endif
if(this.falloff == 1)
else
str = this.strength;
- pushdeltatime = time - other.lastpushtime;
+ pushdeltatime = time - toucher.lastpushtime;
if (pushdeltatime > 0.15) pushdeltatime = 0;
- other.lastpushtime = time;
+ toucher.lastpushtime = time;
if(!pushdeltatime) return;
if(this.spawnflags & 64)
{
#ifdef SVQC
- float addspeed = str - other.velocity * normalize(targ.origin - this.origin);
+ float addspeed = str - toucher.velocity * normalize(targ.origin - this.origin);
if (addspeed > 0)
{
float accelspeed = min(8 * pushdeltatime * str, addspeed);
- other.velocity += accelspeed * normalize(targ.origin - this.origin);
+ toucher.velocity += accelspeed * normalize(targ.origin - this.origin);
}
#elif defined(CSQC)
- float addspeed = str - other.move_velocity * normalize(targ.origin - this.origin);
+ float addspeed = str - toucher.move_velocity * normalize(targ.origin - this.origin);
if (addspeed > 0)
{
float accelspeed = min(8 * pushdeltatime * str, addspeed);
- other.move_velocity += accelspeed * normalize(targ.origin - this.origin);
+ toucher.move_velocity += accelspeed * normalize(targ.origin - this.origin);
}
#endif
}
else
#ifdef SVQC
- other.velocity = other.velocity + normalize(targ.origin - this.origin) * str * pushdeltatime;
+ toucher.velocity = toucher.velocity + normalize(targ.origin - this.origin) * str * pushdeltatime;
#elif defined(CSQC)
- other.move_velocity = other.move_velocity + normalize(targ.origin - this.origin) * str * pushdeltatime;
+ toucher.move_velocity = toucher.move_velocity + normalize(targ.origin - this.origin) * str * pushdeltatime;
#endif
#ifdef SVQC
- UNSET_ONGROUND(other);
+ UNSET_ONGROUND(toucher);
- UpdateCSQCProjectile(other);
+ UpdateCSQCProjectile(toucher);
#elif defined(CSQC)
- other.move_flags &= ~FL_ONGROUND;
+ toucher.move_flags &= ~FL_ONGROUND;
#endif
}
// Directionless (accelerator/decelerator) mode
-void trigger_impulse_touch2(entity this)
+void trigger_impulse_touch2(entity this, entity toucher)
{
float pushdeltatime;
if (this.active != ACTIVE_ACTIVE)
return;
- if (!isPushable(other))
+ if (!isPushable(toucher))
return;
- EXACTTRIGGER_TOUCH;
+ EXACTTRIGGER_TOUCH(this, toucher);
- pushdeltatime = time - other.lastpushtime;
+ pushdeltatime = time - toucher.lastpushtime;
if (pushdeltatime > 0.15) pushdeltatime = 0;
- other.lastpushtime = time;
+ toucher.lastpushtime = time;
if(!pushdeltatime) return;
// div0: ticrate independent, 1 = identity (not 20)
#ifdef SVQC
- other.velocity = other.velocity * pow(this.strength, pushdeltatime);
+ toucher.velocity = toucher.velocity * pow(this.strength, pushdeltatime);
- UpdateCSQCProjectile(other);
+ UpdateCSQCProjectile(toucher);
#elif defined(CSQC)
- other.move_velocity = other.move_velocity * pow(this.strength, pushdeltatime);
+ toucher.move_velocity = toucher.move_velocity * pow(this.strength, pushdeltatime);
#endif
}
// Spherical (gravity/repulsor) mode
-void trigger_impulse_touch3(entity this)
+void trigger_impulse_touch3(entity this, entity toucher)
{
float pushdeltatime;
float str;
if (this.active != ACTIVE_ACTIVE)
return;
- if (!isPushable(other))
+ if (!isPushable(toucher))
return;
- EXACTTRIGGER_TOUCH;
+ EXACTTRIGGER_TOUCH(this, toucher);
- pushdeltatime = time - other.lastpushtime;
+ pushdeltatime = time - toucher.lastpushtime;
if (pushdeltatime > 0.15) pushdeltatime = 0;
- other.lastpushtime = time;
+ toucher.lastpushtime = time;
if(!pushdeltatime) return;
setsize(this, '-1 -1 -1' * this.radius,'1 1 1' * this.radius);
#ifdef SVQC
- str = min(this.radius, vlen(this.origin - other.origin));
+ str = min(this.radius, vlen(this.origin - toucher.origin));
#elif defined(CSQC)
- str = min(this.radius, vlen(this.origin - other.move_origin));
+ str = min(this.radius, vlen(this.origin - toucher.move_origin));
#endif
if(this.falloff == 1)
str = this.strength;
#ifdef SVQC
- other.velocity = other.velocity + normalize(other.origin - this.origin) * str * pushdeltatime;
+ toucher.velocity = toucher.velocity + normalize(toucher.origin - this.origin) * str * pushdeltatime;
- UpdateCSQCProjectile(other);
+ UpdateCSQCProjectile(toucher);
#elif defined(CSQC)
- other.move_velocity = other.move_velocity + normalize(other.move_origin - this.origin) * str * pushdeltatime;
+ toucher.move_velocity = toucher.move_velocity + normalize(toucher.move_origin - this.origin) * str * pushdeltatime;
#endif
}