From: Mario Date: Wed, 14 Oct 2015 14:31:30 +0000 (+1000) Subject: Mario scored against another gamemode specific check X-Git-Tag: xonotic-v0.8.2~1801^2~26 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=32d514a72598594938e688ae4d3eb1344c62a8ff;p=xonotic%2Fxonotic-data.pk3dir.git Mario scored against another gamemode specific check --- diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index c73e43253..45e4572e8 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -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 diff --git a/qcsrc/server/mutators/gamemode_lms.qc b/qcsrc/server/mutators/gamemode_lms.qc index e9a0029d0..facf5771c 100644 --- a/qcsrc/server/mutators/gamemode_lms.qc +++ b/qcsrc/server/mutators/gamemode_lms.qc @@ -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() { diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index f1b964417..9ef3e1e75 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -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)