]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_damage.qc
GameRules: encapsulate scoring
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_damage.qc
index 4e6820fd5c86104e99696678074faba67ac57912..8a0223804d473e8d1f3288f235f546bdb7dab84c 100644 (file)
@@ -28,7 +28,7 @@
 
 void UpdateFrags(entity player, int f)
 {
-       PlayerTeamScore_AddScore(player, f);
+       GameRules_scoring_add_team(player, SCORE, f);
 }
 
 void GiveFrags (entity attacker, entity targ, float f, int deathtype)
@@ -41,23 +41,23 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype)
                if(targ == attacker)
                {
                        // suicide
-                       PlayerScore_Add(attacker, SP_SUICIDES, 1);
+                       GameRules_scoring_add(attacker, SUICIDES, 1);
                }
                else
                {
                        // teamkill
-                       PlayerScore_Add(attacker, SP_KILLS, -1); // or maybe add a teamkills field?
+                       GameRules_scoring_add(attacker, KILLS, -1); // or maybe add a teamkills field?
                }
        }
        else
        {
                // regular frag
-               PlayerScore_Add(attacker, SP_KILLS, 1);
+               GameRules_scoring_add(attacker, KILLS, 1);
                if(targ.playerid)
                        PS_GR_P_ADDVAL(attacker, sprintf("kills-%d", targ.playerid), 1);
        }
 
-       PlayerScore_Add(targ, SP_DEATHS, 1);
+       GameRules_scoring_add(targ, DEATHS, 1);
 
        .entity weaponentity = weaponentities[0]; // TODO: unhardcode
 
@@ -509,7 +509,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
                LogDeath("accident", deathtype, targ, targ);
                GiveFrags(targ, targ, -1, deathtype);
 
-               if(PlayerScore_Add(targ, SP_SCORE, 0) == -5)
+               if(GameRules_scoring_add(targ, SCORE, 0) == -5)
                {
                        Send_Notification(NOTIF_ONE, targ, MSG_ANNCE, ANNCE_ACHIEVEMENT_BOTLIKE);
                        PS_GR_P_ADDVAL(attacker, PLAYERSTATS_ACHIEVEMENT_BOTLIKE, 1);