From: AriosJentu Date: Tue, 27 Aug 2019 16:19:36 +0000 (+1000) Subject: Add telefrag achievement X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2da8331070dd32266b97de7738cb659816306b2c;p=xonotic%2Fxonotic-data.pk3dir.git Add telefrag achievement --- diff --git a/qcsrc/common/achievements.qc b/qcsrc/common/achievements.qc index 38fa48e5f..1f6b19703 100644 --- a/qcsrc/common/achievements.qc +++ b/qcsrc/common/achievements.qc @@ -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 ""; } diff --git a/qcsrc/common/achievements.qh b/qcsrc/common/achievements.qh index fab08ca5c..45f4a4fb8 100644 --- a/qcsrc/common/achievements.qh +++ b/qcsrc/common/achievements.qh @@ -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 diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 8655fafc8..e8e49b26d 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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,