]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/tturrets/units/unit_hellion.qc
Merge branch 'master' into terencehill/screenshot_viewer
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / tturrets / units / unit_hellion.qc
index 1e42e5e1ada3251fa3707a2e53d7b6883e5d7998..b1dc47bf1c794c0d064cdc7db08cdb251afa8030 100644 (file)
@@ -10,28 +10,30 @@ void turret_hellion_missile_damage (entity inflictor, entity attacker, float dam
 
 void turret_hellion_postthink()
 {
-    if (cvar("g_turrets_reloadcvars"))
+    if (autocvar_g_turrets_reloadcvars)
     {
-        if (!self.shot_speed_max)  self.shot_speed_max  = cvar("g_turrets_unit_hellion_std_shot_speed_max");
-        if (!self.shot_speed_gain) self.shot_speed_gain = cvar("g_turrets_unit_hellion_std_shot_speed_gain");
+        if (!self.shot_speed_max)  self.shot_speed_max  = autocvar_g_turrets_unit_hellion_std_shot_speed_max;
+        if (!self.shot_speed_gain) self.shot_speed_gain = autocvar_g_turrets_unit_hellion_std_shot_speed_gain;
     }
 
     if (self.tur_head.frame != 0)
-        self.tur_head.frame = self.tur_head.frame + 1;
+        self.tur_head.frame += 1;
 
-    if (self.tur_head.frame > 7)
+    if (self.tur_head.frame >= 7)
         self.tur_head.frame = 0;
 }
 
 void turret_hellion_attack()
 {
-    local entity missile;
-
+    entity missile;
+               
+       if(self.tur_head.frame != 0)
+               self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire"));
+       else
+               self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire2"));
+    
     sound (self, CHAN_WEAPON, "weapons/hagar_fire.wav", VOL_BASE, ATTN_NORM);
 
-    // switch tubes
-    //self.tur_shotorg_y = self.tur_shotorg_y * -1;
-
     missile = spawn ();
     setorigin(missile, self.tur_shotorg);
     setsize (missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot
@@ -57,12 +59,9 @@ void turret_hellion_attack()
     missile.tur_health         = time + 9;
     missile.tur_aimpos         = randomvec() * 128;
     te_explosion (missile.origin);
-
        CSQCProjectile(missile, FALSE, PROJECTILE_ROCKET, FALSE); // no culling, has fly sound
 
-    if (self.tur_head.frame == 0)
-        self.tur_head.frame = self.tur_head.frame + 1;
-
+       self.tur_head.frame += 1;
 }
 
 void turret_hellion_missile_damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
@@ -136,7 +135,6 @@ void turret_hellion_missile_think()
 
 void turret_hellion_missile_explode()
 {
-    vector org2;
     float d;
 
     if(self.event_damage != SUB_Null)
@@ -147,19 +145,8 @@ void turret_hellion_missile_explode()
         return;
     }
 
-    sound (self, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
-    org2 = findbetterlocation (self.origin, 16);
-
-    // LordHavoc: TE_TEI_BIGEXPLOSION
-    WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
-    WriteByte (MSG_BROADCAST, 78);
-    WriteCoord (MSG_BROADCAST, org2_x);
-    WriteCoord (MSG_BROADCAST, org2_y);
-    WriteCoord (MSG_BROADCAST, org2_z);
-
-    //w_deathtypestring = "could not dodge the twin missiles.";
     self.event_damage = SUB_Null;
-    d = RadiusDamage (self, self.owner, self.owner.shot_dmg, 0, self.owner.shot_radius, world, self.owner.shot_force, DEATH_TURRET, world);
+    d = RadiusDamage (self, self.owner, self.owner.shot_dmg, 0, self.owner.shot_radius, world, self.owner.shot_force, DEATH_TURRET_HELLION, world);
 
 #ifdef TURRET_DEBUG
     self.owner.tur_dbg_dmg_t_h = self.owner.tur_dbg_dmg_t_h + d; //self.owner.shot_dmg;
@@ -178,10 +165,10 @@ void turret_hellion_dinit()
     if (self.netname == "")      self.netname  = "Hellion Missile Turret";
 
     if not (self.shot_speed_max)
-        self.shot_speed_max  = cvar("g_turrets_unit_hellion_std_shot_speed_max");
+        self.shot_speed_max  = autocvar_g_turrets_unit_hellion_std_shot_speed_max;
 
     if not (self.shot_speed_gain)
-        self.shot_speed_gain = cvar("g_turrets_unit_hellion_std_shot_speed_gain");
+        self.shot_speed_gain = autocvar_g_turrets_unit_hellion_std_shot_speed_gain;
 
     self.turrcaps_flags = TFL_TURRCAPS_RADIUSDMG | TFL_TURRCAPS_FASTPROJ | TFL_TURRCAPS_PLAYERKILL | TFL_TURRCAPS_MISSILEKILL;
     self.aim_flags = TFL_AIM_SIMPLE;
@@ -189,15 +176,12 @@ void turret_hellion_dinit()
     self.firecheck_flags = TFL_FIRECHECK_WORLD | TFL_FIRECHECK_DEAD | TFL_FIRECHECK_DISTANCES | TFL_FIRECHECK_TEAMCECK | TFL_FIRECHECK_REFIRE | TFL_FIRECHECK_AFF | TFL_FIRECHECK_OWM_AMMO;
     self.ammo_flags = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
 
-    if (turret_stdproc_init("hellion_std",0,"models/turrets/base.md3","models/turrets/hellion.md3") == 0)
+    if (turret_stdproc_init("hellion_std", "models/turrets/base.md3", "models/turrets/hellion.md3", TID_HELLION) == 0)
     {
         remove(self);
         return;
     }
 
-    if (!turret_tag_fire_update())
-        dprint("Warning: Turret ",self.classname, " faild to initialize md3 tags\n");
-
     self.turret_firefunc  = turret_hellion_attack;
     self.turret_postthink = turret_hellion_postthink;
 }