if(wasfreed(this))
return;
- if(this.touch == Gib_Touch) // don't do this for the "chunk" thingie...
+ if(gettouch(this) == Gib_Touch) // don't do this for the "chunk" thingie...
// TODO somehow make it spray in a direction dependent on this.angles
__trailparticles(this, _particleeffectnum(strcat(species_prefix(this.cnt), EFFECT_TR_SLIGHTBLOOD.eent_eff_name)), oldorg, this.origin);
else
ball.velocity = '0 0 0';
ball.movetype = MOVETYPE_NONE;
- ball.touch = func_null;
+ settouch(ball, func_null);
ball.effects |= EF_NOSHADOW;
ball.scale = 1; // scale down.
ball.scale = ball_scale;
ball.velocity = vel;
ball.nb_droptime = time;
- ball.touch = basketball_touch;
+ settouch(ball, basketball_touch);
ball.think = ResetBall;
ball.nextthink = min(time + autocvar_g_nexball_delay_idle, ball.teamtime);
UNSET_ONGROUND(this);
this.movetype = MOVETYPE_BOUNCE;
if(this.classname == "nexball_basketball")
- this.touch = basketball_touch;
+ settouch(this, basketball_touch);
else if(this.classname == "nexball_football")
- this.touch = football_touch;
+ settouch(this, football_touch);
this.cnt = 0;
this.think = ResetBall;
this.nextthink = time + autocvar_g_nexball_delay_idle + 3;
if(time == this.teamtime)
bprint("The ", Team_ColoredFullName(this.team), " held the ball for too long.\n");
- this.touch = func_null;
+ settouch(this, func_null);
this.movetype = MOVETYPE_NOCLIP;
this.velocity = '0 0 0'; // just in case?
if(!this.cnt)
ball.cnt = 1;
ball.think = ResetBall;
if(ball.classname == "nexball_basketball")
- ball.touch = football_touch; // better than func_null: football control until the ball gets reset
+ settouch(ball, football_touch); // better than func_null: football control until the ball gets reset
ball.nextthink = time + autocvar_g_nexball_delay_goal * (self.team != GOAL_OUT);
}
if(this.noise == "")
this.noise = "ctf/respawn.wav";
precache_sound(this.noise);
- this.touch = GoalTouch;
+ settouch(this, GoalTouch);
}
spawnfunc(nexball_redgoal)
W_SetupProjVelocity_Basic(missile, autocvar_g_balance_nexball_secondary_speed, 0);
missile.angles = vectoangles(missile.velocity);
- missile.touch = W_Nexball_Touch;
+ settouch(missile, W_Nexball_Touch);
missile.think = SUB_Remove_self;
missile.nextthink = time + autocvar_g_balance_nexball_secondary_lifetime; //FIXME: use a distance instead?
shield.team = generator.team;
shield.colormap = generator.colormap;
shield.reset = ons_CaptureShield_Reset;
- shield.touch = ons_CaptureShield_Touch;
+ settouch(shield, ons_CaptureShield_Touch);
shield.customizeentityforclient = ons_CaptureShield_Customize;
shield.effects = EF_ADDITIVE;
shield.movetype = MOVETYPE_NOCLIP;
cp.team = 0;
cp.solid = SOLID_BBOX;
cp.movetype = MOVETYPE_NONE;
- cp.touch = ons_ControlPoint_Touch;
+ settouch(cp, ons_ControlPoint_Touch);
cp.think = ons_ControlPoint_Think;
cp.nextthink = time + ONS_CP_THINKRATE;
cp.reset = ons_ControlPoint_Reset;
gen.iscaptured = true;
gen.islinked = true;
gen.isshielded = true;
- gen.touch = onslaught_generator_touch;
+ settouch(gen, onslaught_generator_touch);
// appearence
// model handled by CSQC
missile.velocity = dir * 400;
missile.avelocity = '300 300 300';
missile.enemy = this.enemy;
- missile.touch = M_Mage_Attack_Spike_Touch;
+ settouch(missile, M_Mage_Attack_Spike_Touch);
this.mage_spike = missile;
gren.nextthink = time;
gren.think = M_Shambler_Attack_Lightning_Think;
gren.use = M_Shambler_Attack_Lightning_Explode_use;
- gren.touch = M_Shambler_Attack_Lightning_Touch;
+ settouch(gren, M_Shambler_Attack_Lightning_Touch);
gren.takedamage = DAMAGE_YES;
gren.health = 50;
//proj.glow_color = 45;
proj.movetype = MOVETYPE_BOUNCE;
W_SetupProjVelocity_Explicit(proj, v_forward, v_up, (autocvar_g_monster_spider_attack_web_speed), (autocvar_g_monster_spider_attack_web_speed_up), 0, 0, false);
- proj.touch = M_Spider_Attack_Web_Touch;
+ settouch(proj, M_Spider_Attack_Web_Touch);
setsize(proj, '-4 -4 -4', '4 4 4');
proj.takedamage = DAMAGE_NO;
proj.damageforcescale = 0;
missile.avelocity = '300 300 300';
missile.nextthink = time + 5;
missile.think = M_Wyvern_Attack_Fireball_Explode;
- missile.touch = M_Wyvern_Attack_Fireball_Touch;
+ settouch(missile, M_Wyvern_Attack_Fireball_Touch);
CSQCProjectile(missile, true, PROJECTILE_FIREMINE, true);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
angles_face = vectoangles(self.moveto - self.origin);
angles_face = normalize(angles_face) * (autocvar_g_monster_zombie_attack_leap_force);
Damage(other, self, self, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(self), DEATH_MONSTER_ZOMBIE_JUMP.m_id, other.origin, angles_face);
- self.touch = Monster_Touch; // instantly turn it off to stop damage spam
+ settouch(self, Monster_Touch); // instantly turn it off to stop damage spam
self.state = 0;
}
if (trace_dphitcontents)
{
self.state = 0;
- self.touch = Monster_Touch;
+ settouch(self, Monster_Touch);
}
}
if(this.flags & FL_MONSTER)
this.state = MONSTER_ATTACK_RANGED;
- this.touch = touchfunc;
+ settouch(this, touchfunc);
this.origin_z += 1;
this.velocity = vel;
UNSET_ONGROUND(this);
if(this.state == MONSTER_ATTACK_RANGED && IS_ONGROUND(this))
{
this.state = 0;
- this.touch = Monster_Touch;
+ settouch(this, Monster_Touch);
}
if(this.state && time >= this.attack_finished_single[0])
this.enemy = world;
this.movetype = MOVETYPE_TOSS;
this.moveto = this.origin;
- this.touch = Monster_Touch; // reset incase monster was pouncing
+ settouch(this, Monster_Touch); // reset incase monster was pouncing
this.reset = func_null;
this.state = 0;
this.attack_finished_single[0] = 0;
this.damagedbycontents = true;
this.monsterid = mon_id;
this.event_damage = Monster_Damage;
- this.touch = Monster_Touch;
+ settouch(this, Monster_Touch);
this.use = Monster_Use;
this.solid = SOLID_BBOX;
this.movetype = MOVETYPE_WALK;
this.solid = SOLID_TRIGGER;
this.flags = FL_ITEM;
this.think = buff_Think;
- this.touch = buff_Touch;
+ settouch(this, buff_Touch);
this.reset = buff_Reset;
this.nextthink = time + 0.1;
this.gravity = 1;
if(boxesoverlap(self.absmin - pickup_size, self.absmax + pickup_size, it.absmin, it.absmax))
{
- if(it.touch)
+ if(gettouch(it))
{
entity oldother = other;
other = self;
- WITHSELF(it, it.touch());
-
+ WITHSELF(it, gettouch(it)());
other = oldother;
}
}
healer.team = this.realowner.team;
healer.bot_dodge = false;
healer.solid = SOLID_TRIGGER;
- healer.touch = nade_heal_touch;
+ settouch(healer, nade_heal_touch);
setmodel(healer, MDL_NADE_HEAL);
healer.healer_radius = autocvar_g_nades_nade_radius;
if(set_owner)
_nade.realowner = e;
- _nade.touch = nade_touch;
+ settouch(_nade, nade_touch);
_nade.spawnshieldtime = time + 0.1; // prevent instantly picking up again
_nade.health = autocvar_g_nades_nade_health;
_nade.max_health = _nade.health;
setorigin (missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point
W_SetupProjVelocity_Basic(missile, WEP_CVAR(rpc, speed), 0);
- missile.touch = W_RocketPropelledChainsaw_Touch;
+ settouch(missile, W_RocketPropelledChainsaw_Touch);
missile.think = W_RocketPropelledChainsaw_Think;
missile.cnt = time + WEP_CVAR(rpc, lifetime);
wep.think = physical_item_think;
wep.nextthink = time;
- wep.touch = physical_item_touch;
+ settouch(wep, physical_item_touch);
wep.event_damage = physical_item_damage;
if(!wep.cnt)
e.frame = 0;
e.skin = 0;
e.material = string_null;
- e.touch = sandbox_ObjectFunction_Touch;
+ settouch(e, sandbox_ObjectFunction_Touch);
e.think = sandbox_ObjectFunction_Think;
e.nextthink = time;
//e.effects |= EF_SELECTABLE; // don't do this all the time, maybe just when editing objects?
this.bot_pickupbasevalue = pickupbasevalue;
this.mdl = this.model ? this.model : strzone(this.item_model_ent.model_str());
this.netname = itemname;
- this.touch = Item_Touch;
+ settouch(this, Item_Touch);
setmodel(this, MDL_Null); // precision set below
//this.effects |= EF_LOWPRECISION;
this.takedamage = DAMAGE_YES;
}
else
- this.touch = button_touch;
+ settouch(this, button_touch);
if (!this.speed)
this.speed = 40;
trigger.solid = SOLID_TRIGGER;
trigger.owner = self;
#ifdef SVQC
- trigger.touch = door_trigger_touch;
+ settouch(trigger, door_trigger_touch);
#elif defined(CSQC)
trigger.trigger_touch = door_trigger_touch;
trigger.draw = trigger_draw_generic;
if (this.items)
this.wait = -1;
- this.touch = door_touch;
+ settouch(this, door_touch);
// LinkDoors can't be done until all of the doors have been spawned, so
// the sizes can be detected properly.
if (this.items)
this.wait = -1;
- this.touch = door_touch;
+ settouch(this, door_touch);
// LinkDoors can't be done until all of the doors have been spawned, so
// the sizes can be detected properly.
if (this.noise == "") this.noise = "misc/talk.wav";
precache_sound(this.noise);
- this.touch = secret_touch;
+ settouch(this, secret_touch);
this.blocked = secret_blocked;
this.speed = 50;
this.use = fd_secret_use;
void func_ladder_init(entity this)
{
- this.touch = func_ladder_touch;
+ settouch(this, func_ladder_touch);
trigger_init(this);
func_ladder_link(this);
vector tmin, tmax;
trigger = spawn();
- trigger.touch = plat_center_touch;
+ settouch(trigger, plat_center_touch);
trigger.movetype = MOVETYPE_NONE;
trigger.solid = SOLID_TRIGGER;
trigger.enemy = self;
// now enable touch
#ifdef SVQC
- this.touch = Teleport_Touch;
+ settouch(this, Teleport_Touch);
trigger_teleport_link(this);
#elif defined(CSQC)
return;
EXACTTRIGGER_INIT;
- this.touch = trigger_gravity_touch;
+ settouch(this, trigger_gravity_touch);
if(this.noise != "")
precache_sound(this.noise);
this.active = ACTIVE_ACTIVE;
EXACTTRIGGER_INIT;
- this.touch = trigger_heal_touch;
+ settouch(this, trigger_heal_touch);
if (!this.health)
this.health = 10;
if (!this.max_health)
{
EXACTTRIGGER_INIT;
this.active = ACTIVE_ACTIVE;
- this.touch = trigger_hurt_touch;
+ settouch(this, trigger_hurt_touch);
this.use = trigger_hurt_use;
this.enemy = world; // I hate you all
if (!this.dmg)
if(!this.strength) this.strength = 2000 * autocvar_g_triggerimpulse_radial_multiplier;
setorigin(this, this.origin);
setsize(this, '-1 -1 -1' * this.radius,'1 1 1' * this.radius);
- this.touch = trigger_impulse_touch3;
+ settouch(this, trigger_impulse_touch3);
}
else
{
if(this.target)
{
if(!this.strength) this.strength = 950 * autocvar_g_triggerimpulse_directional_multiplier;
- this.touch = trigger_impulse_touch1;
+ settouch(this, trigger_impulse_touch1);
}
else
{
if(!this.strength) this.strength = 0.9;
this.strength = pow(this.strength, autocvar_g_triggerimpulse_accel_power) * autocvar_g_triggerimpulse_accel_multiplier;
- this.touch = trigger_impulse_touch2;
+ settouch(this, trigger_impulse_touch2);
}
}
if (this.spawnflags & PUSH_ONCE)
{
- this.touch = func_null;
+ settouch(this, func_null);
this.think = SUB_Remove_self;
this.nextthink = time;
}
this.active = ACTIVE_ACTIVE;
this.use = trigger_push_use;
- this.touch = trigger_push_touch;
+ settouch(this, trigger_push_touch);
// normal push setup
if (!this.speed)
EXACTTRIGGER_INIT;
- this.touch = trigger_keylock_touch;
+ settouch(this, trigger_keylock_touch);
trigger_keylock_link(this);
}
else
{ // we can't just remove (this) here, because this is a touch function
// called wheil C code is looping through area links...
- this.touch = func_null;
+ settouch(this, func_null);
}
}
void multi_reset(entity this)
{
if ( !(this.spawnflags & SPAWNFLAG_NOTOUCH) )
- this.touch = multi_touch;
+ settouch(this, multi_touch);
if (this.max_health)
{
this.health = this.max_health;
{
if ( !(this.spawnflags & SPAWNFLAG_NOTOUCH) )
{
- this.touch = multi_touch;
+ settouch(this, multi_touch);
setorigin (this, this.origin); // make sure it links into the world
}
}
spawnfunc_trigger_once(this);
// take over the touch() function, so we can mark secret as found
- this.touch = trigger_secret_touch;
+ settouch(this, trigger_secret_touch);
// ignore triggering;
this.use = func_null;
}
{
// Init stuff
trigger_init(this);
- this.touch = swamp_touch;
+ settouch(this, swamp_touch);
// Setup default keys, if missing
if(this.dmg <= 0)
proj.bot_dodge = true;
proj.bot_dodgerating = self.shot_dmg;
proj.think = turret_projectile_explode;
- proj.touch = turret_projectile_touch;
+ settouch(proj, turret_projectile_touch);
proj.nextthink = time + 9;
proj.movetype = MOVETYPE_FLYMISSILE;
proj.velocity = normalize(self.tur_shotdir_updated + randomvec() * self.shot_spread) * self.shot_speed;
WITHSELF(this, InitTrigger());
- this.touch = turret_targettrigger_touch;
+ settouch(this, turret_targettrigger_touch);
}
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);
- rocket.touch = walker_rocket_explode;
+ settouch(rocket, walker_rocket_explode);
rocket.flags = FL_PROJECTILE;
rocket.solid = SOLID_BBOX;
rocket.max_health = time + 9;
proj.bot_dodge = true;
proj.bot_dodgerating = _dmg;
proj.velocity = _vel;
- proj.touch = vehicles_projectile_explode;
+ settouch(proj, vehicles_projectile_explode);
proj.use = vehicles_projectile_explode_use;
proj.owner = this;
proj.realowner = _owner;
{
_gib.think = vehicles_gib_explode;
_gib.nextthink = time + random() * _explode;
- _gib.touch = vehicles_gib_explode;
+ settouch(_gib, vehicles_gib_explode);
}
else
{
self.vehicle_hudmodel.viewmodelforclient = self;
self.owner = world;
- self.touch = vehicles_touch;
+ settouch(self, vehicles_touch);
self.event_damage = vehicles_damage;
self.iscreature = true;
self.teleportable = false; // no teleporting for vehicles, too buggy
this.vehicleid = info.vehicleid;
this.PlayerPhysplug = info.PlayerPhysplug;
this.event_damage = func_null;
- this.touch = vehicles_touch;
+ settouch(this, vehicles_touch);
this.think = vehicles_spawn;
this.nextthink = time;
this.effects = EF_NODRAW;
return;
}
- self.touch = vehicles_touch;
+ settouch(self, vehicles_touch);
if(!IS_DEAD(self))
{
METHOD(Bumblebee, vr_enter, void(Bumblebee thisveh, entity instance))
{
SELFPARAM();
- self.touch = bumblebee_touch;
+ settouch(self, bumblebee_touch);
self.nextthink = 0;
self.movetype = MOVETYPE_BOUNCEMISSILE;
}
entity oldother = other;
other = e;
self.phase = 0;
- self.touch();
+ gettouch(self)();
other = oldother;
return;
}
entity oldother = other;
other = e;
self.phase = 0;
- self.touch();
+ gettouch(self)();
other = oldother;
return;
}
entity _body = vehicle_tossgib(instance, instance, instance.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
if(random() > 0.5)
- _body.touch = bumblebee_blowup;
+ settouch(_body, bumblebee_blowup);
else
- _body.touch = func_null;
+ settouch(_body, func_null);
_body.think = bumblebee_diethink;
_body.nextthink = time;
instance.colormod = '0 0 0';
instance.avelocity = '0 0 0';
instance.velocity = '0 0 0';
- instance.touch = func_null;
+ settouch(instance, func_null);
instance.nextthink = 0;
setorigin(instance, instance.pos1);
instance.wait = time;
instance.delay = 2 + time + random() * 3;
instance.cnt = 1 + random() * 2;
- instance.touch = racer_deadtouch;
+ settouch(instance, racer_deadtouch);
Send_Effect(EFFECT_EXPLOSION_MEDIUM, instance.origin, '0 0 0', 1);
self.velocity = '0 0 0';
setorigin(self, self.pos1);
- self.touch = func_null;
+ settouch(self, func_null);
self.nextthink = 0;
}
instance.avelocity -= '0 0.5 1' * (random() * 400);
instance.colormod = '-0.5 -0.5 -0.5';
- instance.touch = raptor_blowup;
+ settouch(instance, raptor_blowup);
}
METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
{
_flare.event_damage = raptor_flare_damage;
_flare.health = 20;
_flare.tur_impacttime = time + autocvar_g_vehicle_raptor_flare_lifetime;
- _flare.touch = raptor_flare_touch;
+ settouch(_flare, raptor_flare_touch);
}
weapon_thinkf(player, weaponentity, WFRAME_FIRE2, 0, w_ready);
}
setorigin(bomblet, self.origin);
bomblet.movetype = MOVETYPE_TOSS;
- bomblet.touch = raptor_bomblet_touch;
+ settouch(bomblet, raptor_bomblet_touch);
bomblet.think = raptor_bomblet_boom;
bomblet.nextthink = time + 5;
bomblet.owner = self.owner;
bomb_1.movetype = bomb_2.movetype = MOVETYPE_BOUNCE;
bomb_1.velocity = bomb_2.velocity = self.velocity;
- bomb_1.touch = bomb_2.touch = raptor_bomb_burst;
+ settouch(bomb_1, raptor_bomb_burst);
+ settouch(bomb_2, raptor_bomb_burst);
bomb_1.think = bomb_2.think = raptor_bomb_burst;
bomb_1.cnt = bomb_2.cnt = time + 10;
instance.health = 0;
instance.event_damage = func_null;
instance.takedamage = DAMAGE_NO;
- instance.touch = func_null;
+ settouch(instance, func_null);
instance.cnt = 3.4 + time + random() * 2;
instance.think = spiderbot_blowup;
instance.nextthink = time;
missile.event_damage = W_Arc_Bolt_Damage;
missile.damagedbycontents = true;
- missile.touch = W_Arc_Bolt_Touch;
+ settouch(missile, W_Arc_Bolt_Touch);
missile.use = W_Arc_Bolt_Explode_use;
missile.think = adaptor_think2use_hittype_splash;
missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime);
//missile.glow_color = 250; // 244, 250
//missile.glow_size = 120;
- missile.touch = W_Blaster_Touch;
+ settouch(missile, W_Blaster_Touch);
missile.flags = FL_PROJECTILE;
missile.missile_flags = MIF_SPLASH;
missile.projectiledeathtype = atk_deathtype;
}
s = s * WEP_CVAR_PRI(crylink, spread) * g_weaponspreadfactor;
W_SetupProjVelocity_Explicit(proj, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_PRI(crylink, speed), 0, 0, 0, false);
- proj.touch = W_Crylink_Touch;
+ settouch(proj, W_Crylink_Touch);
proj.think = W_Crylink_Fadethink;
if(counter == 0)
}
W_SetupProjVelocity_Explicit(proj, s, v_up, WEP_CVAR_SEC(crylink, speed), 0, 0, 0, false);
- proj.touch = W_Crylink_Touch;
+ settouch(proj, W_Crylink_Touch);
proj.think = W_Crylink_Fadethink;
if(counter == (shots - 1) / 2)
{
W_SetupProjVelocity_Basic(missile, WEP_CVAR(devastator, speedstart), 0);
missile.angles = vectoangles(missile.velocity);
- missile.touch = W_Devastator_Touch;
+ settouch(missile, W_Devastator_Touch);
missile.think = W_Devastator_Think;
missile.nextthink = time;
missile.cnt = time + WEP_CVAR(devastator, lifetime);
proj.movetype = MOVETYPE_FLY;
W_SetupProjVelocity_PRI(proj, electro);
proj.angles = vectoangles(proj.velocity);
- proj.touch = W_Electro_TouchExplode;
+ settouch(proj, W_Electro_TouchExplode);
setsize(proj, '0 0 -3', '0 0 -3');
proj.flags = FL_PROJECTILE;
proj.missile_flags = MIF_SPLASH;
//proj.glow_color = 45;
proj.movetype = MOVETYPE_BOUNCE;
W_SetupProjVelocity_UP_SEC(proj, electro);
- proj.touch = W_Electro_Orb_Touch;
+ settouch(proj, W_Electro_Orb_Touch);
setsize(proj, '0 0 -4', '0 0 -4');
proj.takedamage = DAMAGE_YES;
proj.damageforcescale = WEP_CVAR_SEC(electro, damageforcescale);
proj.movetype = MOVETYPE_FLY;
W_SetupProjVelocity_PRI(proj, fireball);
proj.angles = vectoangles(proj.velocity);
- proj.touch = W_Fireball_TouchExplode;
+ settouch(proj, W_Fireball_TouchExplode);
setsize(proj, '-16 -16 -16', '16 16 16');
proj.flags = FL_PROJECTILE;
proj.missile_flags = MIF_SPLASH | MIF_PROXY;
proj.bot_dodgerating = WEP_CVAR_SEC(fireball, damage);
proj.movetype = MOVETYPE_BOUNCE;
proj.projectiledeathtype = WEP_FIREBALL.m_id | HITTYPE_SECONDARY;
- proj.touch = W_Fireball_Firemine_Touch;
+ settouch(proj, W_Fireball_Firemine_Touch);
PROJECTILE_MAKETRIGGER(proj);
setsize(proj, '-4 -4 -4', '4 4 4');
setorigin(proj, w_shotorg);
missile.event_damage = W_Hagar_Damage;
missile.damagedbycontents = true;
- missile.touch = W_Hagar_Touch;
+ settouch(missile, W_Hagar_Touch);
missile.use = W_Hagar_Explode_use;
missile.think = adaptor_think2use_hittype_splash;
missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime);
missile.event_damage = W_Hagar_Damage;
missile.damagedbycontents = true;
- missile.touch = W_Hagar_Touch2;
+ settouch(missile, W_Hagar_Touch2);
missile.cnt = 0;
missile.use = W_Hagar_Explode2_use;
missile.think = adaptor_think2use_hittype_splash;
missile.event_damage = W_Hagar_Damage;
missile.damagedbycontents = true;
- missile.touch = W_Hagar_Touch; // not bouncy
+ settouch(missile, W_Hagar_Touch); // not bouncy
missile.use = W_Hagar_Explode2_use;
missile.think = adaptor_think2use_hittype_splash;
missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
W_SetupProjVelocity_Basic(missile, WEP_CVAR_PRI(hlac, speed), spread);
//missile.angles = vectoangles(missile.velocity); // csqc
- missile.touch = W_HLAC_Touch;
+ settouch(missile, W_HLAC_Touch);
missile.think = SUB_Remove_self;
missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
W_SetupProjVelocity_Basic(missile, WEP_CVAR_SEC(hlac, speed), spread);
//missile.angles = vectoangles(missile.velocity); // csqc
- missile.touch = W_HLAC_Touch;
+ settouch(missile, W_HLAC_Touch);
missile.think = SUB_Remove_self;
missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
void W_Hook_Explode2()
{SELFPARAM();
self.event_damage = func_null;
- self.touch = func_null;
+ settouch(self, func_null);
self.effects |= EF_NODRAW;
self.think = W_Hook_ExplodeThink;
gren.nextthink = time + WEP_CVAR_SEC(hook, lifetime);
gren.think = adaptor_think2use_hittype_splash;
gren.use = W_Hook_Explode2_use;
- gren.touch = W_Hook_Touch2;
+ settouch(gren, W_Hook_Touch2);
gren.takedamage = DAMAGE_YES;
gren.health = WEP_CVAR_SEC(hook, health);
newmine.mine_time = self.mine_time;
- newmine.touch = func_null;
+ settouch(newmine, func_null);
newmine.think = W_MineLayer_Think;
newmine.nextthink = time;
newmine.cnt = self.cnt;
W_SetupProjVelocity_Basic(mine, WEP_CVAR(minelayer, speed), 0);
mine.angles = vectoangles(mine.velocity);
- mine.touch = W_MineLayer_Touch;
+ settouch(mine, W_MineLayer_Touch);
mine.think = W_MineLayer_Think;
mine.nextthink = time;
mine.cnt = (WEP_CVAR(minelayer, lifetime) - WEP_CVAR(minelayer, lifetime_countdown));
gren.nextthink = time;
gren.think = W_Mortar_Grenade_Think1;
gren.use = W_Mortar_Grenade_Explode_use;
- gren.touch = W_Mortar_Grenade_Touch1;
+ settouch(gren, W_Mortar_Grenade_Touch1);
gren.takedamage = DAMAGE_YES;
gren.health = WEP_CVAR_PRI(mortar, health);
gren.nextthink = time + WEP_CVAR_SEC(mortar, lifetime);
gren.think = adaptor_think2use_hittype_splash;
gren.use = W_Mortar_Grenade_Explode2_use;
- gren.touch = W_Mortar_Grenade_Touch2;
+ settouch(gren, W_Mortar_Grenade_Touch2);
gren.takedamage = DAMAGE_YES;
gren.health = WEP_CVAR_SEC(mortar, health);
gren.nextthink = time + WEP_CVAR_BOTH(porto, (type <= 0), lifetime);
gren.think = W_Porto_Think;
- gren.touch = W_Porto_Touch;
+ settouch(gren, W_Porto_Touch);
if(self.items & ITEM_Strength.m_itemid)
W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(porto, (type <= 0), speed) * autocvar_g_balance_powerup_strength_force, 0);
missile.bot_dodgerating = WEP_CVAR(seeker, missile_damage);
missile.think = W_Seeker_Missile_Think;
- missile.touch = W_Seeker_Missile_Touch;
+ settouch(missile, W_Seeker_Missile_Touch);
missile.event_damage = W_Seeker_Missile_Damage;
missile.nextthink = time;// + 0.2;// + cvar("g_balance_seeker_missile_activate_delay");
missile.cnt = time + WEP_CVAR(seeker, missile_lifetime);
missile.owner = missile.realowner = self;
missile.bot_dodge = true;
missile.bot_dodgerating = WEP_CVAR(seeker, flac_damage);
- missile.touch = W_Seeker_Flac_Explode;
+ settouch(missile, W_Seeker_Flac_Explode);
missile.use = W_Seeker_Flac_Explode_use;
missile.think = adaptor_think2use_hittype_splash;
missile.nextthink = time + WEP_CVAR(seeker, flac_lifetime) + WEP_CVAR(seeker, flac_lifetime_rand);
missile.owner = missile.realowner = self;
missile.bot_dodge = true;
missile.bot_dodgerating = 50;
- missile.touch = W_Seeker_Tag_Touch;
+ settouch(missile, W_Seeker_Tag_Touch);
missile.think = SUB_Remove_self;
missile.nextthink = time + WEP_CVAR(seeker, tag_lifetime);
missile.movetype = MOVETYPE_FLY;
proj.velocity_z = proj.velocity_z + cvar("g_rm_laser_zspread") * (random() - 0.5);
proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
proj.angles = vectoangles(proj.velocity);
- proj.touch = W_RocketMinsta_Laser_Touch;
+ settouch(proj, W_RocketMinsta_Laser_Touch);
setsize(proj, '0 0 -3', '0 0 -3');
proj.flags = FL_PROJECTILE;
proj.missile_flags = MIF_SPLASH;
proj.velocity = w_shotdir * autocvar_g_rm_laser_speed;
proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
proj.angles = vectoangles(proj.velocity);
- proj.touch = W_RocketMinsta_Laser_Touch;
+ settouch(proj, W_RocketMinsta_Laser_Touch);
setsize(proj, '0 0 -3', '0 0 -3');
proj.flags = FL_PROJECTILE;
proj.missile_flags = MIF_SPLASH;
#define WITHSELF(value, block) block
#endif
-#define SELFWRAP(T, R) \
- [[alias(#T)]] .R() __##T; \
- .R(entity this) self##T; \
- R T##_self() { SELFPARAM(); return this.self##T(this); }
+#define SELFWRAP(T, R, args, forward) \
+ .R() T; \
+ .R() __##T = T; \
+ .R args self##T; \
+ R T##_self() { SELFPARAM(); return this.self##T forward; }
noref entity _selftemp;
#define SELFWRAP_SET(T, e, f) \
- (_selftemp = (e), _selftemp.__##T = T##_self, _selftemp.self##T = f)
+ (_selftemp = (e), _selftemp.__##T = ((f) ? T##_self : func_null), _selftemp.self##T = (f))
+#define SELFWRAP_GET(T, e) \
+ (0, (e).self##T)
+#define _SELFWRAP_SET(T, e, f) \
+ ((e).__##T = (f))
+#define _SELFWRAP_GET(T, e) \
+ (0, (e).__##T)
-SELFWRAP(think, void)
+SELFWRAP(think, void, (entity this), (this))
#define setthink(e, f) SELFWRAP_SET(think, e, f)
-SELFWRAP(touch, void)
-#define settouch(e, f) SELFWRAP_SET(touch, e, f)
+SELFWRAP(touch, void, (entity this), (this))
+#define settouch(e, f) _SELFWRAP_SET(touch, e, f)
+#define gettouch(e) _SELFWRAP_GET(touch, e)
-SELFWRAP(predraw, void)
+SELFWRAP(predraw, void, (entity this), (this))
#define setpredraw(e, f) SELFWRAP_SET(predraw, e, f)
+
+#ifndef MENUQC
+void adaptor_think2touch() { SELFPARAM(); WITH(entity, other, NULL, gettouch(this)()); }
+void adaptor_think2use() { SELFPARAM(); if (this.use) this.use(this, NULL, NULL); }
+#endif
warpzone_warpzones_exist = 1;
WarpZone_SetUp(this, this.warpzone_origin, this.warpzone_angles, this.enemy.warpzone_origin, this.enemy.warpzone_angles);
- this.touch = WarpZone_Touch;
+ settouch(this, WarpZone_Touch);
this.SendFlags = 0xFFFFFF;
if(this.spawnflags & 1)
{
self.state = 1;
self.think = GrapplingHookThink;
self.nextthink = time;
- self.touch = func_null;
+ settouch(self, func_null);
self.velocity = '0 0 0';
self.movetype = MOVETYPE_NONE;
self.hook_length = -1;
missile.angles = vectoangles (missile.velocity);
//missile.glow_color = 250; // 244, 250
//missile.glow_size = 120;
- missile.touch = GrapplingHookTouch;
+ settouch(missile, GrapplingHookTouch);
missile.think = GrapplingHookThink;
missile.nextthink = time;
WITHSELF(this, droptofloor());
}
- this.touch = item_key_touch;
+ settouch(this, item_key_touch);
};
}
-void adaptor_think2touch()
-{SELFPARAM();
- entity o;
- o = other;
- other = world;
- self.touch();
- other = o;
-}
-void adaptor_think2use()
-{SELFPARAM();
- if(this.use)
- this.use(this, NULL, NULL);
-}
void adaptor_think2use_hittype_splash() // for timed projectile detonation
{SELFPARAM();
shield.enemy = self;
shield.team = self.team;
- shield.touch = ctf_CaptureShield_Touch;
+ settouch(shield, ctf_CaptureShield_Touch);
shield.customizeentityforclient = ctf_CaptureShield_Customize;
shield.effects = EF_ADDITIVE;
shield.movetype = MOVETYPE_NOCLIP;
flag.velocity = '0 0 0';
flag.mangle = flag.angles;
flag.reset = ctf_Reset;
- flag.touch = ctf_FlagTouch;
+ settouch(flag, ctf_FlagTouch);
flag.think = ctf_FlagThink;
flag.nextthink = time + FLAG_THINKRATE;
flag.ctf_status = FLAG_BASE;
self.think = dompointthink;
self.nextthink = time;
- self.touch = dompointtouch;
+ settouch(self, dompointtouch);
self.solid = SOLID_TRIGGER;
self.flags = FL_ITEM;
setsize(self, '-32 -32 -32', '32 32 32');
self.velocity = '0 0 200';
self.angles = '0 0 0';
self.effects = autocvar_g_keepawayball_effects;
- self.touch = ka_TouchEvent;
+ settouch(self, ka_TouchEvent);
setthink(self, ka_RespawnBall);
self.nextthink = time + autocvar_g_keepawayball_respawntime;
self.velocity = '0 0 0';
self.movetype = MOVETYPE_NONE;
self.effects |= EF_NODRAW;
- self.touch = func_null;
+ settouch(self, func_null);
self.think = ka_TimeScoring;
self.nextthink = time + autocvar_g_keepaway_score_timeinterval;
self.takedamage = DAMAGE_NO;
setattachment(ball, world, "");
ball.movetype = MOVETYPE_BOUNCE;
ball.wait = time + 1;
- ball.touch = ka_TouchEvent;
+ settouch(ball, ka_TouchEvent);
setthink(ball, ka_RespawnBall);
ball.nextthink = time + autocvar_g_keepawayball_respawntime;
ball.takedamage = DAMAGE_YES;
if(time < game_starttime)
{
setthink(this, ka_RespawnBall);
- this.touch = func_null;
+ settouch(this, func_null);
this.nextthink = game_starttime;
}
else
e.flags = FL_ITEM;
e.pushable = true;
e.reset = ka_Reset;
- e.touch = ka_TouchEvent;
+ settouch(e, ka_TouchEvent);
e.owner = world;
ka_ball = e;
entity key = spawn();
key.count = i;
key.classname = STR_ITEM_KH_KEY;
- key.touch = kh_Key_Touch;
+ settouch(key, kh_Key_Touch);
key.think = kh_Key_Think;
key.nextthink = time;
key.items = IT_KEY1 | IT_KEY2;
{
portal.skin = 2;
portal.solid = SOLID_NOT;
- portal.touch = func_null;
+ settouch(portal, func_null);
portal.think = func_null;
portal.effects = 0;
portal.nextthink = 0;
{
portal.skin = 2;
portal.solid = SOLID_NOT;
- portal.touch = func_null;
+ settouch(portal, func_null);
portal.think = func_null;
portal.effects = EF_ADDITIVE;
portal.nextthink = 0;
{
portal.skin = 0;
portal.solid = SOLID_NOT; // this is done when connecting them!
- portal.touch = Portal_Touch;
+ settouch(portal, Portal_Touch);
portal.think = Portal_Think;
portal.effects = EF_RED;
portal.nextthink = time;
{
portal.skin = 1;
portal.solid = SOLID_NOT;
- portal.touch = func_null;
+ settouch(portal, func_null);
portal.think = func_null;
portal.effects = EF_STARDUST | EF_BLUE;
portal.nextthink = 0;
this.use = checkpoint_use;
if (!(this.spawnflags & 1))
- this.touch = checkpoint_touch;
+ settouch(this, checkpoint_touch);
o = (this.absmin + this.absmax) * 0.5;
tracebox(o, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), o - '0 0 1' * (o.z - this.absmin.z), MOVE_NORMAL, this);
this.use = checkpoint_use;
if (!(this.spawnflags & 1))
- this.touch = checkpoint_touch;
+ settouch(this, checkpoint_touch);
o = (this.absmin + this.absmax) * 0.5;
tracebox(o, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), o - '0 0 1' * (o.z - this.absmin.z), MOVE_NORMAL, this);
this.use = penalty_use;
if (!(this.spawnflags & 1))
- this.touch = penalty_touch;
+ settouch(this, penalty_touch);
if (this.race_penalty_reason == "")
this.race_penalty_reason = "missing a checkpoint";