]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_world.qc
Merge branch 'master' into Mario/monsters
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_world.qc
index 1af52b13209eea54f3d915f1a1992a1c0b12cc6f..653bb1f41a5445a3fc9138733f896e2fe296a092 100644 (file)
@@ -266,6 +266,7 @@ void cvar_changes_init()
                BADCVAR("g_freezetag_teams");
                BADCVAR("g_keepaway");
                BADCVAR("g_keyhunt");
+               BADCVAR("g_td");
                BADCVAR("g_keyhunt_teams");
                BADCVAR("g_lms");
                BADCVAR("g_nexball");
@@ -806,6 +807,10 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_NEX_CHARGEPOOL, AS_FLOAT, nex_chargepool_ammo);
 
        addstat(STAT_HAGAR_LOAD, AS_INT, hagar_load);
+       
+       // freeze attacks
+       addstat(STAT_FROZEN, AS_INT, frozen);
+       addstat(STAT_REVIVE_PROGRESS, AS_FLOAT, revive_progress);
 
        // g_movementspeed hack
        addstat(STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW, AS_FLOAT, stat_sv_airspeedlimit_nonqw);
@@ -816,6 +821,10 @@ void spawnfunc_worldspawn (void)
        // secrets
        addstat(STAT_SECRETS_TOTAL, AS_FLOAT, stat_secrets_total);
        addstat(STAT_SECRETS_FOUND, AS_FLOAT, stat_secrets_found);
+       
+       // monsters
+       addstat(STAT_MONSTERS_TOTAL, AS_FLOAT, stat_monsters_total);
+       addstat(STAT_MONSTERS_KILLED, AS_FLOAT, stat_monsters_killed);
 
        // misc
        addstat(STAT_RESPAWN_TIME, AS_FLOAT, stat_respawn_time);
@@ -928,6 +937,8 @@ void spawnfunc_worldspawn (void)
        // weird mutators that deserve to count as mod
        if(autocvar_g_minstagib)
                modname = "MinstaGib";
+       if(autocvar_g_monsters)
+               modname = "Monsters";
        // extra mutators that deserve to count as mod
        MUTATOR_CALLHOOK(SetModname);
 
@@ -2075,6 +2086,36 @@ float WinningCondition_RanOutOfSpawns()
                return WINNING_NO;
 }
 
+// TD winning condition:
+// game terminates if there are no generators (or 1 dies if td_dontend is FALSE)
+float gensurvived;
+float WinningCondition_TowerDefense()
+{
+       WinningConditionHelper(); // set worldstatus
+
+       if(inWarmupStage)
+               return WINNING_NO;
+
+       // first check if the game has ended
+       if(gendestroyed == TRUE) // FALSE means either generator hasen't spawned yet, or mapper didn't add one
+       if(td_gencount < 1 || !td_dont_end)
+       {
+               ClearWinners();
+               dprint("Everyone lost, ending game.\n");
+               return WINNING_YES;
+       }
+       
+       if(gensurvived)
+       {
+               ClearWinners();
+               SetWinners(winning, 4);
+               return WINNING_YES;
+       }
+
+       // Two or more teams remain
+       return WINNING_NO;
+}
+
 /*
 ============
 CheckRules_World
@@ -2230,6 +2271,10 @@ void CheckRules_World()
        {
                checkrules_status = WinningCondition_Onslaught(); // TODO remove this?
        }
+       else if(g_td)
+       {
+               checkrules_status = WinningCondition_TowerDefense();
+       }
        else
        {
                checkrules_status = WinningCondition_Scores(fraglimit, leadlimit);