From: AriosJentu Date: Sun, 8 Sep 2019 15:02:12 +0000 (+1000) Subject: Add achievement when hurt or burn player in lava X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b8ae1689689997b86bedd0cf6ac1c2bdba7485a5;p=xonotic%2Fxonotic-data.pk3dir.git Add achievement when hurt or burn player in lava --- diff --git a/qcsrc/common/achievements.qc b/qcsrc/common/achievements.qc index 2af628a23..c8215f31a 100644 --- a/qcsrc/common/achievements.qc +++ b/qcsrc/common/achievements.qc @@ -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 ""; } diff --git a/qcsrc/common/achievements.qh b/qcsrc/common/achievements.qh index 6f83c75b7..88e0002a1 100644 --- a/qcsrc/common/achievements.qh +++ b/qcsrc/common/achievements.qh @@ -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 diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 84ab97f52..e0a3e6e5f 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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;