]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_world.qc
Merge remote branch 'origin/master' into samual/config_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_world.qc
index 93157819efe8f6685c7594ba38e0f35942d0fe2a..95e3f7d61566c2cb26b1083d41d69d03e31a5a8a 100644 (file)
@@ -101,7 +101,7 @@ void fteqcc_testbugs()
  * players. Also plays reminder sounds.
  */
 void timeoutHandler_Think() {
-       local entity plr;
+       entity plr;
        if (timeoutStatus == 1) {
                if (remainingLeadTime > 0) {
                        //centerprint the information to every player
@@ -253,6 +253,7 @@ void cvar_changes_init()
                BADPREFIX("con_");
                BADPREFIX("scoreboard_");
                BADPREFIX("g_campaign");
+               BADPREFIX("g_waypointsprite_");
                BADPREFIX("gl_");
                BADPREFIX("joy");
                BADPREFIX("hud_");
@@ -278,7 +279,6 @@ void cvar_changes_init()
 
                // private
                BADCVAR("developer");
-               BADCVAR("g_banned_list");
                BADCVAR("log_dest_udp");
                BADCVAR("log_file");
                BADCVAR("net_address");
@@ -286,6 +286,7 @@ void cvar_changes_init()
                BADCVAR("port");
                BADCVAR("savedgamecfg");
                BADCVAR("serverconfig");
+               BADCVAR("sv_autoscreenshot");
                BADCVAR("sv_heartbeatperiod");
                BADCVAR("sv_vote_master_password");
                BADCVAR("sys_colortranslation");
@@ -294,18 +295,23 @@ void cvar_changes_init()
                BADCVAR("timestamps");
                BADPREFIX("developer_");
                BADPREFIX("g_ban_");
+               BADPREFIX("g_banned_list");
                BADPREFIX("g_chat_flood_");
+               BADPREFIX("g_ghost_items");
                BADPREFIX("g_playerstats_");
+               BADPREFIX("g_respawn_ghosts");
                BADPREFIX("g_voice_flood_");
                BADPREFIX("rcon_");
                BADPREFIX("settemp_");
-               BADPREFIX("sv_allowdownloads_");
+               BADPREFIX("sv_allowdownloads");
                BADPREFIX("sv_autodemo");
                BADPREFIX("sv_curl_");
                BADPREFIX("sv_eventlog");
                BADPREFIX("sv_logscores_");
                BADPREFIX("sv_master");
                BADPREFIX("sv_weaponstats_");
+               BADPREFIX("sv_waypointsprite_");
+               BADCVAR("rescan_pending");
 
                // these can contain player IDs, so better hide
                BADPREFIX("g_forced_team_");
@@ -379,6 +385,7 @@ void cvar_changes_init()
                BADCVAR("leadlimit_and_fraglimit");
                BADCVAR("leadlimit_override");
                BADCVAR("pausable");
+               BADCVAR("sv_allow_fullbright");
                BADCVAR("sv_checkforpacketsduringsleep");
                BADCVAR("sv_timeout");
                BADCVAR("welcome_message_time");
@@ -389,12 +396,17 @@ void cvar_changes_init()
                BADPREFIX("net_");
                BADPREFIX("prvm_");
                BADPREFIX("skill_");
-               BADPREFIX("sv_fragmessage_");
+               BADPREFIX("sv_cullentities_");
+               BADPREFIX("sv_fraginfo_");
                BADPREFIX("sv_maxidle_");
                BADPREFIX("sv_vote_");
                BADPREFIX("timelimit_");
                BADCVAR("gameversion");
                BADPREFIX("gameversion_");
+               BADCVAR("sv_namechangetimer");
+#ifndef NO_LEGACY_NETWORKING
+               BADCVAR("sv_use_csqc_players"); // transition
+#endif
 
                // allowed changes to server admins (please sync this to server.cfg)
                // vi commands:
@@ -403,10 +415,10 @@ void cvar_changes_init()
                //   :%s,//\([^ ]*\).*,BADCVAR("\1");,
                //   :%!sort
                // yes, this does contain some redundant stuff, don't really care
+               BADCVAR("bot_config_file");
                BADCVAR("bot_number");
                BADCVAR("bot_prefix");
                BADCVAR("bot_suffix");
-               BADCVAR("bot_config_file");
                BADCVAR("capturelimit_override");
                BADCVAR("fraglimit_override");
                BADCVAR("gametype");
@@ -437,6 +449,7 @@ void cvar_changes_init()
                BADCVAR("g_minstagib");
                BADCVAR("g_mirrordamage");
                BADCVAR("g_nexball_goallimit");
+               BADCVAR("g_powerups");
                BADCVAR("g_runematch_point_limit");
                BADCVAR("g_start_delay");
                BADCVAR("g_warmup");
@@ -453,6 +466,7 @@ void cvar_changes_init()
                BADCVAR("skill");
                BADCVAR("sv_adminnick");
                BADCVAR("sv_autoscreenshot");
+               BADCVAR("sv_autotaunt");
                BADCVAR("sv_curl_defaulturl");
                BADCVAR("sv_defaultcharacter");
                BADCVAR("sv_defaultplayercolors");
@@ -464,6 +478,7 @@ void cvar_changes_init()
                BADCVAR("sv_public");
                BADCVAR("sv_ready_restart");
                BADCVAR("sv_status_privacy");
+               BADCVAR("sv_taunt");
                BADCVAR("sv_vote_call");
                BADCVAR("sv_vote_commands");
                BADCVAR("sv_vote_majority_factor");
@@ -475,6 +490,7 @@ void cvar_changes_init()
                BADCVAR("teamplay_mode");
                BADCVAR("timelimit_override");
                BADPREFIX("g_warmup_");
+               BADPREFIX("sv_ready_restart_");
 
                if(autocvar_g_minstagib)
                {
@@ -628,7 +644,7 @@ void spawnfunc_worldspawn (void)
 
        allowed_to_spawn = TRUE;
 
-       local entity head;
+       entity head;
        head = nextent(world);
        maxclients = 0;
        while(head)
@@ -640,7 +656,7 @@ void spawnfunc_worldspawn (void)
        // needs to be done so early as they would still spawn
        RegisterWeapons();
 
-       ServerProgsDB = db_load("server.db");
+       ServerProgsDB = db_load(strcat("server.db", autocvar_sessionid));
 
        TemporaryDB = db_create();
 
@@ -711,6 +727,10 @@ void spawnfunc_worldspawn (void)
        //      dom_init();
 
        GameLogInit(); // prepare everything
+       // NOTE for matchid:
+       // changing the logic generating it is okay. But:
+       // it HAS to stay <= 64 chars
+       // character set: ASCII 33-126 without the following characters: : ; ' " \ $
        if(autocvar_sv_eventlog)
        {
                s = sprintf("%d.%s.%06d", ftos(autocvar_sv_eventlog_files_counter), strftime(FALSE, "%s"), floor(random() * 1000000));
@@ -732,8 +752,10 @@ void spawnfunc_worldspawn (void)
                        s = strcat(s, ":no_use_ammunition");
 
                // initialiation stuff, not good in the mutator system
-               if(!autocvar_g_pickup_items)
+               if(autocvar_g_pickup_items == 0)
                        s = strcat(s, ":no_pickup_items");
+               if(autocvar_g_pickup_items > 0)
+                       s = strcat(s, ":pickup_items");
 
                // initialiation stuff, not good in the mutator system
                if(autocvar_g_weaponarena != "0")
@@ -751,6 +773,12 @@ void spawnfunc_worldspawn (void)
                if(autocvar_g_minstagib)
                        s = strcat(s, ":minstagib");
 
+               // TODO to mutator system
+               if(autocvar_g_powerups == 0)
+                       s = strcat(s, ":no_powerups");
+               if(autocvar_g_powerups > 0)
+                       s = strcat(s, ":powerups");
+
                GameLogEcho(s);
                GameLogEcho(":gameinfo:end");
        }
@@ -783,22 +811,22 @@ void spawnfunc_worldspawn (void)
                                        continue;
                                if(argv(0) == "cd")
                                {
-                                       print("Found ^1DEPRECATED^7 cd loop command in .cfg file; put this line in mapinfo instead:\n");
+                                       print("Found ^1UNSUPPORTED^7 cd loop command in .cfg file; put this line in mapinfo instead:\n");
                                        print("  cdtrack ", argv(2), "\n");
                                }
                                else if(argv(0) == "fog")
                                {
-                                       print("Found ^1DEPRECATED^7 fog command in .cfg file; put this line in worldspawn in the .map/.bsp/.ent file instead:\n");
+                                       print("Found ^1UNSUPPORTED^7 fog command in .cfg file; put this line in worldspawn in the .map/.bsp/.ent file instead:\n");
                                        print("  \"fog\" \"", s, "\"\n");
                                }
                                else if(argv(0) == "set")
                                {
-                                       print("Found ^1DEPRECATED^7 set command in .cfg file; put this line in mapinfo instead:\n");
+                                       print("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:\n");
                                        print("  clientsettemp_for_type all ", argv(1), " ", argv(2), "\n");
                                }
                                else if(argv(0) != "//")
                                {
-                                       print("Found ^1DEPRECATED^7 set command in .cfg file; put this line in mapinfo instead:\n");
+                                       print("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:\n");
                                        print("  clientsettemp_for_type all ", argv(0), " ", argv(1), "\n");
                                }
                        }
@@ -851,7 +879,11 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_MOVEVARS_MAXSPEED, AS_FLOAT, stat_sv_maxspeed);
        addstat(STAT_MOVEVARS_AIRACCEL_QW, AS_FLOAT, stat_sv_airaccel_qw);
        addstat(STAT_MOVEVARS_AIRSTRAFEACCEL_QW, AS_FLOAT, stat_sv_airstrafeaccel_qw);
-
+       
+       // secrets
+       addstat(STAT_SECRETS_TOTAL, AS_FLOAT, stat_secrets_total);
+       addstat(STAT_SECRETS_FOUND, AS_FLOAT, stat_secrets_found);
+       
        next_pingtime = time + 5;
 
        detect_maptype();
@@ -920,8 +952,17 @@ void spawnfunc_worldspawn (void)
                s = "";
                n = tokenize_console(cvar_string("sv_curl_serverpackages"));
                for(i = 0; i < n; ++i)
-                       if(substring(argv(i), -14, -1) != ".serverpackage")
+                       if(substring(argv(i), -14, -1) != "-serverpackage.txt")
+                       if(substring(argv(i), -14, -1) != ".serverpackage") // OLD legacy
                                s = strcat(s, " ", argv(i));
+               fd = search_begin("*-serverpackage.txt", TRUE, FALSE);
+               if(fd >= 0)
+               {
+                       j = search_getsize(fd);
+                       for(i = 0; i < j; ++i)
+                               s = strcat(s, " ", search_getfilename(fd, i));
+                       search_end(fd);
+               }
                fd = search_begin("*.serverpackage", TRUE, FALSE);
                if(fd >= 0)
                {
@@ -958,7 +999,7 @@ string GetMapname()
 float Map_Count, Map_Current;
 string Map_Current_Name;
 
-// NOTE: this now expects the map list to be already tokenize()d and the count in Map_Count
+// NOTE: this now expects the map list to be already tokenized and the count in Map_Count
 float GetMaplistPosition()
 {
        float pos, idx;
@@ -1098,7 +1139,7 @@ void GameResetCfg()
 {
        // settings persist, except...
        localcmd("\nsettemp_restore\n");
-};
+}
 
 void Map_Goto()
 {
@@ -1237,7 +1278,7 @@ string GetNextMap()
        }
 
        return "";
-};
+}
 
 float DoNextMapOverride()
 {
@@ -1264,11 +1305,7 @@ float DoNextMapOverride()
        }
        if (autocvar_samelevel) // if samelevel is set, stay on same level
        {
-               // this does not work because it tries to exec maps/nexdm01.mapcfg (which doesn't exist, it should be trying maps/dm_nexdm01.mapcfg for example)
-               //localcmd(strcat("exec \"maps/", mapname, ".mapcfg\"\n"));
-               // so instead just restart the current map using the restart command (DOES NOT WORK PROPERLY WITH exit_cfg STUFF)
                localcmd("restart\n");
-               //changelevel (mapname);
                alreadychangedlevel = TRUE;
                return TRUE;
        }
@@ -1288,13 +1325,13 @@ float DoNextMapOverride()
                return TRUE;
        }
        return FALSE;
-};
+}
 
 void GotoNextMap()
 {
-       //local string nextmap;
-       //local float n, nummaps;
-       //local string s;
+       //string nextmap;
+       //float n, nummaps;
+       //string s;
        if (alreadychangedlevel)
                return;
        alreadychangedlevel = TRUE;
@@ -1324,7 +1361,7 @@ void GotoNextMap()
                }
                Map_Goto();
        }
-};
+}
 
 
 /*
@@ -1342,9 +1379,8 @@ void IntermissionThink()
 {
        FixIntermissionClient(self);
 
-       if(autocvar_sv_autoscreenshot)
-       if(self.autoscreenshot > 0)
-       if(time > self.autoscreenshot)
+       if( (autocvar_sv_autoscreenshot || self.cvar_cl_autoscreenshot)
+               && ((self.autoscreenshot > 0) && (time > self.autoscreenshot)) )
        {
                self.autoscreenshot = -1;
                if(clienttype(self) == CLIENTTYPE_REAL)
@@ -1360,7 +1396,7 @@ void IntermissionThink()
                        return;
 
        MapVote_Start();
-};
+}
 
 /*
 ============
@@ -1407,7 +1443,7 @@ entity FindIntermission()
 
        //objerror ("FindIntermission: no spot");
        return world;
-};
+}
 */
 
 /*
@@ -1623,7 +1659,7 @@ void CheckRules_Player()
 
        // fixme: don't check players; instead check spawnfunc_dom_team and spawnfunc_ctf_team entities
        //   (div0: and that in CheckRules_World please)
-};
+}
 
 float checkrules_equality;
 float checkrules_suddendeathwarning;
@@ -1732,7 +1768,7 @@ void ClearWinners(void)
 float WinningCondition_Onslaught()
 {
        entity head;
-       local float t1, t2, t3, t4;
+       float t1, t2, t3, t4;
 
        WinningConditionHelper(); // set worldstatus
 
@@ -1792,7 +1828,7 @@ float LMS_NewPlayerLives()
 void assault_new_round();
 float WinningCondition_Assault()
 {
-       local float status;
+       float status;
 
        WinningConditionHelper(); // set worldstatus
 
@@ -1807,7 +1843,7 @@ float WinningCondition_Assault()
                SetWinners(team, COLOR_TEAM1);
        }
 
-       local entity ent;
+       entity ent;
        ent = find(world, classname, "target_assault_roundend");
        if(ent)
        {
@@ -1824,7 +1860,7 @@ float WinningCondition_Assault()
                        }
                        else
                        {
-                               local entity oldself;
+                               entity oldself;
                                oldself = self;
                                self = ent;
                                assault_new_round();
@@ -2038,6 +2074,9 @@ float WinningCondition_RanOutOfSpawns()
        if(have_team_spawns <= 0)
                return WINNING_NO;
 
+       if(autocvar_g_spawn_useallspawns <= 0)
+               return WINNING_NO;
+
        if(!some_spawn_has_been_used)
                return WINNING_NO;
 
@@ -2279,7 +2318,7 @@ void CheckRules_World()
                //print("WINNING\n");
                NextLevel();
        }
-};
+}
 
 float mapvote_nextthink;
 float mapvote_initialized;
@@ -2799,7 +2838,7 @@ void MapVote_Think()
        }
 
        MapVote_Tick();
-};
+}
 
 string GotoMap(string m)
 {
@@ -2908,7 +2947,7 @@ void RestoreGame()
        // some things then break, so let's work around them...
 
        // Progs DB (capture records)
-       ServerProgsDB = db_load("server.db");
+       ServerProgsDB = db_load(strcat("server.db", autocvar_sessionid));
 
        // Mapinfo
        MapInfo_Shutdown();
@@ -2942,9 +2981,9 @@ void SV_Shutdown()
                if(!cheatcount_total)
                {
                        if(autocvar_sv_db_saveasdump)
-                               db_dump(ServerProgsDB, "server.db");
+                               db_dump(ServerProgsDB, strcat("server.db", autocvar_sessionid));
                        else
-                               db_save(ServerProgsDB, "server.db");
+                               db_save(ServerProgsDB, strcat("server.db", autocvar_sessionid));
                }
                if(autocvar_developer)
                {