]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_seeker.qc
First step to implementing removal of spawned objects. Currently in debugging state...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_seeker.qc
index aa07f82881e9648c868edea7f931f57ddb37fd01..83a374ea7d213cb22c397b41ac59d9a4bf2fc6de 100644 (file)
@@ -124,6 +124,9 @@ void Seeker_Missile_Damage (entity inflictor, entity attacker, float damage, flo
 {
        if (self.health <= 0)
                return;
+               
+       if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+               return; // g_projectiles_damage says to halt
 
        if (self.realowner == attacker)
                self.health = self.health - (damage * 0.25);
@@ -161,12 +164,12 @@ void Seeker_Missile_Animate()
 
 void Seeker_Fire_Missile(vector f_diff, entity m_target)
 {
-       local entity missile;
+       entity missile;
 
        W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_seeker_missile_ammo, autocvar_g_balance_seeker_reload_ammo);
 
        makevectors(self.v_angle);
-       W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/seeker_fire.wav", CHAN_WEAPON, 0);
+       W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/seeker_fire.wav", CH_WEAPON_A, 0);
        w_shotorg += f_diff;
        pointparticles(particleeffectnum("seeker_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
@@ -189,6 +192,7 @@ void Seeker_Fire_Missile(vector f_diff, entity m_target)
        missile.takedamage      = DAMAGE_YES;
        missile.health          = autocvar_g_balance_seeker_missile_health;
        missile.damageforcescale = autocvar_g_balance_seeker_missile_damageforcescale;
+       missile.damagedbycontents = TRUE;
        //missile.think           = Seeker_Missile_Animate; // csqc projectiles.
        
        if (missile.enemy != world)
@@ -231,7 +235,7 @@ void Seeker_Flac_Touch()
 
 void Seeker_Fire_Flac()
 {
-       local entity missile;
+       entity missile;
        vector f_diff;
        float c;
 
@@ -254,7 +258,7 @@ void Seeker_Fire_Flac()
                        f_diff = '+1.25 +3.75 0';
                        break;
        }
-       W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/flac_fire.wav", CHAN_WEAPON, autocvar_g_balance_seeker_flac_damage);
+       W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/flac_fire.wav", CH_WEAPON_A, autocvar_g_balance_seeker_flac_damage);
        w_shotorg += f_diff;
 
        pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
@@ -334,7 +338,7 @@ void Seeker_Vollycontroller_Think() // TODO: Merge this with Seeker_Attack
                return;
        }
 
-       self.nextthink = time + autocvar_g_balance_seeker_missile_delay;
+       self.nextthink = time + autocvar_g_balance_seeker_missile_delay * W_WeaponRateFactor();
        
        oldself = self;
        self = self.realowner;
@@ -409,6 +413,8 @@ void Seeker_Tag_Touch()
        vector org2;
        entity e;
        
+       PROJECTILE_TOUCH;
+
        dir     = normalize (self.realowner.origin - self.origin);
        org2    = findbetterlocation (self.origin, 8);
 
@@ -466,10 +472,10 @@ void Seeker_Tag_Touch()
 
 void Seeker_Fire_Tag()
 {
-       local entity missile;
+       entity missile;
        W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_seeker_tag_ammo, autocvar_g_balance_seeker_reload_ammo);
 
-       W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/tag_fire.wav", CHAN_WEAPON, autocvar_g_balance_seeker_missile_damage * autocvar_g_balance_seeker_missile_count);
+       W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/tag_fire.wav", CH_WEAPON_A, autocvar_g_balance_seeker_missile_damage * autocvar_g_balance_seeker_missile_count);
 
        missile                 = spawn();
        missile.owner           = missile.realowner = self;
@@ -586,13 +592,13 @@ float w_seeker(float req)
        else if (req == WR_CHECKAMMO1)
        {
                ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_missile_ammo;
-               ammo_amount += self.weapon_load[WEP_SEEKER] >= autocvar_g_balance_seeker_missile_ammo;
+               ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_missile_ammo;
                return ammo_amount;
        }
        else if (req == WR_CHECKAMMO2)
        {
                ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_tag_ammo;
-               ammo_amount += self.weapon_load[WEP_SEEKER] >= autocvar_g_balance_seeker_tag_ammo;
+               ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_tag_ammo;
                return ammo_amount;
        }
        else if (req == WR_RELOAD)
@@ -600,7 +606,7 @@ float w_seeker(float req)
                W_Reload(min(autocvar_g_balance_seeker_missile_ammo, autocvar_g_balance_seeker_tag_ammo), autocvar_g_balance_seeker_reload_ammo, autocvar_g_balance_seeker_reload_time, "weapons/reload.wav");
        }
        return TRUE;
-};
+}
 #endif
 #ifdef CSQC
 float w_seeker(float req)
@@ -615,17 +621,17 @@ float w_seeker(float req)
                        if(!w_issilent)
                        {
                                if (w_random<0.15)
-                                       sound(self, CHAN_PROJECTILE, "weapons/tagexp1.wav", 1, ATTN_NORM);
+                                       sound(self, CH_SHOTS, "weapons/tagexp1.wav", 1, ATTN_NORM);
                                else if (w_random<0.7)
-                                       sound(self, CHAN_PROJECTILE, "weapons/tagexp2.wav", 1, ATTN_NORM);
+                                       sound(self, CH_SHOTS, "weapons/tagexp2.wav", 1, ATTN_NORM);
                                else
-                                       sound(self, CHAN_PROJECTILE, "weapons/tagexp3.wav", 1, ATTN_NORM);
+                                       sound(self, CH_SHOTS, "weapons/tagexp3.wav", 1, ATTN_NORM);
                        }
                }
                else if(w_deathtype & HITTYPE_HEADSHOT)
                {
                        if(!w_issilent)
-                               sound(self, CHAN_PROJECTILE, "weapons/tag_impact.wav", 1, ATTN_NORM);
+                               sound(self, CH_SHOTS, "weapons/tag_impact.wav", 1, ATTN_NORM);
                }
                else
                {
@@ -633,11 +639,11 @@ float w_seeker(float req)
                        if(!w_issilent)
                        {
                                if (w_random<0.15)
-                                       sound(self, CHAN_PROJECTILE, "weapons/seekerexp1.wav", 1, ATTN_NORM);
+                                       sound(self, CH_SHOTS, "weapons/seekerexp1.wav", 1, ATTN_NORM);
                                else if (w_random<0.7)
-                                       sound(self, CHAN_PROJECTILE, "weapons/seekerexp2.wav", 1, ATTN_NORM);
+                                       sound(self, CH_SHOTS, "weapons/seekerexp2.wav", 1, ATTN_NORM);
                                else
-                                       sound(self, CHAN_PROJECTILE, "weapons/seekerexp3.wav", 1, ATTN_NORM);
+                                       sound(self, CH_SHOTS, "weapons/seekerexp3.wav", 1, ATTN_NORM);
                        }
                }
        }