]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Turrets: propagate self
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 3 Jan 2016 10:55:21 +0000 (21:55 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 3 Jan 2016 10:55:21 +0000 (21:55 +1100)
12 files changed:
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/turret.qh
qcsrc/common/turrets/turret/ewheel.qc
qcsrc/common/turrets/turret/fusionreactor.qc
qcsrc/common/turrets/turret/hellion.qc
qcsrc/common/turrets/turret/hk.qc
qcsrc/common/turrets/turret/mlrs.qc
qcsrc/common/turrets/turret/phaser.qc
qcsrc/common/turrets/turret/plasma.qc
qcsrc/common/turrets/turret/plasma_dual.qc
qcsrc/common/turrets/turret/tesla.qc
qcsrc/common/turrets/turret/walker.qc

index 1ca91e0a8b30623abea2670624e79ea0afde91dd..9fac6c79fe70c0ff031e24bd64b899aa3ff6d9c6 100644 (file)
@@ -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");
        }
index dcb641404a2e869e6e05cc2c7a4e903aa809dc1a..9e315e271aeef05864d8f55d0be42261dd62f426 100644 (file)
@@ -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);
index 1757dea617e4e92046d1c599a7adddae54faa95a..b681df1056a09ee3e6d2eab0aa7211e48be3fcba 100644 (file)
@@ -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;
index 4f3e7cc704869257d18f23886277bb868034a45e..55dcd62538b19b69e9aceb71de57e20fbb8b10d1 100644 (file)
@@ -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);
 }
index dc256e98722b4ca814f704161d572e61e9c25938..6f5d6f6bd8dd05ff0907bc1c3a3ec375076cc6f8 100644 (file)
@@ -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;
index c5ddc6fc8f208a4a2231e4628410f5fa2dae7c02..945dd48afae83a919094508a027de25644a37bd0 100644 (file)
@@ -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;
index 3583af9f01d47d1ccfa762889a3125607dc1f51a..c1302548d83fec358ac20bad5d9acd335e099049 100644 (file)
@@ -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);
index 24a476c03223127a6c43a581f727c8fd7bf70fd4..edfa88f521c867870b38fabf4f915d2afc6bfa09 100644 (file)
@@ -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)
     {
index c36423381d49bd7940220c2f909bd24e5c99f678..37bdd93299978f50f11671369fccdd897a8618ba 100644 (file)
@@ -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;
index d391815828dad6ef5b84d15e8dcfce98d94eac1d..183d4d96512a564139a8789cf12526add639742e 100644 (file)
@@ -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;
index 051137c4f6f153da7d89eb5c6db77a3bdc5f246b..1b61b4ae833c1a6fcd515a5c141c84c8c0eca92f 100644 (file)
@@ -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)
     {
index caec872785062322089a7507151534cf616ae891..6f19e35cb107a1833b889c093c11463900c8c733 100644 (file)
@@ -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);