]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/campaign_restart_level' into 'master'
authorbones_was_here <bones_was_here@xa.org.au>
Wed, 13 Apr 2022 06:30:38 +0000 (06:30 +0000)
committerbones_was_here <bones_was_here@xa.org.au>
Wed, 13 Apr 2022 06:30:38 +0000 (06:30 +0000)
Minor campaign improvements

See merge request xonotic/xonotic-data.pk3dir!1009

1  2 
qcsrc/server/client.qc

diff --combined qcsrc/server/client.qc
index bacb82e071429c219127ce07e5cc15888d39ff57,e8482e6f52c2eaf4999920ffcf9e2ee0c716931f..7b0c7ba29e8d226ca42a1847490bb92bdbda0ab8
@@@ -1018,6 -1018,21 +1018,6 @@@ void ClientPreConnect(entity this
  }
  #endif
  
 -string GetClientVersionMessage(entity this)
 -{
 -      if (CS(this).version_mismatch) {
 -              if(CS(this).version < autocvar_gameversion) {
 -                      return strcat("This is Xonotic ", autocvar_g_xonoticversion,
 -                              "\n^3Your client version is outdated.\n\n\n### YOU WON'T BE ABLE TO PLAY ON THIS SERVER ###\n\n\nPlease update!!!^8");
 -              } else {
 -                      return strcat("This is Xonotic ", autocvar_g_xonoticversion,
 -                              "\n^3This server is using an outdated Xonotic version.\n\n\n ### THIS SERVER IS INCOMPATIBLE AND THUS YOU CANNOT JOIN ###.^8");
 -              }
 -      } else {
 -              return strcat("Welcome to Xonotic ", autocvar_g_xonoticversion);
 -      }
 -}
 -
  void SendWelcomemessage(entity this, bool force_centerprint)
  {
        msg_entity = this;
        SendWelcomemessage_msg_type(this, force_centerprint, MSG_ONE);
  }
  
 +// NOTE csqc uses the active mutators list sent by this function
 +// to understand which mutators are enabled
 +// also note that they aren't all registered mutators, e.g. jetpack, low gravity
  void SendWelcomemessage_msg_type(entity this, bool force_centerprint, int msg_type)
  {
        WriteByte(msg_type, boolean(autocvar_g_campaign));
        }
        WriteByte(msg_type, force_centerprint);
        WriteString(msg_type, autocvar_hostname);
 -      WriteString(msg_type, GetClientVersionMessage(this));
 +      WriteString(msg_type, autocvar_g_xonoticversion);
 +      WriteByte(msg_type, CS(this).version_mismatch);
 +      WriteByte(msg_type, (CS(this).version < autocvar_gameversion));
  
        MUTATOR_CALLHOOK(BuildMutatorsPrettyString, "");
        string modifications = M_ARGV(0, string);
  
 -      if(g_weaponarena)
 -      {
 -              if(g_weaponarena_random)
 -                      modifications = strcat(modifications, ", ", ftos(g_weaponarena_random), " of ", g_weaponarena_list, " Arena");
 -              else
 -                      modifications = strcat(modifications, ", ", g_weaponarena_list, " Arena");
 -      }
 -      else if(cvar("g_balance_blaster_weaponstartoverride") == 0)
 +      if (!g_weaponarena && cvar("g_balance_blaster_weaponstartoverride") == 0)
                modifications = strcat(modifications, ", No start weapons");
        if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity")))
                modifications = strcat(modifications, ", Low gravity");
        if(g_weapon_stay && !g_cts)
                modifications = strcat(modifications, ", Weapons stay");
        if(autocvar_g_jetpack)
 -              modifications = strcat(modifications, ", Jet pack");
 +              modifications = strcat(modifications, ", Jetpack");
        modifications = substring(modifications, 2, strlen(modifications) - 2);
  
        WriteString(msg_type, modifications);
  
 +      WriteString(msg_type, g_weaponarena_list);
 +
        if(cache_lastmutatormsg != autocvar_g_mutatormsg)
        {
                strcpy(cache_lastmutatormsg, autocvar_g_mutatormsg);
  
        WriteString(msg_type, cache_mutatormsg);
  
 -      string mutator_msg = "";
 -      MUTATOR_CALLHOOK(BuildGameplayTipsString, mutator_msg);
 -      mutator_msg = M_ARGV(0, string);
 -
 -      WriteString(msg_type, mutator_msg); // trust that the mutator will do proper formatting
        WriteString(msg_type, strreplace("\\n", "\n", autocvar_sv_motd));
  }
  
@@@ -1953,6 -1973,9 +1953,9 @@@ bool ShowTeamSelection(entity this
  }
  void Join(entity this)
  {
+       if (autocvar_g_campaign && !campaign_bots_may_start && !game_stopped && time >= game_starttime)
+               ReadyRestart(true);
        TRANSMUTE(Player, this);
  
        if(!this.team_selected)
@@@ -2537,7 -2560,6 +2540,6 @@@ void PlayerPreThink (entity this
                        || (!(autocvar_sv_spectate || autocvar_g_campaign || (Player_GetForcedTeamIndex(this) == TEAM_FORCE_SPECTATOR))
                                && (!teamplay || autocvar_g_balance_teams)))
                {
-                       campaign_bots_may_start = true;
                        if(joinAllowed(this))
                                Join(this);
                        return;