]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/world.qc
Q1BSP: use engine default for gl_max_lightmapsize (currently 512)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / world.qc
index 4ce29a707f26338b3dd9f818362a04cf7b216318..8eae8685b5f3be22356c409daf0a4c28d3609c93 100644 (file)
@@ -450,6 +450,9 @@ void cvar_changes_init()
                BADCVAR("gametype");
                BADCVAR("g_antilag");
                BADCVAR("g_balance_teams");
+               BADCVAR("g_balance_teams_queue");
+               BADCVAR("g_balance_teams_remove");
+               BADCVAR("g_balance_teams_remove_wait");
                BADCVAR("g_balance_teams_prevent_imbalance");
                BADCVAR("g_balance_teams_scorefactor");
                BADCVAR("g_ban_sync_trusted_servers");
@@ -1319,6 +1322,40 @@ void DumpStats(float final)
        }
 }
 
+// it should be called by gametypes where players can join a team but have to wait before playing
+// it puts players who joined too late (without being able to play) back to spectators
+// if prev_team_field is not team it also puts players who previously switched team (without being
+// able to play on the new team) back to previous team
+void MatchEnd_RestoreSpectatorAndTeamStatus(.int prev_team_field)
+{
+       bool fix_team = (teamplay && prev_team_field != team);
+       FOREACH_CLIENT(true,
+       {
+               if (!IS_PLAYER(it) && INGAME_JOINING(it))
+               {
+                       INGAME_STATUS_CLEAR(it);
+                       PutObserverInServer(it, true, false);
+                       bprint(playername(it.netname, it.team, false), " has been moved back to spectator");
+                       it.winning = false;
+               }
+               else if (fix_team && INGAME_JOINED(it) && it.(prev_team_field) && it.team != it.(prev_team_field))
+               {
+                       Player_SetForcedTeamIndex(it, TEAM_FORCE_DEFAULT);
+                       if (MoveToTeam(it, Team_TeamToIndex(it.(prev_team_field)), 6))
+                       {
+                               string pl_name = playername(it.netname, it.team, false);
+                               bprint(pl_name, " has been moved back to the ", Team_ColoredFullName(it.team));
+                       }
+                       it.winning = (it.team == WinningConditionHelper_winnerteam);
+               }
+       });
+}
+
+void MatchEnd_RestoreSpectatorStatus()
+{
+       MatchEnd_RestoreSpectatorAndTeamStatus(team);
+}
+
 /*
 go to the next level for deathmatch
 only called if a time or frag limit has expired
@@ -1346,6 +1383,8 @@ void NextLevel()
 
        VoteReset(true);
 
+       MUTATOR_CALLHOOK(MatchEnd_BeforeScores);
+
        DumpStats(true);
 
        // send statistics
@@ -1778,7 +1817,7 @@ void CheckRules_World()
        }
 }
 
-float want_weapon(entity weaponinfo, float allguns)
+int want_weapon(entity weaponinfo, int allguns)
 {
        int d = 0;
        bool allow_mutatorblocked = false;
@@ -1788,10 +1827,12 @@ float want_weapon(entity weaponinfo, float allguns)
 
        bool mutator_returnvalue = MUTATOR_CALLHOOK(WantWeapon, weaponinfo, d, allguns, allow_mutatorblocked);
        d = M_ARGV(1, float);
-       allguns = M_ARGV(2, bool);
+       allguns = M_ARGV(2, int);
        allow_mutatorblocked = M_ARGV(3, bool);
 
-       if(allguns)
+       if(allguns == 1)
+               d = boolean(!(weaponinfo.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_SPECIALATTACK)));
+       else if(allguns == 2)
                d = boolean((weaponinfo.spawnflags & WEP_FLAG_NORMAL) && !(weaponinfo.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_SPECIALATTACK)));
        else if(!mutator_returnvalue)
                d = !(!weaponinfo.weaponstart);