]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Mario scored against another gamemode specific check
authorMario <mario@smbclan.net>
Wed, 14 Oct 2015 14:31:30 +0000 (00:31 +1000)
committerMario <mario@smbclan.net>
Wed, 14 Oct 2015 14:31:30 +0000 (00:31 +1000)
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/gamemode_lms.qc
qcsrc/server/scores.qc

index c73e432537da2f9100d34c29b104278dea1ca30f..45e4572e8b19682dc865412b0e84a5ecb92ca063 100644 (file)
@@ -753,4 +753,12 @@ MUTATOR_HOOKABLE(SetPlayerFullStatus, EV_SetPlayerFullStatus);
     /**/ o(string, ret_string) \
     /**/
 MUTATOR_HOOKABLE(SetPlayerStatus, EV_SetPlayerStatus);
+
+#define EV_AddPlayerScore(i, o) \
+    /**/ i(int, score_field) \
+    /**/ i(float, ret_float) \
+    /**/ o(float, ret_float) \
+    /**/
+int score_field;
+MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
 #endif
index e9a0029d01915232c3561b4c3f34c3f5200f4db0..facf5771c5c481c421e5922e0444c4837d2ac04e 100644 (file)
@@ -252,6 +252,14 @@ MUTATOR_HOOKFUNCTION(lms, SetPlayerStatus)
        return true;
 }
 
+MUTATOR_HOOKFUNCTION(lms, AddPlayerScore)
+{
+       if(gameover)
+       if(score_field == SP_LMS_RANK)
+               return true; // allow writing to this field in intermission as it is needed for newly joining players
+       return false;
+}
+
 // scoreboard stuff
 void lms_ScoreRules()
 {
index f1b964417d016b6fcc7430770f3adc4137c76333..9ef3e1e7521f241c5f6a408585bfd74c14be0ecf 100644 (file)
@@ -335,14 +335,15 @@ void PlayerScore_Detach(entity player)
 
 float PlayerScore_Add(entity player, float scorefield, float score)
 {
-       entity s;
+       bool mutator_returnvalue = MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score);
+       score = ret_float;
 
        if(gameover)
-       if(!(g_lms && scorefield == SP_LMS_RANK)) // allow writing to this field in intermission as it is needed for newly joining players
+       if(!mutator_returnvalue)
                score = 0;
 
        if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
-       s = player.scorekeeper;
+       entity s = player.scorekeeper;
        if(!s)
        {
                if(gameover)