From: TimePath Date: Mon, 23 May 2016 11:08:11 +0000 (+1000) Subject: Use think accessors X-Git-Tag: xonotic-v0.8.2~896 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=daab9330abb8952053b47239d1322cd029b08cd1;p=xonotic%2Fxonotic-data.pk3dir.git Use think accessors --- diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc index a7b0e4749..656349a0f 100644 --- a/qcsrc/client/announcer.qc +++ b/qcsrc/client/announcer.qc @@ -102,7 +102,7 @@ void Announcer_Gamestart() 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 diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 4fc67a63d..1767b8f2b 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -337,7 +337,7 @@ void TrueAim_Init(); void PostInit() { entity playerchecker = new_pure(playerchecker); - playerchecker.think = Playerchecker_Think; + setthink(playerchecker, Playerchecker_Think); playerchecker.nextthink = time + 0.2; TrueAim_Init(); diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc index 47e98d619..79acf4fb8 100644 --- a/qcsrc/client/shownames.qc +++ b/qcsrc/client/shownames.qc @@ -176,8 +176,8 @@ void Draw_ShowNames_All() 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) { diff --git a/qcsrc/common/effects/qc/damageeffects.qc b/qcsrc/common/effects/qc/damageeffects.qc index 9291a3599..c8afaf990 100644 --- a/qcsrc/common/effects/qc/damageeffects.qc +++ b/qcsrc/common/effects/qc/damageeffects.qc @@ -183,7 +183,7 @@ void DamageEffect(entity this, vector hitorg, float thedamage, int type, int spe 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; } diff --git a/qcsrc/common/ent_cs.qc b/qcsrc/common/ent_cs.qc index 1310ff034..64ddc4473 100644 --- a/qcsrc/common/ent_cs.qc +++ b/qcsrc/common/ent_cs.qc @@ -105,7 +105,7 @@ { 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; @@ -169,7 +169,7 @@ make_pure(e); } e.sv_entnum = n; - e.think = entcs_think; + setthink(e, entcs_think); entcs_receiver(n, e); } else if (this && e != this) @@ -189,7 +189,7 @@ #undef X this.iflags |= IFLAG_ORIGIN; InterpolateOrigin_Note(this); - WITHSELF(this, this.think()); + WITHSELF(this, getthink(this)()); return true; } diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index cc24cfde6..1ce1af8c8 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -175,7 +175,7 @@ void GiveBall(entity plyr, entity ball) if(autocvar_g_nexball_basketball_delay_hold) { - ball.think = DropOwner; + setthink(ball, DropOwner); ball.nextthink = time + autocvar_g_nexball_basketball_delay_hold; } @@ -202,7 +202,7 @@ void DropBall(entity ball, vector org, vector vel) 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) @@ -230,7 +230,7 @@ void InitBall() 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; @@ -271,7 +271,7 @@ void ResetBall() 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; } } @@ -427,7 +427,7 @@ void GoalTouch() 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); @@ -556,7 +556,7 @@ void SpawnBall(entity this) 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; } @@ -793,7 +793,7 @@ void W_Nexball_Attack2() 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; } @@ -816,7 +816,7 @@ void W_Nexball_Attack2() 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; diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc index 0f138819a..38799f2ce 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc @@ -423,7 +423,7 @@ void ons_DelayedLinkSetup(entity this) 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; } @@ -646,7 +646,7 @@ void ons_ControlPoint_Icon_BuildThink() { 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; @@ -830,7 +830,7 @@ void ons_ControlPoint_Reset(entity this) 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); @@ -866,7 +866,7 @@ void ons_ControlPoint_Setup(entity cp) 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; @@ -990,7 +990,7 @@ void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float d 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 @@ -1052,7 +1052,7 @@ void ons_GeneratorReset(entity this) 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); @@ -1112,7 +1112,7 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o 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; diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc index 492428718..be46b285b 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc @@ -35,6 +35,6 @@ bool cpicon_send(entity this, entity to, int sf) 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; } diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc index cf8d234a3..f0255456f 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc @@ -32,6 +32,6 @@ bool generator_send(entity this, entity to, int sf) void generator_link(void() spawnproc) {SELFPARAM(); Net_LinkEntity(self, true, 0, generator_send); - self.think = spawnproc; + setthink(self, spawnproc); self.nextthink = time; } diff --git a/qcsrc/common/minigames/minigame/pong.qc b/qcsrc/common/minigames/minigame/pong.qc index 5074dccff..149989897 100644 --- a/qcsrc/common/minigames/minigame/pong.qc +++ b/qcsrc/common/minigames/minigame/pong.qc @@ -47,7 +47,7 @@ void pong_ball_throw(entity ball) 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; @@ -64,10 +64,10 @@ void pong_ball_reset(entity ball) { 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; } @@ -256,7 +256,7 @@ entity pong_ai_spawn(entity paddle) 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; @@ -315,7 +315,7 @@ entity pong_paddle_spawn(entity minigame, int pl_team, entity real_player) 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); diff --git a/qcsrc/common/minigames/minigame/snake.qc b/qcsrc/common/minigames/minigame/snake.qc index 56efb2e09..95fda671a 100644 --- a/qcsrc/common/minigames/minigame/snake.qc +++ b/qcsrc/common/minigames/minigame/snake.qc @@ -185,7 +185,7 @@ void minigame_setup_snake(entity minigame, int pteam) 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); diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index e746e4394..0f3ea814c 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -230,7 +230,7 @@ void M_Mage_Attack_Spike(entity this, vector dir) 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; diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index d83026474..751d0fff0 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -101,7 +101,7 @@ void M_Shambler_Attack_Lightning_Explode(entity this) 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; } @@ -161,7 +161,7 @@ void M_Shambler_Attack_Lightning(entity this) 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); diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index 5f8add4ff..264512069 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -174,7 +174,7 @@ void M_Spider_Attack_Web(entity this) 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; diff --git a/qcsrc/common/monsters/monster/wyvern.qc b/qcsrc/common/monsters/monster/wyvern.qc index 07f51611e..87cc5d73f 100644 --- a/qcsrc/common/monsters/monster/wyvern.qc +++ b/qcsrc/common/monsters/monster/wyvern.qc @@ -72,7 +72,7 @@ METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity 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); diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 48e510361..f1a0576c7 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -199,12 +199,12 @@ void Monster_Delay_Action(entity this) 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; } } @@ -220,7 +220,7 @@ void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) // 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; @@ -523,7 +523,7 @@ void Monster_Dead_Fade(entity 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; @@ -943,7 +943,7 @@ bool Monster_Appear_Check(entity this, int monster_id) 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; @@ -980,7 +980,7 @@ void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float d // 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; } @@ -988,7 +988,7 @@ void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float d 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; @@ -1115,7 +1115,7 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage { Violence_GibSplash(this, 1, 0.5, attacker); - this.think = SUB_Remove_self; + setthink(this, SUB_Remove_self); this.nextthink = time + 0.1; } } @@ -1216,7 +1216,7 @@ void Monster_Anim(entity this) void Monster_Think() {SELFPARAM(); - this.think = Monster_Think; + setthink(this, Monster_Think); this.nextthink = this.ticrate; if(this.monster_lifetime) @@ -1287,7 +1287,7 @@ bool Monster_Spawn_Setup(entity this) } } - this.think = Monster_Think; + setthink(this, Monster_Think); this.nextthink = time + this.ticrate; if(MUTATOR_CALLHOOK(MonsterSpawn, this)) diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qc b/qcsrc/common/mutators/mutator/buffs/buffs.qc index 302eea34e..d0d206ab0 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qc @@ -422,7 +422,7 @@ void buff_Init(entity 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; @@ -546,7 +546,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_Calculate) 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; } diff --git a/qcsrc/common/mutators/mutator/instagib/instagib.qc b/qcsrc/common/mutators/mutator/instagib/instagib.qc index d9504f82f..8721cede7 100644 --- a/qcsrc/common/mutators/mutator/instagib/instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/instagib.qc @@ -457,11 +457,11 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, OnEntityPreSpawn) 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; diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 96f346164..39310c9fd 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -167,7 +167,7 @@ void nade_spawn(entity _nade) 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; @@ -269,7 +269,7 @@ void nade_napalm_ball(entity this) 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; @@ -340,7 +340,7 @@ void nade_napalm_boom(entity this) 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; @@ -436,7 +436,7 @@ void nade_ice_boom(entity this) 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; @@ -456,7 +456,7 @@ void nade_ice_boom(entity this) 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; @@ -584,7 +584,7 @@ void nade_heal_boom(entity this) Net_LinkEntity(healer, true, 0, healer_send); - healer.think = nade_heal_think; + setthink(healer, nade_heal_think); healer.nextthink = time; healer.SendFlags |= 1; } @@ -741,7 +741,7 @@ void nade_touch() 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); } @@ -796,7 +796,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i { 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; @@ -888,7 +888,7 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time) if(_time) { - _nade.think = nade_boom; + setthink(_nade, nade_boom); _nade.nextthink = _time; } @@ -970,7 +970,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin 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; @@ -981,7 +981,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin 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; diff --git a/qcsrc/common/mutators/mutator/overkill/overkill.qc b/qcsrc/common/mutators/mutator/overkill/overkill.qc index 45a7e77f3..6f3c146a3 100644 --- a/qcsrc/common/mutators/mutator/overkill/overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/overkill.qc @@ -287,7 +287,7 @@ MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn) 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; } @@ -304,7 +304,7 @@ MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn) 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; } diff --git a/qcsrc/common/mutators/mutator/overkill/rpc.qc b/qcsrc/common/mutators/mutator/overkill/rpc.qc index bf531e3b4..c11ebc8a3 100644 --- a/qcsrc/common/mutators/mutator/overkill/rpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/rpc.qc @@ -134,7 +134,7 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep) 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; diff --git a/qcsrc/common/mutators/mutator/physical_items/physical_items.qc b/qcsrc/common/mutators/mutator/physical_items/physical_items.qc index bd68f2bcd..c9ab81b4e 100644 --- a/qcsrc/common/mutators/mutator/physical_items/physical_items.qc +++ b/qcsrc/common/mutators/mutator/physical_items/physical_items.qc @@ -116,7 +116,7 @@ MUTATOR_HOOKFUNCTION(physical_items, Item_Spawn) 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; diff --git a/qcsrc/common/mutators/mutator/sandbox/sandbox.qc b/qcsrc/common/mutators/mutator/sandbox/sandbox.qc index 5ab3ca02b..9d592f277 100644 --- a/qcsrc/common/mutators/mutator/sandbox/sandbox.qc +++ b/qcsrc/common/mutators/mutator/sandbox/sandbox.qc @@ -188,7 +188,7 @@ entity sandbox_ObjectSpawn(float database) 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? diff --git a/qcsrc/common/mutators/mutator/superspec/superspec.qc b/qcsrc/common/mutators/mutator/superspec/superspec.qc index adcc3b2d7..ae10cb5a4 100644 --- a/qcsrc/common/mutators/mutator/superspec/superspec.qc +++ b/qcsrc/common/mutators/mutator/superspec/superspec.qc @@ -398,7 +398,7 @@ MUTATOR_HOOKFUNCTION(superspec, ClientConnect) entity _hello = spawn(); _hello.enemy = self; - _hello.think = superspec_hello; + setthink(_hello, superspec_hello); _hello.nextthink = time + 5; if (!_ISLOCAL) diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index 5bbf8c644..ad2fb846d 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -1019,7 +1019,7 @@ entity WaypointSprite_Spawn( 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; diff --git a/qcsrc/common/notifications/all.qc b/qcsrc/common/notifications/all.qc index 267bd9e66..ab448b184 100644 --- a/qcsrc/common/notifications/all.qc +++ b/qcsrc/common/notifications/all.qc @@ -1697,7 +1697,7 @@ void Send_Notification( 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; diff --git a/qcsrc/common/sounds/sound.qh b/qcsrc/common/sounds/sound.qh index a462861f2..e84c09ef6 100644 --- a/qcsrc/common/sounds/sound.qh +++ b/qcsrc/common/sounds/sound.qh @@ -76,7 +76,7 @@ const float VOL_BASEVOICE = 1.0; 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; \ diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index dcbbb95e3..6ec16667e 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -503,7 +503,7 @@ void Item_Respawn () 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); @@ -583,7 +583,7 @@ void Item_ScheduleRespawnIn(entity e, float t) // 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; @@ -593,7 +593,7 @@ void Item_ScheduleRespawnIn(entity e, float t) } else { - e.think = Item_RespawnThink; + setthink(e, Item_RespawnThink); e.nextthink = time; e.scheduledrespawntime = time + t; e.wait = time + t; @@ -849,7 +849,7 @@ void Item_Reset(entity this) if (this.classname != "droppedweapon") { - this.think = Item_Think; + setthink(this, Item_Think); this.nextthink = time; if (this.waypointsprite_attached) @@ -1082,7 +1082,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default 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; diff --git a/qcsrc/common/triggers/func/bobbing.qc b/qcsrc/common/triggers/func/bobbing.qc index 0dcba018e..7039d151a 100644 --- a/qcsrc/common/triggers/func/bobbing.qc +++ b/qcsrc/common/triggers/func/bobbing.qc @@ -72,7 +72,7 @@ spawnfunc(func_bobbing) 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; diff --git a/qcsrc/common/triggers/func/breakable.qc b/qcsrc/common/triggers/func/breakable.qc index 82e529160..e11680b40 100644 --- a/qcsrc/common/triggers/func/breakable.qc +++ b/qcsrc/common/triggers/func/breakable.qc @@ -221,7 +221,7 @@ void func_breakable_destroy(entity this, entity actor, entity trigger) if(this.respawntime) { - this.think = func_breakable_restore_self; + setthink(this, func_breakable_restore_self); this.nextthink = time + this.respawntime + crandom() * this.respawntimejitter; } @@ -271,7 +271,7 @@ void func_breakable_damage(entity this, entity inflictor, entity attacker, float // 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); } } diff --git a/qcsrc/common/triggers/func/conveyor.qc b/qcsrc/common/triggers/func/conveyor.qc index dd7c129d6..6ad2e80d4 100644 --- a/qcsrc/common/triggers/func/conveyor.qc +++ b/qcsrc/common/triggers/func/conveyor.qc @@ -112,7 +112,7 @@ void conveyor_init(entity this) { if (!this.speed) this.speed = 200; this.movedir *= this.speed; - this.think = conveyor_think; + setthink(this, conveyor_think); this.nextthink = time; IFTARGETED { diff --git a/qcsrc/common/triggers/func/door_rotating.qc b/qcsrc/common/triggers/func/door_rotating.qc index 77061ecb3..504005e36 100644 --- a/qcsrc/common/triggers/func/door_rotating.qc +++ b/qcsrc/common/triggers/func/door_rotating.qc @@ -32,7 +32,7 @@ void door_rotating_reset(entity this) this.angles = this.pos1; this.avelocity = '0 0 0'; this.state = STATE_BOTTOM; - this.think = func_null; + setthink(this, func_null); this.nextthink = 0; } diff --git a/qcsrc/common/triggers/func/door_secret.qc b/qcsrc/common/triggers/func/door_secret.qc index f99996955..da88e4dc9 100644 --- a/qcsrc/common/triggers/func/door_secret.qc +++ b/qcsrc/common/triggers/func/door_secret.qc @@ -72,7 +72,7 @@ void fd_secret_damage(entity this, entity inflictor, entity attacker, float dama 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); } @@ -93,7 +93,7 @@ void fd_secret_move3() if (!(self.spawnflags & SECRET_OPEN_ONCE)) { self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait; - self.think = fd_secret_move4; + setthink(self, fd_secret_move4); } } @@ -109,7 +109,7 @@ void 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); } @@ -175,7 +175,7 @@ void secret_reset(entity this) this.takedamage = DAMAGE_YES; } setorigin(this, this.oldorigin); - this.think = func_null; + setthink(this, func_null); this.SUB_NEXTTHINK = 0; } diff --git a/qcsrc/common/triggers/func/fourier.qc b/qcsrc/common/triggers/func/fourier.qc index a793b3e7b..057fcdca7 100644 --- a/qcsrc/common/triggers/func/fourier.qc +++ b/qcsrc/common/triggers/func/fourier.qc @@ -76,7 +76,7 @@ spawnfunc(func_fourier) 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 diff --git a/qcsrc/common/triggers/func/pendulum.qc b/qcsrc/common/triggers/func/pendulum.qc index e59881ddc..bcfc6e886 100644 --- a/qcsrc/common/triggers/func/pendulum.qc +++ b/qcsrc/common/triggers/func/pendulum.qc @@ -65,7 +65,7 @@ spawnfunc(func_pendulum) 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 diff --git a/qcsrc/common/triggers/func/pointparticles.qc b/qcsrc/common/triggers/func/pointparticles.qc index fa77082b2..7f7ec8eb2 100644 --- a/qcsrc/common/triggers/func/pointparticles.qc +++ b/qcsrc/common/triggers/func/pointparticles.qc @@ -143,7 +143,7 @@ spawnfunc(func_pointparticles) } else this.state = 1; - this.think = pointparticles_think; + setthink(this, pointparticles_think); this.nextthink = time; } diff --git a/qcsrc/common/triggers/func/vectormamamam.qc b/qcsrc/common/triggers/func/vectormamamam.qc index 139145e5b..eb7a5428b 100644 --- a/qcsrc/common/triggers/func/vectormamamam.qc +++ b/qcsrc/common/triggers/func/vectormamamam.qc @@ -94,7 +94,7 @@ void func_vectormamamam_findtarget(entity this) 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) diff --git a/qcsrc/common/triggers/misc/laser.qc b/qcsrc/common/triggers/misc/laser.qc index 3d09282d5..937d68caf 100644 --- a/qcsrc/common/triggers/misc/laser.qc +++ b/qcsrc/common/triggers/misc/laser.qc @@ -232,7 +232,7 @@ spawnfunc(misc_laser) 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); diff --git a/qcsrc/common/triggers/platforms.qc b/qcsrc/common/triggers/platforms.qc index 51c2ac8cc..d16509596 100644 --- a/qcsrc/common/triggers/platforms.qc +++ b/qcsrc/common/triggers/platforms.qc @@ -128,7 +128,7 @@ void plat_outside_touch() 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) diff --git a/qcsrc/common/triggers/subs.qc b/qcsrc/common/triggers/subs.qc index 99dc5217d..bcc7c057c 100644 --- a/qcsrc/common/triggers/subs.qc +++ b/qcsrc/common/triggers/subs.qc @@ -228,7 +228,7 @@ void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float 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 @@ -236,7 +236,7 @@ void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float 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) diff --git a/qcsrc/common/triggers/target/music.qc b/qcsrc/common/triggers/target/music.qc index b67d47d32..c6fca4c7e 100644 --- a/qcsrc/common/triggers/target/music.qc +++ b/qcsrc/common/triggers/target/music.qc @@ -320,7 +320,7 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_MUSIC, bool isnew) 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; } diff --git a/qcsrc/common/triggers/trigger/delay.qc b/qcsrc/common/triggers/trigger/delay.qc index 3dec82ace..d6742fed3 100644 --- a/qcsrc/common/triggers/trigger/delay.qc +++ b/qcsrc/common/triggers/trigger/delay.qc @@ -1,13 +1,13 @@ #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; } diff --git a/qcsrc/common/triggers/trigger/gamestart.qc b/qcsrc/common/triggers/trigger/gamestart.qc index 5f3206a2a..b042d01e0 100644 --- a/qcsrc/common/triggers/trigger/gamestart.qc +++ b/qcsrc/common/triggers/trigger/gamestart.qc @@ -18,7 +18,7 @@ spawnfunc(trigger_gamestart) if(this.wait) { - this.think = adaptor_think2use; + setthink(this, adaptor_think2use); this.nextthink = game_starttime + this.wait; } else diff --git a/qcsrc/common/triggers/trigger/gravity.qc b/qcsrc/common/triggers/trigger/gravity.qc index f2f8a845f..c9ea32501 100644 --- a/qcsrc/common/triggers/trigger/gravity.qc +++ b/qcsrc/common/triggers/trigger/gravity.qc @@ -69,7 +69,7 @@ void trigger_gravity_touch() 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) diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index c578622e0..be2ef03c0 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -263,7 +263,7 @@ void trigger_push_touch() if (this.spawnflags & PUSH_ONCE) { settouch(this, func_null); - this.think = SUB_Remove_self; + setthink(this, SUB_Remove_self); this.nextthink = time; } #endif diff --git a/qcsrc/common/triggers/trigger/monoflop.qc b/qcsrc/common/triggers/trigger/monoflop.qc index 994d498c1..f9738714e 100644 --- a/qcsrc/common/triggers/trigger/monoflop.qc +++ b/qcsrc/common/triggers/trigger/monoflop.qc @@ -41,7 +41,7 @@ spawnfunc(trigger_monoflop) 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; } diff --git a/qcsrc/common/triggers/trigger/multi.qc b/qcsrc/common/triggers/trigger/multi.qc index 5edf1dfa5..5ebe70179 100644 --- a/qcsrc/common/triggers/trigger/multi.qc +++ b/qcsrc/common/triggers/trigger/multi.qc @@ -45,7 +45,7 @@ void multi_trigger(entity this) if (this.wait > 0) { - this.think = multi_wait; + setthink(this, multi_wait); this.nextthink = time + this.wait; } else if (this.wait == 0) @@ -123,7 +123,7 @@ void multi_reset(entity this) this.takedamage = DAMAGE_YES; this.solid = SOLID_BBOX; } - this.think = func_null; + setthink(this, func_null); this.nextthink = 0; this.team = this.team_saved; } diff --git a/qcsrc/common/triggers/trigger/multivibrator.qc b/qcsrc/common/triggers/trigger/multivibrator.qc index 8d3b6b5d5..2c17fbb0d 100644 --- a/qcsrc/common/triggers/trigger/multivibrator.qc +++ b/qcsrc/common/triggers/trigger/multivibrator.qc @@ -68,7 +68,7 @@ spawnfunc(trigger_multivibrator) this.state = 0; this.use = multivibrator_toggle; - this.think = multivibrator_send_think; + setthink(this, multivibrator_send_think); this.nextthink = max(1, time); IFTARGETED diff --git a/qcsrc/common/triggers/trigger/swamp.qc b/qcsrc/common/triggers/trigger/swamp.qc index a09c69f70..4c514df2d 100644 --- a/qcsrc/common/triggers/trigger/swamp.qc +++ b/qcsrc/common/triggers/trigger/swamp.qc @@ -76,7 +76,7 @@ void swamp_touch() //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; diff --git a/qcsrc/common/triggers/trigger/viewloc.qc b/qcsrc/common/triggers/trigger/viewloc.qc index 7003f3889..bfd6db1dc 100644 --- a/qcsrc/common/triggers/trigger/viewloc.qc +++ b/qcsrc/common/triggers/trigger/viewloc.qc @@ -78,7 +78,7 @@ void viewloc_init(entity this) Net_LinkEntity(this, false, 0, trigger_viewloc_send); - this.think = viewloc_think; + setthink(this, viewloc_think); this.nextthink = time; } @@ -159,7 +159,7 @@ NET_HANDLE(ENT_CLIENT_VIEWLOC_TRIGGER, bool isnew) 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"; diff --git a/qcsrc/common/triggers/triggers.qc b/qcsrc/common/triggers/triggers.qc index 617fcd402..572515189 100644 --- a/qcsrc/common/triggers/triggers.qc +++ b/qcsrc/common/triggers/triggers.qc @@ -193,7 +193,7 @@ void SUB_UseTargets(entity this, entity actor, entity trigger) // 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; diff --git a/qcsrc/common/turrets/checkpoint.qc b/qcsrc/common/turrets/checkpoint.qc index 669414c57..d24e9d74f 100644 --- a/qcsrc/common/turrets/checkpoint.qc +++ b/qcsrc/common/turrets/checkpoint.qc @@ -70,7 +70,7 @@ void turret_checkpoint_init() spawnfunc(turret_checkpoint) { setorigin(this,this.origin); - this.think = turret_checkpoint_init; + setthink(this, turret_checkpoint_init); this.nextthink = time + 0.2; } diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 36283fc81..138c87e88 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -168,7 +168,7 @@ void turret_hide() {SELFPARAM(); self.effects |= EF_NODRAW; self.nextthink = time + self.respawntime - 0.2; - self.think = turret_respawn; + setthink(self, turret_respawn); } void turret_die() @@ -201,7 +201,7 @@ 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); } @@ -245,7 +245,7 @@ void turret_damage(entity this, entity inflictor, entity attacker, float damage, 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; @@ -272,7 +272,7 @@ void turret_respawn() self.ammo = self.ammo_max; self.nextthink = time + self.ticrate; - self.think = turret_think; + setthink(self, turret_think); self.SendFlags = TNSF_FULL_UPDATE; @@ -471,7 +471,7 @@ entity turret_projectile(Sound _snd, float _size, float _health, float _death, f 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; @@ -1189,7 +1189,7 @@ void turret_use(entity this, entity actor, entity trigger) 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; } @@ -1256,7 +1256,7 @@ float turret_initialize(Turret tur) if(!e) { e = new(turret_manager); - e.think = turrets_manager_think; + setthink(e, turrets_manager_think); e.nextthink = time + 2; } diff --git a/qcsrc/common/turrets/turret/flac_weapon.qc b/qcsrc/common/turrets/turret/flac_weapon.qc index 175fa7617..fd7179f16 100644 --- a/qcsrc/common/turrets/turret/flac_weapon.qc +++ b/qcsrc/common/turrets/turret/flac_weapon.qc @@ -24,7 +24,7 @@ METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, .entity weaponen 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); diff --git a/qcsrc/common/turrets/turret/hellion_weapon.qc b/qcsrc/common/turrets/turret/hellion_weapon.qc index 7df79c8c7..6fd5bd091 100644 --- a/qcsrc/common/turrets/turret/hellion_weapon.qc +++ b/qcsrc/common/turrets/turret/hellion_weapon.qc @@ -31,7 +31,7 @@ METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, .entity weapo 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; @@ -98,7 +98,7 @@ void turret_hellion_missile_think() 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); } diff --git a/qcsrc/common/turrets/turret/hk_weapon.qc b/qcsrc/common/turrets/turret/hk_weapon.qc index 319a579cf..ca99cca90 100644 --- a/qcsrc/common/turrets/turret/hk_weapon.qc +++ b/qcsrc/common/turrets/turret/hk_weapon.qc @@ -29,7 +29,7 @@ METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, .entity 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); diff --git a/qcsrc/common/turrets/turret/phaser_weapon.qc b/qcsrc/common/turrets/turret/phaser_weapon.qc index 3adc6c689..17622fe1d 100644 --- a/qcsrc/common/turrets/turret/phaser_weapon.qc +++ b/qcsrc/common/turrets/turret/phaser_weapon.qc @@ -26,7 +26,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity 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; diff --git a/qcsrc/common/turrets/turret/walker.qc b/qcsrc/common/turrets/turret/walker.qc index b923d0fc3..c2cedf0a2 100644 --- a/qcsrc/common/turrets/turret/walker.qc +++ b/qcsrc/common/turrets/turret/walker.qc @@ -141,7 +141,7 @@ void walker_rocket_think() if (self.max_health < time) { - self.think = walker_rocket_explode; + setthink(self, walker_rocket_explode); self.nextthink = time; return; } @@ -176,13 +176,13 @@ void walker_rocket_loop3() 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; } @@ -200,14 +200,14 @@ void walker_rocket_loop2() 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; } @@ -219,7 +219,7 @@ void walker_rocket_loop() {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; } @@ -248,9 +248,9 @@ void walker_fire_rocket(vector org) 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; diff --git a/qcsrc/common/turrets/util.qc b/qcsrc/common/turrets/util.qc index 749bff941..0344d1492 100644 --- a/qcsrc/common/turrets/util.qc +++ b/qcsrc/common/turrets/util.qc @@ -98,7 +98,7 @@ void marker_think() if(self.cnt) if(self.cnt < time) { - self.think = SUB_Remove; + setthink(self, SUB_Remove); self.nextthink = time; return; } @@ -116,7 +116,7 @@ void mark_error(vector where,float 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 = 0; if(lifetime) @@ -129,7 +129,7 @@ void mark_info(vector where,float 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) @@ -142,7 +142,7 @@ entity mark_misc(vector where,float 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) diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index bfb735197..2fb60210f 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -208,7 +208,7 @@ void vehicles_projectile_damage(entity this, entity inflictor, entity attacker, { this.takedamage = DAMAGE_NO; this.event_damage = func_null; - this.think = adaptor_think2use; + setthink(this, adaptor_think2use); this.nextthink = time; } } @@ -265,7 +265,7 @@ entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound, 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) @@ -325,14 +325,14 @@ entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag, 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; } @@ -442,7 +442,7 @@ void vehicles_clearreturn(entity veh) 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) @@ -458,7 +458,7 @@ void vehicles_return() {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) @@ -484,12 +484,12 @@ void vehicles_showwp() 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(); @@ -499,7 +499,7 @@ void vehicles_showwp() setorigin(ent, this.wp00.pos1); ent.nextthink = time + 5; - ent.think = vehicles_showwp_goaway; + setthink(ent, vehicles_showwp_goaway); } if(teamplay && ent.team) @@ -526,7 +526,7 @@ void vehicles_setreturn(entity veh) ret = new(vehicle_return); ret.wp00 = veh; ret.team = veh.team; - ret.think = vehicles_showwp; + setthink(ret, vehicles_showwp); if(IS_DEAD(veh)) { @@ -559,7 +559,7 @@ void vehicle_use(entity this, entity actor, entity trigger) 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 @@ -665,7 +665,7 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag 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'; @@ -1126,7 +1126,7 @@ void vehicles_spawn() 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 @@ -1211,7 +1211,7 @@ bool vehicle_initialize(entity this, Vehicle info, bool nodrop) 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; diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index e61ab440d..72a70cf41 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -635,7 +635,7 @@ void bumblebee_land() self.angles_z *= 0.95; if(hgt < 16) - self.think = vehicles_think; + setthink(self, vehicles_think); self.nextthink = time; @@ -654,7 +654,7 @@ void bumblebee_exit(float eject) if(!IS_DEAD(self)) { - self.think = bumblebee_land; + setthink(self, bumblebee_land); self.nextthink = time; } @@ -705,7 +705,7 @@ void bumblebee_blowup() void bumblebee_diethink() {SELFPARAM(); if(time >= self.wait) - self.think = bumblebee_blowup; + setthink(self, bumblebee_blowup); if(random() < 0.1) { @@ -797,7 +797,7 @@ METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance)) 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; @@ -834,7 +834,7 @@ METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity 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; diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index e79cab9ec..6eb064af3 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -437,7 +437,7 @@ void racer_exit(float eject) {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); @@ -489,7 +489,7 @@ void racer_blowup() 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; @@ -605,7 +605,7 @@ METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance)) 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; @@ -651,7 +651,7 @@ METHOD(Racer, vr_death, void(Racer thisveh, entity instance)) 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 } diff --git a/qcsrc/common/vehicles/vehicle/racer_weapon.qc b/qcsrc/common/vehicles/vehicle/racer_weapon.qc index 33d11c1c6..5718d4125 100644 --- a/qcsrc/common/vehicles/vehicle/racer_weapon.qc +++ b/qcsrc/common/vehicles/vehicle/racer_weapon.qc @@ -59,9 +59,9 @@ void racer_fire_rocket(entity player, vector org, vector dir, entity trg) 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() @@ -101,7 +101,7 @@ 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; } diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index 76deddd9d..e62f03333 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -102,7 +102,7 @@ void raptor_land() if(hgt < 16) { self.movetype = MOVETYPE_TOSS; - self.think = vehicles_think; + setthink(self, vehicles_think); self.frame = 0; } @@ -118,7 +118,7 @@ void raptor_exit(float eject) if(!IS_DEAD(self)) { - self.think = raptor_land; + setthink(self, raptor_land); self.nextthink = time; } @@ -541,7 +541,7 @@ void raptor_blowup() void raptor_diethink() {SELFPARAM(); if(time >= self.wait) - self.think = raptor_blowup; + setthink(self, raptor_blowup); if(random() < 0.05) { @@ -644,7 +644,7 @@ METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance)) 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); @@ -724,7 +724,7 @@ METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance)) self.bomb1.gun2 = spinner; // Sigh. - self.bomb1.think = raptor_rotor_anglefix; + setthink(self.bomb1, raptor_rotor_anglefix); self.bomb1.nextthink = time; self.mass = 1 ; diff --git a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc index 14cc7c0ff..8eabe1cdd 100644 --- a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc @@ -70,7 +70,7 @@ METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, .entity weapone _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; @@ -100,7 +100,7 @@ void raptor_bomblet_touch() return; PROJECTILE_TOUCH; - self.think = raptor_bomblet_boom; + setthink(self, raptor_bomblet_boom); self.nextthink = time + random() * autocvar_g_vehicle_raptor_bomblet_explode_delay; } @@ -130,7 +130,7 @@ void raptor_bomb_burst() 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; @@ -159,7 +159,8 @@ void raptor_bombdrop() 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) diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index 864c302d1..e60b263a6 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -351,7 +351,7 @@ void spiderbot_exit(float eject) e = e.chain; } - self.think = vehicles_think; + setthink(self, vehicles_think); self.nextthink = time; self.frame = 5; self.movetype = MOVETYPE_WALK; @@ -394,7 +394,7 @@ void spiderbot_exit(float eject) 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; @@ -451,7 +451,7 @@ void spiderbot_blowup() 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")); @@ -573,7 +573,7 @@ METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance)) 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; diff --git a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc index dd209676d..405a2ac8d 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc @@ -33,7 +33,7 @@ void spiderbot_rocket_guided() 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); @@ -56,10 +56,10 @@ void spiderbot_guide_release(entity this) 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; } @@ -196,7 +196,7 @@ void spiderbot_rocket_do(entity this) float _dist = (random() * autocvar_g_vehicle_spiderbot_rocket_radius) + vlen(v - trace_endpos); _dist -= (random() * autocvar_g_vehicle_spiderbot_rocket_radius) ; rocket.nextthink = time + (_dist / autocvar_g_vehicle_spiderbot_rocket_speed); - 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; @@ -209,7 +209,7 @@ void spiderbot_rocket_do(entity this) crosshair_trace(this.owner); rocket.pos1 = trace_endpos; rocket.nextthink = time; - rocket.think = spiderbot_rocket_guided; + setthink(rocket, spiderbot_rocket_guided); break; diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index 95b7225cc..4354cc415 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -114,7 +114,7 @@ void W_PROP_think() 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 diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index a033d2ab0..46efc1fae 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -256,7 +256,7 @@ void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float dam 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() @@ -288,7 +288,7 @@ void W_Arc_Attack_Bolt(Weapon thiswep) 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; @@ -683,7 +683,7 @@ void W_Arc_Beam(float burst) 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; @@ -691,7 +691,7 @@ void W_Arc_Beam(float burst) beam.beam_bursting = burst; Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send); - WITHSELF(beam, beam.think()); + WITHSELF(beam, getthink(beam)()); } void Arc_Smoke() diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index 56465e5c8..08b5e3472 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -81,7 +81,7 @@ void W_Blaster_Touch() 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); } @@ -139,14 +139,14 @@ void W_Blaster_Attack( 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)()); } } diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index fa7b82584..0d704da24 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -416,7 +416,7 @@ void W_Crylink_Attack(Weapon thiswep) 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); @@ -531,7 +531,7 @@ void W_Crylink_Attack2(Weapon thiswep) 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); @@ -615,7 +615,7 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit 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); diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 8c59a7938..1966509e6 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -385,7 +385,7 @@ void W_Devastator_Attack(Weapon thiswep) 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; diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 9e13fe2fa..84bef35b2 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -104,7 +104,7 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own) 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 = @@ -226,7 +226,7 @@ void W_Electro_Bolt_Think() 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 = @@ -278,7 +278,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep) 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); @@ -332,7 +332,7 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float // 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) @@ -348,7 +348,7 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float 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" } } } @@ -375,7 +375,7 @@ void W_Electro_Attack_Orb(Weapon thiswep) 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); diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index a180ede56..de468896f 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -202,7 +202,7 @@ void W_Fireball_Attack1() 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; @@ -341,7 +341,7 @@ void W_Fireball_Attack2() 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); diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index de576e609..35622949c 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -110,7 +110,7 @@ void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage 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() @@ -157,7 +157,7 @@ void W_Hagar_Attack(Weapon thiswep) 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; @@ -200,7 +200,7 @@ void W_Hagar_Attack2(Weapon thiswep) 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; @@ -258,7 +258,7 @@ void W_Hagar_Attack2_Load_Release(.entity weaponentity) 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; diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index 1fd9e0832..ae0055720 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -105,7 +105,7 @@ void W_HLAC_Attack(Weapon thiswep) //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); @@ -147,7 +147,7 @@ void W_HLAC_Attack2() //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); diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index 77e0e1973..adb1781f6 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -105,7 +105,7 @@ void W_Hook_Explode2() 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); @@ -159,7 +159,7 @@ void W_Hook_Attack2(Weapon thiswep, entity actor) 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); diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index 8b16c273b..e39adb4e5 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -80,7 +80,7 @@ void W_MachineGun_MuzzleFlash_Think() if(this.alpha <= 0) { - this.think = SUB_Remove_self; + setthink(this, SUB_Remove_self); this.nextthink = time; this.realowner.muzzle_flash = world; return; @@ -97,7 +97,7 @@ void W_MachineGun_MuzzleFlash() 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; diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index f397e9e99..f8c3c6ca9 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -97,7 +97,7 @@ void W_MineLayer_Stick(entity to) 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; @@ -356,7 +356,7 @@ void W_MineLayer_Attack(Weapon thiswep) 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; diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 0fc5dd9bd..b264fab00 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -235,7 +235,7 @@ void W_Mortar_Attack(Weapon thiswep) 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); @@ -282,7 +282,7 @@ void W_Mortar_Attack2(Weapon thiswep) 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); diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index 867dd286c..bef792cc5 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -265,7 +265,7 @@ void W_Porto_Attack(float type) 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) diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 448c4363a..2e98fdbe3 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -266,7 +266,7 @@ void W_Seeker_Fire_Missile(Weapon thiswep, vector f_diff, entity m_target) 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"); @@ -361,7 +361,7 @@ void W_Seeker_Fire_Flac(Weapon thiswep) 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; @@ -539,12 +539,12 @@ void W_Seeker_Tag_Touch() { 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; @@ -573,7 +573,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep) 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; diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index 64264de59..3b6266f6e 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -241,7 +241,7 @@ void W_Shockwave_Melee(Weapon thiswep, entity actor, .entity weaponentity, int f 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)); } diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 568b1fe6b..361f70a84 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -79,7 +79,7 @@ void W_Shotgun_Attack(Weapon thiswep, float isprimary) // 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'); @@ -190,7 +190,7 @@ void W_Shotgun_Attack2(Weapon thiswep, entity actor, .entity weaponentity, int f 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)); } diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index abd387084..3f1aca666 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -338,7 +338,7 @@ void W_Tuba_NoteOn(float hittype) 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); @@ -631,9 +631,9 @@ NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isNew) } } - 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) { diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index beba67995..320f0e46c 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -137,7 +137,7 @@ void VaporizerBeam_Draw(entity this) 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; @@ -264,7 +264,7 @@ void W_RocketMinsta_Attack2() 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; @@ -316,7 +316,7 @@ void W_RocketMinsta_Attack3 () 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; diff --git a/qcsrc/lib/defer.qh b/qcsrc/lib/defer.qh index 24764ae15..d56895dca 100644 --- a/qcsrc/lib/defer.qh +++ b/qcsrc/lib/defer.qh @@ -7,8 +7,6 @@ entityclass(Defer); class(Defer).entity owner; - class(Defer).void() think; - class(Defer).float nextthink; class(Defer).void(entity) defer_func; /** Remove self */ @@ -27,7 +25,7 @@ void defer_think() { SELFPARAM(); - this.think = SUB_Remove_self; + setthink(this, SUB_Remove_self); this.nextthink = time; this.defer_func(this.owner); } @@ -41,7 +39,7 @@ entity e = new_pure(deferred); e.owner = this; e.defer_func = func; - e.think = defer_think; + setthink(e, defer_think); e.nextthink = time + fdelay; } diff --git a/qcsrc/lib/net.qh b/qcsrc/lib/net.qh index 03e5c9dd8..49f778a52 100644 --- a/qcsrc/lib/net.qh +++ b/qcsrc/lib/net.qh @@ -124,7 +124,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); } if (dt) { e.nextthink = time + dt; - e.think = SUB_Remove_self; + setthink(e, SUB_Remove_self); } } diff --git a/qcsrc/lib/self.qh b/qcsrc/lib/self.qh index 6b7201dcf..da85a2adc 100644 --- a/qcsrc/lib/self.qh +++ b/qcsrc/lib/self.qh @@ -62,7 +62,8 @@ noref entity _selftemp; (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) diff --git a/qcsrc/lib/warpzone/common.qc b/qcsrc/lib/warpzone/common.qc index 832e32e01..d3d7250e8 100644 --- a/qcsrc/lib/warpzone/common.qc +++ b/qcsrc/lib/warpzone/common.qc @@ -680,7 +680,7 @@ void WarpZone_RefSys_CheckCreate(entity me) { 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); } diff --git a/qcsrc/lib/warpzone/server.qc b/qcsrc/lib/warpzone/server.qc index ddaa41657..9bc39463e 100644 --- a/qcsrc/lib/warpzone/server.qc +++ b/qcsrc/lib/warpzone/server.qc @@ -173,7 +173,7 @@ float WarpZone_Teleport(entity wz, entity player, float f0, float f1) 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; @@ -582,7 +582,7 @@ void WarpZoneCamera_InitStep_FindTarget(entity this) this.SendFlags = 0xFFFFFF; if(this.spawnflags & 1) { - this.think = WarpZoneCamera_Think; + setthink(this, WarpZoneCamera_Think); this.nextthink = time; } else @@ -723,7 +723,7 @@ void WarpZone_InitStep_FinalizeTransform(entity this) this.SendFlags = 0xFFFFFF; if(this.spawnflags & 1) { - this.think = WarpZone_Think; + setthink(this, WarpZone_Think); this.nextthink = time; } else diff --git a/qcsrc/server/bot/waypoints.qc b/qcsrc/server/bot/waypoints.qc index bba6a1b9e..2f0b42539 100644 --- a/qcsrc/server/bot/waypoints.qc +++ b/qcsrc/server/bot/waypoints.qc @@ -289,7 +289,7 @@ void waypoint_schedulerelink(entity wp) 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; } diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index cc1d6cb7d..55440ca8c 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -391,7 +391,7 @@ float CheatCommand(entity this, int argc) 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 @@ -441,7 +441,7 @@ float CheatCommand(entity this, int argc) 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); diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 7ba3ed535..4dd0c2f76 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -294,7 +294,7 @@ void PutObserverInServer() 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; @@ -547,7 +547,7 @@ void PutClientInServer() 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; @@ -709,7 +709,7 @@ void ClientInit_CheckUpdate() 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()); @@ -891,7 +891,7 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2 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); @@ -907,7 +907,7 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2 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); @@ -1258,7 +1258,7 @@ void UpdateChatBubble() 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'); diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 8aaf68cda..5722934f8 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -45,8 +45,8 @@ void CopyBody_Think() 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; @@ -118,9 +118,9 @@ void CopyBody(entity this, float keepvelocity) 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); @@ -622,10 +622,10 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, // 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; } diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 14965d8c7..a798f2866 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -740,7 +740,7 @@ void CommonCommand_timeout(float request, entity caller) // DEAR GOD THIS COMMA 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); diff --git a/qcsrc/server/command/radarmap.qc b/qcsrc/server/command/radarmap.qc index 5105a5b19..138657b88 100644 --- a/qcsrc/server/command/radarmap.qc +++ b/qcsrc/server/command/radarmap.qc @@ -374,7 +374,7 @@ float RadarMap_Make(float argc) 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; diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 3cea4fcc7..bc530b9bc 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -50,7 +50,7 @@ void make_mapinfo_Think() } else { - self.think = make_mapinfo_Think; + setthink(self, make_mapinfo_Think); self.nextthink = time; } } @@ -969,7 +969,7 @@ void GameCommand_make_mapinfo(float request) 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; diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index c07d57048..15d27a3ee 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -439,7 +439,7 @@ void ReadyRestart_force() 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; } diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 0c76214c8..6081b5ba9 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -531,7 +531,7 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo 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); @@ -850,7 +850,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d farcent.origin = hitloc; farcent.forcetype = FORCETYPE_FORCEATPOS; farcent.nextthink = time + 0.1; - farcent.think = SUB_Remove_self; + setthink(farcent, SUB_Remove_self); } else { @@ -1092,7 +1092,7 @@ float Fire_AddDamage(entity e, entity o, float d, float t, float dt) { // 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; } diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index 774e143e1..34719e2f4 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -97,7 +97,7 @@ void GrapplingHook_Stop() 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'; @@ -386,7 +386,7 @@ void FireGrapplingHook () //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; diff --git a/qcsrc/server/g_lights.qc b/qcsrc/server/g_lights.qc index 2b1d12b94..b8237fa6d 100644 --- a/qcsrc/server/g_lights.qc +++ b/qcsrc/server/g_lights.qc @@ -55,7 +55,7 @@ void dynlight_find_aiment(entity this) 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) @@ -67,7 +67,7 @@ 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) @@ -79,7 +79,7 @@ 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) diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 91f8ec501..f55b4f719 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -82,7 +82,7 @@ void PingPLReport_Think() void PingPLReport_Spawn() { pingplreport = new_pure(pingplreport); - pingplreport.think = PingPLReport_Think; + setthink(pingplreport, PingPLReport_Think); pingplreport.nextthink = time; } @@ -525,10 +525,10 @@ void RandomSeed_Think() 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) @@ -543,7 +543,7 @@ 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 diff --git a/qcsrc/server/ipban.qc b/qcsrc/server/ipban.qc index d129d994f..ec845454a 100644 --- a/qcsrc/server/ipban.qc +++ b/qcsrc/server/ipban.qc @@ -319,7 +319,7 @@ void Ban_LoadBans() } entity e = new(bansyncer); - e.think = OnlineBanList_Think; + setthink(e, OnlineBanList_Think); e.nextthink = time + 1; } diff --git a/qcsrc/server/mutators/mutator/gamemode_assault.qc b/qcsrc/server/mutators/mutator/gamemode_assault.qc index b1d3857b4..f22ba7bd9 100644 --- a/qcsrc/server/mutators/mutator/gamemode_assault.qc +++ b/qcsrc/server/mutators/mutator/gamemode_assault.qc @@ -401,7 +401,7 @@ spawnfunc(func_assault_wall) 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); } diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index 0b354425a..4f449a192 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -1212,7 +1212,7 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e 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; diff --git a/qcsrc/server/mutators/mutator/gamemode_cts.qc b/qcsrc/server/mutators/mutator/gamemode_cts.qc index b669553db..ecf3cb0c1 100644 --- a/qcsrc/server/mutators/mutator/gamemode_cts.qc +++ b/qcsrc/server/mutators/mutator/gamemode_cts.qc @@ -101,7 +101,7 @@ void CTS_ClientKill(entity e) // silent version of ClientKill, used when player { 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 diff --git a/qcsrc/server/mutators/mutator/gamemode_domination.qc b/qcsrc/server/mutators/mutator/gamemode_domination.qc index 49623a36e..7bed67bc9 100644 --- a/qcsrc/server/mutators/mutator/gamemode_domination.qc +++ b/qcsrc/server/mutators/mutator/gamemode_domination.qc @@ -350,7 +350,7 @@ void dom_controlpoint_setup(entity this) 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; @@ -540,7 +540,7 @@ spawnfunc(dom_controlpoint) 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; @@ -657,7 +657,7 @@ void dom_spawnpoint(vector org) { 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); diff --git a/qcsrc/server/mutators/mutator/gamemode_invasion.qc b/qcsrc/server/mutators/mutator/gamemode_invasion.qc index 42592dda7..418e5638d 100644 --- a/qcsrc/server/mutators/mutator/gamemode_invasion.qc +++ b/qcsrc/server/mutators/mutator/gamemode_invasion.qc @@ -141,7 +141,7 @@ void invasion_SpawnChosenMonster(float mon) 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 diff --git a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc index b6d3ca3c0..0d46dcaa4 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc @@ -82,6 +82,8 @@ void ka_EventLog(string mode, entity actor) // use an alias for easy changing an } 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; } @@ -100,7 +102,7 @@ void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated 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); @@ -154,7 +156,7 @@ void ka_TouchEvent() // runs any time that the ball comes in contact with someth 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; @@ -193,7 +195,7 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los 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; @@ -230,7 +232,7 @@ void ka_Reset(entity this) if(time < game_starttime) { - setthink(this, ka_RespawnBall); + setthink(this, ka_RespawnBall_self); settouch(this, func_null); this.nextthink = game_starttime; } diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index 8886753aa..6552d3c4a 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc @@ -220,7 +220,7 @@ void kh_Controller_Think() // called a lot 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; @@ -793,7 +793,7 @@ void kh_Key_Spawn(entity initial_owner, float _angle, float i) // runs every ti 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; @@ -1058,7 +1058,7 @@ void kh_Initialize() // sets up th KH environment // 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); diff --git a/qcsrc/server/mutators/mutator/gamemode_lms.qc b/qcsrc/server/mutators/mutator/gamemode_lms.qc index 22850d8b8..f45fc84cc 100644 --- a/qcsrc/server/mutators/mutator/gamemode_lms.qc +++ b/qcsrc/server/mutators/mutator/gamemode_lms.qc @@ -312,7 +312,7 @@ MUTATOR_HOOKFUNCTION(lms, OnEntityPreSpawn) 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; diff --git a/qcsrc/server/pathlib/debug.qc b/qcsrc/server/pathlib/debug.qc index 16f31e6ef..fff4b606c 100644 --- a/qcsrc/server/pathlib/debug.qc +++ b/qcsrc/server/pathlib/debug.qc @@ -36,19 +36,19 @@ void __showpath2_think() #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; } @@ -82,7 +82,7 @@ void pathlib_showsquare(vector where,float goodsquare,float _lifetime) 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; @@ -107,7 +107,7 @@ void pathlib_showedge(vector where,float _lifetime,float rot) 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; diff --git a/qcsrc/server/pathlib/main.qc b/qcsrc/server/pathlib/main.qc index de63f22ce..cb38136cb 100644 --- a/qcsrc/server/pathlib/main.qc +++ b/qcsrc/server/pathlib/main.qc @@ -11,7 +11,7 @@ void pathlib_deletepath(entity start) e = findchainentity(owner, start); while(e) { - e.think = SUB_Remove_self; + setthink(e, SUB_Remove_self); e.nextthink = time; e = e.chain; } @@ -23,7 +23,7 @@ const float PATHLIB_NODEEXPIRE = 20; void dumpnode(entity n) { n.is_path_node = false; - n.think = SUB_Remove_self; + setthink(n, SUB_Remove_self); n.nextthink = time; } @@ -49,7 +49,7 @@ entity pathlib_mknode(vector where,entity parent) 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; diff --git a/qcsrc/server/pathlib/movenode.qc b/qcsrc/server/pathlib/movenode.qc index decc36d9f..2188702f9 100644 --- a/qcsrc/server/pathlib/movenode.qc +++ b/qcsrc/server/pathlib/movenode.qc @@ -102,7 +102,7 @@ vector pathlib_walknode(entity this, vector start, vector end, float doedge) { entity a; a = spawn(); - a.think = a_think; + setthink(a, a_think); a.nextthink = time; setorigin(a,start + movenode_stepup); a.pos1 = trace_endpos; diff --git a/qcsrc/server/pathlib/path_waypoint.qc b/qcsrc/server/pathlib/path_waypoint.qc index 655482f34..e96de8328 100644 --- a/qcsrc/server/pathlib/path_waypoint.qc +++ b/qcsrc/server/pathlib/path_waypoint.qc @@ -246,6 +246,6 @@ void pathlib_waypointpath_autostep() { entity n; n = spawn(); - n.think = plas_think; + setthink(n, plas_think); n.nextthink = time + 0.1; } diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index c6d31ecbb..01f578a82 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -328,7 +328,7 @@ void Portal_MakeBrokenPortal(entity portal) 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; @@ -339,7 +339,7 @@ void Portal_MakeWaitingPortal(entity portal) 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; @@ -350,7 +350,7 @@ void Portal_MakeInPortal(entity portal) 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; @@ -361,7 +361,7 @@ void Portal_MakeOutPortal(entity portal) 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; @@ -582,7 +582,7 @@ void Portal_RemoveLater(entity portal, float kill) { 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) @@ -629,7 +629,7 @@ entity Portal_Spawn(entity own, vector org, vector ang) 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; diff --git a/qcsrc/server/round_handler.qc b/qcsrc/server/round_handler.qc index 8fb1a787b..8810ff027 100644 --- a/qcsrc/server/round_handler.qc +++ b/qcsrc/server/round_handler.qc @@ -80,7 +80,7 @@ void round_handler_FirstThink() { 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); } @@ -93,7 +93,7 @@ void round_handler_Spawn(float() canRoundStart_func, float() canRoundEnd_func, v } 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; diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index e7268a88f..d725654b3 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -103,7 +103,7 @@ void relocate_spawnpoint(entity this) } 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) diff --git a/qcsrc/server/steerlib.qc b/qcsrc/server/steerlib.qc index 0389efa37..b68432cb1 100644 --- a/qcsrc/server/steerlib.qc +++ b/qcsrc/server/steerlib.qc @@ -500,7 +500,7 @@ void flocker_die(entity this) this.owner = world; this.nextthink = time; - this.think = SUB_Remove; + setthink(this, SUB_Remove); } @@ -553,7 +553,7 @@ void spawn_flocker(entity this) 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; @@ -639,7 +639,7 @@ spawnfunc(flockerspawn) 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); @@ -651,7 +651,7 @@ spawnfunc(flockerspawn) 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; diff --git a/qcsrc/server/t_quake3.qc b/qcsrc/server/t_quake3.qc index c1bf96cd8..921da4f3a 100644 --- a/qcsrc/server/t_quake3.qc +++ b/qcsrc/server/t_quake3.qc @@ -129,7 +129,7 @@ void target_give_init(entity 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; diff --git a/qcsrc/server/weapons/common.qc b/qcsrc/server/weapons/common.qc index 4a06e1666..272a91ff7 100644 --- a/qcsrc/server/weapons/common.qc +++ b/qcsrc/server/weapons/common.qc @@ -89,5 +89,5 @@ void W_PrepareExplosionByDamage(entity this, entity attacker, void() explode) // 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); } diff --git a/qcsrc/server/weapons/throwing.qc b/qcsrc/server/weapons/throwing.qc index b05405de4..f1977c8f0 100644 --- a/qcsrc/server/weapons/throwing.qc +++ b/qcsrc/server/weapons/throwing.qc @@ -80,7 +80,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto 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 diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index b7c81925f..0e7f399d0 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -168,7 +168,7 @@ void CL_SpawnWeaponentity(entity actor, .entity weaponentity) 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; @@ -179,7 +179,7 @@ void CL_SpawnWeaponentity(entity actor, .entity weaponentity) 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);