From b8ae1689689997b86bedd0cf6ac1c2bdba7485a5 Mon Sep 17 00:00:00 2001 From: AriosJentu Date: Mon, 9 Sep 2019 01:02:12 +1000 Subject: [PATCH] Add achievement when hurt or burn player in lava --- qcsrc/common/achievements.qc | 4 ++++ qcsrc/common/achievements.qh | 1 + qcsrc/server/g_damage.qc | 6 ++++++ 3 files changed, 11 insertions(+) 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; -- 2.39.2