From: AriosJentu Date: Sat, 24 Aug 2019 08:08:09 +0000 (+1000) Subject: Add Point Blank achievement X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c4bd52049cf5fcd19074358fc6713d081b8fce95;p=xonotic%2Fxonotic-data.pk3dir.git Add Point Blank achievement --- diff --git a/qcsrc/common/achievements.qc b/qcsrc/common/achievements.qc index 74269e94d..26d12da7e 100644 --- a/qcsrc/common/achievements.qc +++ b/qcsrc/common/achievements.qc @@ -31,7 +31,9 @@ void Achievements_set_achievement_value(entity this, string achieve, int value) if (achieve == "electrobitch") this.electrobitch = value; if (achieve == "impressive") this.impressive = value; if (achieve == "flyingyoda") this.flyingyoda = value; + if (achieve == "multirailed") this.multirailed = value; + if (achieve == "pointblank") this.pointblank = value; return; } @@ -55,7 +57,9 @@ int Achievements_get_achievement_value(entity this, string achieve) { if (achieve == "electrobitch") return this.electrobitch; if (achieve == "impressive") return this.impressive; if (achieve == "flyingyoda") return this.flyingyoda; + if (achieve == "multirailed") return this.multirailed; + if (achieve == "pointblank") return this.pointblank; return 0; } diff --git a/qcsrc/common/achievements.qh b/qcsrc/common/achievements.qh index bb51aab9b..6183fbb57 100644 --- a/qcsrc/common/achievements.qh +++ b/qcsrc/common/achievements.qh @@ -24,7 +24,10 @@ CLASS(Achievements, Object) ATTRIB(Achievements, electrobitch, int, 0); ATTRIB(Achievements, impressive, int, 0); ATTRIB(Achievements, flyingyoda, int, 0); //In Yoda maybe incorrect conditions + + //New achievements ATTRIB(Achievements, multirailed, int, 0); + ATTRIB(Achievements, pointblank, int, 0); //Getters and setters for achievements METHOD(Achievements, set_achievement_value, void(Achievements this, string achieve, int value)); diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 8b169cd71..83bedab47 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -872,6 +872,20 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de force = normalize(attacker.origin + attacker.view_ofs - hitloc) * mirrorforce; Damage(attacker, inflictor, attacker, mirrordamage, DEATH_MIRRORDAMAGE.m_id, weaponentity, attacker.origin, force); } + + + //Weapons achievements + entity attacker_achv = attacker_save.achievements; + if (DEATH_ISWEAPON(deathtype, WEP_SHOTGUN)) { + + float distance = vlen(targ.origin-attacker.origin); + + //Add condition to look at, not only for distance + if (distance < 60) { + attacker_achv.inc_achievement(attacker_achv, "pointblank"); + attacker_achv.announce(attacker_achv, attacker_save, "Point Blank!", "pointblank"); + } + } } float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe,