From: Mario Date: Wed, 14 Oct 2015 13:56:26 +0000 (+1000) Subject: Kill another bunch of gamemode specific checks X-Git-Tag: xonotic-v0.8.2~1801^2~29 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=78be9d52fa;p=xonotic%2Fxonotic-data.pk3dir.git Kill another bunch of gamemode specific checks --- diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index cd362e7d6..05f08f057 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -2084,35 +2084,13 @@ void CheckRules_World() return; } - float checkrules_status; - checkrules_status = WinningCondition_RanOutOfSpawns(); + int checkrules_status = WinningCondition_RanOutOfSpawns(); if(checkrules_status == WINNING_YES) - { bprint("Hey! Someone ran out of spawns!\n"); - } - else if(g_race && !g_race_qualifying && timelimit >= 0) - { - checkrules_status = WinningCondition_Race(fraglimit); - //print("WC_RACE yields ", ftos(checkrules_status), "\n"); - } - else if(g_race && g_race_qualifying == 2 && timelimit >= 0) - { - checkrules_status = WinningCondition_QualifyingThenRace(fraglimit); - //print("WC_QUALIFYING_THEN_RACE yields ", ftos(checkrules_status), "\n"); - } - else if(g_assault) - { - checkrules_status = WinningCondition_Assault(); // TODO remove this? - } - else if(g_lms) - { - checkrules_status = WinningCondition_LMS(); - } - else - { + else if(!MUTATOR_CALLHOOK(CheckRules_World, checkrules_status, timelimit, fraglimit)) checkrules_status = WinningCondition_Scores(fraglimit, leadlimit); - //print("WC_SCORES yields ", ftos(checkrules_status), "\n"); - } + + checkrules_status = ret_float; if(checkrules_status == WINNING_STARTSUDDENDEATHOVERTIME) { diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 7852b0ad8..8a69dba0e 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -714,4 +714,15 @@ enum { MUT_SPECCMD_RETURN, // return this flag to make the function return (don't spectate) MUT_SPECCMD_FORCE // return this flag to force the player to spectate, even if they're not a player }; + +/** called when player triggered kill (or is changing teams), return error to not do anything */ +#define EV_CheckRules_World(i, o) \ + /* status */ i(float, ret_float) \ + /* status */ o(float, ret_float) \ + /* time limit */ i(float, checkrules_timelimit) \ + /* frag limit */ i(int, checkrules_fraglimit) \ + /**/ +float checkrules_timelimit; +int checkrules_fraglimit; +MUTATOR_HOOKABLE(CheckRules_World, EV_CheckRules_World); #endif diff --git a/qcsrc/server/mutators/gamemode_assault.qc b/qcsrc/server/mutators/gamemode_assault.qc index c53511cfa..8df531915 100644 --- a/qcsrc/server/mutators/gamemode_assault.qc +++ b/qcsrc/server/mutators/gamemode_assault.qc @@ -573,6 +573,12 @@ MUTATOR_HOOKFUNCTION(as, GetTeamCount) return true; } +MUTATOR_HOOKFUNCTION(as, CheckRules_World) +{ + ret_float = WinningCondition_Assault(); + return true; +} + // scoreboard setup void assault_ScoreRules() { diff --git a/qcsrc/server/mutators/gamemode_lms.qc b/qcsrc/server/mutators/gamemode_lms.qc index c065e7a96..999eb7aa4 100644 --- a/qcsrc/server/mutators/gamemode_lms.qc +++ b/qcsrc/server/mutators/gamemode_lms.qc @@ -230,6 +230,12 @@ MUTATOR_HOOKFUNCTION(lms, ClientCommand_Spectate) return MUT_SPECCMD_CONTINUE; } +MUTATOR_HOOKFUNCTION(lms, CheckRules_World) +{ + ret_float = WinningCondition_LMS(); + return true; +} + // scoreboard stuff void lms_ScoreRules() { diff --git a/qcsrc/server/mutators/gamemode_race.qc b/qcsrc/server/mutators/gamemode_race.qc index d5e85c069..735bce7e0 100644 --- a/qcsrc/server/mutators/gamemode_race.qc +++ b/qcsrc/server/mutators/gamemode_race.qc @@ -311,6 +311,17 @@ MUTATOR_HOOKFUNCTION(rc, FixClientCvars) return false; } +MUTATOR_HOOKFUNCTION(rc, CheckRules_World) +{ + if(g_race_qualifying == 2 && checkrules_timelimit >= 0) + { + ret_float = WinningCondition_QualifyingThenRace(checkrules_fraglimit); + return true; + } + + return false; +} + void race_Initialize() { race_ScoreRules();