]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/turrets/turret/hellion_weapon.qc
Merge branch 'terencehill/lms_itemtimes_fix' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / turret / hellion_weapon.qc
index c3fe8bc019caf55ecd5d2f9ee9e546627a069eb6..0b118be1364e74cef956fe16448f940e47fe6faf 100644 (file)
@@ -2,10 +2,10 @@
 #define TURRET_HELLION_WEAPON_H
 
 CLASS(HellionAttack, PortoLaunch)
-/* flags     */ ATTRIB(HellionAttack, spawnflags, int, WEP_TYPE_OTHER);
+/* flags     */ ATTRIB(HellionAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
 /* impulse   */ ATTRIB(HellionAttack, impulse, int, 9);
 /* refname   */ ATTRIB(HellionAttack, netname, string, "turret_hellion");
-/* wepname   */ ATTRIB(HellionAttack, message, string, _("Hellion"));
+/* wepname   */ ATTRIB(HellionAttack, m_name, string, _("Hellion"));
 ENDCLASS(HellionAttack)
 REGISTER_WEAPON(HELLION, NEW(HellionAttack));
 
@@ -19,28 +19,28 @@ float autocvar_g_turrets_unit_hellion_shot_speed_gain;
 float autocvar_g_turrets_unit_hellion_shot_speed_max;
 
 void turret_hellion_missile_think();
-METHOD(HellionAttack, 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))) {
+SOUND(HellionAttack_FIRE, W_Sound("electro_fire"));
+METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
+    bool isPlayer = IS_PLAYER(actor);
+    if (fire & 1)
+    if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, 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;
-            self.shot_radius = 500;
-            weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+            turret_initparams(actor);
+            W_SetupShot_Dir(actor, v_forward, false, 0, SND(HellionAttack_FIRE), CH_WEAPON_B, 0);
+            actor.tur_shotdir_updated = w_shotdir;
+            actor.tur_shotorg = w_shotorg;
+            actor.tur_head = actor;
+            actor.shot_radius = 500;
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
         }
         if (!isPlayer) {
-            if (self.tur_head.frame != 0)
-                self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire"));
+            if (actor.tur_head.frame != 0)
+                actor.tur_shotorg = gettaginfo(actor.tur_head, gettagindex(actor.tur_head, "tag_fire"));
             else
-                self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire2"));
+                actor.tur_shotorg = gettaginfo(actor.tur_head, gettagindex(actor.tur_head, "tag_fire2"));
         }
 
-        entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HELLION, PROJECTILE_ROCKET, FALSE, FALSE);
+        entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HELLION.m_id, PROJECTILE_ROCKET, false, false);
         te_explosion (missile.origin);
         missile.think          = turret_hellion_missile_think;
         missile.nextthink      = time;
@@ -48,9 +48,8 @@ METHOD(HellionAttack, wr_think, bool(entity thiswep, bool fire1, bool fire2)) {
         missile.max_health   = time + 9;
         missile.tur_aimpos   = randomvec() * 128;
         missile.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_GUIDED_HEAT;
-        if (!isPlayer) self.tur_head.frame += 1;
+        if (!isPlayer) actor.tur_head.frame += 1;
     }
-    return true;
 }
 
 void turret_hellion_missile_think()
@@ -67,7 +66,7 @@ void turret_hellion_missile_think()
         turret_projectile_explode();
 
     // Enemy dead? just keep on the current heading then.
-    if ((self.enemy == world) || (self.enemy.deadflag != DEAD_NO))
+    if ((self.enemy == world) || (IS_DEAD(self.enemy)))
     {
 
         // Make sure we dont return to tracking a respawned player
@@ -76,7 +75,7 @@ void turret_hellion_missile_think()
         // Turn model
         self.angles = vectoangles(self.velocity);
 
-        if ( (vlen(self.origin - self.owner.origin)) > (self.owner.shot_radius * 5) )
+        if(vdist(self.origin - self.owner.origin, >, (self.owner.shot_radius * 5)))
             turret_projectile_explode();
 
         // Accelerate
@@ -88,7 +87,7 @@ void turret_hellion_missile_think()
     }
 
     // Enemy in range?
-    if (vlen(self.origin - self.enemy.origin) < self.owner.shot_radius * 0.2)
+    if(vdist(self.origin - self.enemy.origin, <, self.owner.shot_radius * 0.2))
         turret_projectile_explode();
 
     // Predict enemy position