Make the MapFile a CVar (#2561)

This commit is contained in:
DrSmugleaf
2020-11-15 04:08:58 +01:00
committed by GitHub
parent 43eb7a94f4
commit 2ded2163fe
2 changed files with 9 additions and 2 deletions

View File

@@ -68,7 +68,6 @@ namespace Content.Server.GameTicking
public const float PresetFailedCooldownIncrease = 30f;
private const string PlayerPrototypeName = "HumanMob_Content";
private const string ObserverPrototypeName = "MobObserver";
private const string MapFile = "Maps/saltern.yml";
private static TimeSpan _roundStartTimeSpan;
[ViewVariables] private readonly List<GameRule> _gameRules = new List<GameRule>();
@@ -699,11 +698,16 @@ namespace Content.Server.GameTicking
DisallowLateJoin = false;
}
private string GetMap()
{
return _configurationManager.GetCVar(CCVars.GameMap);
}
private void _preRoundSetup()
{
DefaultMap = _mapManager.CreateMap();
var startTime = _gameTiming.RealTime;
var grid = _mapLoader.LoadBlueprint(DefaultMap, MapFile);
var grid = _mapLoader.LoadBlueprint(DefaultMap, GetMap());
DefaultGridId = grid.Index;
_spawnPoint = grid.ToCoordinates();

View File

@@ -46,6 +46,9 @@ namespace Content.Shared
public static readonly CVarDef<int>
GameMaxCharacterSlots = CVarDef.Create("game.maxcharacterslots", 10, CVar.ARCHIVE | CVar.SERVERONLY);
public static readonly CVarDef<string>
GameMap = CVarDef.Create("game.map", "Maps/saltern.yml", CVar.SERVERONLY);
/// <summary>
/// When enabled, guests will be assigned permanent UIDs and will have their preferences stored.
/// </summary>