]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_world.qc
Accept hash changes (entity indices)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_world.qc
index eac04a62900191da17087d541fad05a0d6d8fea5..e92d0e25203660c79137e0519ccef34d72aca576 100644 (file)
@@ -269,7 +269,9 @@ void cvar_changes_init()
                BADCVAR("g_nexball");
                BADCVAR("g_onslaught");
                BADCVAR("g_race");
+               BADCVAR("g_race_laps_limit");
                BADCVAR("g_race_qualifying_timelimit");
+               BADCVAR("g_race_qualifying_timelimit_override");
                BADCVAR("g_tdm");
                BADCVAR("g_tdm_teams");
                BADCVAR("leadlimit");
@@ -300,47 +302,52 @@ void cvar_changes_init()
 
                // now check if the changes are actually gameplay relevant
 
-               // does nothing visible
+               // does nothing gameplay relevant
                BADCVAR("captureleadlimit_override");
+               BADCVAR("gameversion");
+               BADCVAR("g_allow_oldvortexbeam");
                BADCVAR("g_balance_kill_delay");
-               BADCVAR("g_ca_point_limit");
+               BADCVAR("g_campcheck_distance");
                BADCVAR("g_ca_point_leadlimit");
+               BADCVAR("g_ca_point_limit");
                BADCVAR("g_ctf_captimerecord_always");
                BADCVAR("g_ctf_flag_glowtrails");
                BADCVAR("g_ctf_flag_pickup_verbosename");
                BADCVAR("g_domination_point_leadlimit");
                BADCVAR("g_forced_respawn");
-               BADCVAR("g_freezetag_point_limit");
                BADCVAR("g_freezetag_point_leadlimit");
-               BADCVAR("g_keyhunt_point_leadlimit");
-               BADPREFIX("g_mod_");
+               BADCVAR("g_freezetag_point_limit");
+               BADCVAR("g_hats");
                BADCVAR("g_invasion_point_limit");
+               BADCVAR("g_keyhunt_point_leadlimit");
                BADCVAR("g_nexball_goalleadlimit");
-               BADCVAR("g_tdm_point_limit");
                BADCVAR("g_tdm_point_leadlimit");
+               BADCVAR("g_tdm_point_limit");
                BADCVAR("leadlimit_and_fraglimit");
                BADCVAR("leadlimit_override");
                BADCVAR("pausable");
                BADCVAR("sv_allow_fullbright");
                BADCVAR("sv_checkforpacketsduringsleep");
+               BADCVAR("sv_intermission_cdtrack");
+               BADCVAR("sv_minigames");
+               BADCVAR("sv_namechangetimer");
+               BADCVAR("sv_precacheplayermodels");
                BADCVAR("sv_timeout");
-               BADPREFIX("sv_timeout_");
                BADPREFIX("crypto_");
+               BADPREFIX("gameversion_");
                BADPREFIX("g_chat_");
                BADPREFIX("g_ctf_captimerecord_");
                BADPREFIX("g_maplist_votable_");
+               BADPREFIX("g_mod_");
                BADPREFIX("net_");
                BADPREFIX("prvm_");
                BADPREFIX("skill_");
                BADPREFIX("sv_cullentities_");
                BADPREFIX("sv_maxidle_");
+               BADPREFIX("sv_minigames_");
+               BADPREFIX("sv_timeout_");
                BADPREFIX("sv_vote_");
                BADPREFIX("timelimit_");
-               BADCVAR("gameversion");
-               BADPREFIX("gameversion_");
-               BADCVAR("sv_minigames");
-               BADPREFIX("sv_minigames_");
-               BADCVAR("sv_namechangetimer");
 
                // allowed changes to server admins (please sync this to server.cfg)
                // vi commands:
@@ -385,7 +392,9 @@ void cvar_changes_init()
                BADCVAR("g_mirrordamage");
                BADCVAR("g_nexball_goallimit");
                BADCVAR("g_powerups");
+               BADCVAR("g_spawnshieldtime");
                BADCVAR("g_start_delay");
+               BADCVAR("g_superspectate");
                BADCVAR("g_tdm_teams_override");
                BADCVAR("g_warmup");
                BADCVAR("g_weapon_stay"); BADPRESUFFIX("g_", "_weapon_stay");
@@ -423,7 +432,6 @@ void cvar_changes_init()
                BADCVAR("sv_vote_simple_majority_factor");
                BADCVAR("teamplay_mode");
                BADCVAR("timelimit_override");
-               BADCVAR("g_spawnshieldtime");
                BADPREFIX("g_warmup_");
                BADPREFIX("sv_ready_restart_");
 
@@ -563,46 +571,68 @@ void WeaponStats_Init();
 void WeaponStats_Shutdown();
 spawnfunc(worldspawn)
 {
+       server_is_dedicated = boolean(stof(cvar_defstring("is_dedicated")));
+
        {
                bool wantrestart = false;
-               // Try to use versioned csprogs from pk3
-               // Only ever use versioned csprogs.dat files on dedicated servers;
-               // we need to reset csqc_progname on clients ourselves, and it's easier if the client's release name is constant
-               string pk3csprogs = "csprogs-" WATERMARK ".dat";
-               if (cvar_string_normal("csqc_progname") != pk3csprogs && fexists(pk3csprogs))
+
+               if (!server_is_dedicated)
                {
-                       cvar_set_normal("csqc_progname", pk3csprogs);
-                       wantrestart = true;
+                       // force unloading of server pk3 files when starting a listen server
+                       // localcmd("\nfs_rescan\n"); // FIXME: does more harm than good, has unintended side effects. What we really want is to unload temporary pk3s only
+                       // restore csqc_progname too
+                       string expect = "csprogs.dat";
+                       wantrestart = cvar_string_normal("csqc_progname") != expect;
+                       cvar_set_normal("csqc_progname", expect);
                }
-               // Check for updates on startup
-               // We do it this way for atomicity so that connecting clients still match the server progs and don't disconnect
-               int sentinel = fopen("progs.txt", FILE_READ);
-               if (sentinel >= 0)
+               else
                {
-                       string switchversion = fgets(sentinel);
-                       fclose(sentinel);
-                       if (switchversion != "" && switchversion != WATERMARK)
+                       // Try to use versioned csprogs from pk3
+                       // Only ever use versioned csprogs.dat files on dedicated servers;
+                       // we need to reset csqc_progname on clients ourselves, and it's easier if the client's release name is constant
+                       string pk3csprogs = "csprogs-" WATERMARK ".dat";
+                       // This always works; fall back to it if a versioned csprogs.dat is suddenly missing
+                       string select = "csprogs.dat";
+                       if (fexists(pk3csprogs)) select = pk3csprogs;
+                       if (cvar_string_normal("csqc_progname") != select)
                        {
-                               LOG_INFOF("Switching progs: " WATERMARK " -> %s\n", switchversion);
-                               // if it doesn't exist, assume either:
-                               //   a) the current program was overwritten
-                               //   b) this is a client only update
-                               string newprogs = sprintf("progs-%s.dat", switchversion);
-                               if (fexists(newprogs))
-                               {
-                                       cvar_set_normal("sv_progs", newprogs);
-                                       wantrestart = true;
-                               }
-                               string newcsprogs = sprintf("csprogs-%s.dat", switchversion);
-                               if (fexists(newcsprogs))
+                               cvar_set_normal("csqc_progname", select);
+                               wantrestart = true;
+                       }
+                       // Check for updates on startup
+                       // We do it this way for atomicity so that connecting clients still match the server progs and don't disconnect
+                       int sentinel = fopen("progs.txt", FILE_READ);
+                       if (sentinel >= 0)
+                       {
+                               string switchversion = fgets(sentinel);
+                               fclose(sentinel);
+                               if (switchversion != "" && switchversion != WATERMARK)
                                {
-                                       cvar_set_normal("csqc_progname", newcsprogs);
-                                       wantrestart = true;
+                                       LOG_INFOF("Switching progs: " WATERMARK " -> %s\n", switchversion);
+                                       // if it doesn't exist, assume either:
+                                       //   a) the current program was overwritten
+                                       //   b) this is a client only update
+                                       string newprogs = sprintf("progs-%s.dat", switchversion);
+                                       if (fexists(newprogs))
+                                       {
+                                               cvar_set_normal("sv_progs", newprogs);
+                                               wantrestart = true;
+                                       }
+                                       string newcsprogs = sprintf("csprogs-%s.dat", switchversion);
+                                       if (fexists(newcsprogs))
+                                       {
+                                               cvar_set_normal("csqc_progname", newcsprogs);
+                                               wantrestart = true;
+                                       }
                                }
                        }
                }
-               if (wantrestart) changelevel(mapname);
-               // let initialization continue, shutdown depends on it
+               if (wantrestart)
+               {
+                       LOG_INFOF("Restart requested\n");
+                       changelevel(mapname);
+                       // let initialization continue, shutdown depends on it
+               }
        }
 
        float fd, l;
@@ -628,8 +658,6 @@ spawnfunc(worldspawn)
                ++maxclients;
        }
 
-       server_is_dedicated = (stof(cvar_defstring("is_dedicated")) ? true : false);
-
        // needs to be done so early because of the constants they create
        static_init();
 
@@ -824,9 +852,6 @@ spawnfunc(worldspawn)
 
        localcmd("\n_sv_hook_gamestart ", GetGametype(), "\n");
 
-       // force unloading of server pk3 files when starting a listen server
-       if (!server_is_dedicated) localcmd("\nfs_rescan\n");
-
        // fill sv_curl_serverpackages from .serverpackage files
        if (autocvar_sv_curl_serverpackages_auto)
        {
@@ -1273,7 +1298,7 @@ void IntermissionThink()
                return;
 
        if(!mapvote_initialized)
-               if (time < intermission_exittime + 10 && !(self.BUTTON_ATCK || self.BUTTON_JUMP || self.BUTTON_ATCK2 || self.BUTTON_HOOK || self.BUTTON_USE))
+               if (time < intermission_exittime + 10 && !(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self) || PHYS_INPUT_BUTTON_ATCK2(self) || PHYS_INPUT_BUTTON_HOOK(self) || PHYS_INPUT_BUTTON_USE(self)))
                        return;
 
        MapVote_Start();
@@ -1631,51 +1656,6 @@ void ClearWinners()
        FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.winning = 0));
 }
 
-// Assault winning condition: If the attackers triggered a round end (by fulfilling all objectives)
-// they win. Otherwise the defending team wins once the timelimit passes.
-void assault_new_round();
-float WinningCondition_Assault()
-{SELFPARAM();
-       float status;
-
-       WinningConditionHelper(); // set worldstatus
-
-       status = WINNING_NO;
-       // as the timelimit has not yet passed just assume the defending team will win
-       if(assault_attacker_team == NUM_TEAM_1)
-       {
-               SetWinners(team, NUM_TEAM_2);
-       }
-       else
-       {
-               SetWinners(team, NUM_TEAM_1);
-       }
-
-       entity ent;
-       ent = find(world, classname, "target_assault_roundend");
-       if(ent)
-       {
-               if(ent.winning) // round end has been triggered by attacking team
-               {
-                       bprint("ASSAULT: round completed...\n");
-                       SetWinners(team, assault_attacker_team);
-
-                       TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 666 - TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 0));
-
-                       if(ent.cnt == 1 || autocvar_g_campaign) // this was the second round
-                       {
-                               status = WINNING_YES;
-                       }
-                       else
-                       {
-                               WITH(entity, self, ent, assault_new_round());
-                       }
-               }
-       }
-
-       return status;
-}
-
 void ShuffleMaplist()
 {
        cvar_set("g_maplist", shufflewords(autocvar_g_maplist));