]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_world.qc
Merge branch 'master' into samual/weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_world.qc
index e7a3ad96cc0997be032fd1a3de40d4245dd87f3d..5c65e6944e1b9c867fd042be20af48976c2f01d8 100644 (file)
@@ -253,7 +253,6 @@ void cvar_changes_init()
 
                // mapinfo
                BADCVAR("fraglimit");
-               BADCVAR("g_arena");
                BADCVAR("g_assault");
                BADCVAR("g_ca");
                BADCVAR("g_ca_teams");
@@ -304,7 +303,6 @@ void cvar_changes_init()
 
                // does nothing visible
                BADCVAR("captureleadlimit_override");
-               BADCVAR("g_arena_point_leadlimit");
                BADCVAR("g_balance_kill_delay");
                BADCVAR("g_ca_point_leadlimit");
                BADCVAR("g_ctf_captimerecord_always");
@@ -323,7 +321,6 @@ void cvar_changes_init()
                BADCVAR("sv_fraginfo");
                BADCVAR("sv_timeout");
                BADPREFIX("sv_timeout_");
-               BADCVAR("welcome_message_time");
                BADPREFIX("crypto_");
                BADPREFIX("g_chat_");
                BADPREFIX("g_ctf_captimerecord_");
@@ -429,7 +426,7 @@ void cvar_changes_init()
                BADCVAR("g_nix");
                BADCVAR("g_grappling_hook");
                BADCVAR("g_jetpack");
-               
+
 #undef BADPREFIX
 #undef BADCVAR
 
@@ -545,6 +542,7 @@ void spawnfunc___init_dedicated_server(void)
 
        // needs to be done so early because of the constants they create
        CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
+       CALL_ACCUMULATED_FUNCTION(RegisterMonsters);
        CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
        CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
        CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
@@ -593,6 +591,7 @@ void spawnfunc_worldspawn (void)
 
        // needs to be done so early because of the constants they create
        CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
+       CALL_ACCUMULATED_FUNCTION(RegisterMonsters);
        CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
        CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
        CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
@@ -653,8 +652,6 @@ void spawnfunc_worldspawn (void)
        InitGameplayMode();
        readlevelcvars();
        GrappleHookInit();
-       ElectroInit();
-       LaserInit();
 
        player_count = 0;
        bot_waypoints_for_items = autocvar_g_waypoints_for_items;
@@ -790,8 +787,8 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_TYPEHIT_TIME, AS_FLOAT, typehit_time);
        addstat(STAT_LAYED_MINES, AS_INT, minelayer_mines);
 
-       addstat(STAT_NEX_CHARGE, AS_FLOAT, nex_charge);
-       addstat(STAT_NEX_CHARGEPOOL, AS_FLOAT, nex_chargepool_ammo);
+       addstat(STAT_VORTEX_CHARGE, AS_FLOAT, vortex_charge);
+       addstat(STAT_VORTEX_CHARGEPOOL, AS_FLOAT, vortex_chargepool_ammo);
 
        addstat(STAT_HAGAR_LOAD, AS_INT, hagar_load);
 
@@ -805,6 +802,10 @@ void spawnfunc_worldspawn (void)
        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);
 
@@ -815,6 +816,7 @@ void spawnfunc_worldspawn (void)
        // set up information replies for clients and server to use
        maplist_reply = strzone(getmaplist());
        lsmaps_reply = strzone(getlsmaps());
+       monsterlist_reply = strzone(getmonsterlist());
        for(i = 0; i < 10; ++i)
        {
                s = getrecords(i);
@@ -1049,6 +1051,8 @@ float() MaplistMethod_Iterate = // usual method
 {
        float pass, i;
 
+       dprint("Trying MaplistMethod_Iterate\n");
+
        for(pass = 1; pass <= 2; ++pass)
        {
                for(i = 1; i < Map_Count; ++i)
@@ -1064,6 +1068,8 @@ float() MaplistMethod_Iterate = // usual method
 
 float() MaplistMethod_Repeat = // fallback method
 {
+       dprint("Trying MaplistMethod_Repeat\n");
+
        if(Map_Check(Map_Current, 2))
                return Map_Current;
        return -2;
@@ -1073,6 +1079,8 @@ float() MaplistMethod_Random = // random map selection
 {
        float i, imax;
 
+       dprint("Trying MaplistMethod_Random\n");
+
        imax = 42;
 
        for(i = 0; i <= imax; ++i)
@@ -1091,6 +1099,8 @@ float(float exponent) MaplistMethod_Shuffle = // more clever shuffling
 {
        float i, j, imax, insertpos;
 
+       dprint("Trying MaplistMethod_Shuffle\n");
+
        imax = 42;
 
        for(i = 0; i <= imax; ++i)
@@ -1125,10 +1135,14 @@ float(float exponent) MaplistMethod_Shuffle = // more clever shuffling
 void Maplist_Init()
 {
        Map_Count = tokenizebyseparator(autocvar_g_maplist, " ");
-       if(Map_Count == 0)
+       float i;
+       for (i = 0; i < Map_Count; ++i)
+               if (Map_Check(i, 2))
+                       break;
+       if (i == Map_Count)
        {
-               bprint( "Maplist is empty!  Resetting it to default map list.\n" );
-               cvar_set("g_maplist", MapInfo_ListAllAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags()));
+               bprint( "Maplist contains no usable maps!  Resetting it to default map list.\n" );
+               cvar_set("g_maplist", MapInfo_ListAllAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags() | MAPINFO_FLAG_NOAUTOMAPLIST));
                if(autocvar_g_maplist_shuffle)
                        ShuffleMaplist();
                localcmd("\nmenu_cmd sync\n");
@@ -1231,31 +1245,12 @@ void GotoNextMap(float reinit)
                return;
        alreadychangedlevel = TRUE;
 
-       {
-               string nextMap;
-               float allowReset;
+       string nextMap;
 
-               for(allowReset = 1; allowReset >= 0; --allowReset)
-               {
-                       nextMap = GetNextMap();
-                       if(nextMap != "")
-                               break;
-
-                       if(allowReset)
-                       {
-                               bprint( "Maplist contains no single playable map!  Resetting it to default map list.\n" );
-                               cvar_set("g_maplist", MapInfo_ListAllAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags()));
-                               if(autocvar_g_maplist_shuffle)
-                                       ShuffleMaplist();
-                               localcmd("\nmenu_cmd sync\n");
-                       }
-                       else
-                       {
-                               error("Everything is broken - not even the default map list works. Please report this to the developers.");
-                       }
-               }
-               Map_Goto(reinit);
-       }
+       nextMap = GetNextMap();
+       if(nextMap == "")
+               error("Everything is broken - cannot find a next map. Please report this to the developers.");
+       Map_Goto(reinit);
 }
 
 
@@ -1409,7 +1404,7 @@ void DumpStats(float final)
                {
                        s = strcat(":player:see-labels:", GetPlayerScoreString(other, 0), ":");
                        s = strcat(s, ftos(rint(time - other.jointime)), ":");
-                       if(IS_PLAYER(other) || g_arena || other.caplayer == 1 || g_lms)
+                       if(IS_PLAYER(other) || other.caplayer == 1 || g_lms)
                                s = strcat(s, ftos(other.team), ":");
                        else
                                s = strcat(s, "spectator:");
@@ -1522,7 +1517,7 @@ void NextLevel()
                PlayerStats_AddGlobalInfo(e);
        PlayerStats_Shutdown();
        WeaponStats_Shutdown();
-       
+
        Kill_Notification(NOTIF_ALL, world, MSG_CENTER, 0); // kill all centerprints now
 
        if(autocvar_sv_eventlog)
@@ -1579,7 +1574,7 @@ float InitiateSuddenDeath()
        // - for this timelimit_overtime needs to be >0 of course
        // - also check the winning condition calculated in the previous frame and only add normal overtime
        //   again, if at the point at which timelimit would be extended again, still no winner was found
-       if (!autocvar_g_campaign && (checkrules_overtimesadded >= 0) && (checkrules_overtimesadded < autocvar_timelimit_overtimes) && autocvar_timelimit_overtime && !(g_race && !g_race_qualifying))
+       if (!autocvar_g_campaign && (checkrules_overtimesadded >= 0) && (checkrules_overtimesadded < autocvar_timelimit_overtimes || autocvar_timelimit_overtimes < 0) && autocvar_timelimit_overtime && !(g_race && !g_race_qualifying))
        {
                return 1; // need to call InitiateOvertime later
        }
@@ -1863,7 +1858,7 @@ float WinningCondition_Scores(float limit, float leadlimit)
        if(WinningConditionHelper_zeroisworst)
                leadlimit = 0; // not supported in this mode
 
-       if(g_dm || g_tdm || g_arena || g_ca || g_freezetag || (g_race && !g_race_qualifying) || g_nexball)
+       if(g_dm || g_tdm || g_ca || g_freezetag || (g_race && !g_race_qualifying) || g_nexball)
        // these modes always score in increments of 1, thus this makes sense
        {
                if(leaderfrags != WinningConditionHelper_topscore)
@@ -2246,7 +2241,7 @@ string MapVote_Suggest(string m)
        if(mapvote_initialized)
                return "Can't suggest - voting is already in progress!";
        m = MapInfo_FixName(m);
-       if not(m)
+       if (!m)
                return "The map you suggested is not available on this server.";
        if(!autocvar_g_maplist_votable_suggestions_override_mostrecent)
                if(Map_IsRecent(m))
@@ -2733,6 +2728,8 @@ string GotoMap(string m)
 
 void EndFrame()
 {
+       anticheat_endframe();
+
        float altime;
        FOR_EACH_REALCLIENT(self)
        {