]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/world.qc
Merge branch 'master' into LegendaryGuard/cyber
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / world.qc
index a438e633f61a71f7f47e89bd95bd6c93fe72f58b..65ee2b1a60c691623f2102f91e876f2db5c2b77e 100644 (file)
@@ -301,6 +301,8 @@ void cvar_changes_init()
                BADCVAR("g_tdm");
                BADCVAR("g_tdm_on_dm_maps");
                BADCVAR("g_tdm_teams");
+               BADCVAR("g_mmm");
+               BADCVAR("g_mmm_not_dm_maps");
                BADCVAR("g_vip");
                BADCVAR("leadlimit");
                BADCVAR("nextmap");
@@ -310,12 +312,17 @@ void cvar_changes_init()
                BADCVAR("g_mapinfo_ignore_warnings");
                BADCVAR("g_maplist_ignore_sizes");
                BADCVAR("g_maplist_sizes_count_bots");
+               //LegendGuard adds BADCVAR(g_*) for MMM 20-02-2021
 
                // long
                BADCVAR("hostname");
+               BADCVAR("hostname_full");
                BADCVAR("g_maplist");
                BADCVAR("g_maplist_mostrecent");
                BADCVAR("sv_motd");
+               BADCVAR("sv_motd_permanent");
+               
+               BADPREFIX("g_teamnames_");
 
                v = cvar_string(k);
                d = cvar_defstring(k);
@@ -360,6 +367,9 @@ void cvar_changes_init()
                BADCVAR("g_forced_respawn");
                BADCVAR("g_freezetag_point_leadlimit");
                BADCVAR("g_freezetag_point_limit");
+               BADCVAR("g_freezetag_revive_respawn");
+               BADCVAR("g_freezetag_round_stop");
+               BADCVAR("g_freezetag_round_respawn");
                BADCVAR("g_glowtrails");
                BADCVAR("g_hats");
                BADCVAR("g_casings");
@@ -416,6 +426,8 @@ void cvar_changes_init()
                BADPREFIX("sv_timeout_");
                BADPREFIX("sv_vote_");
                BADPREFIX("timelimit_");
+               BADPREFIX("sv_chat_");
+               BADPREFIX("sv_jingle_");
 
                // allowed changes to server admins (please sync this to server.cfg)
                // vi commands:
@@ -1015,6 +1027,9 @@ spawnfunc(worldspawn)
 
        world_initialized = 1;
        __spawnfunc_spawn_all();
+       
+       if(!warmup_stage)
+               round_handler_Activate(true);
 }
 
 spawnfunc(light)
@@ -1283,6 +1298,8 @@ void NextLevel()
        */
 
        //pos = FindIntermission ();
+       
+       sound(NULL, CH_INFO, SND_ENDMATCH, VOL_BASE, ATTN_NONE);
 
        VoteReset();
 
@@ -1293,6 +1310,11 @@ void NextLevel()
        WeaponStats_Shutdown();
 
        Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_Null); // kill all centerprints now
+       
+       // send winner notification
+       if(teamplay) {
+               Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, APP_TEAM_NUM(WinningConditionHelper_winnerteam, ANNCE_TEAM_WINS));
+       }
 
        if(autocvar_sv_eventlog)
                GameLogEcho(":gameover");
@@ -1314,6 +1336,29 @@ void NextLevel()
        });
 
        target_music_kill();
+       
+       // z411
+       if(autocvar_sv_jingle_end) {
+               int jingles_len = 0;
+               string jingles[32];
+               jingles[0] = "";
+               
+               FOREACH_WORD(autocvar_sv_jingle_end_list, it,
+               {
+                       jingles[jingles_len] = it;
+                       jingles_len++;
+               });
+               
+               if(jingles_len) {
+                       int song_to_play = rint(random() * (jingles_len - 1));
+               
+                       FOREACH_CLIENT(IS_REAL_CLIENT(it),
+                       {
+                               stuffcmd(it, "cd stop\n");
+                               _sound(it, CH_INFO, strcat("jingle/", jingles[song_to_play], ".ogg"), VOL_BASE * autocvar_sv_jingle_end_volume, ATTEN_NORM);
+                       });
+               }
+       }
 
        if(autocvar_g_campaign)
                CampaignPreIntermission();
@@ -1357,6 +1402,12 @@ void InitiateOvertime() // ONLY call this if InitiateSuddenDeath returned true
        //add one more overtime by simply extending the timelimit
        cvar_set("timelimit", ftos(autocvar_timelimit + autocvar_timelimit_overtime));
        Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_OVERTIME_TIME, autocvar_timelimit_overtime * 60);
+       
+       sound(NULL, CH_INFO, SND_OVERTIME, VOL_BASE, ATTN_NONE);
+       if(checkrules_overtimesadded == 1) {
+               Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_OVERTIME);
+               overtime_starttime = time;
+       }
 }
 
 float GetWinningCode(float fraglimitreached, float equality)
@@ -1408,7 +1459,49 @@ void ClearWinners()
        FOREACH_CLIENT(IS_PLAYER(it) || INGAME(it), { it.winning = 0; });
 }
 
-int fragsleft_last;
+void AnnounceNewLeader()
+{
+       if(teamplay) {
+               if (WinningConditionHelper_equality)
+                       Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_TEAM_LEADS_TIED);
+               else
+                       FOREACH_CLIENT(IS_PLAYER(it), {
+                               if(it.team == WinningConditionHelper_winnerteam)
+                                       Send_Notification(NOTIF_ONE_ONLY, it, MSG_ANNCE, ANNCE_TEAM_LEADS_TEAM);
+                               else
+                                       Send_Notification(NOTIF_ONE_ONLY, it, MSG_ANNCE, ANNCE_TEAM_LEADS_ENEMY);
+                       });
+                       Send_Notification(NOTIF_ALL_SPEC, NULL, MSG_ANNCE, APP_TEAM_NUM(WinningConditionHelper_winnerteam, ANNCE_TEAM_LEADS));
+       } else {
+               if (WinningConditionHelper_equality)
+               {
+                       Send_Notification(NOTIF_ONE, WinningConditionHelper_equality_one, MSG_ANNCE, ANNCE_LEAD_TIED);
+                       Send_Notification(NOTIF_ONE, WinningConditionHelper_equality_two, MSG_ANNCE, ANNCE_LEAD_TIED);
+               }
+               else
+               {
+                       Send_Notification(NOTIF_ONE, WinningConditionHelper_winner, MSG_ANNCE, ANNCE_LEAD_GAINED);
+                       Send_Notification(NOTIF_ONE, WinningConditionHelper_second, MSG_ANNCE, ANNCE_LEAD_LOST);
+               }
+       }
+}
+
+void AnnounceScores(float tm)
+{
+       WinningConditionHelper(NULL);
+       if (Score_NewLeader()) {
+               AnnounceNewLeader();
+       } else {
+               FOREACH_CLIENT(IS_PLAYER(it), {
+                       if(it.team == tm)
+                               Send_Notification(NOTIF_ONE_ONLY, it, MSG_ANNCE, ANNCE_TEAM_SCORES_TEAM);
+                       else
+                               Send_Notification(NOTIF_ONE_ONLY, it, MSG_ANNCE, ANNCE_TEAM_SCORES_ENEMY);
+               });
+               Send_Notification(NOTIF_ALL_SPEC, NULL, MSG_ANNCE, APP_TEAM_NUM(tm, ANNCE_TEAM_SCORES));
+       }
+}
+
 float WinningCondition_Scores(float limit, float leadlimit)
 {
        // TODO make everything use THIS winning condition (except LMS)
@@ -1441,7 +1534,6 @@ float WinningCondition_Scores(float limit, float leadlimit)
 
        if(MUTATOR_CALLHOOK(Scores_CountFragsRemaining))
        {
-               float fragsleft;
                if (checkrules_suddendeathend && time >= checkrules_suddendeathend)
                {
                        fragsleft = 1;
@@ -1473,7 +1565,13 @@ float WinningCondition_Scores(float limit, float leadlimit)
                        fragsleft_last = fragsleft;
                }
        }
-
+       
+       // z411 - lead announcer
+       if(MUTATOR_CALLHOOK(Scores_AnnounceLeads)) {
+               if (Score_NewLeader())
+                       AnnounceNewLeader();
+       }
+       
        bool fraglimit_reached = (limit && WinningConditionHelper_topscore >= limit);
        bool leadlimit_reached = (leadlimit && WinningConditionHelper_topscore - WinningConditionHelper_secondscore >= leadlimit);
 
@@ -1589,6 +1687,9 @@ void CheckRules_World()
                        // again, but this shouldn't hurt
                return;
        }
+       
+       // z411 don't check rules if we're in a timeout
+       if (game_timeout) return;
 
        float timelimit = autocvar_timelimit * 60;
        float fraglimit = autocvar_fraglimit;
@@ -1627,6 +1728,9 @@ void CheckRules_World()
                                Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_RACE_FINISHLAP);
                        else
                                Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_OVERTIME_FRAG);
+                       checkrules_overtimesadded = 1;
+                       sound(NULL, CH_INFO, SND_OVERTIME, VOL_BASE, ATTN_NONE);
+                       Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_OVERTIME);
                }
        }
        else
@@ -2049,6 +2153,8 @@ void readlevelcvars()
 {
        if(cvar("sv_allow_fullbright"))
                serverflags |= SERVERFLAG_ALLOW_FULLBRIGHT;
+       if(cvar("sv_forbid_pickuptimer"))
+               serverflags |= SERVERFLAG_FORBID_PICKUPTIMER;
 
        sv_ready_restart_after_countdown = cvar("sv_ready_restart_after_countdown");
 
@@ -2242,7 +2348,7 @@ void RunThink(entity this, float dt)
 bool autocvar_sv_freezenonclients;
 void Physics_Frame()
 {
-       if(autocvar_sv_freezenonclients)
+       if(autocvar_sv_freezenonclients || game_timeout)
                return;
 
        IL_EACH(g_moveables, true,