Merge remote-tracking branch 'upstream/master' into 20-10-30-admins

This commit is contained in:
Pieter-Jan Briers
2020-11-10 16:59:17 +01:00
473 changed files with 5588 additions and 3584 deletions

View File

@@ -9,6 +9,7 @@ using Content.Server.Interfaces.Chat;
using Content.Server.Interfaces.GameTicking;
using Content.Server.Mobs.Roles.Suspicion;
using Content.Server.Players;
using Content.Shared;
using Content.Shared.GameObjects.Components.Inventory;
using Content.Shared.GameObjects.Components.PDA;
using Content.Shared.Roles;
@@ -44,20 +45,12 @@ namespace Content.Server.GameTicking.GamePresets
private static string TraitorID = "SuspicionTraitor";
private static string InnocentID = "SuspicionInnocent";
public static void RegisterCVars(IConfigurationManager cfg)
{
cfg.RegisterCVar("game.suspicion_min_players", 5);
cfg.RegisterCVar("game.suspicion_min_traitors", 2);
cfg.RegisterCVar("game.suspicion_players_per_traitor", 5);
cfg.RegisterCVar("game.suspicion_starting_balance", 20);
}
public override bool Start(IReadOnlyList<IPlayerSession> readyPlayers, bool force = false)
{
MinPlayers = _cfg.GetCVar<int>("game.suspicion_min_players");
MinTraitors = _cfg.GetCVar<int>("game.suspicion_min_traitors");
PlayersPerTraitor = _cfg.GetCVar<int>("game.suspicion_players_per_traitor");
TraitorStartingBalance = _cfg.GetCVar<int>("game.suspicion_starting_balance");
MinPlayers = _cfg.GetCVar(CCVars.GameSuspicionMinPlayers);
MinTraitors = _cfg.GetCVar(CCVars.GameSuspicionMinTraitors);
PlayersPerTraitor = _cfg.GetCVar(CCVars.GameSuspicionPlayersPerTraitor);
TraitorStartingBalance = _cfg.GetCVar(CCVars.GameSuspicionStartingBalance);
if (!force && readyPlayers.Count < MinPlayers)
{

View File

@@ -2,6 +2,7 @@
using System.Threading;
using Content.Server.Interfaces.Chat;
using Content.Server.Interfaces.GameTicking;
using Content.Shared;
using Content.Shared.GameObjects.Components.Damage;
using Robust.Server.Interfaces.Player;
using Robust.Server.Player;
@@ -56,7 +57,7 @@ namespace Content.Server.GameTicking.GameRules
{
_checkTimerCancel = null;
if (!_cfg.GetCVar<bool>("game.enablewin"))
if (!_cfg.GetCVar(CCVars.GameLobbyEnableWin))
return;
IPlayerSession winner = null;

View File

@@ -6,6 +6,7 @@ using Content.Server.Interfaces.Chat;
using Content.Server.Interfaces.GameTicking;
using Content.Server.Mobs.Roles.Suspicion;
using Content.Server.Players;
using Content.Shared;
using Content.Shared.GameObjects.Components.Damage;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.Player;
@@ -58,7 +59,7 @@ namespace Content.Server.GameTicking.GameRules
private void _checkWinConditions()
{
if (!_cfg.GetCVar<bool>("game.enablewin"))
if (!_cfg.GetCVar(CCVars.GameLobbyEnableWin))
return;
var traitorsAlive = 0;

View File

@@ -89,7 +89,7 @@ namespace Content.Server.GameTicking
[ViewVariables] private bool DisallowLateJoin { get; set; } = false;
[ViewVariables] private bool LobbyEnabled => _configurationManager.GetCVar<bool>("game.lobbyenabled");
[ViewVariables] private bool LobbyEnabled => _configurationManager.GetCVar(CCVars.GameLobbyEnabled);
[ViewVariables] private bool _updateOnRoundEnd;
private CancellationTokenSource _updateShutdownCts;
@@ -120,7 +120,7 @@ namespace Content.Server.GameTicking
public event Action<GameRuleAddedEventArgs> OnRuleAdded;
private TimeSpan LobbyDuration =>
TimeSpan.FromSeconds(_configurationManager.GetCVar<int>("game.lobbyduration"));
TimeSpan.FromSeconds(_configurationManager.GetCVar(CCVars.GameLobbyDuration));
public override void Initialize()
{
@@ -128,8 +128,6 @@ namespace Content.Server.GameTicking
DebugTools.Assert(!_initialized);
PresetSuspicion.RegisterCVars(_configurationManager);
_netManager.RegisterNetMessage<MsgTickerJoinLobby>(nameof(MsgTickerJoinLobby));
_netManager.RegisterNetMessage<MsgTickerJoinGame>(nameof(MsgTickerJoinGame));
_netManager.RegisterNetMessage<MsgTickerLobbyStatus>(nameof(MsgTickerLobbyStatus));
@@ -287,9 +285,9 @@ namespace Content.Server.GameTicking
if (!preset.Start(assignedJobs.Keys.ToList(), force))
{
if (_configurationManager.GetCVar<bool>("game.fallbackenabled"))
if (_configurationManager.GetCVar(CCVars.GameLobbyFallbackEnabled))
{
SetStartPreset(_configurationManager.GetCVar<string>("game.fallbackpreset"));
SetStartPreset(_configurationManager.GetCVar(CCVars.GameLobbyFallbackPreset));
var newPreset = MakeGamePreset(profiles);
_chatManager.DispatchServerAnnouncement(
$"Failed to start {preset.ModeTitle} mode! Defaulting to {newPreset.ModeTitle}...");