]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_minelayer.qc
Merge branch 'master' into Mario/classname_checks
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_minelayer.qc
index bcce5ebd152ee267046824528cab88450512e1ed..813bcff75508c01b044c43cfef5a48ff92593863 100644 (file)
@@ -62,11 +62,11 @@ void W_Mine_Stick (entity to)
 void W_Mine_Explode ()
 {
        if(other.takedamage == DAMAGE_AIM)
-               if(other.classname == "player")
+               if(IS_PLAYER(other))
                        if(IsDifferentTeam(self.realowner, other))
                                if(other.deadflag == DEAD_NO)
                                        if(IsFlying(other))
-                                               AnnounceTo(self.realowner, "airshot");
+                                               Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT);
 
        self.event_damage = func_null;
        self.takedamage = DAMAGE_NO;
@@ -185,7 +185,7 @@ void W_Mine_Think (void)
 
        // a player's mines shall explode if he disconnects or dies
        // TODO: Do this on team change too -- Samual: But isn't a player killed when they switch teams?
-       if(self.realowner.classname != "player" || self.realowner.deadflag != DEAD_NO)
+       if(!IS_PLAYER(self.realowner) || self.realowner.deadflag != DEAD_NO)
        {
                other = world;
                self.projectiledeathtype |= HITTYPE_BOUNCE;
@@ -197,7 +197,7 @@ void W_Mine_Think (void)
        head = findradius(self.origin, autocvar_g_balance_minelayer_proximityradius);
        while(head)
        {
-               if(head.classname == "player" && head.deadflag == DEAD_NO)
+               if(IS_PLAYER(head) && head.deadflag == DEAD_NO)
                if(head != self.realowner && IsDifferentTeam(head, self.realowner)) // don't trigger for team mates
                if(!self.mine_time)
                {
@@ -233,7 +233,7 @@ void W_Mine_Touch (void)
                return;
        }
 
-       if(other && other.classname == "player" && other.deadflag == DEAD_NO)
+       if(other && IS_PLAYER(other) && other.deadflag == DEAD_NO)
        {
                // hit a player
                // don't stick
@@ -435,7 +435,7 @@ float w_minelayer(float req)
                                        //As the distance gets larger, a correct detonation gets near imposible
                                        //Bots are assumed to use the mine spawnfunc_light to see if the mine gets near a player
                                        if(v_forward * normalize(mine.origin - self.enemy.origin)< 0.1)
-                                               if(self.enemy.classname == "player")
+                                               if(IS_PLAYER(self.enemy))
                                                        if(desirabledamage >= 0.1*coredamage)
                                                                if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
                                                                        self.BUTTON_ATCK2 = TRUE;
@@ -513,10 +513,22 @@ float w_minelayer(float req)
                else
                        return FALSE;
        }
+       else if (req == WR_RESETPLAYER)
+       {
+               self.minelayer_mines = 0;
+       }
        else if (req == WR_RELOAD)
        {
                W_Reload(autocvar_g_balance_minelayer_ammo, autocvar_g_balance_minelayer_reload_ammo, autocvar_g_balance_minelayer_reload_time, "weapons/reload.wav");
        }
+       else if (req == WR_SUICIDEMESSAGE)
+       {
+               return WEAPON_MINELAYER_SUICIDE;
+       }
+       else if (req == WR_KILLMESSAGE)
+       {
+               return WEAPON_MINELAYER_MURDER;
+       }
        return TRUE;
 }
 #endif
@@ -535,20 +547,6 @@ float w_minelayer(float req)
        {
                precache_sound("weapons/mine_exp.wav");
        }
-       else if (req == WR_SUICIDEMESSAGE)
-               if(w_deathtype & HITTYPE_BOUNCE) // (remote detonation)
-                       w_deathtypestring = _("%s blew themself up with their minelayer");
-               else
-                       w_deathtypestring = _("%s forgot about their mine");
-       else if (req == WR_KILLMESSAGE)
-       {
-               if(w_deathtype & HITTYPE_BOUNCE) // (remote detonation)
-                       w_deathtypestring = _("%s got too close to %s's mine");
-               else if(w_deathtype & HITTYPE_SPLASH)
-                       w_deathtypestring = _("%s almost dodged %s's mine");
-               else
-                       w_deathtypestring = _("%s stepped on %s's mine");
-       }
        return TRUE;
 }
 #endif