]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add achievement when hurt or burn player in lava AriosJentu/Achievements
authorAriosJentu <darthpoezd@gmail.com>
Sun, 8 Sep 2019 15:02:12 +0000 (01:02 +1000)
committerAriosJentu <darthpoezd@gmail.com>
Sun, 8 Sep 2019 15:02:12 +0000 (01:02 +1000)
qcsrc/common/achievements.qc
qcsrc/common/achievements.qh
qcsrc/server/g_damage.qc

index 2af628a231aaa7a4ca9321d357fc175062574e74..c8215f31ac9b069d09068ba7164fafa0552cc684 100644 (file)
@@ -43,6 +43,7 @@ void Achievements_set_achievement_value(entity this, string achieve, int value)
        if (achieve == "telefrag") this.telefrag = value;
        if (achieve == "surprise") this.surprise = value;
        if (achieve == "bitchslap") this.bitchslap = value;
+       if (achieve == "threwaway") this.threwaway = value;
 
        return;
 }
@@ -78,6 +79,7 @@ int Achievements_get_achievement_value(entity this, string achieve) {
        if (achieve == "telefrag") return this.telefrag;
        if (achieve == "surprise") return this.surprise;
        if (achieve == "bitchslap") return this.bitchslap;
+       if (achieve == "threwaway") return this.threwaway;
 
        return 0;
 }
@@ -113,6 +115,8 @@ string Achievements_get_achievement_title(string achieve) {
        if (achieve == "telefrag") return "Unexpected Kill!";
        if (achieve == "surprise") return "Surprise!";
        if (achieve == "bitchslap") return "Bitch Slap!";
+       if (achieve == "threwaway") return "Threw Away!";
+       
        return "";
 }
 
index 6f83c75b79f430dfde6563ea774405d17b3e5001..88e0002a1d16db32a52affdd984681acd7925414 100644 (file)
@@ -37,6 +37,7 @@ CLASS(Achievements, Object)
        ATTRIB(Achievements, telefrag, int, 0);
        ATTRIB(Achievements, surprise, int, 0);
        ATTRIB(Achievements, bitchslap, int, 0);
+       ATTRIB(Achievements, threwaway, int, 0);
 
 
        //Getters and setters for achievements  
index 84ab97f52a9a4b22d0b72e112e69f40ec423b4c8..e0a3e6e5fd6750d7afced8770791fd9958c747a8 100644 (file)
@@ -407,6 +407,12 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .en
                                );
                        }
 
+                       if (deathtype == DEATH_HURTTRIGGER.m_id || deathtype == DEATH_LAVA.m_id) {
+                               entity achv = attacker.achievements;
+                               achv.inc_achievement(achv, "threwaway");
+                               achv.announce(achv, attacker, "threwaway");
+                       }
+                       
                        int f3 = 0;
                        if(deathtype == DEATH_BUFF.m_id)
                                f3 = buff_FirstFromFlags(STAT(BUFFS, attacker)).m_id;