Makes map vote and roundstart smart about player count. (#5418)

* Makes map vote and roundstart smart about player count.
No more Saltern with 30 players, or Knight Ship with 50.

* a typo

* Address reviews.

* Localized.
This commit is contained in:
Moony
2021-11-20 12:32:07 -06:00
committed by GitHub
parent 6487cd6d79
commit eb6d24abd0
18 changed files with 298 additions and 19 deletions

View File

@@ -1,4 +1,5 @@
using Content.Server.Administration;
using Content.Server.Maps;
using Content.Shared.Administration;
using Content.Shared.CCVar;
using Robust.Shared.Configuration;
@@ -24,10 +25,10 @@ namespace Content.Server.GameTicking.Commands
return;
}
var cfg = IoCManager.Resolve<IConfigurationManager>();
var gameMap = IoCManager.Resolve<IGameMapManager>();
var name = args[0];
cfg.SetCVar(CCVars.GameMap, name);
gameMap.ForceSelectMap(name);
shell.WriteLine(Loc.GetString("forcemap-command-success", ("map", name)));
}
}

View File

@@ -12,9 +12,6 @@ namespace Content.Server.GameTicking
[ViewVariables]
public bool DummyTicker { get; private set; } = false;
[ViewVariables]
public string ChosenMap { get; private set; } = string.Empty;
[ViewVariables]
public TimeSpan LobbyDuration { get; private set; } = TimeSpan.Zero;
@@ -34,7 +31,6 @@ namespace Content.Server.GameTicking
{
_configurationManager.OnValueChanged(CCVars.GameLobbyEnabled, value => LobbyEnabled = value, true);
_configurationManager.OnValueChanged(CCVars.GameDummyTicker, value => DummyTicker = value, true);
_configurationManager.OnValueChanged(CCVars.GameMap, value => ChosenMap = value, true);
_configurationManager.OnValueChanged(CCVars.GameLobbyDuration, value => LobbyDuration = TimeSpan.FromSeconds(value), true);
_configurationManager.OnValueChanged(CCVars.GameDisallowLateJoins,
value => { DisallowLateJoin = value; UpdateLateJoinStatus(); UpdateJobsAvailable(); }, true);

View File

@@ -58,7 +58,7 @@ namespace Content.Server.GameTicking
{
DefaultMap = _mapManager.CreateMap();
var startTime = _gameTiming.RealTime;
var map = ChosenMap;
var map = _gameMapManager.GetSelectedMapChecked(true).MapPath;
var grid = _mapLoader.LoadBlueprint(DefaultMap, map);
if (grid == null)

View File

@@ -1,4 +1,5 @@
using Content.Server.Chat.Managers;
using Content.Server.Maps;
using Content.Server.Preferences.Managers;
using Content.Shared.Chat;
using Content.Shared.GameTicking;
@@ -85,5 +86,6 @@ namespace Content.Server.GameTicking
[Dependency] private readonly IBaseServer _baseServer = default!;
[Dependency] private readonly IWatchdogApi _watchdogApi = default!;
[Dependency] private readonly IReflectionManager _reflectionManager = default!;
[Dependency] private readonly IGameMapManager _gameMapManager = default!;
}
}