]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/turrets/turret/phaser_weapon.qc
Merge branch 'master' into TimePath/csqc_viewmodels
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / turret / phaser_weapon.qc
index 2cb036bc557582cc1dca9ef80da2c21f0f7f5d77..087ade8d47b2c1e7e23ac18b1e647433eab2a4b9 100644 (file)
@@ -5,7 +5,7 @@ CLASS(PhaserTurretAttack, PortoLaunch)
 /* flags     */ ATTRIB(PhaserTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
 /* impulse   */ ATTRIB(PhaserTurretAttack, impulse, int, 9);
 /* refname   */ ATTRIB(PhaserTurretAttack, netname, string, "turret_phaser");
-/* wepname   */ ATTRIB(PhaserTurretAttack, message, string, _("Phaser"));
+/* wepname   */ ATTRIB(PhaserTurretAttack, m_name, string, _("Phaser"));
 ENDCLASS(PhaserTurretAttack)
 REGISTER_WEAPON(PHASER, NEW(PhaserTurretAttack));
 
@@ -17,20 +17,20 @@ REGISTER_WEAPON(PHASER, NEW(PhaserTurretAttack));
 void beam_think();
 
 .int fireflag;
-
-METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+SOUND(PhaserTurretAttack_FIRE, W_Sound("electro_fire"));
+METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
     bool isPlayer = IS_PLAYER(actor);
-    if (fire1)
-    if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) {
+    if (fire & 1)
+    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, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+            W_SetupShot_Dir(actor, v_forward, false, 0, SND(PhaserTurretAttack_FIRE), CH_WEAPON_B, 0);
             actor.tur_shotdir_updated = w_shotdir;
             actor.tur_shotorg = w_shotorg;
             actor.tur_head = actor;
             actor.shot_speed = 1;
-            weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
         }
         entity beam = spawn();
         beam.ticrate = 0.1; //autocvar_sys_ticrate;
@@ -51,8 +51,8 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, bool fir
         sound (beam, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM);
         actor.fireflag = 1;
 
-        beam.attack_finished_single = actor.attack_finished_single;
-        actor.attack_finished_single = time; // + autocvar_sys_ticrate;
+        beam.attack_finished_single[0] = actor.attack_finished_single[0];
+        actor.attack_finished_single[0] = time; // + autocvar_sys_ticrate;
 
         setattachment(beam,actor.tur_head, "tag_fire");
 
@@ -67,7 +67,7 @@ void beam_think()
 {SELFPARAM();
     if ((time > self.cnt) || (self.owner.deadflag != DEAD_NO))
     {
-        self.owner.attack_finished_single = time + self.owner.shot_refire;
+        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);
@@ -86,7 +86,7 @@ void beam_think()
 
     self.nextthink = time + self.ticrate;
 
-    self.owner.attack_finished_single = time + frametime;
+    self.owner.attack_finished_single[0] = time + frametime;
     setself(self.owner);
     FireImoBeam (   self.tur_shotorg,
                     self.tur_shotorg + self.tur_shotdir_updated * self.target_range,
@@ -95,7 +95,7 @@ void beam_think()
                     self.shot_force,
                     this.shot_dmg,
                     0.75,
-                    DEATH_TURRET_PHASER);
+                    DEATH_TURRET_PHASER.m_id);
     setself(this);
     self.scale = vlen(self.owner.tur_shotorg - trace_endpos) / 256;