]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add achievement for slapping kill
authorAriosJentu <darthpoezd@gmail.com>
Tue, 27 Aug 2019 16:39:10 +0000 (02:39 +1000)
committerAriosJentu <darthpoezd@gmail.com>
Tue, 27 Aug 2019 16:39:10 +0000 (02:39 +1000)
qcsrc/common/achievements.qc
qcsrc/common/achievements.qh
qcsrc/server/g_damage.qc

index 1f6b19703a50997abe04817083ed67954e25dee3..2af628a231aaa7a4ca9321d357fc175062574e74 100644 (file)
@@ -42,6 +42,7 @@ void Achievements_set_achievement_value(entity this, string achieve, int value)
        if (achieve == "selfimmolation") this.selfimmolation = value;
        if (achieve == "telefrag") this.telefrag = value;
        if (achieve == "surprise") this.surprise = value;
+       if (achieve == "bitchslap") this.bitchslap = value;
 
        return;
 }
@@ -76,6 +77,7 @@ int Achievements_get_achievement_value(entity this, string achieve) {
        if (achieve == "selfimmolation") return this.selfimmolation;
        if (achieve == "telefrag") return this.telefrag;
        if (achieve == "surprise") return this.surprise;
+       if (achieve == "bitchslap") return this.bitchslap;
 
        return 0;
 }
@@ -110,6 +112,7 @@ string Achievements_get_achievement_title(string achieve) {
        if (achieve == "selfimmolation") return "Self-Immolation!";
        if (achieve == "telefrag") return "Unexpected Kill!";
        if (achieve == "surprise") return "Surprise!";
+       if (achieve == "bitchslap") return "Bitch Slap!";
        return "";
 }
 
index 45f4a4fb84491241040833788344add62a10cf97..6f83c75b79f430dfde6563ea774405d17b3e5001 100644 (file)
@@ -36,6 +36,7 @@ CLASS(Achievements, Object)
        ATTRIB(Achievements, selfimmolation, int, 0);
        ATTRIB(Achievements, telefrag, int, 0);
        ATTRIB(Achievements, surprise, int, 0);
+       ATTRIB(Achievements, bitchslap, int, 0);
 
 
        //Getters and setters for achievements  
index e8e49b26d2d8422d57336a01654d97389f628297..3a2622783117c5e0d5a2d8f42725348257e2ae4c 100644 (file)
@@ -877,14 +877,27 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de
        //Weapons achievements
        if (DEATH_ISWEAPON(deathtype, WEP_SHOTGUN) || DEATH_ISWEAPON(deathtype, WEP_CRYLINK)) {
 
-               float distance = vlen(targ.origin-attacker.origin);
-               
-               attacker.pointblank_checker = 1;        
+               if (deathtype != WEP_SHOTGUN.m_id && !DEATH_ISWEAPON(deathtype, WEP_CRYLINK)) {
+                       //It means melee attack
 
-               //Add condition to look at, not only for distance
-               if (distance < 65 && targ != attacker) {
-                       attacker.pointblank_increase = 1;
+                       if (IS_DEAD(targ)) {
+
+                               entity achv = attacker.achievements;
+                               achv.inc_achievement(achv, "bitchslap");
+                               achv.announce(achv, attacker, "bitchslap");
+                       }
+
+               } else {
+                       float distance = vlen(targ.origin-attacker.origin);
+                       
+                       attacker.pointblank_checker = 1;        
+
+                       //Add condition to look at, not only for distance
+                       if (distance < 65 && targ != attacker) {
+                               attacker.pointblank_increase = 1;
+                       }
                }
+
        }
 
        if (IS_DEAD(targ) && IS_PLAYER(attacker)) {