]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Turrets: make plasma turrets use weapons
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 30 Sep 2015 00:13:56 +0000 (10:13 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 30 Sep 2015 00:13:56 +0000 (10:13 +1000)
14 files changed:
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/turret.qh
qcsrc/common/turrets/turret/ewheel.qc
qcsrc/common/turrets/turret/flac.qc
qcsrc/common/turrets/turret/fusionreactor.qc
qcsrc/common/turrets/turret/hellion.qc
qcsrc/common/turrets/turret/hk.qc
qcsrc/common/turrets/turret/machinegun.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 d8e94560cd7d8f7cf86ec44f566a8868c7cc4bf4..ce04086e7c3d8c35bf1dbe8d2f9e7b44df676bdc 100644 (file)
@@ -990,7 +990,8 @@ void turret_fire()
        if(MUTATOR_CALLHOOK(TurretFire, self))
                return;
 
-       TUR_ACTION(self.m_id, TR_ATTACK);
+       Turret info = get_turretinfo(self.m_id);
+       info.tr_attack(info);
 
        self.attack_finished_single = time + self.shot_refire;
        self.ammo -= self.shot_dmg;
@@ -1229,6 +1230,35 @@ void turrets_manager_think()
        }
 }
 
+void turret_initparams(entity tur)
+{
+       #define TRY(x) (x) ? (x)
+       tur.respawntime                 = max  (-1,              (TRY(tur.respawntime)               :  60                                         ));
+       tur.shot_refire                 = bound(0.01,            (TRY(tur.shot_refire)               :  1                                          ), 9999);
+       tur.shot_dmg                    = max  (1,               (TRY(tur.shot_dmg)                  :  tur.shot_refire * 50                       ));
+       tur.shot_radius                 = max  (1,               (TRY(tur.shot_radius)               :  tur.shot_dmg * 0.5                         ));
+       tur.shot_speed                  = max  (1,               (TRY(tur.shot_speed)                :  2500                                       ));
+       tur.shot_spread                 = bound(0.0001,          (TRY(tur.shot_spread)               :  0.0125                                     ), 500);
+       tur.shot_force                  = bound(0.001,           (TRY(tur.shot_force)                :  tur.shot_dmg * 0.5 + tur.shot_radius * 0.5 ), 5000);
+       tur.shot_volly                  = bound(1,               (TRY(tur.shot_volly)                :  1                                          ), floor(tur.ammo_max / tur.shot_dmg));
+       tur.shot_volly_refire           = bound(tur.shot_refire, (TRY(tur.shot_volly_refire)         :  tur.shot_refire * tur.shot_volly           ), 60);
+       tur.target_range                = bound(0,               (TRY(tur.target_range)              :  tur.shot_speed * 0.5                       ), MAX_SHOT_DISTANCE);
+       tur.target_range_min            = bound(0,               (TRY(tur.target_range_min)          :  tur.shot_radius * 2                        ), MAX_SHOT_DISTANCE);
+       tur.target_range_optimal        = bound(0,               (TRY(tur.target_range_optimal)      :  tur.target_range * 0.5                     ), MAX_SHOT_DISTANCE);
+       tur.aim_maxrotate               = bound(0,               (TRY(tur.aim_maxrotate)             :  90                                         ), 360);
+       tur.aim_maxpitch                = bound(0,               (TRY(tur.aim_maxpitch)              :  20                                         ), 90);
+       tur.aim_speed                   = bound(0.1,             (TRY(tur.aim_speed)                 :  36                                         ), 1000);
+       tur.aim_firetolerance_dist      = bound(0.1,             (TRY(tur.aim_firetolerance_dist)    :  5 + (tur.shot_radius * 2)                  ), MAX_SHOT_DISTANCE);
+       tur.target_select_rangebias     = bound(-10,             (TRY(tur.target_select_rangebias)   :  1                                          ), 10);
+       tur.target_select_samebias      = bound(-10,             (TRY(tur.target_select_samebias)    :  1                                          ), 10);
+       tur.target_select_anglebias     = bound(-10,             (TRY(tur.target_select_anglebias)   :  1                                          ), 10);
+       tur.target_select_missilebias   = bound(-10,             (TRY(tur.target_select_missilebias) :  1                                          ), 10);
+       tur.target_select_playerbias    = bound(-10,             (TRY(tur.target_select_playerbias)  :  1                                          ), 10);
+       tur.ammo_max                    = max  (tur.shot_dmg,    (TRY(tur.ammo_max)                  :  tur.shot_dmg * 10                          ));
+       tur.ammo_recharge               = max  (0,               (TRY(tur.ammo_recharge)             :  tur.shot_dmg * 0.5                         ));
+       #undef TRY
+}
+
 float turret_initialize(float tur_id)
 {SELFPARAM();
        if(!autocvar_g_turrets)
@@ -1283,29 +1313,7 @@ float turret_initialize(float tur_id)
                if(!self.track_blendrate)               { self.track_blendrate = 0.35; }
        }
 
-       self.respawntime                                = max(-1, ((!self.respawntime) ? 60 : self.respawntime));
-       self.shot_refire                                = bound(0.01, ((!self.shot_refire) ? 1 : self.shot_refire), 9999);
-       self.shot_dmg                                   = max(1, ((!self.shot_dmg) ? self.shot_refire * 50 : self.shot_dmg));
-       self.shot_radius                                = max(1, ((!self.shot_radius) ? self.shot_dmg * 0.5 : self.shot_radius));
-       self.shot_speed                                 = max(1, ((!self.shot_speed) ? 2500 : self.shot_speed));
-       self.shot_spread                                = bound(0.0001, ((!self.shot_spread) ? 0.0125 : self.shot_spread), 500);
-       self.shot_force                                 = bound(0.001, ((!self.shot_force) ? self.shot_dmg * 0.5 + self.shot_radius * 0.5 : self.shot_force), 5000);
-       self.shot_volly                                 = bound(1, ((!self.shot_volly) ? 1 : self.shot_volly), floor(self.ammo_max / self.shot_dmg));
-       self.shot_volly_refire                  = bound(self.shot_refire, ((!self.shot_volly_refire) ? self.shot_refire * self.shot_volly : self.shot_volly_refire), 60);
-       self.target_range                               = bound(0, ((!self.target_range) ? self.shot_speed * 0.5 : self.target_range), MAX_SHOT_DISTANCE);
-       self.target_range_min                   = bound(0, ((!self.target_range_min) ? self.shot_radius * 2 : self.target_range_min), MAX_SHOT_DISTANCE);
-       self.target_range_optimal               = bound(0, ((!self.target_range_optimal) ? self.target_range * 0.5 : self.target_range_optimal), MAX_SHOT_DISTANCE);
-       self.aim_maxrotate                              = bound(0, ((!self.aim_maxrotate) ? 90 : self.aim_maxrotate), 360);
-       self.aim_maxpitch                               = bound(0, ((!self.aim_maxpitch) ? 20 : self.aim_maxpitch), 90);
-       self.aim_speed                                  = bound(0.1, ((!self.aim_speed) ? 36 : self.aim_speed), 1000);
-       self.aim_firetolerance_dist     = bound(0.1, ((!self.aim_firetolerance_dist) ? 5 + (self.shot_radius * 2) : self.aim_firetolerance_dist), MAX_SHOT_DISTANCE);
-       self.target_select_rangebias    = bound(-10, ((!self.target_select_rangebias) ? 1 : self.target_select_rangebias), 10);
-       self.target_select_samebias     = bound(-10, ((!self.target_select_samebias) ? 1 : self.target_select_samebias), 10);
-       self.target_select_anglebias    = bound(-10, ((!self.target_select_anglebias) ? 1 : self.target_select_anglebias), 10);
-       self.target_select_missilebias  = bound(-10, ((!self.target_select_missilebias) ? 1 : self.target_select_missilebias), 10);
-       self.target_select_playerbias   = bound(-10, ((!self.target_select_playerbias) ? 1 : self.target_select_playerbias), 10);
-       self.ammo_max                                   = max(self.shot_dmg, ((!self.ammo_max) ? self.shot_dmg * 10 : self.ammo_max));
-       self.ammo_recharge                              = max(0, ((!self.ammo_recharge) ? self.shot_dmg * 0.5 : self.ammo_recharge));
+       turret_initparams(self);
 
        self.turret_flags = TUR_FLAG_ISTURRET | (tur.spawnflags);
 
index 17cf20c7387e935d26fc4e3b9a9140ac6941d2b6..a2c934277c280a5d6db959f945b09faa837f0220 100644 (file)
@@ -169,8 +169,8 @@ const int TR_DEATH = 3; // (SERVER) called when turret dies
 .bool(Turret) tr_death;
 const int TR_PRECACHE = 4; // (BOTH) precaches models/sounds used by this turret
 .bool(Turret) tr_precache;
-const int TR_ATTACK = 5; // (SERVER) called when turret attacks
-.bool(Turret) tr_attack;
+/** (SERVER) called when turret attacks */
+.void(Turret) tr_attack;
 const int TR_CONFIG = 6; // (ALL)
 .bool(Turret) tr_config;
 
@@ -180,7 +180,6 @@ bool t_new(Turret this, int req)
     if (req == TR_THINK) return this.tr_think ? this.tr_think(this) : false;
     if (req == TR_DEATH) return this.tr_death ? this.tr_death(this) : false;
     if (req == TR_PRECACHE) return this.tr_precache ? this.tr_precache(this) : false;
-    if (req == TR_ATTACK) return this.tr_attack ? this.tr_attack(this) : false;
     if (req == TR_CONFIG) return this.tr_config ? this.tr_config(this) : false;
     return false;
 }
index 3bf4227cfe00f3f8647b195ed1d283ed55241f45..be562a828b7940ff175be627dfef299db8269dc6 100644 (file)
@@ -130,7 +130,7 @@ void ewheel_move_idle()
 
 void spawnfunc_turret_ewheel() { SELFPARAM(); if(!turret_initialize(TUR_EWHEEL.m_id)) remove(self); }
 
-        METHOD(EWheel, tr_attack, bool(EWheel thistur))
+        METHOD(EWheel, tr_attack, void(EWheel thistur))
         {
             SELFPARAM();
             float i;
@@ -150,8 +150,6 @@ void spawnfunc_turret_ewheel() { SELFPARAM(); if(!turret_initialize(TUR_EWHEEL.m
                 if (self.tur_head.frame > 3)
                     self.tur_head.frame = 0;
             }
-
-            return true;
         }
         METHOD(EWheel, tr_think, bool(EWheel thistur))
         {
index dbeca59ac4c141be836a44f9cd7c38a8565f9530..d917e27f2f0158518516c166d3549bd7452630eb 100644 (file)
@@ -37,7 +37,7 @@ void turret_flac_projectile_think_explode()
 
 void spawnfunc_turret_flac() { SELFPARAM(); if(!turret_initialize(TUR_FLAC.m_id)) remove(self); }
 
-        METHOD(Flac, tr_attack, bool(Flac thistur))
+        METHOD(Flac, tr_attack, void(Flac thistur))
         {
             entity proj;
 
@@ -52,8 +52,6 @@ void spawnfunc_turret_flac() { SELFPARAM(); if(!turret_initialize(TUR_FLAC.m_id)
             self.tur_head.frame = self.tur_head.frame + 1;
             if (self.tur_head.frame >= 4)
                 self.tur_head.frame = 0;
-
-            return true;
         }
         METHOD(Flac, tr_think, bool(Flac thistur))
         {
index dbd74e42462bac263c158a23ce8f6a79f42c9812..cafcf8ba12d9fb12157e0b1d7c242f70975ce353 100644 (file)
@@ -49,15 +49,13 @@ bool turret_fusionreactor_firecheck()
 
 void spawnfunc_turret_fusionreactor() { SELFPARAM(); if(!turret_initialize(TUR_FUSIONREACTOR.m_id)) remove(self); }
 
-        METHOD(FusionReactor, tr_attack, bool(FusionReactor thistur))
+        METHOD(FusionReactor, tr_attack, void(FusionReactor thistur))
         {
             vector fl_org;
 
             self.enemy.ammo = min(self.enemy.ammo + self.shot_dmg,self.enemy.ammo_max);
             fl_org = 0.5 * (self.enemy.absmin + self.enemy.absmax);
             te_smallflash(fl_org);
-
-            return true;
         }
         METHOD(FusionReactor, tr_think, bool(FusionReactor thistur))
         {
index d5cb00af2063b325d2c3c29773e541181bb3ab09..60cf6e0c69095b95a888762dfbbfc389ddee1560 100644 (file)
@@ -85,7 +85,7 @@ void turret_hellion_missile_think()
 
 void spawnfunc_turret_hellion() { SELFPARAM(); if(!turret_initialize(TUR_HELLION.m_id)) remove(self); }
 
-        METHOD(Hellion, tr_attack, bool(Hellion thistur))
+        METHOD(Hellion, tr_attack, void(Hellion thistur))
         {
             entity missile;
 
@@ -103,8 +103,6 @@ void spawnfunc_turret_hellion() { SELFPARAM(); if(!turret_initialize(TUR_HELLION
             missile.tur_aimpos   = randomvec() * 128;
             missile.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_GUIDED_HEAT;
             self.tur_head.frame += 1;
-
-            return true;
         }
         METHOD(Hellion, tr_think, bool(Hellion thistur))
         {
index 482fba4b0980cfebc79d7f3bbe5e1615ae383e34..240143e573501c312af81a67236d943c03d89cc2 100644 (file)
@@ -282,7 +282,7 @@ float turret_hk_addtarget(entity e_target,entity e_sender)
 
 void spawnfunc_turret_hk() { SELFPARAM(); if(!turret_initialize(TUR_HK.m_id)) remove(self); }
 
-        METHOD(HunterKiller, tr_attack, bool(HunterKiller thistur))
+        METHOD(HunterKiller, tr_attack, void(HunterKiller thistur))
         {
             entity missile;
 
@@ -300,8 +300,6 @@ void spawnfunc_turret_hk() { SELFPARAM(); if(!turret_initialize(TUR_HK.m_id)) re
 
             if (self.tur_head.frame == 0)
                 self.tur_head.frame = self.tur_head.frame + 1;
-
-            return true;
         }
         METHOD(HunterKiller, tr_think, bool(HunterKiller thistur))
         {
index cbb0901e6ed327fbc61882678409c3d2409e2a87..8ca679a053cd7960accd836bc5f13ccf2039c047 100644 (file)
@@ -22,14 +22,12 @@ void spawnfunc_turret_machinegun() { SELFPARAM(); if(!turret_initialize(TUR_MACH
 
 void W_MachineGun_MuzzleFlash(void);
 
-        METHOD(MachineGunTurret, tr_attack, bool(MachineGunTurret thistur))
+        METHOD(MachineGunTurret, tr_attack, void(MachineGunTurret thistur))
         {
             fireBullet (self.tur_shotorg, self.tur_shotdir_updated, self.shot_spread, 0, self.shot_dmg, self.shot_force, DEATH_TURRET_MACHINEGUN, 0);
 
             W_MachineGun_MuzzleFlash();
             setattachment(self.muzzle_flash, self.tur_head, "tag_fire");
-
-            return true;
         }
         METHOD(MachineGunTurret, tr_think, bool(MachineGunTurret thistur))
         {
index 1f282ce10c03bdc9a377c318a5d5e9fc950bc7df..35fe1e3c722b1573672d86212ba6d0483e99e1d9 100644 (file)
@@ -20,7 +20,7 @@ REGISTER_TURRET(MLRS, NEW(MLRSTurret));
 #ifdef SVQC
 void spawnfunc_turret_mlrs() { SELFPARAM(); if(!turret_initialize(TUR_MLRS.m_id)) remove(self); }
 
-        METHOD(MLRSTurret, tr_attack, bool(MLRSTurret thistur))
+        METHOD(MLRSTurret, tr_attack, void(MLRSTurret thistur))
         {
             entity missile;
 
@@ -29,8 +29,6 @@ void spawnfunc_turret_mlrs() { SELFPARAM(); if(!turret_initialize(TUR_MLRS.m_id)
             missile.nextthink = time + max(self.tur_impacttime,(self.shot_radius * 2) / self.shot_speed);
             missile.missile_flags = MIF_SPLASH;
             te_explosion (missile.origin);
-
-            return true;
         }
         METHOD(MLRSTurret, tr_think, bool(MLRSTurret thistur))
         {
index 830fbc4461785cdb039efb9e5d1a356841501d5b..8689ebd26290f365d1395ac0f20c4c8e5d03e4f3 100644 (file)
@@ -66,7 +66,7 @@ void beam_think()
 
 void spawnfunc_turret_phaser() { SELFPARAM(); if(!turret_initialize(TUR_PHASER.m_id)) remove(self); }
 
-        METHOD(PhaserTurret, tr_attack, bool(PhaserTurret thistur))
+        METHOD(PhaserTurret, tr_attack, void(PhaserTurret thistur))
         {
             entity beam;
 
@@ -98,8 +98,6 @@ void spawnfunc_turret_phaser() { SELFPARAM(); if(!turret_initialize(TUR_PHASER.m
 
             if (self.tur_head.frame == 0)
                 self.tur_head.frame = 1;
-
-            return true;
         }
         METHOD(PhaserTurret, tr_think, bool(PhaserTurret thistur))
         {
index 0025ae619817332de5784a7cb0af561275e341eb..d5c8ea42a1d7f272eda7fa9953c9b84a366b9214 100644 (file)
@@ -17,16 +17,44 @@ REGISTER_TURRET(PLASMA, NEW(PlasmaTurret));
 #endif
 
 #ifdef IMPLEMENTATION
+
+CLASS(PlasmaAttack, PortoLaunch)
+/* flags     */ ATTRIB(PlasmaAttack, spawnflags, int, WEP_TYPE_OTHER);
+/* impulse   */ ATTRIB(PlasmaAttack, impulse, int, 5);
+/* refname   */ ATTRIB(PlasmaAttack, netname, string, "plasma");
+/* wepname   */ ATTRIB(PlasmaAttack, message, string, _("Plasma"));
+ENDCLASS(PlasmaAttack)
+REGISTER_WEAPON(PLASMA, NEW(PlasmaAttack));
+
 #ifdef SVQC
+
+void turret_initparams(entity tur);
+METHOD(PlasmaAttack, wr_think, bool(entity thiswep, bool fire1, bool fire2)) {
+       SELFPARAM();
+       bool isPlayer = IS_PLAYER(self);
+       if (fire1)
+       if (!isPlayer || weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
+               if (isPlayer) {
+            turret_initparams(self);
+            W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+            self.tur_shotdir_updated = w_shotdir;
+            self.tur_shotorg = w_shotorg;
+            self.tur_head = self;
+            weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+        }
+        entity missile = turret_projectile(SND(HAGAR_FIRE), 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, true, true);
+        missile.missile_flags = MIF_SPLASH;
+        Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
+       }
+       return true;
+}
+
 void spawnfunc_turret_plasma() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA.m_id)) remove(self); }
 
-        METHOD(PlasmaTurret, tr_attack, bool(PlasmaTurret thistur))
+        METHOD(PlasmaTurret, tr_attack, void(PlasmaTurret thistur))
         {
             if(g_instagib)
             {
-                float flying;
-                flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
-
                 FireRailgunBullet (self.tur_shotorg, self.tur_shotorg + self.tur_shotdir_updated * MAX_SHOT_DISTANCE, 10000000000,
                                    800, 0, 0, 0, 0, DEATH_TURRET_PLASMA);
 
@@ -35,20 +63,14 @@ void spawnfunc_turret_plasma() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA.m
                 // teamcolor / hit beam effect
                 vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
                 WarpZone_TrailParticles(world, particleeffectnum(EFFECT_VAPORIZER(self.team)), self.tur_shotorg, v);
-                if (self.tur_head.frame == 0)
-                    self.tur_head.frame = 1;
             }
             else
             {
-                entity missile = turret_projectile(SND(HAGAR_FIRE), 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE);
-                missile.missile_flags = MIF_SPLASH;
-
-                Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
-                if (self.tur_head.frame == 0)
-                    self.tur_head.frame = 1;
+                Weapon wep = WEP_PLASMA;
+                wep.wr_think(wep, true, false);
             }
-
-            return true;
+            if (self.tur_head.frame == 0)
+                self.tur_head.frame = 1;
         }
         METHOD(PlasmaTurret, tr_think, bool(PlasmaTurret thistur))
         {
index 62f0c7138a85ee475572d71c2c9e357d73821521..a7e064b35d6806aa59ec172f931211a7e73e371a 100644 (file)
@@ -30,35 +30,32 @@ REGISTER_WEAPON(PLASMA_DUAL, NEW(PlasmaDualAttack));
 
 #ifdef SVQC
 
+void turret_initparams(entity tur);
 METHOD(PlasmaDualAttack, wr_think, bool(entity thiswep, bool fire1, bool fire2)) {
        SELFPARAM();
+       bool isPlayer = IS_PLAYER(self);
        if (fire1)
-       if (weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
-               W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
-               self.tur_shotdir_updated = w_shotdir;
-               self.tur_shotorg = w_shotorg;
-               self.tur_head = self;
-               self.shot_refire = bound(0.01, ((!self.shot_refire) ? 1 : self.shot_refire), 9999);
-               self.shot_dmg = max(1, ((!self.shot_dmg) ? self.shot_refire * 50 : self.shot_dmg));
-        self.shot_radius = max(1, ((!self.shot_radius) ? self.shot_dmg * 0.5 : self.shot_radius));
-        self.shot_speed = max(1, ((!self.shot_speed) ? 2500 : self.shot_speed));
-        self.shot_spread = bound(0.0001, ((!self.shot_spread) ? 0.0125 : self.shot_spread), 500);
-        self.shot_force = bound(0.001, ((!self.shot_force) ? self.shot_dmg * 0.5 + self.shot_radius * 0.5 : self.shot_force), 5000);
-        TUR_ACTION(TUR_PLASMA_DUAL.m_id, TR_ATTACK);
-               weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+       if (!isPlayer || weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
+               if (isPlayer) {
+            turret_initparams(self);
+            W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+            self.tur_shotdir_updated = w_shotdir;
+            self.tur_shotorg = w_shotorg;
+            self.tur_head = self;
+            weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+        }
+        entity missile = turret_projectile(SND(HAGAR_FIRE), 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, true, true);
+        missile.missile_flags = MIF_SPLASH;
+        Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
        }
        return true;
 }
 
 void spawnfunc_turret_plasma_dual() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA_DUAL.m_id)) remove(self); }
 
-        METHOD(DualPlasmaTurret, tr_attack, bool(DualPlasmaTurret thistur))
+        METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret thistur))
         {
-            if(g_instagib)
-            {
-                float flying;
-                flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
-
+            if (g_instagib) {
                 FireRailgunBullet (self.tur_shotorg, self.tur_shotorg + self.tur_shotdir_updated * MAX_SHOT_DISTANCE, 10000000000,
                                    800, 0, 0, 0, 0, DEATH_TURRET_PLASMA);
 
@@ -68,17 +65,11 @@ void spawnfunc_turret_plasma_dual() { SELFPARAM(); if(!turret_initialize(TUR_PLA
                 // teamcolor / hit beam effect
                 vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
                 WarpZone_TrailParticles(world, particleeffectnum(EFFECT_VAPORIZER(self.team)), self.tur_shotorg, v);
-                self.tur_head.frame += 1;
-            }
-            else
-            {
-                entity missile = turret_projectile(SND(HAGAR_FIRE), 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE);
-                missile.missile_flags = MIF_SPLASH;
-                Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
-                self.tur_head.frame += 1;
+            } else {
+                Weapon wep = WEP_PLASMA_DUAL;
+                wep.wr_think(wep, true, false);
             }
-
-            return true;
+            self.tur_head.frame += 1;
         }
         METHOD(DualPlasmaTurret, tr_think, bool(DualPlasmaTurret thistur))
         {
index b39bdc731343d0e60e9d4f0db4a592387ccf4ebe..80b2d1e7f3011e5409c79b7a347e6603516aa3dd 100644 (file)
@@ -98,7 +98,7 @@ float turret_tesla_firecheck()
 
 void spawnfunc_turret_tesla() { SELFPARAM(); if(!turret_initialize(TUR_TESLA.m_id)) remove(self); }
 
-        METHOD(TeslaCoil, tr_attack, bool(TeslaCoil thistur))
+        METHOD(TeslaCoil, tr_attack, void(TeslaCoil thistur))
         {
             entity e, t;
             float d, r, i;
@@ -113,7 +113,7 @@ void spawnfunc_turret_tesla() { SELFPARAM(); if(!turret_initialize(TUR_TESLA.m_i
             t = toast(e,r,d);
             remove(e);
 
-            if (t == world) return true;
+            if (t == world) return;
 
             self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES | TFL_TARGETSELECT_TEAMCHECK;
 
@@ -133,8 +133,6 @@ void spawnfunc_turret_tesla() { SELFPARAM(); if(!turret_initialize(TUR_TESLA.m_i
                 e.railgunhit = 0;
                 e = e.chain;
             }
-
-            return true;
         }
         METHOD(TeslaCoil, tr_think, bool(TeslaCoil thistur))
         {
index 1c8813a187dcacfa3a2bf3603dac1878aa24a19f..36582d4281a7efb84df535e89baea0533b2d76c5 100644 (file)
@@ -343,13 +343,11 @@ void walker_move_path()
 
 void spawnfunc_turret_walker() { SELFPARAM(); if(!turret_initialize(TUR_WALKER.m_id)) remove(self); }
 
-        METHOD(WalkerTurret, tr_attack, bool(WalkerTurret thistur))
+        METHOD(WalkerTurret, tr_attack, void(WalkerTurret thistur))
         {
             sound (self, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
             fireBullet (self.tur_shotorg, self.tur_shotdir_updated, self.shot_spread, 0, self.shot_dmg, self.shot_force, DEATH_TURRET_WALK_GUN, 0);
             Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
-
-            return true;
         }
         METHOD(WalkerTurret, tr_think, bool(WalkerTurret thistur))
         {