]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Kill another bunch of gamemode specific checks
authorMario <mario@smbclan.net>
Wed, 14 Oct 2015 13:56:26 +0000 (23:56 +1000)
committerMario <mario@smbclan.net>
Wed, 14 Oct 2015 13:56:26 +0000 (23:56 +1000)
qcsrc/server/g_world.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/gamemode_assault.qc
qcsrc/server/mutators/gamemode_lms.qc
qcsrc/server/mutators/gamemode_race.qc

index cd362e7d60a94eb681f5547322559b9375041107..05f08f057b8f6f06373d4e1a5933da3244c86da5 100644 (file)
@@ -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)
        {
index 7852b0ad8dea07570c206a6e5236c92ddbc2056b..8a69dba0eb0c886a0d65297dec66f61ceeacd46f 100644 (file)
@@ -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
index c53511cfa0ada4d06451c76f78984900fe27733d..8df531915640651c45ca02798d0409f92f37565a 100644 (file)
@@ -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()
 {
index c065e7a9682eb7123f7fe8a13e5a23538efbb56f..999eb7aa4c25432731d9a75082966431c6cdc2ce 100644 (file)
@@ -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()
 {
index d5e85c06940335867b345a5ee5f25627981ef379..735bce7e059f1164c9c782b4f642bdf412dc20d6 100644 (file)
@@ -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();