]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add achievement for the most suicides at match
authorAriosJentu <darthpoezd@gmail.com>
Tue, 27 Aug 2019 15:43:02 +0000 (01:43 +1000)
committerAriosJentu <darthpoezd@gmail.com>
Tue, 27 Aug 2019 15:43:02 +0000 (01:43 +1000)
qcsrc/common/achievements.qc
qcsrc/common/achievements.qh
qcsrc/server/g_world.qc

index 51be86530e571563e2a07e013a5396cb8beb7182..38fa48e5fb8c8aa4f70a68c175ade0c71c27d10d 100644 (file)
@@ -27,6 +27,7 @@ void Achievements_set_achievement_value(entity this, string achieve, int value)
        if (achieve == "secondplace") this.secondplace = value;
        if (achieve == "thirdplace") this.thirdplace = value;
        if (achieve == "mostdamage") this.mostdamage = value;
+       if (achieve == "suicider") this.suicider = value;
 
        if (achieve == "airshot") this.airshot = value;
        if (achieve == "amazing") this.amazing = value;
@@ -58,6 +59,7 @@ int Achievements_get_achievement_value(entity this, string achieve) {
        if (achieve == "secondplace") return this.secondplace;
        if (achieve == "thirdplace") return this.thirdplace;
        if (achieve == "mostdamage") return this.mostdamage;
+       if (achieve == "suicider") return this.suicider;
 
        if (achieve == "airshot") return this.airshot;
        if (achieve == "amazing") return this.amazing;
@@ -89,6 +91,7 @@ string Achievements_get_achievement_title(string achieve) {
        if (achieve == "secondplace") return "Second Place!";
        if (achieve == "thirdplace") return "Third Place!";
        if (achieve == "mostdamage") return "Most Damage!";
+       if (achieve == "suicider") return "Master of Suicide!";
 
        if (achieve == "airshot") return "Air Shot!";
        if (achieve == "amazing") return "Amazing!";
index a916b26d0001e53e4c87b4582a6fec2ac033a6e5..fab08ca5ca1f1a37d7612a31c63e2e4e23ab57af 100644 (file)
@@ -19,6 +19,7 @@ CLASS(Achievements, Object)
        ATTRIB(Achievements, secondplace, bool, 0);
        ATTRIB(Achievements, thirdplace, bool, 0);
        ATTRIB(Achievements, mostdamage, bool, 0);
+       ATTRIB(Achievements, suicider, bool, 0);
 
        //Notificated achievements
        ATTRIB(Achievements, airshot, int, 0);
index 119dc59e519415c5accc76a36d8389f508fe11fa..21c24fb460042faf81d0d8a61fb2978d5f68ded4 100644 (file)
@@ -1638,6 +1638,7 @@ void NextLevel()
        entity secondplace = spawn();
        entity thirdplace = spawn();
        entity mostdamage = spawn();
+       entity suicider = spawn();
 
        FOREACH_CLIENT(IS_PLAYER(it), {
 
@@ -1648,6 +1649,10 @@ void NextLevel()
                if (!mostdamage) {
                        mostdamage = it;
                }
+
+               if (!suicider) {
+                       suicider = it;
+               }
                
                float itaverage = PlayerScore_Get(it, SP_KILLS) / PlayerScore_Get(it, SP_SUICIDES);
                float plaverage = PlayerScore_Get(firstplace, SP_KILLS) / PlayerScore_Get(firstplace, SP_SUICIDES);
@@ -1663,12 +1668,17 @@ void NextLevel()
                        mostdamage = it;
                }
 
+               if (PlayerScore_Get(it, SP_SUICIDES) > PlayerScore_Get(suicider, SP_SUICIDES)) {
+                       suicider = it;
+               }
+
        });
 
        if (IS_PLAYER(firstplace)) increase_achieve(firstplace, "firstplace");
        if (IS_PLAYER(secondplace)) increase_achieve(secondplace, "secondplace");
        if (IS_PLAYER(thirdplace)) increase_achieve(thirdplace, "thirdplace");
        if (IS_PLAYER(mostdamage)) increase_achieve(mostdamage, "mostdamage");
+       if (IS_PLAYER(suicider)) increase_achieve(suicider, "suicider");
 
 
 }