Forcemap can be cleared with empty string again (#29472)

This commit is contained in:
Tayrtahn
2024-06-26 02:41:31 -04:00
committed by GitHub
parent c34fb39cf3
commit 1a67ab8c95
3 changed files with 20 additions and 6 deletions

View File

@@ -29,14 +29,19 @@ namespace Content.Server.GameTicking.Commands
var gameMap = IoCManager.Resolve<IGameMapManager>();
var name = args[0];
if (!gameMap.CheckMapExists(name))
// An empty string clears the forced map
if (!string.IsNullOrEmpty(name) && !gameMap.CheckMapExists(name))
{
shell.WriteLine(Loc.GetString("forcemap-command-map-not-found", ("map", name)));
return;
}
_configurationManager.SetCVar(CCVars.GameMap, name);
shell.WriteLine(Loc.GetString("forcemap-command-success", ("map", name)));
if (string.IsNullOrEmpty(name))
shell.WriteLine(Loc.GetString("forcemap-command-cleared"));
else
shell.WriteLine(Loc.GetString("forcemap-command-success", ("map", name)));
}
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)