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

index 38fa48e5fb8c8aa4f70a68c175ade0c71c27d10d..1f6b19703a50997abe04817083ed67954e25dee3 100644 (file)
@@ -40,6 +40,8 @@ void Achievements_set_achievement_value(entity this, string achieve, int value)
        if (achieve == "multirailed") this.multirailed = value;
        if (achieve == "pointblank") this.pointblank = value;
        if (achieve == "selfimmolation") this.selfimmolation = value;
+       if (achieve == "telefrag") this.telefrag = value;
+       if (achieve == "surprise") this.surprise = value;
 
        return;
 }
@@ -72,6 +74,8 @@ int Achievements_get_achievement_value(entity this, string achieve) {
        if (achieve == "multirailed") return this.multirailed;
        if (achieve == "pointblank") return this.pointblank;
        if (achieve == "selfimmolation") return this.selfimmolation;
+       if (achieve == "telefrag") return this.telefrag;
+       if (achieve == "surprise") return this.surprise;
 
        return 0;
 }
@@ -104,6 +108,8 @@ string Achievements_get_achievement_title(string achieve) {
        if (achieve == "multirailed") return "Multi Railed!";
        if (achieve == "pointblank") return "Point Blank!";
        if (achieve == "selfimmolation") return "Self-Immolation!";
+       if (achieve == "telefrag") return "Unexpected Kill!";
+       if (achieve == "surprise") return "Surprise!";
        return "";
 }
 
index fab08ca5ca1f1a37d7612a31c63e2e4e23ab57af..45f4a4fb84491241040833788344add62a10cf97 100644 (file)
@@ -34,6 +34,8 @@ CLASS(Achievements, Object)
        ATTRIB(Achievements, multirailed, int, 0);
        ATTRIB(Achievements, pointblank, int, 0);
        ATTRIB(Achievements, selfimmolation, int, 0);
+       ATTRIB(Achievements, telefrag, int, 0);
+       ATTRIB(Achievements, surprise, int, 0);
 
 
        //Getters and setters for achievements  
index 8655fafc8695c376ece2caca059ef03f6e9770cf..e8e49b26d2d8422d57336a01654d97389f628297 100644 (file)
@@ -895,6 +895,15 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de
                        attacker.suicide = 1;
                }
        }
+
+       if(deathtype == DEATH_TELEFRAG.m_id) {
+               entity att_achv = attacker.achievements;
+               entity trg_achv = targ.achievements;
+               att_achv.inc_achievement(att_achv, "telefrag");
+               trg_achv.inc_achievement(trg_achv, "surprise");
+               att_achv.announce(att_achv, attacker, "telefrag");
+               trg_achv.announce(trg_achv, targ, "surprise");
+       }
 }
 
 float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe,