]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_seeker.qc
Set default CTF leadlimit to 6 (https://gitlab.com/xonotic/xonotic-data.pk3dir/issues...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_seeker.qc
index cd9088e03a54a4d9910f94b4bd074f0b43f71657..c870f0868eaaff99b084721dd15a0effe3104ff5 100644 (file)
@@ -1,5 +1,15 @@
 #ifdef REGISTER_WEAPON
-REGISTER_WEAPON(SEEKER, w_seeker, IT_ROCKETS, 8, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "seeker", "seeker", _("T.A.G. Seeker"))
+REGISTER_WEAPON(
+/* WEP_##id  */ SEEKER,
+/* function  */ w_seeker,
+/* ammotype  */ IT_ROCKETS,
+/* impulse   */ 8,
+/* flags     */ WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH,
+/* rating    */ BOT_PICKUP_RATING_MID,
+/* model     */ "seeker",
+/* shortname */ "seeker",
+/* fullname  */ _("T.A.G. Seeker")
+);
 #else
 #ifdef SVQC
 //.float proxytime; = autoswitch
@@ -74,7 +84,7 @@ void Seeker_Missile_Think()
                        // Calc how important it is that we turn and add this to the desierd (enemy) dir.
                        desireddir  = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5);
                }
-               
+
                newdir = normalize(olddir + desireddir * turnrate); // take the average of the 2 directions; not the best method but simple & easy
                self.velocity = newdir * spd; // make me fly in the new direction at my flight speed
        }
@@ -126,7 +136,7 @@ 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
 
@@ -134,7 +144,7 @@ void Seeker_Missile_Damage (entity inflictor, entity attacker, float damage, flo
                self.health = self.health - (damage * 0.25);
        else
                self.health = self.health - damage;
-               
+
        if (self.health <= 0)
                W_PrepareExplosionByDamage(attacker, Seeker_Missile_Explode);
 }
@@ -196,10 +206,10 @@ void Seeker_Fire_Missile(vector f_diff, entity m_target)
        missile.damageforcescale = autocvar_g_balance_seeker_missile_damageforcescale;
        missile.damagedbycontents = TRUE;
        //missile.think           = Seeker_Missile_Animate; // csqc projectiles.
-       
+
        if (missile.enemy != world)
                missile.projectiledeathtype = WEP_SEEKER | HITTYPE_SECONDARY;
-       else 
+       else
                missile.projectiledeathtype = WEP_SEEKER;
 
 
@@ -208,7 +218,7 @@ void Seeker_Fire_Missile(vector f_diff, entity m_target)
        missile.movetype    = MOVETYPE_FLYMISSILE;
        missile.flags       = FL_PROJECTILE;
        missile.missile_flags = MIF_SPLASH | MIF_GUIDED_TAG;
-       
+
        W_SETUPPROJECTILEVELOCITY_UP(missile, g_balance_seeker_missile);
 
        missile.angles = vectoangles (missile.velocity);
@@ -219,7 +229,7 @@ void Seeker_Fire_Missile(vector f_diff, entity m_target)
 }
 
 // ============================
-// Begin: FLAC, close range attack meant for defeating rockets which are coming at you. 
+// Begin: FLAC, close range attack meant for defeating rockets which are coming at you.
 // ============================
 void Seeker_Flac_Explode ()
 {
@@ -273,23 +283,23 @@ void Seeker_Fire_Flac()
        missile.bot_dodge               = TRUE;
        missile.bot_dodgerating = autocvar_g_balance_seeker_flac_damage;
        missile.touch                   = Seeker_Flac_Explode;
-       missile.use                     = Seeker_Flac_Explode; 
+       missile.use                     = Seeker_Flac_Explode;
        missile.think                   = adaptor_think2use_hittype_splash;
        missile.nextthink               = time + autocvar_g_balance_seeker_flac_lifetime + autocvar_g_balance_seeker_flac_lifetime_rand;
        missile.solid                   = SOLID_BBOX;
-       missile.movetype                = MOVETYPE_FLY; 
+       missile.movetype                = MOVETYPE_FLY;
        missile.projectiledeathtype = WEP_SEEKER;
        missile.projectiledeathtype = WEP_SEEKER | HITTYPE_SECONDARY;
        missile.flags                           = FL_PROJECTILE;
-       missile.missile_flags       = MIF_SPLASH; 
-       
+       missile.missile_flags       = MIF_SPLASH;
+
        // csqc projectiles
-       //missile.angles                                = vectoangles (missile.velocity);       
-       //missile.scale = 0.4; // BUG: the model is too big 
-       
+       //missile.angles                                = vectoangles (missile.velocity);
+       //missile.scale = 0.4; // BUG: the model is too big
+
        setorigin (missile, w_shotorg);
        setsize (missile, '-2 -2 -2', '2 2 2');
-               
+
        W_SETUPPROJECTILEVELOCITY_UP(missile, g_balance_seeker_flac);
        CSQCProjectile(missile, TRUE, PROJECTILE_FLAC, TRUE);
 
@@ -297,22 +307,22 @@ void Seeker_Fire_Flac()
 }
 
 // ============================
-// Begin: Tag and rocket controllers 
+// Begin: Tag and rocket controllers
 // ============================
 entity Seeker_Tagged_Info(entity isowner, entity istarget)
 {
        entity tag;
-       for(tag = world; (tag = find(tag, classname, "tag_tracker")); ) 
+       for(tag = world; (tag = find(tag, classname, "tag_tracker")); )
                if ((tag.realowner == isowner) && (tag.tag_target == istarget))
                        return tag;
-               
+
        return world;
 }
 
 void Seeker_Attack()
 {
        entity tracker, closest_target;
-       
+
        closest_target = world;
        for(tracker = world; (tracker = find(tracker, classname, "tag_tracker")); ) if (tracker.realowner == self)
        {
@@ -321,14 +331,14 @@ void Seeker_Attack()
                        if (vlen(self.origin - tracker.tag_target.origin) < vlen(self.origin - closest_target.origin))
                                closest_target = tracker.tag_target;
                }
-               else 
+               else
                        closest_target = tracker.tag_target;
        }
-               
+
        traceline(self.origin + self.view_ofs, closest_target.origin, MOVE_NOMONSTERS, self);
        if ((!closest_target) || ((trace_fraction < 1) && (trace_ent != closest_target)))
                closest_target = world;
-       
+
        Seeker_Fire_Missile('0 0 0', closest_target);
 }
 
@@ -345,13 +355,13 @@ void Seeker_Vollycontroller_Think() // TODO: Merge this with Seeker_Attack
        }
 
        self.nextthink = time + autocvar_g_balance_seeker_missile_delay * W_WeaponRateFactor();
-       
+
        oldself = self;
        self = self.realowner;
-       
+
        oldenemy = self.enemy;
        self.enemy = oldself.enemy;
-       
+
        c = mod(self.cnt, 4);
        switch(c)
        {
@@ -374,7 +384,7 @@ void Seeker_Vollycontroller_Think() // TODO: Merge this with Seeker_Attack
        self = oldself;
 }
 
-void Seeker_Tracker_Think() 
+void Seeker_Tracker_Think()
 {
        // commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up
        if ((self.realowner.deadflag != DEAD_NO) || (self.tag_target.deadflag != DEAD_NO) || (self.realowner.switchweapon != WEP_SEEKER)
@@ -387,13 +397,13 @@ void Seeker_Tracker_Think()
                }
                return;
        }
-       
+
        // Update the think method information
        self.nextthink = time;
 }
 
 // ============================
-// Begin: Tag projectile 
+// Begin: Tag projectile
 // ============================
 void Seeker_Tag_Explode ()
 {
@@ -418,7 +428,7 @@ void Seeker_Tag_Touch()
        vector dir;
        vector org2;
        entity e;
-       
+
        PROJECTILE_TOUCH;
 
        dir     = normalize (self.realowner.origin - self.origin);
@@ -433,38 +443,38 @@ void Seeker_Tag_Touch()
        {
                // check to see if this person is already tagged by me
                entity tag = Seeker_Tagged_Info(self.realowner, other);
-               
+
                if (tag != world)
                {
                        if (other.wps_tag_tracker && (autocvar_g_balance_seeker_type == 1)) // don't attach another waypointsprite without killing the old one first
                                WaypointSprite_Kill(other.wps_tag_tracker);
-                               
+
                        tag.tag_time = time;
                }
                else
-               {               
+               {
                        //sprint(self.realowner, strcat("You just tagged ^2", other.netname, "^7 with a tracking device!\n"));
                        e             = spawn();
                        e.cnt         = autocvar_g_balance_seeker_missile_count;
                        e.classname   = "tag_tracker";
                        e.owner       = self.owner;
                        e.realowner   = self.realowner;
-                       
+
                        if      (autocvar_g_balance_seeker_type == 1)
                        {
                                e.tag_target  = other;
                                e.tag_time    = time;
                                e.think       = Seeker_Tracker_Think;
                        }
-                       else 
+                       else
                        {
                                e.enemy     = other;
                                e.think     = Seeker_Vollycontroller_Think;
                        }
-                       
+
                        e.nextthink   = time;
                }
-               
+
                if      (autocvar_g_balance_seeker_type == 1)
                {
                        WaypointSprite_Spawn("tagged-target", autocvar_g_balance_seeker_tag_tracker_lifetime, 0, other, '0 0 64', self.realowner, 0, other, wps_tag_tracker, TRUE, RADARICON_TAGGED, '0.5 1 0');
@@ -503,7 +513,7 @@ void Seeker_Fire_Tag()
        setsize (missile, '-2 -2 -2', '2 2 2');
 
        missile.flags       = FL_PROJECTILE;
-       //missile.missile_flags = MIF_..?; 
+       //missile.missile_flags = MIF_..?;
 
        missile.movetype    = MOVETYPE_FLY;
        W_SETUPPROJECTILEVELOCITY(missile, g_balance_seeker_tag);
@@ -528,7 +538,7 @@ float w_seeker(float req)
 
        if (req == WR_AIM)
        {
-               if (autocvar_g_balance_seeker_type == 1) 
+               if (autocvar_g_balance_seeker_type == 1)
                        if (Seeker_Tagged_Info(self, self.enemy) != world)
                                self.BUTTON_ATCK = bot_aim(autocvar_g_balance_seeker_missile_speed_max, 0, autocvar_g_balance_seeker_missile_lifetime, FALSE);
                        else
@@ -540,10 +550,10 @@ float w_seeker(float req)
        {
                if(autocvar_g_balance_seeker_reload_ammo && self.clip_load < min(autocvar_g_balance_seeker_missile_ammo, autocvar_g_balance_seeker_tag_ammo)) // forced reload
                        weapon_action(self.weapon, WR_RELOAD);
-                       
+
                else if (self.BUTTON_ATCK)
                {
-                       if (autocvar_g_balance_seeker_type == 1) 
+                       if (autocvar_g_balance_seeker_type == 1)
                        {
                                if (weapon_prepareattack(0, autocvar_g_balance_seeker_missile_refire))
                                {
@@ -551,7 +561,7 @@ float w_seeker(float req)
                                        weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_missile_animtime, w_ready);
                                }
                        }
-                       else 
+                       else
                        {
                                if (weapon_prepareattack(0, autocvar_g_balance_seeker_tag_refire))
                                {
@@ -563,7 +573,7 @@ float w_seeker(float req)
 
                else if (self.BUTTON_ATCK2)
                {
-                       if (autocvar_g_balance_seeker_type == 1) 
+                       if (autocvar_g_balance_seeker_type == 1)
                        {
                                if (weapon_prepareattack(0, autocvar_g_balance_seeker_tag_refire))
                                {
@@ -571,7 +581,7 @@ float w_seeker(float req)
                                        weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_tag_animtime, w_ready);
                                }
                        }
-                       else 
+                       else
                        {
                                if (weapon_prepareattack(0, autocvar_g_balance_seeker_flac_refire))
                                {
@@ -598,20 +608,49 @@ 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;
+               if (autocvar_g_balance_seeker_type == 1)
+               {
+                       ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_missile_ammo;
+                       ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_missile_ammo;
+               }
+               else
+               {
+                       ammo_amount = self.ammo_rockets >= 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_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;
+               if (autocvar_g_balance_seeker_type == 1)
+               {
+                       ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_tag_ammo;
+                       ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_tag_ammo;
+               }
+               else
+               {
+                       ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_flac_ammo;
+                       ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_flac_ammo;
+               }
+
                return ammo_amount;
        }
        else if (req == WR_RELOAD)
        {
                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");
        }
+       else if (req == WR_SUICIDEMESSAGE)
+       {
+               return WEAPON_SEEKER_SUICIDE;
+       }
+       else if (req == WR_KILLMESSAGE)
+       {
+               if(w_deathtype & HITTYPE_SECONDARY)
+                       return WEAPON_SEEKER_MURDER_TAG;
+               else
+                       return WEAPON_SEEKER_MURDER_SPRAY;
+       }
        return TRUE;
 }
 #endif
@@ -627,7 +666,7 @@ float w_seeker(float req)
                        if(w_deathtype & HITTYPE_SECONDARY)
                        {
                                if(!w_issilent)
-                                       sound(self, CH_SHOTS, "weapons/tag_impact.wav", 1, ATTN_NORM);
+                                       sound(self, CH_SHOTS, "weapons/tag_impact.wav", 1, ATTEN_NORM);
                        }
                        else
                        {
@@ -635,11 +674,11 @@ float w_seeker(float req)
                                if(!w_issilent)
                                {
                                        if (w_random<0.15)
-                                               sound(self, CH_SHOTS, "weapons/tagexp1.wav", 1, ATTN_NORM);
+                                               sound(self, CH_SHOTS, "weapons/tagexp1.wav", 1, ATTEN_NORM);
                                        else if (w_random<0.7)
-                                               sound(self, CH_SHOTS, "weapons/tagexp2.wav", 1, ATTN_NORM);
+                                               sound(self, CH_SHOTS, "weapons/tagexp2.wav", 1, ATTEN_NORM);
                                        else
-                                               sound(self, CH_SHOTS, "weapons/tagexp3.wav", 1, ATTN_NORM);
+                                               sound(self, CH_SHOTS, "weapons/tagexp3.wav", 1, ATTEN_NORM);
                                }
                        }
                }
@@ -649,11 +688,11 @@ float w_seeker(float req)
                        if(!w_issilent)
                        {
                                if (w_random<0.15)
-                                       sound(self, CH_SHOTS, "weapons/seekerexp1.wav", 1, ATTN_NORM);
+                                       sound(self, CH_SHOTS, "weapons/seekerexp1.wav", 1, ATTEN_NORM);
                                else if (w_random<0.7)
-                                       sound(self, CH_SHOTS, "weapons/seekerexp2.wav", 1, ATTN_NORM);
+                                       sound(self, CH_SHOTS, "weapons/seekerexp2.wav", 1, ATTEN_NORM);
                                else
-                                       sound(self, CH_SHOTS, "weapons/seekerexp3.wav", 1, ATTN_NORM);
+                                       sound(self, CH_SHOTS, "weapons/seekerexp3.wav", 1, ATTEN_NORM);
                        }
                }
        }
@@ -667,15 +706,6 @@ float w_seeker(float req)
                precache_sound("weapons/tagexp3.wav");
                precache_sound("weapons/tag_impact.wav");
        }
-       else if (req == WR_SUICIDEMESSAGE)
-               w_deathtypestring = _("%s played with tiny seeker rockets");
-       else if (req == WR_KILLMESSAGE)
-       {
-               if(w_deathtype & HITTYPE_SECONDARY)
-                       w_deathtypestring = _("%s was tagged with a seeker by %s");
-               else
-                       w_deathtypestring = _("%s was pummeled with seeker rockets by %s");
-       }
        return TRUE;
 }
 #endif