]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add Point Blank achievement
authorAriosJentu <darthpoezd@gmail.com>
Sat, 24 Aug 2019 08:08:09 +0000 (18:08 +1000)
committerAriosJentu <darthpoezd@gmail.com>
Sat, 24 Aug 2019 08:08:09 +0000 (18:08 +1000)
qcsrc/common/achievements.qc
qcsrc/common/achievements.qh
qcsrc/server/g_damage.qc

index 74269e94deb75147fb24337277db51afbb8ce98c..26d12da7ea4b0740e0a030c51279b95aa49e32ef 100644 (file)
@@ -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;
 }
index bb51aab9b17b0ecd0d0db3062a5586302dfe5377..6183fbb57f134c31a8916aaeb7f3e817cd8c0c38 100644 (file)
@@ -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));
index 8b169cd7123e47f50d4b155b8c49db68a5716060..83bedab47198ba316e081c91d9d3930c8384ae37 100644 (file)
@@ -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,