From b3e6c1e50968511dd530f208775d5d941a769791 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 3 Jan 2016 21:55:21 +1100 Subject: [PATCH] Turrets: propagate self --- qcsrc/common/turrets/sv_turrets.qc | 10 +++++----- qcsrc/common/turrets/turret.qh | 6 +++--- qcsrc/common/turrets/turret/ewheel.qc | 2 +- qcsrc/common/turrets/turret/fusionreactor.qc | 4 ++-- qcsrc/common/turrets/turret/hellion.qc | 2 +- qcsrc/common/turrets/turret/hk.qc | 2 +- qcsrc/common/turrets/turret/mlrs.qc | 2 +- qcsrc/common/turrets/turret/phaser.qc | 2 +- qcsrc/common/turrets/turret/plasma.qc | 6 +++--- qcsrc/common/turrets/turret/plasma_dual.qc | 6 +++--- qcsrc/common/turrets/turret/tesla.qc | 2 +- qcsrc/common/turrets/turret/walker.qc | 2 +- 12 files changed, 23 insertions(+), 23 deletions(-) diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 1ca91e0a8..9fac6c79f 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -994,7 +994,7 @@ void turret_fire() return; Turret info = get_turretinfo(self.m_id); - info.tr_attack(info); + info.tr_attack(info, self); self.attack_finished_single[0] = time + self.shot_refire; self.ammo -= self.shot_dmg; @@ -1108,7 +1108,7 @@ void turret_think() turret_fire(); Turret tur = get_turretinfo(self.m_id); - tur.tr_think(tur); + tur.tr_think(tur, self); return; } @@ -1147,7 +1147,7 @@ void turret_think() turret_track(); Turret tur = get_turretinfo(self.m_id); - tur.tr_think(tur); + tur.tr_think(tur, self); // And bail. return; @@ -1171,7 +1171,7 @@ void turret_think() } Turret tur = get_turretinfo(self.m_id); - tur.tr_think(tur); + tur.tr_think(tur, self); } /* @@ -1209,7 +1209,7 @@ void turrets_manager_think() FOREACH_ENTITY(IS_TURRET(it), LAMBDA( load_unit_settings(it, true); Turret tur = get_turretinfo(it.m_id); - tur.tr_think(tur); + tur.tr_think(tur, it); )); cvar_set("g_turrets_reloadcvars", "0"); } diff --git a/qcsrc/common/turrets/turret.qh b/qcsrc/common/turrets/turret.qh index dcb641404..9e315e271 100644 --- a/qcsrc/common/turrets/turret.qh +++ b/qcsrc/common/turrets/turret.qh @@ -23,7 +23,7 @@ CLASS(Turret, Object) /** turret hitbox size */ ATTRIB(Turret, maxs, vector, '0 0 0') - METHOD(Turret, display, void(entity this, void(string name, string icon) returns)) { + METHOD(Turret, display, void(Turret this, void(string name, string icon) returns)) { returns(this.turret_name, string_null); } /** (BOTH) setup turret data */ @@ -31,7 +31,7 @@ CLASS(Turret, Object) } /** (SERVER) logic to run every frame */ - METHOD(Turret, tr_think, void(Turret this)) { + METHOD(Turret, tr_think, void(Turret this, entity it)) { } /** (SERVER) called when turret dies */ @@ -45,7 +45,7 @@ CLASS(Turret, Object) ATTRIB(Turret, m_weapon, Weapon, WEP_Null) #ifdef SVQC /** (SERVER) called when turret attacks */ - METHOD(Turret, tr_attack, void(Turret this)) { + METHOD(Turret, tr_attack, void(Turret this, entity it)) { Weapon w = this.m_weapon; .entity weaponentity = weaponentities[0]; w.wr_think(w, self, weaponentity, 1); diff --git a/qcsrc/common/turrets/turret/ewheel.qc b/qcsrc/common/turrets/turret/ewheel.qc index 1757dea61..b681df105 100644 --- a/qcsrc/common/turrets/turret/ewheel.qc +++ b/qcsrc/common/turrets/turret/ewheel.qc @@ -137,7 +137,7 @@ void ewheel_move_idle() spawnfunc(turret_ewheel) { if(!turret_initialize(TUR_EWHEEL)) remove(self); } - METHOD(EWheel, tr_think, void(EWheel thistur)) + METHOD(EWheel, tr_think, void(EWheel thistur, entity it)) { SELFPARAM(); float vz; diff --git a/qcsrc/common/turrets/turret/fusionreactor.qc b/qcsrc/common/turrets/turret/fusionreactor.qc index 4f3e7cc70..55dcd6253 100644 --- a/qcsrc/common/turrets/turret/fusionreactor.qc +++ b/qcsrc/common/turrets/turret/fusionreactor.qc @@ -48,13 +48,13 @@ bool turret_fusionreactor_firecheck() spawnfunc(turret_fusionreactor) { if (!turret_initialize(TUR_FUSIONREACTOR)) remove(self); } -METHOD(FusionReactor, tr_attack, void(FusionReactor this)) +METHOD(FusionReactor, tr_attack, void(FusionReactor this, entity it)) { self.enemy.ammo = min(self.enemy.ammo + self.shot_dmg,self.enemy.ammo_max); vector fl_org = 0.5 * (self.enemy.absmin + self.enemy.absmax); te_smallflash(fl_org); } -METHOD(FusionReactor, tr_think, void(FusionReactor thistur)) +METHOD(FusionReactor, tr_think, void(FusionReactor thistur, entity it)) { self.tur_head.avelocity = '0 250 0' * (self.ammo / self.ammo_max); } diff --git a/qcsrc/common/turrets/turret/hellion.qc b/qcsrc/common/turrets/turret/hellion.qc index dc256e987..6f5d6f6bd 100644 --- a/qcsrc/common/turrets/turret/hellion.qc +++ b/qcsrc/common/turrets/turret/hellion.qc @@ -26,7 +26,7 @@ REGISTER_TURRET(HELLION, NEW(Hellion)); spawnfunc(turret_hellion) { if (!turret_initialize(TUR_HELLION)) remove(self); } -METHOD(Hellion, tr_think, void(Hellion thistur)) +METHOD(Hellion, tr_think, void(Hellion thistur, entity it)) { if (self.tur_head.frame != 0) self.tur_head.frame += 1; diff --git a/qcsrc/common/turrets/turret/hk.qc b/qcsrc/common/turrets/turret/hk.qc index c5ddc6fc8..945dd48af 100644 --- a/qcsrc/common/turrets/turret/hk.qc +++ b/qcsrc/common/turrets/turret/hk.qc @@ -32,7 +32,7 @@ REGISTER_TURRET(HK, NEW(HunterKiller)); spawnfunc(turret_hk) { if(!turret_initialize(TUR_HK)) remove(self); } -METHOD(HunterKiller, tr_think, void(HunterKiller thistur)) +METHOD(HunterKiller, tr_think, void(HunterKiller thistur, entity it)) { if (self.tur_head.frame != 0) self.tur_head.frame = self.tur_head.frame + 1; diff --git a/qcsrc/common/turrets/turret/mlrs.qc b/qcsrc/common/turrets/turret/mlrs.qc index 3583af9f0..c1302548d 100644 --- a/qcsrc/common/turrets/turret/mlrs.qc +++ b/qcsrc/common/turrets/turret/mlrs.qc @@ -26,7 +26,7 @@ REGISTER_TURRET(MLRS, NEW(MLRSTurret)); spawnfunc(turret_mlrs) { if (!turret_initialize(TUR_MLRS)) remove(self); } -METHOD(MLRSTurret, tr_think, void(MLRSTurret thistur)) +METHOD(MLRSTurret, tr_think, void(MLRSTurret thistur, entity it)) { // 0 = full, 6 = empty self.tur_head.frame = bound(0, 6 - floor(0.1 + self.ammo / self.shot_dmg), 6); diff --git a/qcsrc/common/turrets/turret/phaser.qc b/qcsrc/common/turrets/turret/phaser.qc index 24a476c03..edfa88f52 100644 --- a/qcsrc/common/turrets/turret/phaser.qc +++ b/qcsrc/common/turrets/turret/phaser.qc @@ -26,7 +26,7 @@ REGISTER_TURRET(PHASER, NEW(PhaserTurret)); spawnfunc(turret_phaser) { if (!turret_initialize(TUR_PHASER)) remove(self); } -METHOD(PhaserTurret, tr_think, void(PhaserTurret thistur)) +METHOD(PhaserTurret, tr_think, void(PhaserTurret thistur, entity it)) { if (self.tur_head.frame != 0) { diff --git a/qcsrc/common/turrets/turret/plasma.qc b/qcsrc/common/turrets/turret/plasma.qc index c36423381..37bdd9329 100644 --- a/qcsrc/common/turrets/turret/plasma.qc +++ b/qcsrc/common/turrets/turret/plasma.qc @@ -26,7 +26,7 @@ REGISTER_TURRET(PLASMA, NEW(PlasmaTurret)); spawnfunc(turret_plasma) { if (!turret_initialize(TUR_PLASMA)) remove(self); } -METHOD(PlasmaTurret, tr_attack, void(PlasmaTurret this)) +METHOD(PlasmaTurret, tr_attack, void(PlasmaTurret this, entity it)) { if(g_instagib) { @@ -41,12 +41,12 @@ METHOD(PlasmaTurret, tr_attack, void(PlasmaTurret this)) } else { - SUPER(PlasmaTurret).tr_attack(this); + SUPER(PlasmaTurret).tr_attack(this, it); } if (self.tur_head.frame == 0) self.tur_head.frame = 1; } -METHOD(PlasmaTurret, tr_think, void(PlasmaTurret thistur)) +METHOD(PlasmaTurret, tr_think, void(PlasmaTurret thistur, entity it)) { if (self.tur_head.frame != 0) self.tur_head.frame = self.tur_head.frame + 1; diff --git a/qcsrc/common/turrets/turret/plasma_dual.qc b/qcsrc/common/turrets/turret/plasma_dual.qc index d39181582..183d4d965 100644 --- a/qcsrc/common/turrets/turret/plasma_dual.qc +++ b/qcsrc/common/turrets/turret/plasma_dual.qc @@ -28,7 +28,7 @@ REGISTER_TURRET(PLASMA_DUAL, NEW(DualPlasmaTurret)); spawnfunc(turret_plasma_dual) { if (!turret_initialize(TUR_PLASMA_DUAL)) remove(self); } -METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret this)) +METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret this, entity it)) { if (g_instagib) { FireRailgunBullet (self.tur_shotorg, self.tur_shotorg + self.tur_shotdir_updated * MAX_SHOT_DISTANCE, 10000000000, @@ -41,11 +41,11 @@ METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret this)) vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); WarpZone_TrailParticles(world, particleeffectnum(EFFECT_VAPORIZER(self.team)), self.tur_shotorg, v); } else { - SUPER(PlasmaTurret).tr_attack(this); + SUPER(PlasmaTurret).tr_attack(this, it); } self.tur_head.frame += 1; } -METHOD(DualPlasmaTurret, tr_think, void(DualPlasmaTurret thistur)) +METHOD(DualPlasmaTurret, tr_think, void(DualPlasmaTurret thistur, entity it)) { if ((self.tur_head.frame != 0) && (self.tur_head.frame != 3)) self.tur_head.frame = self.tur_head.frame + 1; diff --git a/qcsrc/common/turrets/turret/tesla.qc b/qcsrc/common/turrets/turret/tesla.qc index 051137c4f..1b61b4ae8 100644 --- a/qcsrc/common/turrets/turret/tesla.qc +++ b/qcsrc/common/turrets/turret/tesla.qc @@ -26,7 +26,7 @@ REGISTER_TURRET(TESLA, NEW(TeslaCoil)); spawnfunc(turret_tesla) { if (!turret_initialize(TUR_TESLA)) remove(self); } -METHOD(TeslaCoil, tr_think, void(TeslaCoil thistur)) +METHOD(TeslaCoil, tr_think, void(TeslaCoil thistur, entity it)) { if(!self.active) { diff --git a/qcsrc/common/turrets/turret/walker.qc b/qcsrc/common/turrets/turret/walker.qc index caec87278..6f19e35cb 100644 --- a/qcsrc/common/turrets/turret/walker.qc +++ b/qcsrc/common/turrets/turret/walker.qc @@ -348,7 +348,7 @@ void walker_move_path() spawnfunc(turret_walker) { if(!turret_initialize(TUR_WALKER)) remove(self); } - METHOD(WalkerTurret, tr_think, void(WalkerTurret thistur)) + METHOD(WalkerTurret, tr_think, void(WalkerTurret thistur, entity it)) { fixedmakevectors(self.angles); -- 2.39.2