.float scale;
.vector colormod;
-void SUB_Stop(entity this)
+void SUB_Stop(entity this, entity toucher)
{
this.move_velocity = this.move_avelocity = '0 0 0';
this.move_movetype = MOVETYPE_NONE;
class(Projectile).int snd_looping;
class(Projectile).bool silent;
-void SUB_Stop(entity this);
+void SUB_Stop(entity this, entity toucher);
void Projectile_ResetTrail(entity this, vector to);
return Sounds_from(SND_CASINGS1.m_id + floor(prandom() * 3));
}
-void Casing_Touch(entity this)
+void Casing_Touch(entity this, entity toucher)
{
if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
{
__pointparticles(ef, org, randomvec() * explosionspeed, howmany / 50);
}
-void SUB_RemoveOnNoImpact(entity this)
+void SUB_RemoveOnNoImpact(entity this, entity toucher)
{
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
Gib_Delete(this);
}
-void Gib_Touch(entity this)
+void Gib_Touch(entity this, entity toucher)
{
// TODO maybe bounce of walls, make more gibs, etc.
float autocvar_g_balance_nexball_secondary_refire;
float autocvar_g_balance_nexball_secondary_speed;
-void basketball_touch(entity this);
-void football_touch(entity this);
+void basketball_touch(entity this, entity toucher);
+void football_touch(entity this, entity toucher);
void ResetBall(entity this);
const int NBM_NONE = 0;
const int NBM_FOOTBALL = 2;
}
}
-void football_touch(entity this)
+void football_touch(entity this, entity toucher)
{
- if(other.solid == SOLID_BSP)
+ if(toucher.solid == SOLID_BSP)
{
if(time > this.lastground + 0.1)
{
this.nextthink = time + autocvar_g_nexball_delay_idle;
return;
}
- if (!IS_PLAYER(other))
+ if (!IS_PLAYER(toucher))
return;
- if(other.health < 1)
+ if(toucher.health < 1)
return;
if(!this.cnt)
this.nextthink = time + autocvar_g_nexball_delay_idle;
- this.pusher = other;
- this.team = other.team;
+ this.pusher = toucher;
+ this.team = toucher.team;
if(autocvar_g_nexball_football_physics == -1) // MrBougo try 1, before decompiling Rev's original
{
- if(other.velocity)
- this.velocity = other.velocity * 1.5 + '0 0 1' * autocvar_g_nexball_football_boost_up;
+ if(toucher.velocity)
+ this.velocity = toucher.velocity * 1.5 + '0 0 1' * autocvar_g_nexball_football_boost_up;
}
else if(autocvar_g_nexball_football_physics == 1) // MrBougo's modded Rev style: partially independant of the height of the aiming point
{
- makevectors(other.v_angle);
- this.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + '0 0 1' * autocvar_g_nexball_football_boost_up;
+ makevectors(toucher.v_angle);
+ this.velocity = toucher.velocity + v_forward * autocvar_g_nexball_football_boost_forward + '0 0 1' * autocvar_g_nexball_football_boost_up;
}
else if(autocvar_g_nexball_football_physics == 2) // 2nd mod try: totally independant. Really playable!
{
- makevectors(other.v_angle.y * '0 1 0');
- this.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up;
+ makevectors(toucher.v_angle.y * '0 1 0');
+ this.velocity = toucher.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up;
}
else // Revenant's original style (from the original mod's disassembly, acknowledged by Revenant)
{
- makevectors(other.v_angle);
- this.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up;
+ makevectors(toucher.v_angle);
+ this.velocity = toucher.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up;
}
this.avelocity = -250 * v_forward; // maybe there is a way to make it look better?
}
-void basketball_touch(entity this)
+void basketball_touch(entity this, entity toucher)
{
- if(other.ballcarried)
+ if(toucher.ballcarried)
{
- football_touch(this);
+ football_touch(this, toucher);
return;
}
- if(!this.cnt && IS_PLAYER(other) && !STAT(FROZEN, other) && !IS_DEAD(other) && (other != this.nb_dropper || time > this.nb_droptime + autocvar_g_nexball_delay_collect))
+ if(!this.cnt && IS_PLAYER(toucher) && !STAT(FROZEN, toucher) && !IS_DEAD(toucher) && (toucher != this.nb_dropper || time > this.nb_droptime + autocvar_g_nexball_delay_collect))
{
- if(other.health <= 0)
+ if(toucher.health <= 0)
return;
- LogNB("caught", other);
- GiveBall(other, this);
+ LogNB("caught", toucher);
+ GiveBall(toucher, this);
}
- else if(other.solid == SOLID_BSP)
+ else if(toucher.solid == SOLID_BSP)
{
_sound(this, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
if(this.velocity && !this.cnt)
}
}
-void GoalTouch(entity this)
+void GoalTouch(entity this, entity toucher)
{
entity ball;
float isclient, pscore, otherteam;
string pname;
if(gameover) return;
- if((this.spawnflags & GOAL_TOUCHPLAYER) && other.ballcarried)
- ball = other.ballcarried;
+ if((this.spawnflags & GOAL_TOUCHPLAYER) && toucher.ballcarried)
+ ball = toucher.ballcarried;
else
- ball = other;
+ ball = toucher;
if(ball.classname != "nexball_basketball")
if(ball.classname != "nexball_football")
return;
if((!ball.pusher && this.team != GOAL_OUT) || ball.cnt)
return;
- EXACTTRIGGER_TOUCH;
+ EXACTTRIGGER_TOUCH(this, toucher);
if(nb_teams == 2)
this.nextthink = time;
}
-void W_Nexball_Touch(entity this)
+void W_Nexball_Touch(entity this, entity toucher)
{
entity ball, attacker;
attacker = this.owner;
//this.think = func_null;
//this.enemy = NULL;
- PROJECTILE_TOUCH(this);
- if(attacker.team != other.team || autocvar_g_nexball_basketball_teamsteal)
- if((ball = other.ballcarried) && !STAT(FROZEN, other) && !IS_DEAD(other) && (IS_PLAYER(attacker)))
+ PROJECTILE_TOUCH(this, toucher);
+ if(attacker.team != toucher.team || autocvar_g_nexball_basketball_teamsteal)
+ if((ball = toucher.ballcarried) && !STAT(FROZEN, toucher) && !IS_DEAD(toucher) && (IS_PLAYER(attacker)))
{
- other.velocity = other.velocity + normalize(this.velocity) * other.damageforcescale * autocvar_g_balance_nexball_secondary_force;
- UNSET_ONGROUND(other);
+ toucher.velocity = toucher.velocity + normalize(this.velocity) * toucher.damageforcescale * autocvar_g_balance_nexball_secondary_force;
+ UNSET_ONGROUND(toucher);
if(!attacker.ballcarried)
{
LogNB("stole", attacker);
- _sound(other, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM);
+ _sound(toucher, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM);
- if(SAME_TEAM(attacker, other) && time > attacker.teamkill_complain)
+ if(SAME_TEAM(attacker, toucher) && time > attacker.teamkill_complain)
{
attacker.teamkill_complain = time + 5;
attacker.teamkill_soundtime = time + 0.4;
- attacker.teamkill_soundsource = other;
+ attacker.teamkill_soundsource = toucher;
}
- GiveBall(attacker, other.ballcarried);
+ GiveBall(attacker, toucher.ballcarried);
}
}
remove(this);
return true;
}
-void ons_CaptureShield_Touch(entity this)
+void ons_CaptureShield_Touch(entity this, entity toucher)
{
- if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, other.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return; }
- if(!IS_PLAYER(other)) { return; }
- if(SAME_TEAM(other, this)) { return; }
+ if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, toucher.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return; }
+ if(!IS_PLAYER(toucher)) { return; }
+ if(SAME_TEAM(toucher, this)) { return; }
vector mymid = (this.absmin + this.absmax) * 0.5;
- vector othermid = (other.absmin + other.absmax) * 0.5;
+ vector theirmid = (toucher.absmin + toucher.absmax) * 0.5;
- Damage(other, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(othermid - mymid) * ons_captureshield_force);
+ Damage(toucher, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(theirmid - mymid) * ons_captureshield_force);
- if(IS_REAL_CLIENT(other))
+ if(IS_REAL_CLIENT(toucher))
{
- play2(other, SND(ONS_DAMAGEBLOCKEDBYSHIELD));
+ play2(toucher, SND(ONS_DAMAGEBLOCKEDBYSHIELD));
if(this.enemy.classname == "onslaught_generator")
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_GENERATOR_SHIELDED);
+ Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_GENERATOR_SHIELDED);
else
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_CONTROLPOINT_SHIELDED);
+ Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_CONTROLPOINT_SHIELDED);
}
}
}
}
-void ons_ControlPoint_Touch(entity this)
+void ons_ControlPoint_Touch(entity this, entity toucher)
{
- entity toucher = other;
int attackable;
if(IS_VEHICLE(toucher) && toucher.owner)
}
-void onslaught_generator_touch(entity this)
+void onslaught_generator_touch(entity this, entity toucher)
{
- if ( IS_PLAYER(other) )
- if ( SAME_TEAM(this,other) )
+ if ( IS_PLAYER(toucher) )
+ if ( SAME_TEAM(this,toucher) )
if ( this.iscaptured )
{
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_TELEPORT);
+ Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT);
}
}
remove (this);
}
-void M_Mage_Attack_Spike_Touch(entity this)
+void M_Mage_Attack_Spike_Touch(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
- M_Mage_Attack_Spike_Explode(this);
+ WITH(entity, other, toucher, M_Mage_Attack_Spike_Explode(this));
}
.float wait;
W_PrepareExplosionByDamage(this, attacker, adaptor_think2use);
}
-void M_Shambler_Attack_Lightning_Touch(entity this)
+void M_Shambler_Attack_Lightning_Touch(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
- this.use(this, NULL, NULL);
+ WITH(entity, other, toucher, this.use(this, NULL, NULL));
}
void M_Shambler_Attack_Lightning_Think(entity this)
M_Spider_Attack_Web_Explode(this);
}
-void M_Spider_Attack_Web_Touch(entity this)
+void M_Spider_Attack_Web_Touch(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
M_Spider_Attack_Web_Explode(this);
}
float autocvar_g_monster_wyvern_attack_fireball_speed;
void M_Wyvern_Attack_Fireball_Explode(entity this);
-void M_Wyvern_Attack_Fireball_Touch(entity this);
+void M_Wyvern_Attack_Fireball_Touch(entity this, entity toucher);
SOUND(WyvernAttack_FIRE, W_Sound("electro_fire"));
METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity weaponentity, int fire))
remove(this);
}
-void M_Wyvern_Attack_Fireball_Touch(entity this)
+void M_Wyvern_Attack_Fireball_Touch(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
M_Wyvern_Attack_Fireball_Explode(this);
}
.vector moveto;
-void M_Zombie_Attack_Leap_Touch(entity this)
+void M_Zombie_Attack_Leap_Touch(entity this, entity toucher)
{
if (this.health <= 0)
return;
vector angles_face;
- if(other.takedamage)
+ if(toucher.takedamage)
{
angles_face = vectoangles(this.moveto - this.origin);
angles_face = normalize(angles_face) * (autocvar_g_monster_zombie_attack_leap_force);
- Damage(other, this, this, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(this), DEATH_MONSTER_ZOMBIE_JUMP.m_id, other.origin, angles_face);
+ Damage(toucher, this, this, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(this), DEATH_MONSTER_ZOMBIE_JUMP.m_id, toucher.origin, angles_face);
settouch(this, Monster_Touch); // instantly turn it off to stop damage spam
this.state = 0;
}
return true;
}
-bool Monster_Attack_Leap(entity this, vector anm, void(entity this) touchfunc, vector vel, float animtime)
+bool Monster_Attack_Leap(entity this, vector anm, void(entity this, entity toucher) touchfunc, vector vel, float animtime)
{
if(!Monster_Attack_Leap_Check(this, vel))
return false;
mon.mr_anim(mon, this);
}
-void Monster_Touch(entity this)
+void Monster_Touch(entity this, entity toucher)
{
- if(other == NULL) { return; }
+ if(toucher == NULL) { return; }
- if(other.monster_attack)
- if(this.enemy != other)
- if(!IS_MONSTER(other))
- if(Monster_ValidTarget(this, other))
- this.enemy = other;
+ if(toucher.monster_attack)
+ if(this.enemy != toucher)
+ if(!IS_MONSTER(toucher))
+ if(Monster_ValidTarget(this, toucher))
+ this.enemy = toucher;
}
void Monster_Miniboss_Check(entity this)
void monster_setupcolors(entity this);
-void Monster_Touch(entity this);
+void Monster_Touch(entity this, entity toucher);
void Monster_Move_2D(entity this, float mspeed, float allow_jumpoff);
float Monster_Attack_Melee(entity this, entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop);
-bool Monster_Attack_Leap(entity this, vector anm, void(entity this) touchfunc, vector vel, float animtime);
+bool Monster_Attack_Leap(entity this, vector anm, void(entity this, entity toucher) touchfunc, vector vel, float animtime);
entity Monster_FindTarget(entity this);
sound(this, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
}
-void buff_Touch(entity this)
+void buff_Touch(entity this, entity toucher)
{
if(gameover) { return; }
return;
}
- if((this.team && DIFF_TEAM(other, this))
- || (STAT(FROZEN, other))
- || (other.vehicle)
+ if((this.team && DIFF_TEAM(toucher, this))
+ || (STAT(FROZEN, toucher))
+ || (toucher.vehicle)
|| (!this.buff_active)
)
{
return;
}
- if(MUTATOR_CALLHOOK(BuffTouch, this, other))
+ if(MUTATOR_CALLHOOK(BuffTouch, this, toucher))
return;
- other = M_ARGV(1, entity);
+ toucher = M_ARGV(1, entity);
- if(!IS_PLAYER(other))
- return; // incase mutator changed other
+ if(!IS_PLAYER(toucher))
+ return; // incase mutator changed toucher
- if (other.buffs)
+ if (toucher.buffs)
{
- if (other.cvar_cl_buffs_autoreplace && other.buffs != this.buffs)
+ if (toucher.cvar_cl_buffs_autoreplace && toucher.buffs != this.buffs)
{
- int buffid = buff_FirstFromFlags(other.buffs).m_id;
- //Send_Notification(NOTIF_ONE, other, MSG_MULTI, ITEM_BUFF_DROP, other.buffs);
- Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ITEM_BUFF_LOST, other.netname, buffid);
+ int buffid = buff_FirstFromFlags(toucher.buffs).m_id;
+ //Send_Notification(NOTIF_ONE, toucher, MSG_MULTI, ITEM_BUFF_DROP, toucher.buffs);
+ Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ITEM_BUFF_LOST, toucher.netname, buffid);
- other.buffs = 0;
- //sound(other, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
+ toucher.buffs = 0;
+ //sound(toucher, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
}
else { return; } // do nothing
}
- this.owner = other;
+ this.owner = toucher;
this.buff_active = false;
this.lifetime = 0;
int buffid = buff_FirstFromFlags(this.buffs).m_id;
- Send_Notification(NOTIF_ONE, other, MSG_MULTI, ITEM_BUFF_GOT, buffid);
- Send_Notification(NOTIF_ALL_EXCEPT, other, MSG_INFO, INFO_ITEM_BUFF, other.netname, buffid);
+ Send_Notification(NOTIF_ONE, toucher, MSG_MULTI, ITEM_BUFF_GOT, buffid);
+ Send_Notification(NOTIF_ALL_EXCEPT, toucher, MSG_INFO, INFO_ITEM_BUFF, toucher.netname, buffid);
Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
- sound(other, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTN_NORM);
- other.buffs |= (this.buffs);
+ sound(toucher, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTN_NORM);
+ toucher.buffs |= (this.buffs);
}
float buff_Available(entity buff)
if(boxesoverlap(player.absmin - pickup_size, player.absmax + pickup_size, it.absmin, it.absmax))
{
if(gettouch(it))
- {
- entity oldother = other;
- other = player;
- gettouch(it)(it);
- other = oldother;
- }
+ gettouch(it)(it, player);
}
});
}
return orb;
}
-void nade_entrap_touch(entity this)
+void nade_entrap_touch(entity this, entity toucher)
{
- if(DIFF_TEAM(other, this.realowner)) // TODO: what if realowner changes team or disconnects?
+ if(DIFF_TEAM(toucher, this.realowner)) // TODO: what if realowner changes team or disconnects?
{
- if (!isPushable(other))
+ if (!isPushable(toucher))
return;
- float pushdeltatime = time - other.lastpushtime;
+ float 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(autocvar_g_nades_entrap_strength, pushdeltatime);
+ toucher.velocity = toucher.velocity * pow(autocvar_g_nades_entrap_strength, pushdeltatime);
- UpdateCSQCProjectile(other);
+ UpdateCSQCProjectile(toucher);
#elif defined(CSQC)
- other.move_velocity = other.move_velocity * pow(autocvar_g_nades_entrap_strength, pushdeltatime);
+ toucher.move_velocity = toucher.move_velocity * pow(autocvar_g_nades_entrap_strength, pushdeltatime);
#endif
}
- if ( IS_REAL_CLIENT(other) || IS_VEHICLE(other) || IS_MONSTER(other) )
+ if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) || IS_MONSTER(toucher) )
{
- entity show_tint = (IS_VEHICLE(other)) ? other.owner : other;
+ entity show_tint = (IS_VEHICLE(toucher)) ? toucher.owner : toucher;
STAT(ENTRAP_ORB, show_tint) = time + 0.1;
float tint_alpha = 0.75;
- if(SAME_TEAM(other, this.realowner))
+ if(SAME_TEAM(toucher, this.realowner))
tint_alpha = 0.45;
STAT(ENTRAP_ORB_ALPHA, show_tint) = tint_alpha * (this.ltime - time) / this.orb_lifetime;
}
orb.colormod = NADE_TYPE_ENTRAP.m_color;
}
-void nade_heal_touch(entity this)
+void nade_heal_touch(entity this, entity toucher)
{
float maxhealth;
float health_factor;
- if(IS_PLAYER(other) || IS_MONSTER(other))
- if(!IS_DEAD(other))
- if(!STAT(FROZEN, other))
+ if(IS_PLAYER(toucher) || IS_MONSTER(toucher))
+ if(!IS_DEAD(toucher))
+ if(!STAT(FROZEN, toucher))
{
health_factor = autocvar_g_nades_heal_rate*frametime/2;
- if ( other != this.realowner )
+ if ( toucher != this.realowner )
{
- if ( SAME_TEAM(other,this) )
+ if ( SAME_TEAM(toucher,this) )
health_factor *= autocvar_g_nades_heal_friend;
else
health_factor *= autocvar_g_nades_heal_foe;
}
if ( health_factor > 0 )
{
- maxhealth = (IS_MONSTER(other)) ? other.max_health : g_pickup_healthmega_max;
- if ( other.health < maxhealth )
+ maxhealth = (IS_MONSTER(toucher)) ? toucher.max_health : g_pickup_healthmega_max;
+ if ( toucher.health < maxhealth )
{
if ( this.nade_show_particles )
- Send_Effect(EFFECT_HEALING, other.origin, '0 0 0', 1);
- other.health = min(other.health+health_factor, maxhealth);
+ Send_Effect(EFFECT_HEALING, toucher.origin, '0 0 0', 1);
+ toucher.health = min(toucher.health+health_factor, maxhealth);
}
- other.pauserothealth_finished = max(other.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
+ toucher.pauserothealth_finished = max(toucher.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
}
else if ( health_factor < 0 )
{
- Damage(other,this,this.realowner,-health_factor,DEATH_NADE_HEAL.m_id,other.origin,'0 0 0');
+ Damage(toucher,this,this.realowner,-health_factor,DEATH_NADE_HEAL.m_id,toucher.origin,'0 0 0');
}
}
- if ( IS_REAL_CLIENT(other) || IS_VEHICLE(other) )
+ if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) )
{
- entity show_red = (IS_VEHICLE(other)) ? other.owner : other;
+ entity show_red = (IS_VEHICLE(toucher)) ? toucher.owner : toucher;
show_red.stat_healing_orb = time+0.1;
show_red.stat_healing_orb_alpha = 0.75 * (this.ltime - time) / this.orb_lifetime;
}
}
bool CanThrowNade(entity this);
-void nade_touch(entity this)
+void nade_touch(entity this, entity toucher)
{
- if(other)
+ if(toucher)
UpdateCSQCProjectile(this);
- if(other == this.realowner)
+ if(toucher == this.realowner)
return; // no this impacts
if(autocvar_g_nades_pickup)
if(time >= this.spawnshieldtime)
- if(!other.nade && this.health == this.max_health) // no boosted shot pickups, thank you very much
- if(!other.frozen)
- if(CanThrowNade(other)) // prevent some obvious things, like dead players
- if(IS_REAL_CLIENT(other)) // above checks for IS_PLAYER, don't need to do it here
+ if(!toucher.nade && this.health == this.max_health) // no boosted shot pickups, thank you very much
+ if(!toucher.frozen)
+ if(CanThrowNade(toucher)) // prevent some obvious things, like dead players
+ if(IS_REAL_CLIENT(toucher)) // above checks for IS_PLAYER, don't need to do it here
{
- nade_pickup(other, this);
+ nade_pickup(toucher, this);
sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
remove(this);
return;
return;
}
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
//setsize(this, '-2 -2 -2', '2 2 2');
//UpdateCSQCProjectile(this);
return;
}
- this.enemy = other;
+ this.enemy = toucher;
nade_boom(this);
}
remove (this);
}
-void W_RocketPropelledChainsaw_Touch (entity this)
+void W_RocketPropelledChainsaw_Touch (entity this, entity toucher)
{
- if(WarpZone_Projectile_Touch(this))
+ if(WarpZone_Projectile_Touch(this, toucher))
if(wasfreed(this))
return;
- W_RocketPropelledChainsaw_Explode(this);
+ WITH(entity, other, toucher, W_RocketPropelledChainsaw_Explode(this));
}
void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
remove(this); // the real item is gone, remove this
}
-void physical_item_touch(entity this)
+void physical_item_touch(entity this, entity toucher)
{
if(!this.cnt) // not for dropped items
if (ITEM_TOUCH_NEEDKILL())
.string material;
.float touch_timer;
-void sandbox_ObjectFunction_Touch(entity this)
+void sandbox_ObjectFunction_Touch(entity this, entity toucher)
{
// apply material impact effects
// make particle count and sound volume depend on impact speed
float intensity;
- intensity = vlen(this.velocity) + vlen(other.velocity);
+ intensity = vlen(this.velocity) + vlen(toucher.velocity);
if(intensity) // avoid divisions by 0
intensity /= 2; // average the two velocities
if (!(intensity >= autocvar_g_sandbox_object_material_velocity_min))
void _Movetype_Impact(entity this, entity oth) // SV_Impact
{
- entity oldother = other;
-
if(gettouch(this))
- {
- other = oth;
-
- gettouch(this)(this);
-
- other = oldother;
- }
+ gettouch(this)(this, oth);
if(gettouch(oth))
- {
- other = this;
-
- gettouch(oth)(oth);
-
- other = oldother;
- }
+ gettouch(oth)(oth, this);
}
void _Movetype_LinkEdict_TouchAreaGrid(entity this) // SV_LinkEdict_TouchAreaGrid
if(this.solid == SOLID_NOT)
return;
- entity oldother = other;
-
FOREACH_ENTITY_RADIUS(0.5 * (this.absmin + this.absmax), 0.5 * vlen(this.absmax - this.absmin), true, {
if (it.solid == SOLID_TRIGGER && it != this)
if (it.move_nomonsters != MOVE_NOMONSTERS && it.move_nomonsters != MOVE_WORLDONLY)
if (gettouch(it) && boxesoverlap(it.absmin, it.absmax, this.absmin, this.absmax))
{
- other = this;
-
trace_allsolid = false;
trace_startsolid = false;
trace_fraction = 1;
trace_plane_dist = 0;
trace_ent = this;
- gettouch(it)(it);
+ gettouch(it)(it, this);
}
});
-
- other = oldother;
}
void _Movetype_LinkEdict(entity this, bool touch_triggers) // SV_LinkEdict
return 1;
}
-void Item_Touch(entity this)
+void Item_Touch(entity this, entity toucher)
{
// remove the item if it's currnetly in a NODROP brush or hits a NOIMPACT surface (such as sky)
}
}
- if(!(other.flags & FL_PICKUPITEMS)
- || STAT(FROZEN, other)
- || IS_DEAD(other)
+ if(!(toucher.flags & FL_PICKUPITEMS)
+ || STAT(FROZEN, toucher)
+ || IS_DEAD(toucher)
|| (this.solid != SOLID_TRIGGER)
- || (this.owner == other)
+ || (this.owner == toucher)
|| (time < this.item_spawnshieldtime)
) { return; }
- switch (MUTATOR_CALLHOOK(ItemTouch, this, other))
+ switch (MUTATOR_CALLHOOK(ItemTouch, this, toucher))
{
case MUT_ITEMTOUCH_RETURN: { return; }
- case MUT_ITEMTOUCH_PICKUP: { other = M_ARGV(1, entity); goto pickup; }
+ case MUT_ITEMTOUCH_PICKUP: { toucher = M_ARGV(1, entity); goto pickup; }
}
- other = M_ARGV(1, entity);
+ toucher = M_ARGV(1, entity);
if (this.classname == "droppedweapon")
{
this.superweapons_finished = max(0, this.superweapons_finished - time);
}
entity it = this.itemdef;
- bool gave = ITEM_HANDLE(Pickup, it, this, other);
+ bool gave = ITEM_HANDLE(Pickup, it, this, toucher);
if (!gave)
{
if (this.classname == "droppedweapon")
LABEL(pickup)
- other.last_pickup = time;
+ toucher.last_pickup = time;
Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
- _sound (other, (this.itemdef.instanceOfPowerup ? CH_TRIGGER_SINGLE : CH_TRIGGER), (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
+ _sound (toucher, (this.itemdef.instanceOfPowerup ? CH_TRIGGER_SINGLE : CH_TRIGGER), (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
if (this.classname == "droppedweapon")
remove (this);
void target_items_use(entity this, entity actor, entity trigger)
{
- other = trigger; // TODO
-
if(actor.classname == "droppedweapon")
{
- EXACTTRIGGER_TOUCH;
+ EXACTTRIGGER_TOUCH(this, trigger);
remove(actor);
return;
}
return;
if(trigger.solid == SOLID_TRIGGER)
{
- EXACTTRIGGER_TOUCH;
+ EXACTTRIGGER_TOUCH(this, trigger);
}
FOREACH_ENTITY_ENT(enemy, actor,
float Item_GiveTo(entity item, entity player);
-void Item_Touch(entity this);
+void Item_Touch(entity this, entity toucher);
void Item_Reset(entity this);
button_fire(this);
}
-void button_touch(entity this)
+void button_touch(entity this, entity toucher)
{
- if (!other)
+ if (!toucher)
return;
- if (!other.iscreature)
+ if (!toucher.iscreature)
return;
- if(other.velocity * this.movedir < 0)
+ if(toucher.velocity * this.movedir < 0)
return;
- this.enemy = other;
- if (other.owner)
- this.enemy = other.owner;
+ this.enemy = toucher;
+ if (toucher.owner)
+ this.enemy = toucher.owner;
button_fire (this);
}
================
*/
-void door_touch(entity this)
+void door_touch(entity this, entity toucher)
{
- if (!IS_PLAYER(other))
+ if (!IS_PLAYER(toucher))
return;
if (this.owner.door_finished > time)
return;
#ifdef SVQC
if (!(this.owner.dmg) && (this.owner.message != ""))
{
- if (IS_CLIENT(other))
- centerprint(other, this.owner.message);
- play2(other, this.owner.noise);
+ if (IS_CLIENT(toucher))
+ centerprint(toucher, this.owner.message);
+ play2(toucher, this.owner.noise);
}
#endif
}
void door_generic_plat_blocked(entity this)
{
-
- if((this.spawnflags & 8) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!!
+ if((this.spawnflags & 8) && (other.takedamage != DAMAGE_NO)) { // Kill Kill Kill!!
#ifdef SVQC
Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
#endif
=========================================
*/
-void door_trigger_touch(entity this)
+void door_trigger_touch(entity this, entity toucher)
{
- if (other.health < 1)
+ if (toucher.health < 1)
#ifdef SVQC
- if (!((other.iscreature || (other.flags & FL_PROJECTILE)) && !IS_DEAD(other)))
+ if (!((toucher.iscreature || (toucher.flags & FL_PROJECTILE)) && !IS_DEAD(toucher)))
#elif defined(CSQC)
- if(!((IS_CLIENT(other) || other.classname == "csqcprojectile") && !IS_DEAD(other)))
+ if(!((IS_CLIENT(toucher) || toucher.classname == "csqcprojectile") && !IS_DEAD(toucher)))
#endif
return;
return;
// check if door is locked
- if (!door_check_keys(this, other))
+ if (!door_check_keys(this, toucher))
return;
this.door_finished = time + 1;
- door_use(this.owner, other, NULL);
+ door_use(this.owner, toucher, NULL);
}
void door_spawnfield(entity this, vector fmins, vector fmaxs)
Prints messages
================
*/
-void secret_touch(entity this)
+void secret_touch(entity this, entity toucher)
{
- if (!other.iscreature)
+ if (!toucher.iscreature)
return;
if (this.door_finished > time)
return;
if (this.message)
{
- if (IS_CLIENT(other))
- centerprint(other, this.message);
- play2(other, this.noise);
+ if (IS_CLIENT(toucher))
+ centerprint(toucher, this.message);
+ play2(toucher, this.noise);
}
}
REGISTER_NET_LINKED(ENT_CLIENT_LADDER)
-void func_ladder_touch(entity this)
+void func_ladder_touch(entity this, entity toucher)
{
#ifdef SVQC
- if (!other.iscreature)
+ if (!toucher.iscreature)
return;
- if(IS_VEHICLE(other))
+ if(IS_VEHICLE(toucher))
return;
#elif defined(CSQC)
- if(!other.isplayermodel)
+ if(!toucher.isplayermodel)
return;
#endif
- EXACTTRIGGER_TOUCH;
+ EXACTTRIGGER_TOUCH(this, toucher);
- other.ladder_time = time + 0.1;
- other.ladder_entity = this;
+ toucher.ladder_time = time + 0.1;
+ toucher.ladder_entity = this;
}
#ifdef SVQC
SUB_CalcMove (this, this.pos1, TSPEED_LINEAR, this.speed, plat_hit_top);
}
-void plat_center_touch(entity this)
+void plat_center_touch(entity this, entity toucher)
{
#ifdef SVQC
- if (!other.iscreature)
+ if (!toucher.iscreature)
return;
- if (other.health <= 0)
+ if (toucher.health <= 0)
return;
#elif defined(CSQC)
- if (!IS_PLAYER(other))
+ if (!IS_PLAYER(toucher))
return;
- if(IS_DEAD(other))
+ if(IS_DEAD(toucher))
return;
#endif
this.enemy.SUB_NEXTTHINK = this.enemy.SUB_LTIME + 1;
}
-void plat_outside_touch(entity this)
+void plat_outside_touch(entity this, entity toucher)
{
#ifdef SVQC
- if (!other.iscreature)
+ if (!toucher.iscreature)
return;
- if (other.health <= 0)
+ if (toucher.health <= 0)
return;
#elif defined(CSQC)
- if (!IS_PLAYER(other))
+ if (!IS_PLAYER(toucher))
return;
#endif
.float dmgtime2;
-void plat_center_touch(entity this);
-void plat_outside_touch(entity this);
+void plat_center_touch(entity this, entity toucher);
+void plat_outside_touch(entity this, entity toucher);
void plat_trigger_use(entity this, entity actor, entity trigger);
void plat_go_up(entity this);
void plat_go_down(entity this);
entity Simple_TeleportPlayer(entity teleporter, entity player);
-void Teleport_Touch (entity this);
+void Teleport_Touch(entity this, entity toucher);
void teleport_findtarget(entity this);
this.state = !this.state;
}
-void trigger_gravity_touch(entity this)
+void trigger_gravity_touch(entity this, entity toucher)
{
float g;
if(this.state != true)
return;
- EXACTTRIGGER_TOUCH;
+ EXACTTRIGGER_TOUCH(this, toucher);
g = this.gravity;
if (!(this.spawnflags & 1))
{
- if(other.trigger_gravity_check)
+ if(toucher.trigger_gravity_check)
{
- if(this == other.trigger_gravity_check.enemy)
+ if(this == toucher.trigger_gravity_check.enemy)
{
// same?
- other.trigger_gravity_check.count = 2; // gravity one more frame...
+ toucher.trigger_gravity_check.count = 2; // gravity one more frame...
return;
}
// compare prio
- if(this.cnt > other.trigger_gravity_check.enemy.cnt)
- trigger_gravity_remove(other);
+ if(this.cnt > toucher.trigger_gravity_check.enemy.cnt)
+ trigger_gravity_remove(toucher);
else
return;
}
- other.trigger_gravity_check = spawn();
- other.trigger_gravity_check.enemy = this;
- other.trigger_gravity_check.owner = other;
- other.trigger_gravity_check.gravity = other.gravity;
- setthink(other.trigger_gravity_check, trigger_gravity_check_think);
- other.trigger_gravity_check.nextthink = time;
- other.trigger_gravity_check.count = 2;
- if(other.gravity)
- g *= other.gravity;
+ toucher.trigger_gravity_check = spawn();
+ toucher.trigger_gravity_check.enemy = this;
+ toucher.trigger_gravity_check.owner = toucher;
+ toucher.trigger_gravity_check.gravity = toucher.gravity;
+ setthink(toucher.trigger_gravity_check, trigger_gravity_check_think);
+ toucher.trigger_gravity_check.nextthink = time;
+ toucher.trigger_gravity_check.count = 2;
+ if(toucher.gravity)
+ g *= toucher.gravity;
}
- if (other.gravity != g)
+ if (toucher.gravity != g)
{
- other.gravity = g;
+ toucher.gravity = g;
if(this.noise != "")
- _sound (other, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
+ _sound (toucher, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
UpdateCSQCProjectile(this.owner);
}
}
#ifdef SVQC
.float triggerhealtime;
-void trigger_heal_touch(entity this)
+void trigger_heal_touch(entity this, entity toucher)
{
if (this.active != ACTIVE_ACTIVE)
return;
// only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
- if (other.iscreature)
+ if (toucher.iscreature)
{
- if (other.takedamage)
- if (!IS_DEAD(other))
- if (other.triggerhealtime < time)
+ if (toucher.takedamage)
+ if (!IS_DEAD(toucher))
+ if (toucher.triggerhealtime < time)
{
- EXACTTRIGGER_TOUCH;
- other.triggerhealtime = time + 1;
+ EXACTTRIGGER_TOUCH(this, toucher);
+ toucher.triggerhealtime = time + 1;
- if (other.health < this.max_health)
+ if (toucher.health < this.max_health)
{
- other.health = min(other.health + this.health, this.max_health);
- other.pauserothealth_finished = max(other.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
- _sound (other, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
+ toucher.health = min(toucher.health + this.health, this.max_health);
+ toucher.pauserothealth_finished = max(toucher.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
+ _sound (toucher, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
}
}
}
}
.float triggerhurttime;
-void trigger_hurt_touch(entity this)
+void trigger_hurt_touch(entity this, entity toucher)
{
if (this.active != ACTIVE_ACTIVE)
return;
if(this.team)
- if(((this.spawnflags & 4) == 0) == (this.team != other.team))
+ if(((this.spawnflags & 4) == 0) == (this.team != toucher.team))
return;
// only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
- if (other.iscreature)
+ if (toucher.iscreature)
{
- if (other.takedamage)
- if (other.triggerhurttime < time)
+ if (toucher.takedamage)
+ if (toucher.triggerhurttime < time)
{
- EXACTTRIGGER_TOUCH;
- other.triggerhurttime = time + 1;
+ EXACTTRIGGER_TOUCH(this, toucher);
+ toucher.triggerhurttime = time + 1;
entity own;
own = this.enemy;
this.enemy = NULL; // I still hate you all
}
- Damage (other, this, own, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
+ Damage (toucher, this, own, this.dmg, DEATH_HURTTRIGGER.m_id, toucher.origin, '0 0 0');
}
}
- else if(other.damagedbytriggers)
+ else if(toucher.damagedbytriggers)
{
- if(other.takedamage)
+ if(toucher.takedamage)
{
- EXACTTRIGGER_TOUCH;
- Damage(other, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
+ EXACTTRIGGER_TOUCH(this, toucher);
+ Damage(toucher, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, toucher.origin, '0 0 0');
}
}
// 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
}
return sdir * vs + '0 0 1' * vz;
}
-void trigger_push_touch(entity this)
+void trigger_push_touch(entity this, entity toucher)
{
if (this.active == ACTIVE_NOT)
return;
- if (!isPushable(other))
+ if (!isPushable(toucher))
return;
if(this.team)
- if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, other)))
+ if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, toucher)))
return;
- EXACTTRIGGER_TOUCH;
+ EXACTTRIGGER_TOUCH(this, toucher);
if(this.enemy)
{
- other.velocity = trigger_push_calculatevelocity(other.origin, this.enemy, this.height);
- other.move_velocity = other.velocity;
+ toucher.velocity = trigger_push_calculatevelocity(toucher.origin, this.enemy, this.height);
+ toucher.move_velocity = toucher.velocity;
}
else if(this.target && this.target != "")
{
else
RandomSelection_Add(e, 0, string_null, 1, 1);
}
- other.velocity = trigger_push_calculatevelocity(other.origin, RandomSelection_chosen_ent, this.height);
- other.move_velocity = other.velocity;
+ toucher.velocity = trigger_push_calculatevelocity(toucher.origin, RandomSelection_chosen_ent, this.height);
+ toucher.move_velocity = toucher.velocity;
}
else
{
- other.velocity = this.movedir;
- other.move_velocity = other.velocity;
+ toucher.velocity = this.movedir;
+ toucher.move_velocity = toucher.velocity;
}
#ifdef SVQC
- UNSET_ONGROUND(other);
+ UNSET_ONGROUND(toucher);
#elif defined(CSQC)
- other.move_flags &= ~FL_ONGROUND;
+ toucher.move_flags &= ~FL_ONGROUND;
- if (other.flags & FL_PROJECTILE)
+ if (toucher.flags & FL_PROJECTILE)
{
- other.move_angles = vectoangles (other.move_velocity);
- switch(other.move_movetype)
+ toucher.move_angles = vectoangles (toucher.move_velocity);
+ switch(toucher.move_movetype)
{
case MOVETYPE_FLY:
- other.move_movetype = MOVETYPE_TOSS;
- other.gravity = 1;
+ toucher.move_movetype = MOVETYPE_TOSS;
+ toucher.gravity = 1;
break;
case MOVETYPE_BOUNCEMISSILE:
- other.move_movetype = MOVETYPE_BOUNCE;
- other.gravity = 1;
+ toucher.move_movetype = MOVETYPE_BOUNCE;
+ toucher.gravity = 1;
break;
}
}
#endif
#ifdef SVQC
- if (IS_PLAYER(other))
+ if (IS_PLAYER(toucher))
{
// reset tracking of oldvelocity for impact damage (sudden velocity changes)
- other.oldvelocity = other.velocity;
+ toucher.oldvelocity = toucher.velocity;
if(this.pushltime < time) // prevent "snorring" sound when a player hits the jumppad more than once
{
// flash when activated
- Send_Effect(EFFECT_JUMPPAD, other.origin, other.velocity, 1);
- _sound (other, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
+ Send_Effect(EFFECT_JUMPPAD, toucher.origin, toucher.velocity, 1);
+ _sound (toucher, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
this.pushltime = time + 0.2;
}
- if(IS_REAL_CLIENT(other) || IS_BOT_CLIENT(other))
+ if(IS_REAL_CLIENT(toucher) || IS_BOT_CLIENT(toucher))
{
bool found = false;
- for(int i = 0; i < other.jumppadcount && i < NUM_JUMPPADSUSED; ++i)
- if(other.(jumppadsused[i]) == this)
+ for(int i = 0; i < toucher.jumppadcount && i < NUM_JUMPPADSUSED; ++i)
+ if(toucher.(jumppadsused[i]) == this)
found = true;
if(!found)
{
- other.(jumppadsused[other.jumppadcount % NUM_JUMPPADSUSED]) = this;
- other.jumppadcount = other.jumppadcount + 1;
+ toucher.(jumppadsused[toucher.jumppadcount % NUM_JUMPPADSUSED]) = this;
+ toucher.jumppadcount = toucher.jumppadcount + 1;
}
- if(IS_REAL_CLIENT(other))
+ if(IS_REAL_CLIENT(toucher))
{
if(this.message)
- centerprint(other, this.message);
+ centerprint(toucher, this.message);
}
else
- other.lastteleporttime = time;
+ toucher.lastteleporttime = time;
- if (!IS_DEAD(other))
- animdecide_setaction(other, ANIMACTION_JUMP, true);
+ if (!IS_DEAD(toucher))
+ animdecide_setaction(toucher, ANIMACTION_JUMP, true);
}
else
- other.jumppadcount = true;
+ toucher.jumppadcount = true;
// reset tracking of who pushed you into a hazard (for kill credit)
- other.pushltime = 0;
- other.istypefrag = 0;
+ toucher.pushltime = 0;
+ toucher.istypefrag = 0;
}
if(this.enemy.target)
- SUB_UseTargets(this.enemy, other, other); // TODO: do we need other as trigger too?
+ SUB_UseTargets(this.enemy, toucher, toucher); // TODO: do we need toucher as trigger too?
- if (other.flags & FL_PROJECTILE)
+ if (toucher.flags & FL_PROJECTILE)
{
- other.angles = vectoangles (other.velocity);
- switch(other.movetype)
+ toucher.angles = vectoangles (toucher.velocity);
+ switch(toucher.movetype)
{
case MOVETYPE_FLY:
- other.movetype = MOVETYPE_TOSS;
- other.gravity = 1;
+ toucher.movetype = MOVETYPE_TOSS;
+ toucher.gravity = 1;
break;
case MOVETYPE_BOUNCEMISSILE:
- other.movetype = MOVETYPE_BOUNCE;
- other.gravity = 1;
+ toucher.movetype = MOVETYPE_BOUNCE;
+ toucher.gravity = 1;
break;
}
- UpdateCSQCProjectile(other);
+ UpdateCSQCProjectile(toucher);
}
- /*if (other.flags & FL_ITEM)
+ /*if (toucher.flags & FL_ITEM)
{
- ItemUpdate(other);
- other.SendFlags |= ISF_DROP;
+ ItemUpdate(toucher);
+ toucher.SendFlags |= ISF_DROP;
}*/
if (this.spawnflags & PUSH_ONCE)
vector trigger_push_calculatevelocity(vector org, entity tgt, float ht);
-void trigger_push_touch(entity this);
+void trigger_push_touch(entity this, entity toucher);
.vector dest;
void trigger_push_findtarget(entity this);
remove(t);
}
-void trigger_keylock_touch(entity this)
+void trigger_keylock_touch(entity this, entity toucher)
{
bool key_used = false;
bool started_delay = false;
// only player may trigger the lock
- if(!IS_PLAYER(other))
+ if(!IS_PLAYER(toucher))
return;
// check silver key
if(this.itemkeys)
- key_used = item_keys_usekey(this, other);
+ key_used = item_keys_usekey(this, toucher);
if(this.itemkeys)
{
if(key_used)
{
// one or more keys were given, but others are still missing!
- play2(other, this.noise1);
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(this.itemkeys));
- other.key_door_messagetime = time + 2;
+ play2(toucher, this.noise1);
+ Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(this.itemkeys));
+ toucher.key_door_messagetime = time + 2;
}
- else if(other.key_door_messagetime <= time)
+ else if(toucher.key_door_messagetime <= time)
{
// no keys were given
- play2(other, this.noise2);
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(this.itemkeys));
- other.key_door_messagetime = time + 2;
+ play2(toucher, this.noise2);
+ Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(this.itemkeys));
+ toucher.key_door_messagetime = time + 2;
}
#endif
if(this.delay <= time || started_delay == true)
if(this.target2)
{
- trigger_keylock_trigger(this, other, this.target2);
+ trigger_keylock_trigger(this, toucher, this.target2);
started_delay = true;
this.delay = time + this.wait;
}
{
#ifdef SVQC
// all keys were given!
- play2(other, this.noise);
- centerprint(other, this.message);
+ play2(toucher, this.noise);
+ centerprint(toucher, this.message);
#endif
if(this.target)
- trigger_keylock_trigger(this, other, this.target);
+ trigger_keylock_trigger(this, toucher, this.target);
if(this.killtarget)
trigger_keylock_kill(this.killtarget);
multi_trigger(this);
}
-void multi_touch(entity this)
+void multi_touch(entity this, entity toucher)
{
if(!(this.spawnflags & 2))
- if(!other.iscreature)
+ if(!toucher.iscreature)
return;
if(this.team)
- if(((this.spawnflags & 4) == 0) == (this.team != other.team))
+ if(((this.spawnflags & 4) == 0) == (this.team != toucher.team))
return;
// if the trigger has an angles field, check player's facing direction
if (this.movedir != '0 0 0')
{
- makevectors (other.angles);
+ makevectors (toucher.angles);
if (v_forward * this.movedir < 0)
return; // not facing the right way
}
// if the trigger has pressed keys, check that the player is pressing those keys
if(this.pressedkeys)
- if(IS_PLAYER(other)) // only for players
- if(!(other.pressedkeys & this.pressedkeys))
+ if(IS_PLAYER(toucher)) // only for players
+ if(!(toucher.pressedkeys & this.pressedkeys))
return;
- EXACTTRIGGER_TOUCH;
+ EXACTTRIGGER_TOUCH(this, toucher);
- this.enemy = other;
- this.goalentity = other;
+ this.enemy = toucher;
+ this.goalentity = toucher;
multi_trigger(this);
}
/**
* A secret has been found (maybe :P)
*/
-void trigger_secret_touch(entity this)
+void trigger_secret_touch(entity this, entity toucher)
{
// only a player can trigger this
- if (!IS_PLAYER(other))
+ if (!IS_PLAYER(toucher))
return;
// update secrets found counter
//print(ftos(secret_counter.count), "\n");
// centerprint message (multi_touch() doesn't always call centerprint())
- centerprint(other, this.message);
+ centerprint(toucher, this.message);
this.message = "";
// handle normal trigger features
- multi_touch(this);
+ multi_touch(this, toucher);
remove(this);
}
#ifdef SVQC
spawnfunc(trigger_swamp);
#endif
-void swamp_touch(entity this);
+void swamp_touch(entity this, entity toucher);
void swampslug_think(entity this);
// Or we have exited it very recently.
// Do the damage and renew the timer.
#ifdef SVQC
- Damage (this.owner, this, this, this.dmg, DEATH_SWAMP.m_id, other.origin, '0 0 0');
+ Damage (this.owner, this, this, this.dmg, DEATH_SWAMP.m_id, this.owner.origin, '0 0 0');
#endif
this.nextthink = time + this.swamp_interval;
}
-void swamp_touch(entity this)
+void swamp_touch(entity this, entity toucher)
{
// If whatever thats touching the swamp is not a player
// or if its a dead player, just dont care abt it.
- if(!IS_PLAYER(other) || IS_DEAD(other))
+ if(!IS_PLAYER(toucher) || IS_DEAD(toucher))
return;
- EXACTTRIGGER_TOUCH;
+ EXACTTRIGGER_TOUCH(this, toucher);
// Chech if player alredy got a swampslug.
- if(other.in_swamp != 1)
+ if(toucher.in_swamp != 1)
{
// If not attach one.
- //centerprint(other,"Entering swamp!\n");
- other.swampslug = spawn();
- other.swampslug.health = 2;
- setthink(other.swampslug, swampslug_think);
- other.swampslug.nextthink = time;
- other.swampslug.owner = other;
- other.swampslug.dmg = this.dmg;
- other.swampslug.swamp_interval = this.swamp_interval;
- other.swamp_slowdown = this.swamp_slowdown;
- other.in_swamp = 1;
+ //centerprint(toucher,"Entering swamp!\n");
+ toucher.swampslug = spawn();
+ toucher.swampslug.health = 2;
+ setthink(toucher.swampslug, swampslug_think);
+ toucher.swampslug.nextthink = time;
+ toucher.swampslug.owner = toucher;
+ toucher.swampslug.dmg = this.dmg;
+ toucher.swampslug.swamp_interval = this.swamp_interval;
+ toucher.swamp_slowdown = this.swamp_slowdown;
+ toucher.in_swamp = 1;
return;
}
- //other.in_swamp = 1;
+ //toucher.in_swamp = 1;
//Revitalize players swampslug
- other.swampslug.health = 2;
+ toucher.swampslug.health = 2;
}
REGISTER_NET_LINKED(ENT_CLIENT_SWAMP)
}
#endif
-void Teleport_Touch (entity this)
+void Teleport_Touch(entity this, entity toucher)
{
if (this.active != ACTIVE_ACTIVE)
return;
#ifdef SVQC
- if (!other.teleportable)
+ if (!toucher.teleportable)
return;
- if(other.vehicle)
- if(!other.vehicle.teleportable)
+ if(toucher.vehicle)
+ if(!toucher.vehicle.teleportable)
return;
- if(IS_TURRET(other))
+ if(IS_TURRET(toucher))
return;
#elif defined(CSQC)
- if(!IS_PLAYER(other))
+ if(!IS_PLAYER(toucher))
return;
#endif
- if(IS_DEAD(other))
+ if(IS_DEAD(toucher))
return;
if(this.team)
- if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, other)))
+ if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, toucher)))
return;
- EXACTTRIGGER_TOUCH;
+ EXACTTRIGGER_TOUCH(this, toucher);
#ifdef SVQC
- if(IS_PLAYER(other))
- RemoveGrapplingHook(other);
+ if(IS_PLAYER(toucher))
+ RemoveGrapplingHook(toucher);
#endif
entity e;
- e = Simple_TeleportPlayer(this, other);
+ e = Simple_TeleportPlayer(this, toucher);
#ifdef SVQC
string s = this.target; this.target = string_null;
- SUB_UseTargets(this, other, other); // TODO: should we be using other for trigger too?
+ SUB_UseTargets(this, toucher, toucher); // TODO: should we be using toucher for trigger too?
if (!this.target) this.target = s;
- SUB_UseTargets(e, other, other);
+ SUB_UseTargets(e, toucher, toucher);
#endif
}
remove(this);
}
-void turret_projectile_touch(entity this)
+void turret_projectile_touch(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
turret_projectile_explode(this);
}
spawnfunc(turret_targettrigger);
-void turret_targettrigger_touch(entity this);
+void turret_targettrigger_touch(entity this, entity toucher);
-void turret_targettrigger_touch(entity this)
+void turret_targettrigger_touch(entity this, entity toucher)
{
if (this.cnt > time) return;
FOREACH_ENTITY_STRING_ORDERED(targetname, this.target, {
if (!(it.turret_flags & TUR_FLAG_RECIEVETARGETS)) continue;
if (!it.turret_addtarget) continue;
- it.turret_addtarget(it, other, this);
+ it.turret_addtarget(it, toucher, this);
});
this.cnt = time + 0.5;
}
remove (this);
}
+void walker_rocket_touch(entity this, entity toucher)
+{
+ walker_rocket_explode(this);
+}
+
void walker_rocket_damage(entity this, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
{
this.health = this.health - damage;
rocket.movetype = MOVETYPE_FLY;
rocket.velocity = normalize((v_forward + v_up * 0.5) + (randomvec() * 0.2)) * (autocvar_g_turrets_unit_walker_rocket_speed);
rocket.angles = vectoangles(rocket.velocity);
- settouch(rocket, walker_rocket_explode);
+ settouch(rocket, walker_rocket_touch);
rocket.flags = FL_PROJECTILE;
rocket.solid = SOLID_BBOX;
rocket.max_health = time + 9;
}
}
-void vehicles_projectile_explode(entity this)
+void vehicles_projectile_explode(entity this, entity toucher)
{
- if(this.owner && other != NULL)
+ if(this.owner && toucher != NULL)
{
- if(other == this.owner.vehicle)
+ if(toucher == this.owner.vehicle)
return;
- if(other == this.owner.vehicle.tur_head)
+ if(toucher == this.owner.vehicle.tur_head)
return;
}
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
this.event_damage = func_null;
- RadiusDamage (this, this.realowner, this.shot_dmg, 0, this.shot_radius, this, NULL, this.shot_force, this.totalfrags, other);
+ RadiusDamage (this, this.realowner, this.shot_dmg, 0, this.shot_radius, this, NULL, this.shot_force, this.totalfrags, toucher);
remove (this);
}
+void vehicles_projectile_explode_think(entity this)
+{
+ vehicles_projectile_explode(this, NULL);
+}
+
void vehicles_projectile_explode_use(entity this, entity actor, entity trigger)
{
- vehicles_projectile_explode(this);
+ vehicles_projectile_explode(this, trigger);
}
entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound,
remove(this);
}
+void vehicles_gib_touch(entity this, entity toucher)
+{
+ vehicles_gib_explode(this);
+}
+
void vehicles_gib_think(entity this)
{
this.alpha -= 0.1;
{
setthink(_gib, vehicles_gib_explode);
_gib.nextthink = time + random() * _explode;
- settouch(_gib, vehicles_gib_explode);
+ settouch(_gib, vehicles_gib_touch);
}
else
{
vehicles_exit_running = false;
}
-void vehicles_touch(entity this)
+void vehicles_touch(entity this, entity toucher)
{
- if(MUTATOR_CALLHOOK(VehicleTouch, this, other))
+ if(MUTATOR_CALLHOOK(VehicleTouch, this, toucher))
return;
// Vehicle currently in use
if(this.owner)
{
if(!forbidWeaponUse(this.owner))
- if(other != NULL)
- if((this.origin_z + this.maxs_z) > (other.origin_z))
- if(vehicles_crushable(other))
+ if(toucher != NULL)
+ if((this.origin_z + this.maxs_z) > (toucher.origin_z))
+ if(vehicles_crushable(toucher))
{
if(vdist(this.velocity, >=, 30))
- Damage(other, this, this.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH.m_id, '0 0 0', normalize(other.origin - this.origin) * autocvar_g_vehicles_crush_force);
+ Damage(toucher, this, this.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH.m_id, '0 0 0', normalize(toucher.origin - this.origin) * autocvar_g_vehicles_crush_force);
return; // Dont do selfdamage when hitting "soft targets".
}
if(autocvar_g_vehicles_enter)
return;
- vehicles_enter(other, this);
+ vehicles_enter(toucher, this);
}
bool vehicle_impulse(entity this, int imp)
return true;
}
-void bumblebee_touch(entity this)
+void bumblebee_touch(entity this, entity toucher)
{
if(autocvar_g_vehicles_enter) { return; }
if(this.gunner1 != NULL && this.gunner2 != NULL)
{
- vehicles_touch(this);
+ vehicles_touch(this, toucher);
return;
}
- if(vehicles_valid_pilot(this, other))
+ if(vehicles_valid_pilot(this, toucher))
{
float phase_time = (time >= this.gun1.phase) + (time >= this.gun2.phase);
- if(time >= other.vehicle_enter_delay && phase_time)
- if(bumblebee_gunner_enter(this, other))
+ if(time >= toucher.vehicle_enter_delay && phase_time)
+ if(bumblebee_gunner_enter(this, toucher))
return;
}
- vehicles_touch(this);
+ vehicles_touch(this, toucher);
}
void bumblebee_regen(entity this)
remove(this);
}
+void bumblebee_dead_touch(entity this, entity toucher)
+{
+ bumblebee_blowup(this);
+}
+
void bumblebee_diethink(entity this)
{
if(time >= this.wait)
{
entity e = instance.gunner1;
instance.gun1.vehicle_exit(instance.gun1, VHEF_EJECT);
- entity oldother = other;
- other = e;
instance.phase = 0;
- gettouch(instance)(instance);
- other = oldother;
+ gettouch(instance)(instance, e);
return;
}
{
entity e = instance.gunner2;
instance.gun2.vehicle_exit(instance.gun2, VHEF_EJECT);
- entity oldother = other;
- other = e;
instance.phase = 0;
- gettouch(instance)(instance);
- other = oldother;
+ gettouch(instance)(instance, e);
return;
}
}
entity _body = vehicle_tossgib(instance, instance, instance.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
if(random() > 0.5)
- settouch(_body, bumblebee_blowup);
+ settouch(_body, bumblebee_dead_touch);
else
settouch(_body, func_null);
CSQCMODEL_AUTOUPDATE(this);
}
-void racer_deadtouch(entity this)
+void racer_deadtouch(entity this, entity toucher)
{
this.avelocity_x *= 0.7;
this.cnt -= 1;
PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
}
-void raptor_blowup(entity this)
+void raptor_blowup(entity this, entity toucher)
{
this.deadflag = DEAD_DEAD;
this.vehicle_exit(this, VHEF_NORMAL);
void raptor_diethink(entity this)
{
if(time >= this.wait)
- setthink(this, raptor_blowup);
+ {
+ raptor_blowup(this, NULL);
+ return;
+ }
if(random() < 0.05)
{
void raptor_flare_think(entity this);
void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
-void raptor_flare_touch(entity this);
+void raptor_flare_touch(entity this, entity toucher);
METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
bool isPlayer = IS_PLAYER(actor);
remove(this);
}
-void raptor_bomblet_touch(entity this)
+void raptor_bomblet_touch(entity this, entity toucher)
{
- if(other == this.owner)
+ if(toucher == this.owner)
return;
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
setthink(this, raptor_bomblet_boom);
this.nextthink = time + random() * autocvar_g_vehicle_raptor_bomblet_explode_delay;
}
remove(this);
}
+void raptor_bomb_touch(entity this, entity toucher)
+{
+ raptor_bomb_burst(this);
+}
+
void raptor_bombdrop(entity this)
{
entity bomb_1, bomb_2;
bomb_1.movetype = bomb_2.movetype = MOVETYPE_BOUNCE;
bomb_1.velocity = bomb_2.velocity = this.velocity;
- settouch(bomb_1, raptor_bomb_burst);
- settouch(bomb_2, raptor_bomb_burst);
+ settouch(bomb_1, raptor_bomb_touch);
+ settouch(bomb_2, raptor_bomb_touch);
setthink(bomb_1, raptor_bomb_burst);
setthink(bomb_2, raptor_bomb_burst);
bomb_1.cnt = bomb_2.cnt = time + 10;
CSQCProjectile(bomb_2, true, PROJECTILE_RAPTORBOMB, true);
}
-void raptor_flare_touch(entity this)
+void raptor_flare_touch(entity this, entity toucher)
{
remove(this);
}
float _dist = (random() * autocvar_g_vehicle_spiderbot_rocket_radius) + vlen(v - trace_endpos);
_dist -= (random() * autocvar_g_vehicle_spiderbot_rocket_radius) ;
rocket.nextthink = time + (_dist / autocvar_g_vehicle_spiderbot_rocket_speed);
- setthink(rocket, vehicles_projectile_explode);
+ setthink(rocket, vehicles_projectile_explode_think);
if(PHYS_INPUT_BUTTON_ATCK2(this.owner) && this.tur_head.frame == 1)
this.wait = -10;
W_PrepareExplosionByDamage(this, attacker, getthink(this));
}
-void W_Arc_Bolt_Touch(entity this)
+void W_Arc_Bolt_Touch(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
- this.use(this, NULL, NULL);
+ PROJECTILE_TOUCH(this, toucher);
+ WITH(entity, other, toucher, this.use(this, NULL, NULL));
}
void W_Arc_Attack_Bolt(Weapon thiswep, entity actor)
spawnfunc(weapon_blaster) { weapon_defaultspawnfunc(this, WEP_BLASTER); }
spawnfunc(weapon_laser) { spawnfunc_weapon_blaster(this); }
-void W_Blaster_Touch(entity this)
+void W_Blaster_Touch(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
this.event_damage = func_null;
NULL,
this.blaster_force,
this.projectiledeathtype,
- other
+ toucher
);
remove(this);
}
// NO bounce protection, as bounces are limited!
-void W_Crylink_Touch(entity this)
+void W_Crylink_Touch(entity this, entity toucher)
{
float finalhit;
float f;
float isprimary = !(this.projectiledeathtype & HITTYPE_SECONDARY);
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
float a;
a = bound(0, 1 - (time - this.fade_time) * this.fade_rate, 1);
- finalhit = ((this.cnt <= 0) || (other.takedamage != DAMAGE_NO));
+ finalhit = ((this.cnt <= 0) || (toucher.takedamage != DAMAGE_NO));
if(finalhit)
f = 1;
else
if(a)
f *= a;
- float totaldamage = RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * f, this.projectiledeathtype, other);
+ float totaldamage = RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * f, this.projectiledeathtype, toucher);
if(totaldamage && ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 2) || ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 1) && !W_Crylink_Touch_WouldHitFriendly(this, WEP_CVAR_BOTH(crylink, isprimary, radius)))))
{
if(this == this.realowner.crylink_lastgroup)
this.realowner.crylink_lastgroup = NULL;
- W_Crylink_LinkExplode(this.queuenext, this);
+ WITH(entity, other, toucher, W_Crylink_LinkExplode(this.queuenext, this));
this.classname = "spike_oktoremove";
remove(this);
return;
UpdateCSQCProjectile(this);
}
-void W_Devastator_Touch(entity this)
+void W_Devastator_Touch(entity this, entity toucher)
{
- if(WarpZone_Projectile_Touch(this))
+ if(WarpZone_Projectile_Touch(this, toucher))
{
if(wasfreed(this))
W_Devastator_Unregister(this);
return;
}
W_Devastator_Unregister(this);
- W_Devastator_Explode(this);
+ WITH(entity, other, toucher, W_Devastator_Explode(this));
}
void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
W_Electro_Explode(this);
}
-void W_Electro_TouchExplode(entity this)
+void W_Electro_TouchExplode(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
- W_Electro_Explode(this);
+ PROJECTILE_TOUCH(this, toucher);
+ WITH(entity, other, toucher, W_Electro_Explode(this));
}
void W_Electro_Bolt_Think(entity this)
MUTATOR_CALLHOOK(EditProjectile, actor, proj);
}
-void W_Electro_Orb_Touch(entity this)
+void W_Electro_Orb_Touch(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
- if(other.takedamage == DAMAGE_AIM)
- { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(this); } }
+ PROJECTILE_TOUCH(this, toucher);
+ if(toucher.takedamage == DAMAGE_AIM)
+ { if(WEP_CVAR_SEC(electro, touchexplode)) { WITH(entity, other, toucher, W_Electro_Explode(this)); } }
else
{
//UpdateCSQCProjectile(this);
W_Fireball_Explode(this);
}
-void W_Fireball_TouchExplode(entity this)
+void W_Fireball_TouchExplode(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
- W_Fireball_Explode(this);
+ PROJECTILE_TOUCH(this, toucher);
+ WITH(entity, other, toucher, W_Fireball_Explode(this));
}
void W_Fireball_LaserPlay(entity this, float dt, float dist, float damage, float edgedamage, float burntime)
this.nextthink = time + 0.1;
}
-void W_Fireball_Firemine_Touch(entity this)
+void W_Fireball_Firemine_Touch(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
- if(other.takedamage == DAMAGE_AIM)
- if(Fire_AddDamage(other, this.realowner, WEP_CVAR_SEC(fireball, damage), WEP_CVAR_SEC(fireball, damagetime), this.projectiledeathtype) >= 0)
+ PROJECTILE_TOUCH(this, toucher);
+ if(toucher.takedamage == DAMAGE_AIM)
+ if(Fire_AddDamage(toucher, this.realowner, WEP_CVAR_SEC(fireball, damage), WEP_CVAR_SEC(fireball, damagetime), this.projectiledeathtype) >= 0)
{
remove(this);
return;
W_PrepareExplosionByDamage(this, attacker, getthink(this));
}
-void W_Hagar_Touch(entity this)
+void W_Hagar_Touch(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
- this.use(this, NULL, NULL);
+ PROJECTILE_TOUCH(this, toucher);
+ WITH(entity, other, toucher, this.use(this, NULL, NULL));
}
-void W_Hagar_Touch2(entity this)
+void W_Hagar_Touch2(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
- if(this.cnt > 0 || other.takedamage == DAMAGE_AIM) {
- this.use(this, NULL, NULL);
+ if(this.cnt > 0 || toucher.takedamage == DAMAGE_AIM) {
+ WITH(entity, other, toucher, this.use(this, NULL, NULL));
} else {
this.cnt++;
Send_Effect(EFFECT_HAGAR_BOUNCE, this.origin, this.velocity, 1);
#ifdef SVQC
spawnfunc(weapon_hlac) { weapon_defaultspawnfunc(this, WEP_HLAC); }
-void W_HLAC_Touch(entity this)
+void W_HLAC_Touch(entity this, entity toucher)
{
float isprimary;
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
this.event_damage = func_null;
isprimary = !(this.projectiledeathtype & HITTYPE_SECONDARY);
- RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(hlac, isprimary, damage), WEP_CVAR_BOTH(hlac, isprimary, edgedamage), WEP_CVAR_BOTH(hlac, isprimary, radius), NULL, NULL, WEP_CVAR_BOTH(hlac, isprimary, force), this.projectiledeathtype, other);
+ RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(hlac, isprimary, damage), WEP_CVAR_BOTH(hlac, isprimary, edgedamage), WEP_CVAR_BOTH(hlac, isprimary, radius), NULL, NULL, WEP_CVAR_BOTH(hlac, isprimary, force), this.projectiledeathtype, toucher);
remove(this);
}
W_PrepareExplosionByDamage(this, this.realowner, W_Hook_Explode2);
}
-void W_Hook_Touch2(entity this)
+void W_Hook_Touch2(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
this.use(this, NULL, NULL);
}
W_MineLayer_RemoteExplode(this);
}
-void W_MineLayer_Touch(entity this)
+void W_MineLayer_Touch(entity this, entity toucher)
{
if(this.movetype == MOVETYPE_NONE || this.movetype == MOVETYPE_FOLLOW)
return; // we're already a stuck mine, why do we get called? TODO does this even happen?
- if(WarpZone_Projectile_Touch(this))
+ if(WarpZone_Projectile_Touch(this, toucher))
{
if(wasfreed(this))
this.realowner.minelayer_mines -= 1;
return;
}
- if(other && IS_PLAYER(other) && !IS_DEAD(other))
+ if(toucher && IS_PLAYER(toucher) && !IS_DEAD(toucher))
{
// hit a player
// don't stick
}
else
{
- W_MineLayer_Stick(this, other);
+ W_MineLayer_Stick(this, toucher);
}
}
W_Mortar_Grenade_Explode(this);
}
-void W_Mortar_Grenade_Touch1(entity this)
+void W_Mortar_Grenade_Touch1(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
- if(other.takedamage == DAMAGE_AIM || WEP_CVAR_PRI(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
+ PROJECTILE_TOUCH(this, toucher);
+ if(toucher.takedamage == DAMAGE_AIM || WEP_CVAR_PRI(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
{
- this.use(this, NULL, NULL);
+ WITH(entity, other, toucher, this.use(this, NULL, NULL));
}
else if(WEP_CVAR_PRI(mortar, type) == 1) // bounce
{
this.projectiledeathtype |= HITTYPE_BOUNCE;
this.gl_bouncecnt += 1;
}
- else if(WEP_CVAR_PRI(mortar, type) == 2 && (!other || (other.takedamage != DAMAGE_AIM && other.movetype == MOVETYPE_NONE))) // stick
+ else if(WEP_CVAR_PRI(mortar, type) == 2 && (!toucher || (toucher.takedamage != DAMAGE_AIM && toucher.movetype == MOVETYPE_NONE))) // stick
{
spamsound(this, CH_SHOTS, SND(GRENADE_STICK), VOL_BASE, ATTN_NORM);
}
}
-void W_Mortar_Grenade_Touch2(entity this)
+void W_Mortar_Grenade_Touch2(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
- if(other.takedamage == DAMAGE_AIM || WEP_CVAR_SEC(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
+ PROJECTILE_TOUCH(this, toucher);
+ if(toucher.takedamage == DAMAGE_AIM || WEP_CVAR_SEC(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
{
- this.use(this, NULL, NULL);
+ WITH(entity, other, toucher, this.use(this, NULL, NULL));
}
else if(WEP_CVAR_SEC(mortar, type) == 1) // bounce
{
this.nextthink = time + WEP_CVAR_SEC(mortar, lifetime_bounce);
}
- else if(WEP_CVAR_SEC(mortar, type) == 2 && (!other || (other.takedamage != DAMAGE_AIM && other.movetype == MOVETYPE_NONE))) // stick
+ else if(WEP_CVAR_SEC(mortar, type) == 2 && (!toucher || (toucher.takedamage != DAMAGE_AIM && toucher.movetype == MOVETYPE_NONE))) // stick
{
spamsound(this, CH_SHOTS, SND(GRENADE_STICK), VOL_BASE, ATTN_NORM);
W_Porto_Fail(this, 0);
}
-void W_Porto_Touch(entity this)
+void W_Porto_Touch(entity this, entity toucher)
{
vector norm;
// do not use PROJECTILE_TOUCH here
// FIXME but DO handle warpzones!
- if(other.classname == "portal")
+ if(toucher.classname == "portal")
return; // handled by the portal
norm = trace_plane_normal;
remove(this);
}
-void W_Seeker_Missile_Touch(entity this)
+void W_Seeker_Missile_Touch(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
- W_Seeker_Missile_Explode(this);
+ // TODO
+ WITH(entity, other, toucher, W_Seeker_Missile_Explode(this));
}
void W_Seeker_Missile_Think(entity this)
remove(this);
}
+void W_Seeker_Flac_Touch(entity this, entity toucher)
+{
+ WITH(entity, other, toucher, W_Seeker_Flac_Explode(this));
+}
+
void W_Seeker_Flac_Explode_use(entity this, entity actor, entity trigger)
{
- W_Seeker_Flac_Explode(this);
+ WITH(entity, other, trigger, W_Seeker_Flac_Explode(this));
}
void W_Seeker_Fire_Flac(Weapon thiswep, entity actor)
missile.owner = missile.realowner = actor;
missile.bot_dodge = true;
missile.bot_dodgerating = WEP_CVAR(seeker, flac_damage);
- settouch(missile, W_Seeker_Flac_Explode);
+ settouch(missile, W_Seeker_Flac_Touch);
missile.use = W_Seeker_Flac_Explode_use;
setthink(missile, adaptor_think2use_hittype_splash);
missile.nextthink = time + WEP_CVAR(seeker, flac_lifetime) + WEP_CVAR(seeker, flac_lifetime_rand);
W_Seeker_Tag_Explode(this);
}
-void W_Seeker_Tag_Touch(entity this)
+void W_Seeker_Tag_Touch(entity this, entity toucher)
{
vector dir;
vector org2;
entity e;
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
dir = normalize(this.realowner.origin - this.origin);
org2 = findbetterlocation(this.origin, 8);
te_knightspike(org2);
this.event_damage = func_null;
- Damage_DamageInfo(this.origin, 0, 0, 0, this.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE | HITTYPE_SECONDARY, other.species, this);
+ Damage_DamageInfo(this.origin, 0, 0, 0, this.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE | HITTYPE_SECONDARY, toucher.species, this);
- if(other.takedamage == DAMAGE_AIM && !IS_DEAD(other))
+ if(toucher.takedamage == DAMAGE_AIM && !IS_DEAD(toucher))
{
// check to see if this person is already tagged by me
- entity tag = W_Seeker_Tagged_Info(this.realowner, other);
+ entity tag = W_Seeker_Tagged_Info(this.realowner, toucher);
if(tag != NULL)
{
- if(other.wps_tag_tracker && (WEP_CVAR(seeker, type) == 1)) // don't attach another waypointsprite without killing the old one first
- WaypointSprite_Kill(other.wps_tag_tracker);
+ if(toucher.wps_tag_tracker && (WEP_CVAR(seeker, type) == 1)) // don't attach another waypointsprite without killing the old one first
+ WaypointSprite_Kill(toucher.wps_tag_tracker);
tag.tag_time = time;
}
else
{
- //sprint(this.realowner, strcat("You just tagged ^2", other.netname, "^7 with a tracking device!\n"));
+ //sprint(this.realowner, strcat("You just tagged ^2", toucher.netname, "^7 with a tracking device!\n"));
e = new(tag_tracker);
e.cnt = WEP_CVAR(seeker, missile_count);
e.owner = this.owner;
if(WEP_CVAR(seeker, type) == 1)
{
- e.tag_target = other;
+ e.tag_target = toucher;
e.tag_time = time;
setthink(e, W_Seeker_Tracker_Think);
}
else
{
- e.enemy = other;
+ e.enemy = toucher;
setthink(e, W_Seeker_Vollycontroller_Think);
}
if(WEP_CVAR(seeker, type) == 1)
{
- WaypointSprite_Spawn(WP_Seeker, WEP_CVAR(seeker, tag_tracker_lifetime), 0, other, '0 0 64', this.realowner, 0, other, wps_tag_tracker, true, RADARICON_TAGGED);
- WaypointSprite_UpdateRule(other.wps_tag_tracker, 0, SPRITERULE_DEFAULT);
+ WaypointSprite_Spawn(WP_Seeker, WEP_CVAR(seeker, tag_tracker_lifetime), 0, toucher, '0 0 64', this.realowner, 0, toucher, wps_tag_tracker, true, RADARICON_TAGGED);
+ WaypointSprite_UpdateRule(toucher.wps_tag_tracker, 0, SPRITERULE_DEFAULT);
}
}
W_RocketMinsta_Laser_Explode(this);
}
-void W_RocketMinsta_Laser_Touch (entity this)
+void W_RocketMinsta_Laser_Touch(entity this, entity toucher)
{
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
//W_RocketMinsta_Laser_Explode ();
- RadiusDamage (this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, other);
+ RadiusDamage(this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, toucher);
remove(this);
}
#define setthink(e, f) SELFWRAP_SET(think, e, f)
#define getthink(e) SELFWRAP_GET(think, e)
-SELFWRAP(touch, void, (), (entity this), (this))
+#ifndef MENUQC
+SELFWRAP(touch, void, (), (entity this, entity toucher), (this, other))
#define settouch(e, f) SELFWRAP_SET(touch, e, f)
#define gettouch(e) SELFWRAP_GET(touch, e)
+#endif
SELFWRAP(blocked, void, (), (entity this), (this))
#define setblocked(e, f) SELFWRAP_SET(blocked, e, f)
this.drawmask = MASK_NORMAL;
}
-void WarpZone_Touch (entity this);
+void WarpZone_Touch(entity this, entity toucher);
NET_HANDLE(ENT_CLIENT_WARPZONE, bool isnew)
{
warpzone_warpzones_exist = 1;
void WarpZoneLib_ExactTrigger_Init(entity this);
// WARNING: this kills the trace globals
-#define EXACTTRIGGER_TOUCH if(WarpZoneLib_ExactTrigger_Touch(this, other)) return
+#define EXACTTRIGGER_TOUCH(e,t) if(WarpZoneLib_ExactTrigger_Touch((e), (t))) return
#define EXACTTRIGGER_INIT WarpZoneLib_ExactTrigger_Init(this)
#endif
return 1;
}
-void WarpZone_Touch (entity this)
+void WarpZone_Touch(entity this, entity toucher)
{
- if(other.classname == "trigger_warpzone")
+ if(toucher.classname == "trigger_warpzone")
return;
- if(time <= other.warpzone_teleport_finishtime) // already teleported this frame
+ if(time <= toucher.warpzone_teleport_finishtime) // already teleported this frame
return;
// FIXME needs a better check to know what is safe to teleport and what not
#ifdef SVQC
- if(other.movetype == MOVETYPE_NONE || other.movetype == MOVETYPE_FOLLOW || other.tag_entity)
+ if(toucher.movetype == MOVETYPE_NONE || toucher.movetype == MOVETYPE_FOLLOW || toucher.tag_entity)
#elif defined(CSQC)
- if(other.move_movetype == MOVETYPE_NONE || other.move_movetype == MOVETYPE_FOLLOW || other.tag_networkentity)
+ if(toucher.move_movetype == MOVETYPE_NONE || toucher.move_movetype == MOVETYPE_FOLLOW || toucher.tag_networkentity)
#endif
return;
- if(WarpZoneLib_ExactTrigger_Touch(this, other))
+ if(WarpZoneLib_ExactTrigger_Touch(this, toucher))
return;
#ifdef SVQC
- if(WarpZone_PlaneDist(this, other.origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
+ if(WarpZone_PlaneDist(this, toucher.origin + toucher.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
#elif defined(CSQC)
- if(WarpZone_PlaneDist(this, other.move_origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
+ if(WarpZone_PlaneDist(this, toucher.move_origin + toucher.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
#endif
return;
// 24/(0.25/frametime)
// 96*frametime
float d;
- d = 24 + max(vlen(other.mins), vlen(other.maxs));
- if(IS_NOT_A_CLIENT(other))
+ d = 24 + max(vlen(toucher.mins), vlen(toucher.maxs));
+ if(IS_NOT_A_CLIENT(toucher))
#ifdef SVQC
- f = -d / bound(frametime * d * 1, frametime * vlen(other.velocity), d);
+ f = -d / bound(frametime * d * 1, frametime * vlen(toucher.velocity), d);
#elif defined(CSQC)
- f = -d / bound(frametime * d * 1, frametime * vlen(other.move_velocity), d);
+ f = -d / bound(frametime * d * 1, frametime * vlen(toucher.move_velocity), d);
#endif
else
f = -1;
- if(WarpZone_Teleport(this, other, f, 0))
+ if(WarpZone_Teleport(this, toucher, f, 0))
{
#ifdef SVQC
string save1, save2;
save1 = this.target; this.target = string_null;
save2 = this.target3; this.target3 = string_null;
- SUB_UseTargets(this, other, other); // use other too?
+ SUB_UseTargets(this, toucher, toucher); // use toucher too?
if (!this.target) this.target = save1;
if (!this.target3) this.target3 = save2;
save1 = this.target; this.target = string_null;
save2 = this.target2; this.target2 = string_null;
- SUB_UseTargets(this.enemy, other, other); // use other too?
+ SUB_UseTargets(this.enemy, toucher, toucher); // use toucher too?
if (!this.target) this.target = save1;
if (!this.target2) this.target2 = save2;
#endif
#endif
#endif
-float WarpZone_Projectile_Touch(entity this)
+float WarpZone_Projectile_Touch(entity this, entity toucher)
{
- if(other.classname == "trigger_warpzone")
+ if(toucher.classname == "trigger_warpzone")
return true;
// no further impacts if we teleported this frame!
}
#endif
- if(WarpZone_Projectile_Touch_ImpactFilter_Callback(this, other))
+ if(WarpZone_Projectile_Touch_ImpactFilter_Callback(this, toucher))
return true;
#endif
WarpZone_PostInitialize_Callback();
}
- entity oldother = other;
-
FOREACH_ENTITY(!is_pure(it),
{
if(warpzone_warpzones_exist)
if(IS_OBSERVER(it) || it.solid == SOLID_NOT)
if(IS_CLIENT(it)) // we don't care about it being a bot
{
- other = it; // player
-
// warpzones
if (warpzone_warpzones_exist) {
entity e = WarpZone_Find(it.origin + it.mins, it.origin + it.maxs);
if (e)
- if (!WarpZoneLib_ExactTrigger_Touch(e, other))
+ if (!WarpZoneLib_ExactTrigger_Touch(e, it))
if (WarpZone_PlaneDist(e, it.origin + it.view_ofs) <= 0)
WarpZone_Teleport(e, it, -1, 0); // NOT triggering targets by this!
}
// teleporters
- if(other.teleportable)
+ if(it.teleportable)
{
entity ent = Teleport_Find(it.origin + it.mins, it.origin + it.maxs);
if (ent)
- if (!WarpZoneLib_ExactTrigger_Touch(ent, other))
- Simple_TeleportPlayer(ent, other); // NOT triggering targets by this!
+ if (!WarpZoneLib_ExactTrigger_Touch(ent, it))
+ Simple_TeleportPlayer(ent, it); // NOT triggering targets by this!
}
}
});
- other = oldother;
}
.float warpzone_reconnecting;
#ifdef SVQC
void WarpZone_StartFrame();
-float WarpZone_Projectile_Touch(entity this);
+float WarpZone_Projectile_Touch(entity this, entity toucher);
// THESE must be defined by calling QC code:
void WarpZone_PostTeleportPlayer_Callback(entity pl);
}
}
-void GrapplingHookTouch (entity this)
+void GrapplingHookTouch(entity this, entity toucher)
{
- if(other.movetype == MOVETYPE_FOLLOW)
+ if(toucher.movetype == MOVETYPE_FOLLOW)
return;
- PROJECTILE_TOUCH(this);
+ PROJECTILE_TOUCH(this, toucher);
GrapplingHook_Stop(this);
- if(other)
- if(other.movetype != MOVETYPE_NONE)
+ if(toucher)
+ if(toucher.movetype != MOVETYPE_NONE)
{
- SetMovetypeFollow(this, other);
+ SetMovetypeFollow(this, toucher);
WarpZone_RefSys_BeginAddingIncrementally(this, this.aiment);
}
/**
* Key touch handler.
*/
-void item_key_touch(entity this)
+void item_key_touch(entity this, entity toucher)
{
- if (!IS_PLAYER(other))
+ if (!IS_PLAYER(toucher))
return;
// player already picked up this key
- if (other.itemkeys & this.itemkeys)
+ if (toucher.itemkeys & this.itemkeys)
return;
- other.itemkeys |= this.itemkeys;
- play2(other, this.noise);
+ toucher.itemkeys |= this.itemkeys;
+ play2(toucher, this.noise);
- centerprint(other, this.message);
+ centerprint(toucher, this.message);
string oldmsg = this.message;
this.message = "";
- SUB_UseTargets(this, other, other); // TODO: should we be using other for the trigger here?
+ SUB_UseTargets(this, toucher, toucher); // TODO: should we be using toucher for the trigger here?
this.message = oldmsg;
};
#define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER.m_id) || ((dt) == DEATH_SLIME.m_id) || ((dt) == DEATH_LAVA.m_id) || ((dt) == DEATH_SWAMP.m_id))
-#define PROJECTILE_TOUCH(this) MACRO_BEGIN if (WarpZone_Projectile_Touch(this)) return; MACRO_END
+#define PROJECTILE_TOUCH(e,t) MACRO_BEGIN if (WarpZone_Projectile_Touch(e,t)) return; MACRO_END
#define CENTER_OR_VIEWOFS(ent) (ent.origin + (IS_PLAYER(ent) ? ent.view_ofs : ((ent.mins + ent.maxs) * 0.5)))
return true;
}
-void ctf_CaptureShield_Touch(entity this)
+void ctf_CaptureShield_Touch(entity this, entity toucher)
{
- if(!other.ctf_captureshielded) { return; }
- if(CTF_SAMETEAM(this, other)) { return; }
+ if(!toucher.ctf_captureshielded) { return; }
+ if(CTF_SAMETEAM(this, toucher)) { return; }
vector mymid = (this.absmin + this.absmax) * 0.5;
- vector othermid = (other.absmin + other.absmax) * 0.5;
+ vector theirmid = (toucher.absmin + toucher.absmax) * 0.5;
- Damage(other, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(othermid - mymid) * ctf_captureshield_force);
- if(IS_REAL_CLIENT(other)) { Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_CTF_CAPTURESHIELD_SHIELDED); }
+ Damage(toucher, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(theirmid - mymid) * ctf_captureshield_force);
+ if(IS_REAL_CLIENT(toucher)) { Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_CTF_CAPTURESHIELD_SHIELDED); }
}
void ctf_CaptureShield_Spawn(entity flag)
ATTRIB(Flag, m_maxs, vector, PL_MAX_CONST + '0 0 -13')
ENDCLASS(Flag)
Flag CTF_FLAG; STATIC_INIT(Flag) { CTF_FLAG = NEW(Flag); }
-void ctf_FlagTouch(entity this) { ITEM_HANDLE(Pickup, CTF_FLAG, this, other); }
+void ctf_FlagTouch(entity this, entity toucher) { ITEM_HANDLE(Pickup, CTF_FLAG, this, toucher); }
// flag constants // for most of these, there is just one question to be asked: WHYYYYY?
}
}
-void dompointtouch(entity this)
+void dompointtouch(entity this, entity toucher)
{
- if (!IS_PLAYER(other))
+ if (!IS_PLAYER(toucher))
return;
- if (other.health < 1)
+ if (toucher.health < 1)
return;
if(round_handler_IsActive() && !round_handler_IsRoundStarted())
// only valid teams can claim it
entity head = find(NULL, classname, "dom_team");
- while (head && head.team != other.team)
+ while (head && head.team != toucher.team)
head = find(head, classname, "dom_team");
if (!head || head.netname == "" || head == this.goalentity)
return;
this.team = this.goalentity.team; // this stores the PREVIOUS team!
- this.cnt = other.team;
+ this.cnt = toucher.team;
this.owner = head; // team to switch to after the delay
- this.dmg_inflictor = other;
+ this.dmg_inflictor = toucher;
// this.state = 1;
// this.delay = time + cvar("g_domination_point_capturetime");
this.modelindex = head.dmg;
this.skin = head.skin;
- this.enemy = other; // individual player scoring
- this.enemy_playerid = other.playerid;
+ this.enemy = toucher; // individual player scoring
+ this.enemy_playerid = toucher.playerid;
dompoint_captured(this);
}
GameLogEcho(strcat(":ka:", mode, ((actor != NULL) ? (strcat(":", ftos(actor.playerid))) : "")));
}
-void ka_TouchEvent(entity this);
+void ka_TouchEvent(entity this, entity toucher);
void ka_RespawnBall(entity this);
void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated
{
}
}
-void ka_TouchEvent(entity this) // runs any time that the ball comes in contact with something
+void ka_TouchEvent(entity this, entity toucher) // runs any time that the ball comes in contact with something
{
if(gameover) { return; }
if(!this) { return; }
ka_RespawnBall(this);
return;
}
- if(IS_DEAD(other)) { return; }
- if(STAT(FROZEN, other)) { return; }
- if (!IS_PLAYER(other))
+ if(IS_DEAD(toucher)) { return; }
+ if(STAT(FROZEN, toucher)) { return; }
+ if (!IS_PLAYER(toucher))
{ // The ball just touched an object, most likely the world
Send_Effect(EFFECT_BALL_SPARKS, this.origin, '0 0 0', 1);
sound(this, CH_TRIGGER, SND_KA_TOUCH, VOL_BASE, ATTEN_NORM);
else if(this.wait > time) { return; }
// attach the ball to the player
- this.owner = other;
- other.ballcarried = this;
- setattachment(this, other, "");
+ this.owner = toucher;
+ toucher.ballcarried = this;
+ setattachment(this, toucher, "");
setorigin(this, '0 0 0');
// make the ball invisible/unable to do anything/set up time scoring
this.takedamage = DAMAGE_NO;
// apply effects to player
- other.glow_color = autocvar_g_keepawayball_trail_color;
- other.glow_trail = true;
- other.effects |= autocvar_g_keepaway_ballcarrier_effects;
+ toucher.glow_color = autocvar_g_keepawayball_trail_color;
+ toucher.glow_trail = true;
+ toucher.effects |= autocvar_g_keepaway_ballcarrier_effects;
// messages and sounds
- ka_EventLog("pickup", other);
- Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_KEEPAWAY_PICKUP, other.netname);
- Send_Notification(NOTIF_ALL_EXCEPT, other, MSG_CENTER, CENTER_KEEPAWAY_PICKUP, other.netname);
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_KEEPAWAY_PICKUP_SELF);
+ ka_EventLog("pickup", toucher);
+ Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_KEEPAWAY_PICKUP, toucher.netname);
+ Send_Notification(NOTIF_ALL_EXCEPT, toucher, MSG_CENTER, CENTER_KEEPAWAY_PICKUP, toucher.netname);
+ Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_KEEPAWAY_PICKUP_SELF);
sound(this.owner, CH_TRIGGER, SND_KA_PICKEDUP, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
// scoring
- PlayerScore_Add(other, SP_KEEPAWAY_PICKUPS, 1);
+ PlayerScore_Add(toucher, SP_KEEPAWAY_PICKUPS, 1);
// waypoints
- WaypointSprite_AttachCarrier(WP_KaBallCarrier, other, RADARICON_FLAGCARRIER);
- other.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = ka_ballcarrier_waypointsprite_visible_for_player;
- WaypointSprite_UpdateRule(other.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
- WaypointSprite_Ping(other.waypointsprite_attachedforcarrier);
+ WaypointSprite_AttachCarrier(WP_KaBallCarrier, toucher, RADARICON_FLAGCARRIER);
+ toucher.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = ka_ballcarrier_waypointsprite_visible_for_player;
+ WaypointSprite_UpdateRule(toucher.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
+ WaypointSprite_Ping(toucher.waypointsprite_attachedforcarrier);
WaypointSprite_Kill(this.waypointsprite_attachedforcarrier);
}
kh_Key_AssignTo(key, player); // this also updates .kh_state
}
-void kh_Key_Touch(entity this) // runs many, many times when a key has been dropped and can be picked up
+void kh_Key_Touch(entity this, entity toucher) // runs many, many times when a key has been dropped and can be picked up
{
if(intermission_running)
return;
// maybe start a shorter countdown?
}
- if (!IS_PLAYER(other))
+ if (!IS_PLAYER(toucher))
return;
- if(IS_DEAD(other))
+ if(IS_DEAD(toucher))
return;
- if(other == this.enemy)
+ if(toucher == this.enemy)
if(time < this.kh_droptime + autocvar_g_balance_keyhunt_delay_collect)
return; // you just dropped it!
- kh_Key_Collect(this, other);
+ kh_Key_Collect(this, toucher);
}
void kh_Key_Remove(entity key) // runs after when all the keys have been collected or when a key has been dropped for more than X seconds
#endif
}
-void Portal_Touch(entity this)
+void Portal_Touch(entity this, entity toucher)
{
vector g;
if(this.solid != SOLID_TRIGGER)
return; // possibly engine bug
- if(IS_PLAYER(other))
+ if(IS_PLAYER(toucher))
return; // handled by think
#endif
- if(other.classname == "item_flag_team")
+ if(toucher.classname == "item_flag_team")
return; // never portal these
- if(other.classname == "grapplinghook")
+ if(toucher.classname == "grapplinghook")
return; // handled by think
if(!autocvar_g_vehicles_teleportable)
- if(IS_VEHICLE(other))
+ if(IS_VEHICLE(toucher))
return; // no teleporting vehicles?
if(!this.enemy)
return; // only handle impacts
#endif
- if(other.classname == "porto")
+ if(toucher.classname == "porto")
{
- if(other.portal_id == this.portal_id)
+ if(toucher.portal_id == this.portal_id)
return;
}
if(time < this.portal_activatetime)
- if(other == this.aiment)
+ if(toucher == this.aiment)
{
this.portal_activatetime = time + 0.1;
return;
}
- if(other != this.aiment)
- if(IS_PLAYER(other))
- if(IS_INDEPENDENT_PLAYER(other) || IS_INDEPENDENT_PLAYER(this.aiment))
+ if(toucher != this.aiment)
+ if(IS_PLAYER(toucher))
+ if(IS_INDEPENDENT_PLAYER(toucher) || IS_INDEPENDENT_PLAYER(this.aiment))
return; // cannot go through someone else's portal
- if(other.aiment != this.aiment)
- if(IS_PLAYER(other.aiment))
- if(IS_INDEPENDENT_PLAYER(other.aiment) || IS_INDEPENDENT_PLAYER(this.aiment))
+ if(toucher.aiment != this.aiment)
+ if(IS_PLAYER(toucher.aiment))
+ if(IS_INDEPENDENT_PLAYER(toucher.aiment) || IS_INDEPENDENT_PLAYER(this.aiment))
return; // cannot go through someone else's portal
fixedmakevectors(this.mangle);
g = frametime * '0 0 -1' * autocvar_sv_gravity;
- if(!Portal_WillHitPlane(other.origin, other.mins, other.maxs, other.velocity + g, this.origin, v_forward, this.maxs.x))
+ if(!Portal_WillHitPlane(toucher.origin, toucher.mins, toucher.maxs, toucher.velocity + g, this.origin, v_forward, this.maxs.x))
return;
/*
- if(other.mins_x < PL_MIN.x || other.mins_y < PL_MIN.y || other.mins_z < PL_MIN.z
- || other.maxs_x > PL_MAX.x || other.maxs_y > PL_MAX.y || other.maxs_z > PL_MAX.z)
+ if(toucher.mins_x < PL_MIN.x || toucher.mins_y < PL_MIN.y || toucher.mins_z < PL_MIN.z
+ || toucher.maxs_x > PL_MAX.x || toucher.maxs_y > PL_MAX.y || toucher.maxs_z > PL_MAX.z)
{
// can't teleport this
return;
}
*/
- if(Portal_TeleportPlayer(this, other))
- if(other.classname == "porto")
- if(other.effects & EF_RED)
- other.effects += EF_BLUE - EF_RED;
+ if(Portal_TeleportPlayer(this, toucher))
+ if(toucher.classname == "porto")
+ if(toucher.effects & EF_RED)
+ toucher.effects += EF_BLUE - EF_RED;
}
void Portal_Think(entity this);
}
}
-void checkpoint_touch(entity this)
+void checkpoint_touch(entity this, entity toucher)
{
- EXACTTRIGGER_TOUCH;
- checkpoint_passed(this, other);
+ EXACTTRIGGER_TOUCH(this, toucher);
+ checkpoint_passed(this, toucher);
}
void checkpoint_use(entity this, entity actor, entity trigger)
}
}
-void penalty_touch(entity this)
+void penalty_touch(entity this, entity toucher)
{
- EXACTTRIGGER_TOUCH;
- if(other.race_lastpenalty != this)
+ EXACTTRIGGER_TOUCH(this, toucher);
+ if(toucher.race_lastpenalty != this)
{
- other.race_lastpenalty = this;
- race_ImposePenaltyTime(other, this.race_penalty, this.race_penalty_reason);
+ toucher.race_lastpenalty = this;
+ race_ImposePenaltyTime(toucher, this.race_penalty, this.race_penalty_reason);
}
}