From: AriosJentu Date: Tue, 27 Aug 2019 16:39:10 +0000 (+1000) Subject: Add achievement for slapping kill X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e7b36c2ff966c0b6c86a968e29cb6621d86db6f7;p=xonotic%2Fxonotic-data.pk3dir.git Add achievement for slapping kill --- diff --git a/qcsrc/common/achievements.qc b/qcsrc/common/achievements.qc index 1f6b19703..2af628a23 100644 --- a/qcsrc/common/achievements.qc +++ b/qcsrc/common/achievements.qc @@ -42,6 +42,7 @@ void Achievements_set_achievement_value(entity this, string achieve, int value) if (achieve == "selfimmolation") this.selfimmolation = value; if (achieve == "telefrag") this.telefrag = value; if (achieve == "surprise") this.surprise = value; + if (achieve == "bitchslap") this.bitchslap = value; return; } @@ -76,6 +77,7 @@ int Achievements_get_achievement_value(entity this, string achieve) { if (achieve == "selfimmolation") return this.selfimmolation; if (achieve == "telefrag") return this.telefrag; if (achieve == "surprise") return this.surprise; + if (achieve == "bitchslap") return this.bitchslap; return 0; } @@ -110,6 +112,7 @@ string Achievements_get_achievement_title(string achieve) { if (achieve == "selfimmolation") return "Self-Immolation!"; if (achieve == "telefrag") return "Unexpected Kill!"; if (achieve == "surprise") return "Surprise!"; + if (achieve == "bitchslap") return "Bitch Slap!"; return ""; } diff --git a/qcsrc/common/achievements.qh b/qcsrc/common/achievements.qh index 45f4a4fb8..6f83c75b7 100644 --- a/qcsrc/common/achievements.qh +++ b/qcsrc/common/achievements.qh @@ -36,6 +36,7 @@ CLASS(Achievements, Object) ATTRIB(Achievements, selfimmolation, int, 0); ATTRIB(Achievements, telefrag, int, 0); ATTRIB(Achievements, surprise, int, 0); + ATTRIB(Achievements, bitchslap, int, 0); //Getters and setters for achievements diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index e8e49b26d..3a2622783 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -877,14 +877,27 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de //Weapons achievements if (DEATH_ISWEAPON(deathtype, WEP_SHOTGUN) || DEATH_ISWEAPON(deathtype, WEP_CRYLINK)) { - float distance = vlen(targ.origin-attacker.origin); - - attacker.pointblank_checker = 1; + if (deathtype != WEP_SHOTGUN.m_id && !DEATH_ISWEAPON(deathtype, WEP_CRYLINK)) { + //It means melee attack - //Add condition to look at, not only for distance - if (distance < 65 && targ != attacker) { - attacker.pointblank_increase = 1; + if (IS_DEAD(targ)) { + + entity achv = attacker.achievements; + achv.inc_achievement(achv, "bitchslap"); + achv.announce(achv, attacker, "bitchslap"); + } + + } else { + float distance = vlen(targ.origin-attacker.origin); + + attacker.pointblank_checker = 1; + + //Add condition to look at, not only for distance + if (distance < 65 && targ != attacker) { + attacker.pointblank_increase = 1; + } } + } if (IS_DEAD(targ) && IS_PLAYER(attacker)) {