if (!announcer_countdown)
{
announcer_countdown = new(announcer_countdown);
- announcer_countdown.think = Announcer_Countdown;
+ setthink(announcer_countdown, Announcer_Countdown);
}
if(time + 5.0 < startTime) // if connecting to server while restart was active don't always play prepareforbattle
void PostInit()
{
entity playerchecker = new_pure(playerchecker);
- playerchecker.think = Playerchecker_Think;
+ setthink(playerchecker, Playerchecker_Think);
playerchecker.nextthink = time + 0.2;
TrueAim_Init();
continue;
}
make_impure(it);
- assert(entcs.think, eprint(entcs));
- WITHSELF(entcs, entcs.think());
+ assert(getthink(entcs), eprint(entcs));
+ WITHSELF(entcs, getthink(entcs)());
if (!entcs.has_origin) continue;
if (entcs.m_entcs_private)
{
e.owner = this;
e.cnt = time + life;
e.team = _particleeffectnum(effectname);
- e.think = DamageEffect_Think;
+ setthink(e, DamageEffect_Think);
e.nextthink = time;
this.total_damages += 1;
}
{
entity e = player.entcs = new(entcs_sender);
e.owner = player;
- e.think = entcs_think;
+ setthink(e, entcs_think);
e.nextthink = time;
Net_LinkEntity(e, false, 0, entcs_send);
if (!IS_REAL_CLIENT(player)) return;
make_pure(e);
}
e.sv_entnum = n;
- e.think = entcs_think;
+ setthink(e, entcs_think);
entcs_receiver(n, e);
}
else if (this && e != this)
#undef X
this.iflags |= IFLAG_ORIGIN;
InterpolateOrigin_Note(this);
- WITHSELF(this, this.think());
+ WITHSELF(this, getthink(this)());
return true;
}
if(autocvar_g_nexball_basketball_delay_hold)
{
- ball.think = DropOwner;
+ setthink(ball, DropOwner);
ball.nextthink = time + autocvar_g_nexball_basketball_delay_hold;
}
ball.velocity = vel;
ball.nb_droptime = time;
settouch(ball, basketball_touch);
- ball.think = ResetBall;
+ setthink(ball, ResetBall);
ball.nextthink = min(time + autocvar_g_nexball_delay_idle, ball.teamtime);
if(ball.owner.metertime)
else if(this.classname == "nexball_football")
settouch(this, football_touch);
this.cnt = 0;
- this.think = ResetBall;
+ setthink(this, ResetBall);
this.nextthink = time + autocvar_g_nexball_delay_idle + 3;
this.teamtime = 0;
this.pusher = world;
this.velocity = '0 0 0';
setorigin(this, this.spawnorigin); // make sure it's positioned correctly anyway
this.movetype = MOVETYPE_NONE;
- this.think = InitBall;
+ setthink(this, InitBall);
this.nextthink = max(time, game_starttime) + autocvar_g_nexball_delay_start;
}
}
WaypointSprite_Ping(ball.waypointsprite_attachedforcarrier);
ball.cnt = 1;
- ball.think = ResetBall;
+ setthink(ball, ResetBall);
if(ball.classname == "nexball_basketball")
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);
WaypointSprite_AttachCarrier(WP_NbBall, this, RADARICON_FLAGCARRIER); // the ball's team is not set yet, no rule update needed
this.reset = ball_restart;
- this.think = InitBall;
+ setthink(this, InitBall);
this.nextthink = game_starttime + autocvar_g_nexball_delay_start;
}
entity _ball = self.ballcarried;
W_SetupShot(self, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32));
- _ball.think = W_Nexball_Think;
+ setthink(_ball, W_Nexball_Think);
_ball.nextthink = time;
return;
}
W_SetupProjVelocity_Basic(missile, autocvar_g_balance_nexball_secondary_speed, 0);
missile.angles = vectoangles(missile.velocity);
settouch(missile, W_Nexball_Touch);
- missile.think = SUB_Remove_self;
+ setthink(missile, SUB_Remove_self);
missile.nextthink = time + autocvar_g_balance_nexball_secondary_lifetime; //FIXME: use a distance instead?
missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
LOG_DEBUG(strcat(etos(this.goalentity), " linked with ", etos(this.enemy), "\n"));
this.SendFlags |= 3;
- this.think = ons_Link_CheckUpdate;
+ setthink(this, ons_Link_CheckUpdate);
this.nextthink = time;
}
{
this.health = this.max_health;
this.count = autocvar_g_onslaught_cp_regen * ONS_CP_THINKRATE; // slow repair rate from now on
- this.think = ons_ControlPoint_Icon_Think;
+ setthink(this, ons_ControlPoint_Icon_Think);
sound(this, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILT, VOL_BASE, ATTEN_NORM);
this.owner.iscaptured = true;
this.solid = SOLID_BBOX;
this.iscaptured = false;
this.islinked = false;
this.isshielded = true;
- this.think = ons_ControlPoint_Think;
+ setthink(this, ons_ControlPoint_Think);
this.ons_toucher = world;
this.nextthink = time + ONS_CP_THINKRATE;
setmodel_fixsize(this, MDL_ONS_CP_PAD1);
cp.solid = SOLID_BBOX;
cp.movetype = MOVETYPE_NONE;
settouch(cp, ons_ControlPoint_Touch);
- cp.think = ons_ControlPoint_Think;
+ setthink(cp, ons_ControlPoint_Think);
cp.nextthink = time + ONS_CP_THINKRATE;
cp.reset = ons_ControlPoint_Reset;
cp.colormap = 1024;
this.takedamage = DAMAGE_NO; // can't be hurt anymore
this.event_damage = func_null; // won't do anything if hurt
this.count = 0; // reset counter
- this.think = func_null;
+ setthink(this, func_null);
this.nextthink = 0;
//this.think(); // do the first explosion now
this.islinked = true;
this.isshielded = true;
this.event_damage = ons_GeneratorDamage;
- this.think = ons_GeneratorThink;
+ setthink(this, ons_GeneratorThink);
this.nextthink = time + GEN_THINKRATE;
Net_LinkEntity(this, false, 0, generator_send);
gen.bot_attack = true;
gen.event_damage = ons_GeneratorDamage;
gen.reset = ons_GeneratorReset;
- gen.think = ons_GeneratorThink;
+ setthink(gen, ons_GeneratorThink);
gen.nextthink = time + GEN_THINKRATE;
gen.iscaptured = true;
gen.islinked = true;
void onslaught_controlpoint_icon_link(entity e, void() spawnproc)
{
Net_LinkEntity(e, true, 0, cpicon_send);
- e.think = spawnproc;
+ setthink(e, spawnproc);
e.nextthink = time * sys_frametime;
}
void generator_link(void() spawnproc)
{SELFPARAM();
Net_LinkEntity(self, true, 0, generator_send);
- self.think = spawnproc;
+ setthink(self, spawnproc);
self.nextthink = time;
}
while ( fabs(sin(angle)) < 0.17 || fabs(cos(angle)) < 0.17 );
ball.velocity_x = cos(angle)*autocvar_sv_minigames_pong_ball_speed;
ball.velocity_y = sin(angle)*autocvar_sv_minigames_pong_ball_speed;
- ball.think = pong_ball_think;
+ setthink(ball, pong_ball_think);
ball.nextthink = time;
ball.team = 0;
ball.SendFlags |= MINIG_SF_UPDATE|PONG_SF_BALLTEAM;
{
ball.velocity = '0 0 0';
ball.origin = '0.5 0.5 0';
- ball.think = SUB_NullThink;
+ setthink(ball, SUB_NullThink);
ball.team = 0;
ball.SendFlags |= MINIG_SF_UPDATE|PONG_SF_BALLTEAM;
- ball.think = pong_ball_throwthink;
+ setthink(ball, pong_ball_throwthink);
ball.nextthink = time + autocvar_sv_minigames_pong_ball_wait;
}
entity ai = msle_spawn(paddle.owner,"pong_ai");
ai.minigame_players = ai;
ai.team = paddle.team;
- ai.think = pong_ai_think;
+ setthink(ai, pong_ai_think);
ai.nextthink = time;
ai.pong_ai_paddle = paddle;
entity paddle = msle_spawn(minigame,"pong_paddle");
paddle.pong_length = autocvar_sv_minigames_pong_paddle_size;
paddle.origin = pong_team_to_paddlepos(pl_team);
- paddle.think = pong_paddle_think;
+ setthink(paddle, pong_paddle_think);
paddle.nextthink = time;
paddle.team = pl_team;
paddle.mins = pong_team_to_box_halfsize(pl_team,-paddle.pong_length,-1/16);
piece.snake_next = world;
piece.snake_prev = world;
piece.snake_last = piece;
- piece.think = snake_head_think;
+ setthink(piece, snake_head_think);
piece.snake_delay = autocvar_sv_minigames_snake_delay_initial;
piece.nextthink = time + 0.1;
minigame_server_sendflags(piece,MINIG_SF_ALL);
entity missile = spawn();
missile.owner = missile.realowner = this;
- missile.think = M_Mage_Attack_Spike_Think;
+ setthink(missile, M_Mage_Attack_Spike_Think);
missile.ltime = time + 7;
missile.nextthink = time;
missile.solid = SOLID_BBOX;
Damage(head, this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage_zap) * MONSTER_SKILLMOD(this), DEATH_MONSTER_SHAMBLER_ZAP.m_id, head.origin, '0 0 0');
}
- this.think = SUB_Remove_self;
+ setthink(this, SUB_Remove_self);
this.nextthink = time + 0.2;
}
gren.cnt = time + 5;
gren.nextthink = time;
- gren.think = M_Shambler_Attack_Lightning_Think;
+ setthink(gren, M_Shambler_Attack_Lightning_Think);
gren.use = M_Shambler_Attack_Lightning_Explode_use;
settouch(gren, M_Shambler_Attack_Lightning_Touch);
entity proj = new(plasma);
proj.owner = proj.realowner = this;
proj.use = M_Spider_Attack_Web_Explode_use;
- proj.think = adaptor_think2use_hittype_splash;
+ setthink(proj, adaptor_think2use_hittype_splash);
proj.bot_dodge = true;
proj.bot_dodgerating = 0;
proj.nextthink = time + 5;
missile.velocity = w_shotdir * (autocvar_g_monster_wyvern_attack_fireball_speed);
missile.avelocity = '300 300 300';
missile.nextthink = time + 5;
- missile.think = M_Wyvern_Attack_Fireball_Explode;
+ setthink(missile, M_Wyvern_Attack_Fireball_Explode);
settouch(missile, M_Wyvern_Attack_Fireball_Touch);
CSQCProjectile(missile, true, PROJECTILE_FIREMINE, true);
if(this.cnt > 1)
{
this.cnt -= 1;
- this.think = Monster_Delay_Action_self;
+ setthink(this, Monster_Delay_Action_self);
this.nextthink = time + this.count;
}
else
{
- this.think = SUB_Remove_self;
+ setthink(this, SUB_Remove_self);
this.nextthink = time;
}
}
// deferred attacking, checks if monster is still alive and target is still valid before attacking
entity e = spawn();
- e.think = Monster_Delay_Action_self;
+ setthink(e, Monster_Delay_Action_self);
e.nextthink = time + defer_amnt;
e.count = defer_amnt;
e.owner = this;
if(Monster_Respawn_Check(this))
{
this.spawnflags |= MONSTERFLAG_RESPAWNED;
- this.think = Monster_Respawn;
+ setthink(this, Monster_Respawn);
this.nextthink = time + this.respawntime;
this.monster_lifetime = 0;
this.deadflag = DEAD_RESPAWNING;
if(!(this.spawnflags & MONSTERFLAG_APPEAR))
return false;
- this.think = func_null;
+ setthink(this, func_null);
this.monsterid = monster_id; // set so this monster is properly registered (otherwise, normal initialization is used)
this.nextthink = 0;
this.use = Monster_Appear;
// number of monsters spawned with mobspawn command
totalspawned -= 1;
- this.think = SUB_Remove_self;
+ setthink(this, SUB_Remove_self);
this.nextthink = time + 0.1;
this.event_damage = func_null;
}
void Monster_Dead(entity this, entity attacker, float gibbed)
{
- this.think = Monster_Dead_Think;
+ setthink(this, Monster_Dead_Think);
this.nextthink = time;
this.monster_lifetime = time + 5;
{
Violence_GibSplash(this, 1, 0.5, attacker);
- this.think = SUB_Remove_self;
+ setthink(this, SUB_Remove_self);
this.nextthink = time + 0.1;
}
}
void Monster_Think()
{SELFPARAM();
- this.think = Monster_Think;
+ setthink(this, Monster_Think);
this.nextthink = this.ticrate;
if(this.monster_lifetime)
}
}
- this.think = Monster_Think;
+ setthink(this, Monster_Think);
this.nextthink = time + this.ticrate;
if(MUTATOR_CALLHOOK(MonsterSpawn, this))
this.classname = "item_buff";
this.solid = SOLID_TRIGGER;
this.flags = FL_ITEM;
- this.think = buff_Think;
+ setthink(this, buff_Think);
settouch(this, buff_Touch);
this.reset = buff_Reset;
this.nextthink = time + 0.1;
dmgent.dmg = frag_damage * autocvar_g_buffs_vengeance_damage_multiplier;
dmgent.enemy = frag_attacker;
dmgent.owner = frag_target;
- dmgent.think = buff_Vengeance_DelayedDamage;
+ setthink(dmgent, buff_Vengeance_DelayedDamage);
dmgent.nextthink = time + 0.1;
}
float r = random();
if (r < 0.3)
- e.think = instagib_invisibility;
+ setthink(e, instagib_invisibility);
else if (r < 0.6)
- e.think = instagib_extralife;
+ setthink(e, instagib_extralife);
else
- e.think = instagib_speed;
+ setthink(e, instagib_speed);
e.nextthink = time + 0.1;
e.spawnflags = self.spawnflags;
setattachment(timer, _nade, "");
timer.colormap = _nade.colormap;
timer.glowmod = _nade.glowmod;
- timer.think = nade_timer_think;
+ setthink(timer, nade_timer_think);
timer.nextthink = time;
timer.wait = _nade.wait;
timer.owner = _nade;
proj.scale = 1;//0.5;
setsize(proj, '-4 -4 -4', '4 4 4');
setorigin(proj, this.origin);
- proj.think = napalm_ball_think;
+ setthink(proj, napalm_ball_think);
proj.nextthink = time;
proj.damageforcescale = autocvar_g_nades_napalm_ball_damageforcescale;
proj.effects = EF_LOWPRECISION | EF_FLAME;
fountain.realowner = self.realowner;
fountain.origin = self.origin;
setorigin(fountain, fountain.origin);
- fountain.think = napalm_fountain_think;
+ setthink(fountain, napalm_fountain_think);
fountain.nextthink = time;
fountain.ltime = time + autocvar_g_nades_napalm_fountain_lifetime;
fountain.pushltime = fountain.ltime;
fountain.realowner = this.realowner;
fountain.origin = this.origin;
setorigin(fountain, fountain.origin);
- fountain.think = nade_ice_think;
+ setthink(fountain, nade_ice_think);
fountain.nextthink = time;
fountain.ltime = time + autocvar_g_nades_ice_freeze_time;
fountain.pushltime = fountain.wait = fountain.ltime;
setattachment(timer, fountain, "");
timer.colormap = this.colormap;
timer.glowmod = this.glowmod;
- timer.think = nade_timer_think;
+ setthink(timer, nade_timer_think);
timer.nextthink = time;
timer.wait = fountain.ltime;
timer.owner = fountain;
Net_LinkEntity(healer, true, 0, healer_send);
- healer.think = nade_heal_think;
+ setthink(healer, nade_heal_think);
healer.nextthink = time;
healer.SendFlags |= 1;
}
void nade_beep()
{SELFPARAM();
sound(this, CH_SHOTS_SINGLE, SND_NADE_BEEP, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
- this.think = nade_boom;
+ setthink(this, nade_boom);
this.nextthink = max(this.wait, time);
}
{
sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
this.nextthink = max(time + autocvar_g_nades_nade_lifetime, time);
- this.think = nade_beep;
+ setthink(this, nade_beep);
}
this.health -= damage;
if(_time)
{
- _nade.think = nade_boom;
+ setthink(_nade, nade_boom);
_nade.nextthink = _time;
}
n.glowmod = player.glowmod;
n.wait = time + max(0, ntime);
n.nade_time_primed = time;
- n.think = nade_beep;
+ setthink(n, nade_beep);
n.nextthink = max(n.wait - 3, time);
n.projectiledeathtype = DEATH_NADE.m_id;
fn.colormod = Nades_from(n.nade_type).m_color;
fn.colormap = player.colormap;
fn.glowmod = player.glowmod;
- fn.think = SUB_Remove_self;
+ setthink(fn, SUB_Remove_self);
fn.nextthink = n.wait;
player.nade = n;
wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
wep.pickup_anyway = true;
wep.spawnfunc_checked = true;
- wep.think = self_spawnfunc_weapon_hmg;
+ setthink(wep, self_spawnfunc_weapon_hmg);
wep.nextthink = time + 0.1;
return true;
}
wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
wep.pickup_anyway = true;
wep.spawnfunc_checked = true;
- wep.think = self_spawnfunc_weapon_rpc;
+ setthink(wep, self_spawnfunc_weapon_rpc);
wep.nextthink = time + 0.1;
return true;
}
settouch(missile, W_RocketPropelledChainsaw_Touch);
- missile.think = W_RocketPropelledChainsaw_Think;
+ setthink(missile, W_RocketPropelledChainsaw_Think);
missile.cnt = time + WEP_CVAR(rpc, lifetime);
missile.nextthink = time;
missile.flags = FL_PROJECTILE;
wep.dphitcontentsmask = self.dphitcontentsmask;
wep.cnt = (self.owner != world);
- wep.think = physical_item_think;
+ setthink(wep, physical_item_think);
wep.nextthink = time;
settouch(wep, physical_item_touch);
wep.event_damage = physical_item_damage;
e.skin = 0;
e.material = string_null;
settouch(e, sandbox_ObjectFunction_Touch);
- e.think = sandbox_ObjectFunction_Think;
+ setthink(e, sandbox_ObjectFunction_Think);
e.nextthink = time;
//e.effects |= EF_SELECTABLE; // don't do this all the time, maybe just when editing objects?
entity _hello = spawn();
_hello.enemy = self;
- _hello.think = superspec_hello;
+ setthink(_hello, superspec_hello);
_hello.nextthink = time + 5;
if (!_ISLOCAL)
wp.owned_by_field = ownfield;
}
wp.fade_rate = maxdistance;
- wp.think = WaypointSprite_Think;
+ setthink(wp, WaypointSprite_Think);
wp.nextthink = time;
wp.model1 = spr.netname;
wp.customizeentityforclient = WaypointSprite_Customize;
net_notif.nent_floats[i] = ...((net_notif.nent_stringcount + i), float);
}
- net_notif.think = Net_Notification_Remove;
+ setthink(net_notif, Net_Notification_Remove);
net_notif.nextthink = (time > autocvar_notification_lifetime_mapload)
? (time + autocvar_notification_lifetime_runtime)
: autocvar_notification_lifetime_mapload;
auto = true; \
__chan = fabs(__chan); \
entity tmp = __e = new(csqc_autochannel); \
- tmp.think = SUB_Remove_self; \
+ setthink(tmp, SUB_Remove_self); \
tmp.nextthink = time + soundlength(__samp); \
} \
vector old_origin = __e.origin; \
Item_ItemsTime_SetTimesForAllPlayers();
}
- self.think = Item_Think;
+ setthink(self, Item_Think);
self.nextthink = time;
//Send_Effect(EFFECT_ITEM_RESPAWN, self.origin + self.mins_z * '0 0 1' + '0 0 48', '0 0 0', 1);
// if the respawn time is longer than 10 seconds, show a waypoint, otherwise, just respawn normally
if ((Item_ItemsTime_Allow(e.itemdef) || e.weapons & WEPSET_SUPERWEAPONS) && (t - ITEM_RESPAWN_TICKS) > 0)
{
- e.think = Item_RespawnCountdown;
+ setthink(e, Item_RespawnCountdown);
e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);
e.scheduledrespawntime = e.nextthink + ITEM_RESPAWN_TICKS;
e.count = 0;
}
else
{
- e.think = Item_RespawnThink;
+ setthink(e, Item_RespawnThink);
e.nextthink = time;
e.scheduledrespawntime = time + t;
e.wait = time + t;
if (this.classname != "droppedweapon")
{
- this.think = Item_Think;
+ setthink(this, Item_Think);
this.nextthink = time;
if (this.waypointsprite_attached)
this.movetype = MOVETYPE_TOSS;
// Savage: remove thrown items after a certain period of time ("garbage collection")
- this.think = RemoveItem;
+ setthink(this, RemoveItem);
this.nextthink = time + 20;
this.takedamage = DAMAGE_YES;
controller = new(func_bobbing_controller);
controller.owner = this;
controller.nextthink = time + 1;
- controller.think = func_bobbing_controller_think;
+ setthink(controller, func_bobbing_controller_think);
this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999;
this.SUB_THINK = SUB_NullThink;
if(this.respawntime)
{
- this.think = func_breakable_restore_self;
+ setthink(this, func_breakable_restore_self);
this.nextthink = time + this.respawntime + crandom() * this.respawntimejitter;
}
// do not explode NOW but in the NEXT FRAME!
// because recursive calls to RadiusDamage are not allowed
this.nextthink = time;
- this.think = func_breakable_destroy_self;
+ setthink(this, func_breakable_destroy_self);
}
}
{
if (!this.speed) this.speed = 200;
this.movedir *= this.speed;
- this.think = conveyor_think;
+ setthink(this, conveyor_think);
this.nextthink = time;
IFTARGETED
{
this.angles = this.pos1;
this.avelocity = '0 0 0';
this.state = STATE_BOTTOM;
- this.think = func_null;
+ setthink(this, func_null);
this.nextthink = 0;
}
void fd_secret_move1()
{SELFPARAM();
self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
- self.think = fd_secret_move2;
+ setthink(self, fd_secret_move2);
if (self.noise3 != "")
_sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
}
if (!(self.spawnflags & SECRET_OPEN_ONCE))
{
self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
- self.think = fd_secret_move4;
+ setthink(self, fd_secret_move4);
}
}
void fd_secret_move5()
{SELFPARAM();
self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
- self.think = fd_secret_move6;
+ setthink(self, fd_secret_move6);
if (self.noise3 != "")
_sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
}
this.takedamage = DAMAGE_YES;
}
setorigin(this, this.oldorigin);
- this.think = func_null;
+ setthink(this, func_null);
this.SUB_NEXTTHINK = 0;
}
controller = new(func_fourier_controller);
controller.owner = this;
controller.nextthink = time + 1;
- controller.think = func_fourier_controller_think;
+ setthink(controller, func_fourier_controller_think);
this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999;
this.SUB_THINK = SUB_NullThink; // for PushMove
controller = new(func_pendulum_controller);
controller.owner = this;
controller.nextthink = time + 1;
- controller.think = func_pendulum_controller_think;
+ setthink(controller, func_pendulum_controller_think);
this.nextthink = this.SUB_LTIME + 999999999;
this.SUB_THINK = SUB_NullThink; // for PushMove
}
else
this.state = 1;
- this.think = pointparticles_think;
+ setthink(this, pointparticles_think);
this.nextthink = time;
}
controller = new(func_vectormamamam_controller);
controller.owner = this;
controller.nextthink = time + 1;
- controller.think = func_vectormamamam_controller_think;
+ setthink(controller, func_vectormamamam_controller_think);
}
spawnfunc(func_vectormamamam)
if(!this.scale) this.scale = 1;
if(!this.modelscale) this.modelscale = 1;
else if(this.modelscale < 0) this.modelscale = 0;
- this.think = misc_laser_think;
+ setthink(this, misc_laser_think);
this.nextthink = time;
InitializeEntity(this, misc_laser_init, INITPRIO_FINDTARGET);
void plat_trigger_use(entity this, entity actor, entity trigger)
{
#ifdef SVQC
- if (this.think)
+ if (getthink(this))
return; // already activated
#elif defined(CSQC)
if(this.move_think)
controller.finaldest = (tdest + '0 0 0.125'); // where do we want to end? Offset to overshoot a bit.
controller.animstate_starttime = time;
controller.animstate_endtime = time + traveltime;
- controller.think = SUB_CalcMove_controller_think;
+ setthink(controller, SUB_CalcMove_controller_think);
controller.think1 = self.SUB_THINK;
// the thinking is now done by the controller
self.SUB_NEXTTHINK = self.SUB_LTIME + traveltime;
// invoke controller
- WITHSELF(controller, controller.think());
+ WITHSELF(controller, getthink(controller)());
}
void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func)
setorigin(this, this.origin);
setsize(this, this.mins, this.maxs);
this.cnt = 1;
- this.think = Ent_TriggerMusic_Think;
+ setthink(this, Ent_TriggerMusic_Think);
this.nextthink = time;
return true;
}
#ifdef SVQC
void delay_use(entity this, entity actor, entity trigger)
{
- this.think = SUB_UseTargets_self;
+ setthink(this, SUB_UseTargets_self);
this.nextthink = this.wait;
}
void delay_reset(entity this)
{
- this.think = func_null;
+ setthink(this, func_null);
this.nextthink = 0;
}
if(this.wait)
{
- this.think = adaptor_think2use;
+ setthink(this, adaptor_think2use);
this.nextthink = game_starttime + this.wait;
}
else
other.trigger_gravity_check.enemy = self;
other.trigger_gravity_check.owner = other;
other.trigger_gravity_check.gravity = other.gravity;
- other.trigger_gravity_check.think = trigger_gravity_check_think;
+ setthink(other.trigger_gravity_check, trigger_gravity_check_think);
other.trigger_gravity_check.nextthink = time;
other.trigger_gravity_check.count = 2;
if(other.gravity)
if (this.spawnflags & PUSH_ONCE)
{
settouch(this, func_null);
- this.think = SUB_Remove_self;
+ setthink(this, SUB_Remove_self);
this.nextthink = time;
}
#endif
this.use = monoflop_fixed_use;
else
this.use = monoflop_use;
- this.think = monoflop_think;
+ setthink(this, monoflop_think);
this.state = 0;
this.reset = monoflop_reset;
}
if (this.wait > 0)
{
- this.think = multi_wait;
+ setthink(this, multi_wait);
this.nextthink = time + this.wait;
}
else if (this.wait == 0)
this.takedamage = DAMAGE_YES;
this.solid = SOLID_BBOX;
}
- this.think = func_null;
+ setthink(this, func_null);
this.nextthink = 0;
this.team = this.team_saved;
}
this.state = 0;
this.use = multivibrator_toggle;
- this.think = multivibrator_send_think;
+ setthink(this, multivibrator_send_think);
this.nextthink = max(1, time);
IFTARGETED
//centerprint(other,"Entering swamp!\n");
other.swampslug = spawn();
other.swampslug.health = 2;
- other.swampslug.think = swampslug_think;
+ setthink(other.swampslug, swampslug_think);
other.swampslug.nextthink = time;
other.swampslug.owner = other;
other.swampslug.dmg = self.dmg;
Net_LinkEntity(this, false, 0, trigger_viewloc_send);
- this.think = viewloc_think;
+ setthink(this, viewloc_think);
this.nextthink = time;
}
this.cnt = point1;
this.count = point2;
- this.think = trigger_viewloc_updatelink;
+ setthink(this, trigger_viewloc_updatelink);
this.nextthink = time + 1; // we need to delay this or else
this.classname = "trigger_viewlocation";
// create a temp object to fire at a later time
entity t = new(DelayedUse);
t.nextthink = time + this.delay;
- t.think = DelayThink;
+ setthink(t, DelayThink);
t.enemy = actor;
t.message = this.message;
t.killtarget = this.killtarget;
spawnfunc(turret_checkpoint)
{
setorigin(this,this.origin);
- this.think = turret_checkpoint_init;
+ setthink(this, turret_checkpoint_init);
this.nextthink = time + 0.2;
}
{SELFPARAM();
self.effects |= EF_NODRAW;
self.nextthink = time + self.respawntime - 0.2;
- self.think = turret_respawn;
+ setthink(self, turret_respawn);
}
void turret_die()
// Setup respawn
self.SendFlags |= TNSF_STATUS;
self.nextthink = time + 0.2;
- self.think = turret_hide;
+ setthink(self, turret_hide);
tur.tr_death(tur, self);
}
this.tur_head.event_damage = func_null;
this.takedamage = DAMAGE_NO;
this.nextthink = time;
- this.think = turret_die;
+ setthink(this, turret_die);
}
this.SendFlags |= TNSF_STATUS;
self.ammo = self.ammo_max;
self.nextthink = time + self.ticrate;
- self.think = turret_think;
+ setthink(self, turret_think);
self.SendFlags = TNSF_FULL_UPDATE;
proj.realowner = self;
proj.bot_dodge = true;
proj.bot_dodgerating = self.shot_dmg;
- proj.think = turret_projectile_explode;
+ setthink(proj, turret_projectile_explode);
settouch(proj, turret_projectile_touch);
proj.nextthink = time + 9;
proj.movetype = MOVETYPE_FLYMISSILE;
void turret_link()
{SELFPARAM();
Net_LinkEntity(self, true, 0, turret_send);
- self.think = turret_think;
+ setthink(self, turret_think);
self.nextthink = time;
self.tur_head.effects = EF_NODRAW;
}
if(!e)
{
e = new(turret_manager);
- e.think = turrets_manager_think;
+ setthink(e, turrets_manager_think);
e.nextthink = time + 2;
}
entity proj = turret_projectile(SND_HAGAR_FIRE, 5, 0, DEATH_TURRET_FLAC.m_id, PROJECTILE_HAGAR, true, true);
proj.missile_flags = MIF_SPLASH | MIF_PROXY;
- proj.think = turret_flac_projectile_think_explode;
+ setthink(proj, turret_flac_projectile_think_explode);
proj.nextthink = time + actor.tur_impacttime + (random() * 0.01 - random() * 0.01);
Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
entity missile = turret_projectile(SND_ROCKET_FIRE, 6, 10, DEATH_TURRET_HELLION.m_id, PROJECTILE_ROCKET, false, false);
te_explosion (missile.origin);
- missile.think = turret_hellion_missile_think;
+ setthink(missile, turret_hellion_missile_think);
missile.nextthink = time;
missile.flags = FL_PROJECTILE;
missile.max_health = time + 9;
self.velocity = newdir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
if (itime < 0.05)
- self.think = turret_projectile_explode;
+ setthink(self, turret_projectile_explode);
UpdateCSQCProjectile(self);
}
entity missile = turret_projectile(SND_ROCKET_FIRE, 6, 10, DEATH_TURRET_HK.m_id, PROJECTILE_ROCKET, false, false);
te_explosion (missile.origin);
- missile.think = turret_hk_missile_think;
+ setthink(missile, turret_hk_missile_think);
missile.nextthink = time + 0.25;
missile.movetype = MOVETYPE_BOUNCEMISSILE;
missile.velocity = actor.tur_shotdir_updated * (actor.shot_speed * 0.75);
setmodel(beam, MDL_TUR_PHASER_BEAM);
beam.effects = EF_LOWPRECISION;
beam.solid = SOLID_NOT;
- beam.think = beam_think;
+ setthink(beam, beam_think);
beam.cnt = time + actor.shot_speed;
beam.shot_spread = time + 2;
beam.nextthink = time;
if (self.max_health < time)
{
- self.think = walker_rocket_explode;
+ setthink(self, walker_rocket_explode);
self.nextthink = time;
return;
}
if (self.max_health < time)
{
- self.think = walker_rocket_explode;
+ setthink(self, walker_rocket_explode);
return;
}
if(vdist(self.origin - self.tur_shotorg, <, 100))
{
- self.think = walker_rocket_think;
+ setthink(self, walker_rocket_think);
return;
}
if (self.max_health < time)
{
- self.think = walker_rocket_explode;
+ setthink(self, walker_rocket_explode);
return;
}
if(vdist(self.origin - self.tur_shotorg, <, 100))
{
self.tur_shotorg = self.origin - '0 0 200';
- self.think = walker_rocket_loop3;
+ setthink(self, walker_rocket_loop3);
return;
}
{SELFPARAM();
self.nextthink = time;
self.tur_shotorg = self.origin + '0 0 300';
- self.think = walker_rocket_loop2;
+ setthink(self, walker_rocket_loop2);
self.shot_dmg = 1337;
}
rocket.enemy = self.enemy;
if (random() < 0.01)
- rocket.think = walker_rocket_loop;
+ setthink(rocket, walker_rocket_loop);
else
- rocket.think = walker_rocket_think;
+ setthink(rocket, walker_rocket_think);
rocket.event_damage = walker_rocket_damage;
if(self.cnt)
if(self.cnt < time)
{
- self.think = SUB_Remove;
+ setthink(self, SUB_Remove);
self.nextthink = time;
return;
}
setmodel(err, MDL_MARKER);
setorigin(err,where);
err.movetype = MOVETYPE_NONE;
- err.think = marker_think;
+ setthink(err, marker_think);
err.nextthink = time;
err.skin = 0;
if(lifetime)
setmodel(err, MDL_MARKER);
setorigin(err,where);
err.movetype = MOVETYPE_NONE;
- err.think = marker_think;
+ setthink(err, marker_think);
err.nextthink = time;
err.skin = 1;
if(lifetime)
setmodel(err, MDL_MARKER);
setorigin(err,where);
err.movetype = MOVETYPE_NONE;
- err.think = marker_think;
+ setthink(err, marker_think);
err.nextthink = time;
err.skin = 3;
if(lifetime)
{
this.takedamage = DAMAGE_NO;
this.event_damage = func_null;
- this.think = adaptor_think2use;
+ setthink(this, adaptor_think2use);
this.nextthink = time;
}
}
proj.use = vehicles_projectile_explode_use;
proj.owner = this;
proj.realowner = _owner;
- proj.think = SUB_Remove_self;
+ setthink(proj, SUB_Remove_self);
proj.nextthink = time + 30;
if(_health)
if(_explode)
{
- _gib.think = vehicles_gib_explode;
+ setthink(_gib, vehicles_gib_explode);
_gib.nextthink = time + random() * _explode;
settouch(_gib, vehicles_gib_explode);
}
else
{
_gib.cnt = time + _maxtime;
- _gib.think = vehicles_gib_think;
+ setthink(_gib, vehicles_gib_think);
_gib.nextthink = time + _maxtime - 1;
_gib.alpha = 1;
}
if(ret.wp00 == veh)
{
ret.classname = "";
- ret.think = SUB_Remove_self;
+ setthink(ret, SUB_Remove_self);
ret.nextthink = time + 0.1;
if(ret.waypointsprite_attached)
{SELFPARAM();
Send_Effect(EFFECT_TELEPORT, self.wp00.origin + '0 0 64', '0 0 0', 1);
- self.wp00.think = vehicles_spawn;
+ setthink(self.wp00, vehicles_spawn);
self.wp00.nextthink = time;
if(self.waypointsprite_attached)
if(ent.cnt)
{
- ent.think = vehicles_return;
+ setthink(ent, vehicles_return);
ent.nextthink = ent.cnt;
}
else
{
- ent.think = vehicles_return;
+ setthink(ent, vehicles_return);
ent.nextthink = time + 1;
ent = spawn();
setorigin(ent, this.wp00.pos1);
ent.nextthink = time + 5;
- ent.think = vehicles_showwp_goaway;
+ setthink(ent, vehicles_showwp_goaway);
}
if(teamplay && ent.team)
ret = new(vehicle_return);
ret.wp00 = veh;
ret.team = veh.team;
- ret.think = vehicles_showwp;
+ setthink(ret, vehicles_showwp);
if(IS_DEAD(veh))
{
LOG_TRACE("Respawning vehicle: ", this.netname, "\n");
if(this.effects & EF_NODRAW)
{
- this.think = vehicles_spawn;
+ setthink(this, vehicles_spawn);
this.nextthink = time + 3;
}
else
setattachment(this.vehicle_shieldent, this, "");
setorigin(this.vehicle_shieldent, real_origin(this) - this.origin);
this.vehicle_shieldent.scale = 256 / vlen(this.maxs - this.mins);
- this.vehicle_shieldent.think = shieldhit_think;
+ setthink(this.vehicle_shieldent, shieldhit_think);
}
this.vehicle_shieldent.colormod = '1 1 1';
self.flags = FL_NOTARGET;
self.avelocity = '0 0 0';
self.velocity = '0 0 0';
- self.think = vehicles_think;
+ setthink(self, vehicles_think);
self.nextthink = time;
// Reset locking
this.PlayerPhysplug = info.PlayerPhysplug;
this.event_damage = func_null;
settouch(this, vehicles_touch);
- this.think = vehicles_spawn;
+ setthink(this, vehicles_spawn);
this.nextthink = time;
this.effects = EF_NODRAW;
this.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID;
self.angles_z *= 0.95;
if(hgt < 16)
- self.think = vehicles_think;
+ setthink(self, vehicles_think);
self.nextthink = time;
if(!IS_DEAD(self))
{
- self.think = bumblebee_land;
+ setthink(self, bumblebee_land);
self.nextthink = time;
}
void bumblebee_diethink()
{SELFPARAM();
if(time >= self.wait)
- self.think = bumblebee_blowup;
+ setthink(self, bumblebee_blowup);
if(random() < 0.1)
{
else
settouch(_body, func_null);
- _body.think = bumblebee_diethink;
+ setthink(_body, bumblebee_diethink);
_body.nextthink = time;
_body.wait = time + 2 + (random() * 8);
_body.owner = instance;
setattachment(self.vehicle_shieldent, self, "");
setorigin(self.vehicle_shieldent, real_origin(self) - self.origin);
self.vehicle_shieldent.scale = 512 / vlen(self.maxs - self.mins);
- self.vehicle_shieldent.think = shieldhit_think;
+ setthink(self.vehicle_shieldent, shieldhit_think);
self.vehicle_shieldent.alpha = -1;
self.vehicle_shieldent.effects = EF_LOWPRECISION | EF_NODRAW;
{SELFPARAM();
vector spot;
- self.think = racer_think;
+ setthink(self, racer_think);
self.nextthink = time;
self.movetype = MOVETYPE_BOUNCE;
sound (self.tur_head, CH_TRIGGER_SINGLE, SND_Null, VOL_VEHICLEENGINE, ATTEN_NORM);
DEATH_VH_WAKI_DEATH.m_id, world);
self.nextthink = time + autocvar_g_vehicle_racer_respawntime;
- self.think = vehicles_spawn;
+ setthink(self, vehicles_spawn);
self.movetype = MOVETYPE_NONE;
self.effects = EF_NODRAW;
self.solid = SOLID_NOT;
self.mass = 900;
}
- self.think = racer_think;
+ setthink(self, racer_think);
self.nextthink = time;
self.vehicle_health = autocvar_g_vehicle_racer_health;
self.vehicle_shield = autocvar_g_vehicle_racer_shield;
instance.velocity += '0 0 700';
instance.colormod = '-0.5 -0.5 -0.5';
- instance.think = racer_blowup_think;
+ setthink(instance, racer_blowup_think);
instance.nextthink = time;
#endif
}
rocket.cnt = time + 15;
if(trg)
- rocket.think = racer_rocket_tracker;
+ setthink(rocket, racer_rocket_tracker);
else
- rocket.think = racer_rocket_groundhugger;
+ setthink(rocket, racer_rocket_groundhugger);
}
void racer_rocket_tracker()
{
//bprint("Target lost!\n");
//dprint("OF:", ftos(vlen(newdir - v_forward)), "\n");
- self.think = racer_rocket_groundhugger;
+ setthink(self, racer_rocket_groundhugger);
return;
}
if(hgt < 16)
{
self.movetype = MOVETYPE_TOSS;
- self.think = vehicles_think;
+ setthink(self, vehicles_think);
self.frame = 0;
}
if(!IS_DEAD(self))
{
- self.think = raptor_land;
+ setthink(self, raptor_land);
self.nextthink = time;
}
void raptor_diethink()
{SELFPARAM();
if(time >= self.wait)
- self.think = raptor_blowup;
+ setthink(self, raptor_blowup);
if(random() < 0.05)
{
instance.takedamage = DAMAGE_NO;
instance.deadflag = DEAD_DYING;
instance.movetype = MOVETYPE_BOUNCE;
- instance.think = raptor_diethink;
+ setthink(instance, raptor_diethink);
instance.nextthink = time;
instance.wait = time + 5 + (random() * 5);
self.bomb1.gun2 = spinner;
// Sigh.
- self.bomb1.think = raptor_rotor_anglefix;
+ setthink(self.bomb1, raptor_rotor_anglefix);
self.bomb1.nextthink = time;
self.mass = 1 ;
_flare.movetype = MOVETYPE_TOSS;
_flare.gravity = 0.15;
_flare.velocity = 0.25 * actor.velocity + (v_forward + randomvec() * 0.25)* -500;
- _flare.think = raptor_flare_think;
+ setthink(_flare, raptor_flare_think);
_flare.nextthink = time;
_flare.owner = veh ? veh : player;
_flare.solid = SOLID_CORPSE;
return;
PROJECTILE_TOUCH;
- self.think = raptor_bomblet_boom;
+ setthink(self, raptor_bomblet_boom);
self.nextthink = time + random() * autocvar_g_vehicle_raptor_bomblet_explode_delay;
}
bomblet.movetype = MOVETYPE_TOSS;
settouch(bomblet, raptor_bomblet_touch);
- bomblet.think = raptor_bomblet_boom;
+ setthink(bomblet, raptor_bomblet_boom);
bomblet.nextthink = time + 5;
bomblet.owner = self.owner;
bomblet.realowner = self.realowner;
bomb_1.velocity = bomb_2.velocity = self.velocity;
settouch(bomb_1, raptor_bomb_burst);
settouch(bomb_2, raptor_bomb_burst);
- bomb_1.think = bomb_2.think = raptor_bomb_burst;
+ setthink(bomb_1, raptor_bomb_burst);
+ setthink(bomb_2, raptor_bomb_burst);
bomb_1.cnt = bomb_2.cnt = time + 10;
if(autocvar_g_vehicle_raptor_bomblet_alt)
e = e.chain;
}
- self.think = vehicles_think;
+ setthink(self, vehicles_think);
self.nextthink = time;
self.frame = 5;
self.movetype = MOVETYPE_WALK;
void spiderbot_headfade()
{SELFPARAM();
- self.think = spiderbot_headfade;
+ setthink(self, spiderbot_headfade);
self.nextthink = self.fade_time;
self.alpha = 1 - (time - self.fade_time) * self.fade_rate;
h.cnt = time + (3.5 * random());
h.fade_rate = 1 / min(self.respawntime, 10);
h.fade_time = time;
- h.think = spiderbot_headfade;
+ setthink(h, spiderbot_headfade);
h.nextthink = time;
org = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_hardpoint01"));
instance.takedamage = DAMAGE_NO;
settouch(instance, func_null);
instance.cnt = 3.4 + time + random() * 2;
- instance.think = spiderbot_blowup;
+ setthink(instance, spiderbot_blowup);
instance.nextthink = time;
instance.deadflag = DEAD_DYING;
instance.frame = 5;
self.nextthink = time;
if(!self.realowner.vehicle)
- self.think = spiderbot_rocket_unguided;
+ setthink(self, spiderbot_rocket_unguided);
crosshair_trace(self.realowner);
olddir = normalize(self.velocity);
crosshair_trace(this.owner);
while(rkt)
{
- if(rkt.think == spiderbot_rocket_guided)
+ if(getthink(rkt) == spiderbot_rocket_guided)
{
rkt.pos1 = trace_endpos;
- rkt.think = spiderbot_rocket_unguided;
+ setthink(rkt, spiderbot_rocket_unguided);
}
rkt = rkt.chain;
}
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);
- rocket.think = vehicles_projectile_explode;
+ setthink(rocket, vehicles_projectile_explode);
if(PHYS_INPUT_BUTTON_ATCK2(this.owner) && this.tur_head.frame == 1)
this.wait = -10;
crosshair_trace(this.owner);
rocket.pos1 = trace_endpos;
rocket.nextthink = time;
- rocket.think = spiderbot_rocket_guided;
+ setthink(rocket, spiderbot_rocket_guided);
break;
STATIC_INIT_LATE(W_PROP_reloader)
{
entity e = W_PROP_reloader = new_pure(W_PROP_reloader);
- WITHSELF(e, (e.think = W_PROP_think)());
+ WITHSELF(e, (setthink(e, W_PROP_think))());
}
#endif
this.angles = vectoangles(this.velocity);
if(this.health <= 0)
- W_PrepareExplosionByDamage(this, attacker, this.think);
+ W_PrepareExplosionByDamage(this, attacker, getthink(this));
}
void W_Arc_Bolt_Touch()
settouch(missile, W_Arc_Bolt_Touch);
missile.use = W_Arc_Bolt_Explode_use;
- missile.think = adaptor_think2use_hittype_splash;
+ setthink(missile, adaptor_think2use_hittype_splash);
missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime);
PROJECTILE_MAKETRIGGER(missile);
missile.projectiledeathtype = WEP_ARC.m_id | HITTYPE_SECONDARY;
entity beam = self.arc_beam = new(W_Arc_Beam);
beam.solid = SOLID_NOT;
- beam.think = W_Arc_Beam_Think;
+ setthink(beam, W_Arc_Beam_Think);
beam.owner = self;
beam.movetype = MOVETYPE_NONE;
beam.bot_dodge = true;
beam.beam_bursting = burst;
Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
- WITHSELF(beam, beam.think());
+ WITHSELF(beam, getthink(beam)());
}
void Arc_Smoke()
void W_Blaster_Think()
{SELFPARAM();
this.movetype = MOVETYPE_FLY;
- this.think = SUB_Remove_self;
+ setthink(this, SUB_Remove_self);
this.nextthink = time + this.blaster_lifetime;
CSQCProjectile(this, true, PROJECTILE_BLASTER, true);
}
missile.flags = FL_PROJECTILE;
missile.missile_flags = MIF_SPLASH;
missile.projectiledeathtype = atk_deathtype;
- missile.think = W_Blaster_Think;
+ setthink(missile, W_Blaster_Think);
missile.nextthink = time + atk_delay;
MUTATOR_CALLHOOK(EditProjectile, actor, missile);
if (time >= missile.nextthink)
{
- WITHSELF(missile, missile.think());
+ WITHSELF(missile, getthink(missile)());
}
}
W_SetupProjVelocity_Explicit(proj, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_PRI(crylink, speed), 0, 0, 0, false);
settouch(proj, W_Crylink_Touch);
- proj.think = W_Crylink_Fadethink;
+ setthink(proj, W_Crylink_Fadethink);
if(counter == 0)
{
proj.fade_time = time + WEP_CVAR_PRI(crylink, middle_lifetime);
W_SetupProjVelocity_Explicit(proj, s, v_up, WEP_CVAR_SEC(crylink, speed), 0, 0, 0, false);
settouch(proj, W_Crylink_Touch);
- proj.think = W_Crylink_Fadethink;
+ setthink(proj, W_Crylink_Fadethink);
if(counter == (shots - 1) / 2)
{
proj.fade_time = time + WEP_CVAR_SEC(crylink, middle_lifetime);
pos = W_Crylink_LinkJoin(actor.crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed));
linkjoineffect = new(linkjoineffect);
- linkjoineffect.think = W_Crylink_LinkJoinEffect_Think;
+ setthink(linkjoineffect, W_Crylink_LinkJoinEffect_Think);
linkjoineffect.nextthink = time + w_crylink_linkjoin_time;
linkjoineffect.owner = actor;
setorigin(linkjoineffect, pos);
missile.angles = vectoangles(missile.velocity);
settouch(missile, W_Devastator_Touch);
- missile.think = W_Devastator_Think;
+ setthink(missile, W_Devastator_Think);
missile.nextthink = time;
missile.cnt = time + WEP_CVAR(devastator, lifetime);
missile.flags = FL_PROJECTILE;
e.classname = "electro_orb_chain";
// now set the next one to trigger as well
- e.think = W_Electro_ExplodeCombo;
+ setthink(e, W_Electro_ExplodeCombo);
// delay combo chains, looks cooler
e.nextthink =
e.classname = "electro_orb_chain";
// now set the next one to trigger as well
- e.think = W_Electro_ExplodeCombo;
+ setthink(e, W_Electro_ExplodeCombo);
// delay combo chains, looks cooler
e.nextthink =
proj.bot_dodge = true;
proj.bot_dodgerating = WEP_CVAR_PRI(electro, damage);
proj.use = W_Electro_Explode_use;
- proj.think = W_Electro_Bolt_Think;
+ setthink(proj, W_Electro_Bolt_Think);
proj.nextthink = time;
proj.ltime = time + WEP_CVAR_PRI(electro, lifetime);
PROJECTILE_MAKETRIGGER(proj);
// change owner to whoever caused the combo explosion
this.realowner = inflictor.realowner;
this.classname = "electro_orb_chain";
- this.think = W_Electro_ExplodeCombo;
+ setthink(this, W_Electro_ExplodeCombo);
this.nextthink = time +
(
// bound the length, inflictor may be in a galaxy far far away (warpzones)
else
{
this.use = W_Electro_Explode_use;
- this.think = adaptor_think2use; // not _hittype_splash, as this runs "immediately"
+ setthink(this, adaptor_think2use); // not _hittype_splash, as this runs "immediately"
}
}
}
entity proj = new(electro_orb);
proj.owner = proj.realowner = self;
proj.use = W_Electro_Explode_use;
- proj.think = adaptor_think2use_hittype_splash;
+ setthink(proj, adaptor_think2use_hittype_splash);
proj.bot_dodge = true;
proj.bot_dodgerating = WEP_CVAR_SEC(electro, damage);
proj.nextthink = time + WEP_CVAR_SEC(electro, lifetime);
proj.bot_dodgerating = WEP_CVAR_PRI(fireball, damage);
proj.pushltime = time + WEP_CVAR_PRI(fireball, lifetime);
proj.use = W_Fireball_Explode_use;
- proj.think = W_Fireball_Think;
+ setthink(proj, W_Fireball_Think);
proj.nextthink = time;
proj.health = WEP_CVAR_PRI(fireball, health);
proj.team = self.team;
PROJECTILE_MAKETRIGGER(proj);
setsize(proj, '-4 -4 -4', '4 4 4');
setorigin(proj, w_shotorg);
- proj.think = W_Fireball_Firemine_Think;
+ setthink(proj, W_Fireball_Firemine_Think);
proj.nextthink = time;
proj.damageforcescale = WEP_CVAR_SEC(fireball, damageforcescale);
proj.pushltime = time + WEP_CVAR_SEC(fireball, lifetime);
this.angles = vectoangles(this.velocity);
if(this.health <= 0)
- W_PrepareExplosionByDamage(this, attacker, this.think);
+ W_PrepareExplosionByDamage(this, attacker, getthink(this));
}
void W_Hagar_Touch()
settouch(missile, W_Hagar_Touch);
missile.use = W_Hagar_Explode_use;
- missile.think = adaptor_think2use_hittype_splash;
+ setthink(missile, adaptor_think2use_hittype_splash);
missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime);
PROJECTILE_MAKETRIGGER(missile);
missile.projectiledeathtype = WEP_HAGAR.m_id;
settouch(missile, W_Hagar_Touch2);
missile.cnt = 0;
missile.use = W_Hagar_Explode2_use;
- missile.think = adaptor_think2use_hittype_splash;
+ setthink(missile, adaptor_think2use_hittype_splash);
missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
PROJECTILE_MAKETRIGGER(missile);
missile.projectiledeathtype = WEP_HAGAR.m_id | HITTYPE_SECONDARY;
settouch(missile, W_Hagar_Touch); // not bouncy
missile.use = W_Hagar_Explode2_use;
- missile.think = adaptor_think2use_hittype_splash;
+ setthink(missile, adaptor_think2use_hittype_splash);
missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
PROJECTILE_MAKETRIGGER(missile);
missile.projectiledeathtype = WEP_HAGAR.m_id | HITTYPE_SECONDARY;
//missile.angles = vectoangles(missile.velocity); // csqc
settouch(missile, W_HLAC_Touch);
- missile.think = SUB_Remove_self;
+ setthink(missile, SUB_Remove_self);
missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
//missile.angles = vectoangles(missile.velocity); // csqc
settouch(missile, W_HLAC_Touch);
- missile.think = SUB_Remove_self;
+ setthink(missile, SUB_Remove_self);
missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
settouch(self, func_null);
self.effects |= EF_NODRAW;
- self.think = W_Hook_ExplodeThink;
+ setthink(self, W_Hook_ExplodeThink);
self.nextthink = time;
self.dmg = WEP_CVAR_SEC(hook, damage);
self.dmg_edge = WEP_CVAR_SEC(hook, edgedamage);
setsize(gren, '0 0 0', '0 0 0');
gren.nextthink = time + WEP_CVAR_SEC(hook, lifetime);
- gren.think = adaptor_think2use_hittype_splash;
+ setthink(gren, adaptor_think2use_hittype_splash);
gren.use = W_Hook_Explode2_use;
settouch(gren, W_Hook_Touch2);
if(this.alpha <= 0)
{
- this.think = SUB_Remove_self;
+ setthink(this, SUB_Remove_self);
this.nextthink = time;
this.realowner.muzzle_flash = world;
return;
setmodel(self.muzzle_flash, MDL_MACHINEGUN_MUZZLEFLASH); // precision set below
self.muzzle_flash.scale = 0.75;
- self.muzzle_flash.think = W_MachineGun_MuzzleFlash_Think;
+ setthink(self.muzzle_flash, W_MachineGun_MuzzleFlash_Think);
self.muzzle_flash.nextthink = time + 0.02;
self.muzzle_flash.frame = 2;
self.muzzle_flash.alpha = 0.75;
newmine.mine_time = self.mine_time;
settouch(newmine, func_null);
- newmine.think = W_MineLayer_Think;
+ setthink(newmine, W_MineLayer_Think);
newmine.nextthink = time;
newmine.cnt = self.cnt;
newmine.flags = self.flags;
mine.angles = vectoangles(mine.velocity);
settouch(mine, W_MineLayer_Touch);
- mine.think = W_MineLayer_Think;
+ setthink(mine, W_MineLayer_Think);
mine.nextthink = time;
mine.cnt = (WEP_CVAR(minelayer, lifetime) - WEP_CVAR(minelayer, lifetime_countdown));
mine.flags = FL_PROJECTILE;
gren.cnt = time + WEP_CVAR_PRI(mortar, lifetime);
gren.nextthink = time;
- gren.think = W_Mortar_Grenade_Think1;
+ setthink(gren, W_Mortar_Grenade_Think1);
gren.use = W_Mortar_Grenade_Explode_use;
settouch(gren, W_Mortar_Grenade_Touch1);
setsize(gren, '-3 -3 -3', '3 3 3');
gren.nextthink = time + WEP_CVAR_SEC(mortar, lifetime);
- gren.think = adaptor_think2use_hittype_splash;
+ setthink(gren, adaptor_think2use_hittype_splash);
gren.use = W_Mortar_Grenade_Explode2_use;
settouch(gren, W_Mortar_Grenade_Touch2);
setsize(gren, '0 0 0', '0 0 0');
gren.nextthink = time + WEP_CVAR_BOTH(porto, (type <= 0), lifetime);
- gren.think = W_Porto_Think;
+ setthink(gren, W_Porto_Think);
settouch(gren, W_Porto_Touch);
if(self.items & ITEM_Strength.m_itemid)
missile.bot_dodge = true;
missile.bot_dodgerating = WEP_CVAR(seeker, missile_damage);
- missile.think = W_Seeker_Missile_Think;
+ setthink(missile, W_Seeker_Missile_Think);
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.bot_dodgerating = WEP_CVAR(seeker, flac_damage);
settouch(missile, W_Seeker_Flac_Explode);
missile.use = W_Seeker_Flac_Explode_use;
- missile.think = adaptor_think2use_hittype_splash;
+ setthink(missile, adaptor_think2use_hittype_splash);
missile.nextthink = time + WEP_CVAR(seeker, flac_lifetime) + WEP_CVAR(seeker, flac_lifetime_rand);
missile.solid = SOLID_BBOX;
missile.movetype = MOVETYPE_FLY;
{
e.tag_target = other;
e.tag_time = time;
- e.think = W_Seeker_Tracker_Think;
+ setthink(e, W_Seeker_Tracker_Think);
}
else
{
e.enemy = other;
- e.think = W_Seeker_Vollycontroller_Think;
+ setthink(e, W_Seeker_Vollycontroller_Think);
}
e.nextthink = time;
missile.bot_dodge = true;
missile.bot_dodgerating = 50;
settouch(missile, W_Seeker_Tag_Touch);
- missile.think = SUB_Remove_self;
+ setthink(missile, SUB_Remove_self);
missile.nextthink = time + WEP_CVAR(seeker, tag_lifetime);
missile.movetype = MOVETYPE_FLY;
missile.solid = SOLID_BBOX;
entity meleetemp = new_pure(meleetemp);
meleetemp.owner = meleetemp.realowner = actor;
- meleetemp.think = W_Shockwave_Melee_Think;
+ setthink(meleetemp, W_Shockwave_Melee_Think);
meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor();
W_SetupShot_Range(actor, true, 0, SND_Null, 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
}
// muzzle flash for 1st person view
flash = spawn();
setmodel(flash, MDL_SHOTGUN_MUZZLEFLASH); // precision set below
- flash.think = SUB_Remove_self;
+ setthink(flash, SUB_Remove_self);
flash.nextthink = time + 0.06;
flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
W_AttachToShotorg(self, flash, '5 0 0');
entity meleetemp = new_pure(meleetemp);
meleetemp.realowner = actor;
- meleetemp.think = W_Shotgun_Melee_Think;
+ setthink(meleetemp, W_Shotgun_Melee_Think);
meleetemp.nextthink = time + WEP_CVAR_SEC(shotgun, melee_delay) * W_WeaponRateFactor();
W_SetupShot_Range(actor, true, 0, SND_Null, 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range));
}
self.tuba_note.owner = self.tuba_note.realowner = self;
self.tuba_note.cnt = n;
self.tuba_note.tuba_instrument = self.tuba_instrument;
- self.tuba_note.think = W_Tuba_NoteThink;
+ setthink(self.tuba_note, W_Tuba_NoteThink);
self.tuba_note.nextthink = time;
self.tuba_note.spawnshieldtime = time;
Net_LinkEntity(self.tuba_note, false, 0, W_Tuba_NoteSendEntity);
}
}
- this.think = Ent_TubaNote_StopSound_self;
+ setthink(this, Ent_TubaNote_StopSound_self);
this.entremove = Ent_TubaNote_StopSound;
- this.enemy.think = Ent_TubaNote_Think;
+ setthink(this.enemy, Ent_TubaNote_Think);
this.enemy.nextthink = time + 10;
if (upd) {
NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew)
{
Net_Accept(vortex_beam);
- this.think = SUB_Remove_self;
+ setthink(this, SUB_Remove_self);
this.nextthink = time + bound(0, autocvar_cl_vaporizerbeam_lifetime, 10);
this.draw = VaporizerBeam_Draw;
this.drawmask = MASK_NORMAL;
proj.bot_dodge = true;
proj.bot_dodgerating = autocvar_g_rm_laser_damage;
proj.use = W_RocketMinsta_Laser_Explode_use;
- proj.think = adaptor_think2use_hittype_splash;
+ setthink(proj, adaptor_think2use_hittype_splash);
proj.nextthink = time + autocvar_g_rm_laser_lifetime;
PROJECTILE_MAKETRIGGER(proj);
proj.projectiledeathtype = WEP_ELECTRO.m_id;
proj.bot_dodge = true;
proj.bot_dodgerating = autocvar_g_rm_laser_damage;
proj.use = W_RocketMinsta_Laser_Explode_use;
- proj.think = adaptor_think2use_hittype_splash;
+ setthink(proj, adaptor_think2use_hittype_splash);
proj.nextthink = time + autocvar_g_rm_laser_lifetime;
PROJECTILE_MAKETRIGGER(proj);
proj.projectiledeathtype = WEP_ELECTRO.m_id;
entityclass(Defer);
class(Defer).entity owner;
- class(Defer).void() think;
- class(Defer).float nextthink;
class(Defer).void(entity) defer_func;
/** Remove self */
void defer_think()
{
SELFPARAM();
- this.think = SUB_Remove_self;
+ setthink(this, SUB_Remove_self);
this.nextthink = time;
this.defer_func(this.owner);
}
entity e = new_pure(deferred);
e.owner = this;
e.defer_func = func;
- e.think = defer_think;
+ setthink(e, defer_think);
e.nextthink = time + fdelay;
}
if (dt)
{
e.nextthink = time + dt;
- e.think = SUB_Remove_self;
+ setthink(e, SUB_Remove_self);
}
}
(0, (e).__##T)
SELFWRAP(think, void, (entity this), (this))
-#define setthink(e, f) SELFWRAP_SET(think, e, f)
+#define setthink(e, f) _SELFWRAP_SET(think, e, f)
+#define getthink(e) _SELFWRAP_GET(think, e)
SELFWRAP(touch, void, (entity this), (this))
#define settouch(e, f) _SELFWRAP_SET(touch, e, f)
{
me.WarpZone_refsys = new(warpzone_refsys);
me.WarpZone_refsys.owner = me;
- me.WarpZone_refsys.think = WarpZone_RefSys_GC;
+ setthink(me.WarpZone_refsys, WarpZone_RefSys_GC);
me.WarpZone_refsys.nextthink = time + 1;
WarpZone_Accumulator_Clear(me.WarpZone_refsys);
}
ts.SendEntity3 = WarpZone_Teleported_Send;
ts.SendFlags = 0xFFFFFF;
ts.drawonlytoclient = player;
- ts.think = SUB_Remove_self;
+ setthink(ts, SUB_Remove_self);
ts.nextthink = time + 1;
ts.owner = player;
ts.enemy = wz;
this.SendFlags = 0xFFFFFF;
if(this.spawnflags & 1)
{
- this.think = WarpZoneCamera_Think;
+ setthink(this, WarpZoneCamera_Think);
this.nextthink = time;
}
else
this.SendFlags = 0xFFFFFF;
if(this.spawnflags & 1)
{
- this.think = WarpZone_Think;
+ setthink(this, WarpZone_Think);
this.nextthink = time;
}
else
if (!(wp.wpflags & WAYPOINTFLAG_NORELINK))
waypoint_clearlinks(wp);
// schedule an actual relink on next frame
- wp.think = waypoint_think;
+ setthink(wp, waypoint_think);
wp.nextthink = time;
wp.effects = EF_LOWPRECISION;
}
case "dragbox_spawn": {
IS_CHEAT(this, 0, argc, 0);
entity e = new(dragbox_box);
- e.think = DragBox_Think;
+ setthink(e, DragBox_Think);
e.nextthink = time;
e.solid = -1; // black
setmodel(e, MDL_Null); // network it
case "dragpoint_spawn": {
IS_CHEAT(this, 0, argc, 0);
entity e = new(dragpoint);
- e.think = DragBox_Think;
+ setthink(e, DragBox_Think);
e.nextthink = time;
e.solid = 0; // nothing special
setmodel(e, MDL_MARKER);
this.superweapons_finished = 0;
this.pushltime = 0;
this.istypefrag = 0;
- this.think = func_null;
+ setthink(this, func_null);
this.nextthink = 0;
this.hook_time = 0;
this.deadflag = DEAD_NO;
this.pain_frame = 0;
this.pain_finished = 0;
this.pushltime = 0;
- this.think = func_null; // players have no think function
+ setthink(this, func_null); // players have no think function
this.nextthink = 0;
this.dmg_team = 0;
this.ballistics_density = autocvar_g_ballistics_density_player;
void ClientInit_Spawn()
{
entity e = new_pure(clientinit);
- e.think = ClientInit_CheckUpdate;
+ setthink(e, ClientInit_CheckUpdate);
Net_LinkEntity(e, false, 0, ClientInit_SendEntity);
WITHSELF(e, ClientInit_CheckUpdate());
this.killindicator.scale = 0.5;
setattachment(this.killindicator, this, "");
setorigin(this.killindicator, '0 0 52');
- this.killindicator.think = KillIndicator_Think;
+ setthink(this.killindicator, KillIndicator_Think);
this.killindicator.nextthink = starttime + (this.lip) * 0.05;
clientkilltime = max(clientkilltime, this.killindicator.nextthink + 0.05);
this.killindicator.cnt = ceil(killtime);
e.killindicator.scale = 0.5;
setattachment(e.killindicator, e, "");
setorigin(e.killindicator, '0 0 52');
- e.killindicator.think = KillIndicator_Think;
+ setthink(e.killindicator, KillIndicator_Think);
e.killindicator.nextthink = starttime + (e.lip) * 0.05;
clientkilltime = max(clientkilltime, e.killindicator.nextthink + 0.05);
e.killindicator.cnt = ceil(killtime);
this.chatbubbleentity = new(chatbubbleentity);
this.chatbubbleentity.owner = this;
this.chatbubbleentity.exteriormodeltoclient = this;
- this.chatbubbleentity.think = ChatBubbleThink;
+ setthink(this.chatbubbleentity, ChatBubbleThink);
this.chatbubbleentity.nextthink = time;
setmodel(this.chatbubbleentity, MDL_CHAT); // precision set below
//setorigin(this.chatbubbleentity, this.origin + '0 0 15' + this.maxs_z * '0 0 1');
if(wasfreed(this))
return;
this.CopyBody_nextthink = this.nextthink;
- this.CopyBody_think = this.think;
- this.think = CopyBody_Think;
+ this.CopyBody_think = getthink(this);
+ setthink(this, CopyBody_Think);
}
CSQCMODEL_AUTOUPDATE(this);
this.nextthink = time;
CSQCMODEL_AUTOINIT(clone);
clone.CopyBody_nextthink = this.nextthink;
- clone.CopyBody_think = this.think;
+ clone.CopyBody_think = getthink(this);
clone.nextthink = time;
- clone.think = CopyBody_Think;
+ setthink(clone, CopyBody_Think);
// "bake" the current animation frame for clones (they don't get clientside animation)
animdecide_load_if_needed(clone);
animdecide_setframes(clone, false, frame, frame1time, frame2, frame2time);
// set up to fade out later
SUB_SetFade (this, time + 6 + random (), 1);
// reset body think wrapper broken by SUB_SetFade
- if(this.classname == "body" && this.think != CopyBody_Think) {
- this.CopyBody_think = this.think;
+ if(this.classname == "body" && getthink(this) != CopyBody_Think) {
+ this.CopyBody_think = getthink(this);
this.CopyBody_nextthink = this.nextthink;
- this.think = CopyBody_Think;
+ setthink(this, CopyBody_Think);
this.nextthink = time;
}
timeout_leadtime = autocvar_sv_timeout_leadtime;
timeout_handler = spawn();
- timeout_handler.think = timeout_handler_think;
+ setthink(timeout_handler, timeout_handler_think);
timeout_handler.nextthink = time; // always let the entity think asap
Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_TIMEOUT);
if (!radarmapper)
{
radarmapper = new(radarmapper);
- radarmapper.think = RadarMap_Think;
+ setthink(radarmapper, RadarMap_Think);
radarmapper.nextthink = time;
radarmapper.count = 8; // default to the --trace method, as it is faster now
radarmapper.ltime = 1;
}
else
{
- self.think = make_mapinfo_Think;
+ setthink(self, make_mapinfo_Think);
self.nextthink = time;
}
}
entity tmp_entity;
tmp_entity = new(make_mapinfo);
- tmp_entity.think = make_mapinfo_Think;
+ setthink(tmp_entity, make_mapinfo_Think);
tmp_entity.nextthink = time;
MapInfo_Enumerate();
return;
if (autocvar_sv_ready_restart_after_countdown)
{
entity restart_timer = new_pure(restart_timer);
- restart_timer.think = ReadyRestart_think;
+ setthink(restart_timer, ReadyRestart_think);
restart_timer.nextthink = game_starttime;
}
entity ice = new(ice);
ice.owner = targ;
ice.scale = targ.scale;
- ice.think = Ice_Think;
+ setthink(ice, Ice_Think);
ice.nextthink = time;
ice.frame = floor(random() * 21); // ice model has 20 different looking frames
setmodel(ice, MDL_ICE);
farcent.origin = hitloc;
farcent.forcetype = FORCETYPE_FORCEATPOS;
farcent.nextthink = time + 0.1;
- farcent.think = SUB_Remove_self;
+ setthink(farcent, SUB_Remove_self);
}
else
{
{
// print("adding a fire burner to ", e.classname, "\n");
e.fire_burner = new(fireburner);
- e.fire_burner.think = fireburner_think;
+ setthink(e.fire_burner, fireburner_think);
e.fire_burner.nextthink = time;
e.fire_burner.owner = e;
}
sound (self, CH_SHOTS, SND_HOOK_IMPACT, VOL_BASE, ATTEN_NORM);
self.state = 1;
- self.think = GrapplingHookThink;
+ setthink(self, GrapplingHookThink);
self.nextthink = time;
settouch(self, func_null);
self.velocity = '0 0 0';
//missile.glow_color = 250; // 244, 250
//missile.glow_size = 120;
settouch(missile, GrapplingHookTouch);
- missile.think = GrapplingHookThink;
+ setthink(missile, GrapplingHookThink);
missile.nextthink = time;
missile.effects = /*EF_FULLBRIGHT | EF_ADDITIVE |*/ EF_LOWPRECISION;
self.punchangle = targ.angles;
self.view_ofs = self.origin - targ.origin;
self.v_angle = self.angles - targ.angles;
- self.think = dynlight_think;
+ setthink(self, dynlight_think);
self.nextthink = time + 0.1;
}
void dynlight_find_path(entity this)
targ = find(world, targetname, self.target);
self.target = targ.target;
setorigin (self, targ.origin);
- self.think = train_next;
+ setthink(self, train_next);
self.nextthink = time + 0.1;
}
void dynlight_find_target(entity this)
targ = find(world, targetname, self.target);
setattachment(self, targ, self.dtagname);
self.owner = targ;
- self.think = dynlight_think;
+ setthink(self, dynlight_think);
self.nextthink = time + 0.1;
}
void dynlight_use(entity this, entity actor, entity trigger)
void PingPLReport_Spawn()
{
pingplreport = new_pure(pingplreport);
- pingplreport.think = PingPLReport_Think;
+ setthink(pingplreport, PingPLReport_Think);
pingplreport.nextthink = time;
}
void RandomSeed_Spawn()
{
randomseed = new_pure(randomseed);
- randomseed.think = RandomSeed_Think;
+ setthink(randomseed, RandomSeed_Think);
Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
- WITHSELF(randomseed, randomseed.think()); // sets random seed and nextthink
+ WITHSELF(randomseed, getthink(randomseed)()); // sets random seed and nextthink
}
spawnfunc(__init_dedicated_server)
remove = remove_unsafely;
entity e = spawn();
- e.think = GotoFirstMap;
+ setthink(e, GotoFirstMap);
e.nextthink = time; // this is usually 1 at this point
e = new(info_player_deathmatch); // safeguard against player joining
}
entity e = new(bansyncer);
- e.think = OnlineBanList_Think;
+ setthink(e, OnlineBanList_Think);
e.nextthink = time + 1;
}
this.mdl = this.model;
_setmodel(this, this.mdl);
this.solid = SOLID_BSP;
- this.think = assault_wall_think;
+ setthink(this, assault_wall_think);
this.nextthink = time;
InitializeEntity(this, assault_setenemytoobjective, INITPRIO_FINDTARGET);
}
flag.mangle = flag.angles;
flag.reset = ctf_Reset;
settouch(flag, ctf_FlagTouch);
- flag.think = ctf_FlagThink;
+ setthink(flag, ctf_FlagThink);
flag.nextthink = time + FLAG_THINKRATE;
flag.ctf_status = FLAG_BASE;
{
e.killindicator = spawn();
e.killindicator.owner = e;
- e.killindicator.think = KillIndicator_Think;
+ setthink(e.killindicator, KillIndicator_Think);
e.killindicator.nextthink = time + (e.lip) * 0.05;
e.killindicator.cnt = ceil(autocvar_g_cts_finish_kill_delay);
e.killindicator.health = 1; // this is used to indicate that it should be silent
if(!self.t_length)
self.t_length = 239; // maximum frame
- self.think = dompointthink;
+ setthink(self, dompointthink);
self.nextthink = time;
settouch(self, dompointtouch);
self.solid = SOLID_TRIGGER;
remove(this);
return;
}
- this.think = dom_controlpoint_setup_self;
+ setthink(this, dom_controlpoint_setup_self);
this.nextthink = time + 0.1;
this.reset = dom_controlpoint_setup;
{
entity e = spawn();
e.classname = "dom_controlpoint";
- e.think = self_spawnfunc_dom_controlpoint;
+ setthink(e, self_spawnfunc_dom_controlpoint);
e.nextthink = time;
setorigin(e, org);
spawnfunc_dom_controlpoint(e);
monster = spawnmonster("", mon, world, world, e.origin, false, false, 2);
else return;
- e.think = SUB_Remove_self;
+ setthink(e, SUB_Remove_self);
e.nextthink = time + 0.1;
}
else
}
void ka_TouchEvent();
+void ka_RespawnBall(entity this);
+void ka_RespawnBall_self() { SELFPARAM(); ka_RespawnBall(this); }
void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated
{
if(gameover) { return; }
self.angles = '0 0 0';
self.effects = autocvar_g_keepawayball_effects;
settouch(self, ka_TouchEvent);
- setthink(self, ka_RespawnBall);
+ setthink(self, ka_RespawnBall_self);
self.nextthink = time + autocvar_g_keepawayball_respawntime;
Send_Effect(EFFECT_ELECTRO_COMBO, oldballorigin, '0 0 0', 1);
self.movetype = MOVETYPE_NONE;
self.effects |= EF_NODRAW;
settouch(self, func_null);
- self.think = ka_TimeScoring;
+ setthink(self, ka_TimeScoring);
self.nextthink = time + autocvar_g_keepaway_score_timeinterval;
self.takedamage = DAMAGE_NO;
ball.movetype = MOVETYPE_BOUNCE;
ball.wait = time + 1;
settouch(ball, ka_TouchEvent);
- setthink(ball, ka_RespawnBall);
+ setthink(ball, ka_RespawnBall_self);
ball.nextthink = time + autocvar_g_keepawayball_respawntime;
ball.takedamage = DAMAGE_YES;
ball.effects &= ~EF_NODRAW;
if(time < game_starttime)
{
- setthink(this, ka_RespawnBall);
+ setthink(this, ka_RespawnBall_self);
settouch(this, func_null);
this.nextthink = game_starttime;
}
if(intermission_running)
return;
if(self.cnt > 0)
- { if(self.think != kh_WaitForPlayers) { self.cnt -= 1; } }
+ { if(getthink(self) != kh_WaitForPlayers) { self.cnt -= 1; } }
else if(self.cnt == 0)
{
self.cnt -= 1;
key.count = i;
key.classname = STR_ITEM_KH_KEY;
settouch(key, kh_Key_Touch);
- key.think = kh_Key_Think;
+ setthink(key, kh_Key_Think);
key.nextthink = time;
key.items = IT_KEY1 | IT_KEY2;
key.cnt = _angle;
// make a KH entity for controlling the game
kh_controller = spawn();
- kh_controller.think = kh_Controller_Think;
+ setthink(kh_controller, kh_Controller_Think);
kh_Controller_SetThink(0, kh_WaitForPlayers);
setmodel(kh_controller, MDL_KH_KEY);
if (self.classname != "item_health_mega") return false;
entity e = spawn();
- e.think = lms_extralife;
+ setthink(e, lms_extralife);
e.nextthink = time + 0.1;
e.spawnflags = self.spawnflags;
#endif
if(self.path_next)
{
- self.path_next.think = __showpath2_think;
+ setthink(self.path_next, __showpath2_think);
self.path_next.nextthink = time + 0.15;
}
else
{
- self.owner.think = __showpath2_think;
+ setthink(self.owner, __showpath2_think);
self.owner.nextthink = time + 0.15;
}
}
void pathlib_showpath2(entity path)
{
- path.think = __showpath2_think;
+ setthink(path, __showpath2_think);
path.nextthink = time;
}
s = spawn();
s.alpha = 0.25;
- s.think = SUB_Remove_self;
+ setthink(s, SUB_Remove_self);
s.nextthink = _lifetime;
s.scale = pathlib_gridsize / 512.001;
s.solid = SOLID_NOT;
e = spawn();
e.alpha = 0.25;
- e.think = SUB_Remove_self;
+ setthink(e, SUB_Remove_self);
e.nextthink = _lifetime;
e.scale = pathlib_gridsize / 512;
e.solid = SOLID_NOT;
e = findchainentity(owner, start);
while(e)
{
- e.think = SUB_Remove_self;
+ setthink(e, SUB_Remove_self);
e.nextthink = time;
e = e.chain;
}
void dumpnode(entity n)
{
n.is_path_node = false;
- n.think = SUB_Remove_self;
+ setthink(n, SUB_Remove_self);
n.nextthink = time;
}
node = spawn();
- node.think = SUB_Remove_self;
+ setthink(node, SUB_Remove_self);
node.nextthink = time + PATHLIB_NODEEXPIRE;
node.is_path_node = true;
node.owner = openlist;
{
entity a;
a = spawn();
- a.think = a_think;
+ setthink(a, a_think);
a.nextthink = time;
setorigin(a,start + movenode_stepup);
a.pos1 = trace_endpos;
{
entity n;
n = spawn();
- n.think = plas_think;
+ setthink(n, plas_think);
n.nextthink = time + 0.1;
}
portal.skin = 2;
portal.solid = SOLID_NOT;
settouch(portal, func_null);
- portal.think = func_null;
+ setthink(portal, func_null);
portal.effects = 0;
portal.nextthink = 0;
portal.takedamage = DAMAGE_NO;
portal.skin = 2;
portal.solid = SOLID_NOT;
settouch(portal, func_null);
- portal.think = func_null;
+ setthink(portal, func_null);
portal.effects = EF_ADDITIVE;
portal.nextthink = 0;
portal.takedamage = DAMAGE_YES;
portal.skin = 0;
portal.solid = SOLID_NOT; // this is done when connecting them!
settouch(portal, Portal_Touch);
- portal.think = Portal_Think;
+ setthink(portal, Portal_Think);
portal.effects = EF_RED;
portal.nextthink = time;
portal.takedamage = DAMAGE_NO;
portal.skin = 1;
portal.solid = SOLID_NOT;
settouch(portal, func_null);
- portal.think = func_null;
+ setthink(portal, func_null);
portal.effects = EF_STARDUST | EF_BLUE;
portal.nextthink = 0;
portal.takedamage = DAMAGE_YES;
{
Portal_MakeBrokenPortal(portal);
portal.cnt = kill;
- portal.think = Portal_RemoveLater_Think;
+ setthink(portal, Portal_RemoveLater_Think);
portal.nextthink = time;
}
void Portal_ClearAllLater_PortalsOnly(entity own)
portal.mangle = ang;
portal.angles = ang;
portal.angles_x = -portal.angles.x; // is a bmodel
- portal.think = Portal_Think;
+ setthink(portal, Portal_Think);
portal.nextthink = 0;
portal.portal_activatetime = time + 0.1;
portal.takedamage = DAMAGE_AIM;
{
SELFPARAM();
round_starttime = max(time, game_starttime) + this.count;
- this.think = round_handler_Think;
+ setthink(this, round_handler_Think);
this.nextthink = max(time, game_starttime);
}
}
entity this = round_handler = new(round_handler);
- this.think = round_handler_FirstThink;
+ setthink(this, round_handler_FirstThink);
this.canRoundStart = canRoundStart_func;
this.canRoundEnd = canRoundEnd_func;
this.roundStart = roundStart_func;
}
this.use = spawnpoint_use;
- this.think = spawnpoint_think;
+ setthink(this, spawnpoint_think);
this.nextthink = time + 0.5 + random() * 2; // shouldn't need it for a little second
this.team_saved = this.team;
if (!this.cnt)
this.owner = world;
this.nextthink = time;
- this.think = SUB_Remove;
+ setthink(this, SUB_Remove);
}
flocker.flock_id = this.flock_id;
flocker.owner = this;
- flocker.think = flocker_think;
+ setthink(flocker, flocker_think);
flocker.nextthink = time + random() * 5;
PROJECTILE_MAKETRIGGER(flocker);
flocker.movetype = MOVETYPE_BOUNCEMISSILE;
if(!this.delay) this.delay = 0.25;
if(!this.flock_id) this.flock_id = globflockcnt;
- this.think = flockerspawn_think;
+ setthink(this, flockerspawn_think);
this.nextthink = time + 0.25;
this.enemy = new(FLock Hunter);
this.enemy.effects = EF_LOWPRECISION;
this.enemy.movetype = MOVETYPE_BOUNCEMISSILE;
PROJECTILE_MAKETRIGGER(this.enemy);
- this.enemy.think = flocker_hunter_think;
+ setthink(this.enemy, flocker_hunter_think);
this.enemy.nextthink = time + 10;
this.enemy.flock_id = this.flock_id;
this.enemy.owner = this;
else if (targ.classname == "item_health_mega")
this.health = 200;
//remove(targ); // removing ents in init functions causes havoc, workaround:
- targ.think = SUB_Remove_self;
+ setthink(targ, SUB_Remove_self);
targ.nextthink = time;
}
this.spawnflags = 2;
// do not explode NOW but in the NEXT FRAME!
// because recursive calls to RadiusDamage are not allowed
this.nextthink = time;
- this.think = explode;
+ setthink(this, explode);
}
if(startitem_failed)
return string_null;
wep.glowmod = weaponentity_glowmod(info, own.clientcolors);
- wep.think = thrown_wep_think;
+ setthink(wep, thrown_wep_think);
wep.savenextthink = wep.nextthink;
wep.nextthink = min(wep.nextthink, time + 0.5);
wep.pickup_anyway = true; // these are ALWAYS pickable
setmodel(view, MDL_Null); // precision set when changed
setorigin(view, '0 0 0');
view.weaponentity_fld = weaponentity;
- view.think = CL_Weaponentity_Think;
+ setthink(view, CL_Weaponentity_Think);
view.nextthink = time;
view.viewmodelforclient = actor;
view.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
exterior.solid = SOLID_NOT;
exterior.owner = actor;
setorigin(exterior, '0 0 0');
- exterior.think = CL_ExteriorWeaponentity_Think;
+ setthink(exterior, CL_ExteriorWeaponentity_Think);
exterior.nextthink = time;
CSQCMODEL_AUTOINIT(exterior);