]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/turrets/turret/phaser_weapon.qc
Give W_SetupShot a deathtype parameter, fixes some ugly hacks
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / turret / phaser_weapon.qc
index 1f6d62c95b78bb7fa13a81b8955b00ef4f6b2a05..0a3627631139a250552448dbf48f54870ae9a332 100644 (file)
@@ -1,7 +1,5 @@
 #include "phaser_weapon.qh"
 
-#ifdef IMPLEMENTATION
-
 #ifdef SVQC
 void beam_think(entity this);
 
@@ -14,7 +12,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity
     if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
         if (isPlayer) {
             turret_initparams(actor);
-            W_SetupShot_Dir(actor, v_forward, false, 0, SND_PhaserTurretAttack_FIRE, CH_WEAPON_B, 0);
+            W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_PhaserTurretAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_PHASER.m_id);
             actor.tur_shotdir_updated = w_shotdir;
             actor.tur_shotorg = w_shotorg;
             actor.tur_head = actor;
@@ -33,9 +31,10 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity
         beam.owner = actor;
         beam.shot_dmg = actor.shot_dmg / (actor.shot_speed / beam.ticrate);
         beam.scale = actor.target_range / 256;
-        beam.movetype = MOVETYPE_NONE;
+        set_movetype(beam, MOVETYPE_NONE);
         beam.enemy = actor.enemy;
         beam.bot_dodge = true;
+        IL_PUSH(g_bot_dodge, beam);
         beam.bot_dodgerating = beam.shot_dmg;
         sound (beam, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM);
         actor.fireflag = 1;
@@ -54,40 +53,38 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity
 
 void beam_think(entity this)
 {
-    if ((time > self.cnt) || (IS_DEAD(self.owner)))
+    if ((time > this.cnt) || (IS_DEAD(this.owner)))
     {
-        self.owner.attack_finished_single[0] = time + self.owner.shot_refire;
-        self.owner.fireflag = 2;
-        self.owner.tur_head.frame = 10;
-        sound (self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
-        remove(self);
+        this.owner.attack_finished_single[0] = time + this.owner.shot_refire;
+        this.owner.fireflag = 2;
+        this.owner.tur_head.frame = 10;
+        sound (this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
+        delete(this);
         return;
     }
 
-    turret_do_updates(self.owner);
+    turret_do_updates(this.owner);
 
-    if (time - self.shot_spread > 0)
+    if (time - this.shot_spread > 0)
     {
-        self.shot_spread = time + 2;
-        sound (self, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM);
+        this.shot_spread = time + 2;
+        sound (this, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM);
     }
 
 
-    self.nextthink = time + self.ticrate;
+    this.nextthink = time + this.ticrate;
 
-    self.owner.attack_finished_single[0] = time + frametime;
-    FireImoBeam (   self.owner, self.tur_shotorg,
-                    self.tur_shotorg + self.tur_shotdir_updated * self.target_range,
-                    '-1 -1 -1' * self.shot_radius,
-                    '1 1 1' * self.shot_radius,
-                    self.shot_force,
+    this.owner.attack_finished_single[0] = time + frametime;
+    FireImoBeam (   this.owner, this.tur_shotorg,
+                    this.tur_shotorg + this.tur_shotdir_updated * this.target_range,
+                    '-1 -1 -1' * this.shot_radius,
+                    '1 1 1' * this.shot_radius,
+                    this.shot_force,
                     this.shot_dmg,
                     0.75,
                     DEATH_TURRET_PHASER.m_id);
-    self.scale = vlen(self.owner.tur_shotorg - trace_endpos) / 256;
+    this.scale = vlen(this.owner.tur_shotorg - trace_endpos) / 256;
 
 }
 
 #endif
-
-#endif