]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/world.qc
Merge branch 'master' into LegendaryGuard/bai_mod
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / world.qc
index 9da86388c1f22936b91de84c88ee9bae265b4b03..d509eccf89da66807bc104cebd9105e8e8b0afff 100644 (file)
@@ -313,9 +313,12 @@ void cvar_changes_init()
 
                // long
                BADCVAR("hostname");
+               BADCVAR("hostname_full");
                BADCVAR("g_maplist");
                BADCVAR("g_maplist_mostrecent");
                BADCVAR("sv_motd");
+               
+               BADPREFIX("g_teamnames_");
 
                v = cvar_string(k);
                d = cvar_defstring(k);
@@ -358,6 +361,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");
@@ -413,6 +419,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:
@@ -1013,6 +1021,9 @@ spawnfunc(worldspawn)
 
        world_initialized = 1;
        __spawnfunc_spawn_all();
+       
+       if(!warmup_stage)
+               round_handler_Activate(true);
 }
 
 spawnfunc(light)
@@ -1281,6 +1292,8 @@ void NextLevel()
        */
 
        //pos = FindIntermission ();
+       
+       sound(NULL, CH_INFO, SND_ENDMATCH, VOL_BASE, ATTN_NONE);
 
        VoteReset();
 
@@ -1291,6 +1304,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");
@@ -1304,6 +1322,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();
@@ -1347,6 +1388,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)
@@ -1398,7 +1445,27 @@ void ClearWinners()
        FOREACH_CLIENT(IS_PLAYER(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
+                       Send_Notification(NOTIF_ALL, 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);
+               }
+       }
+}
+
 float WinningCondition_Scores(float limit, float leadlimit)
 {
        // TODO make everything use THIS winning condition (except LMS)
@@ -1431,7 +1498,6 @@ float WinningCondition_Scores(float limit, float leadlimit)
 
        if(MUTATOR_CALLHOOK(Scores_CountFragsRemaining))
        {
-               float fragsleft;
                if (checkrules_suddendeathend && time >= checkrules_suddendeathend)
                {
                        fragsleft = 1;
@@ -1463,7 +1529,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);
 
@@ -1579,6 +1651,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;
@@ -1617,6 +1692,8 @@ void CheckRules_World()
                                Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_RACE_FINISHLAP);
                        else
                                Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_OVERTIME_FRAG);
+                       sound(NULL, CH_INFO, SND_OVERTIME, VOL_BASE, ATTN_NONE);
+                       Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_SUDDENDEATH);
                }
        }
        else
@@ -2237,7 +2314,7 @@ void RunThink(entity this)
 bool autocvar_sv_freezenonclients;
 void Physics_Frame()
 {
-       if(autocvar_sv_freezenonclients)
+       if(autocvar_sv_freezenonclients || game_timeout)
                return;
 
        IL_EACH(g_moveables, true,