2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Chat.Managers;
|
|
|
|
|
using Content.Server.Preferences.Managers;
|
2020-04-09 00:28:56 +02:00
|
|
|
using Content.Shared.Chat;
|
2020-10-14 22:45:53 +02:00
|
|
|
using Content.Shared.GameTicking;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.GameWindow;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Server;
|
|
|
|
|
using Robust.Server.Maps;
|
2020-04-16 21:23:08 +02:00
|
|
|
using Robust.Server.ServerStatus;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Shared.Configuration;
|
2019-04-15 21:11:38 -06:00
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
using Robust.Shared.Map;
|
2020-08-18 14:52:59 +02:00
|
|
|
using Robust.Shared.Network;
|
2019-11-17 11:18:39 -05:00
|
|
|
using Robust.Shared.Prototypes;
|
2019-08-17 21:09:09 +02:00
|
|
|
using Robust.Shared.Random;
|
2021-02-14 15:39:24 +01:00
|
|
|
using Robust.Shared.Reflection;
|
2019-04-15 21:11:38 -06:00
|
|
|
using Robust.Shared.Timing;
|
|
|
|
|
using Robust.Shared.Utility;
|
|
|
|
|
using Robust.Shared.ViewVariables;
|
2018-11-22 10:37:58 +01:00
|
|
|
|
|
|
|
|
namespace Content.Server.GameTicking
|
|
|
|
|
{
|
2021-06-20 10:09:24 +02:00
|
|
|
public partial class GameTicker : SharedGameTicker
|
2018-11-22 10:37:58 +01:00
|
|
|
{
|
2020-01-18 01:54:13 +01:00
|
|
|
[ViewVariables] private bool _initialized;
|
2021-06-20 10:09:24 +02:00
|
|
|
[ViewVariables] private bool _postInitialized;
|
2020-10-14 22:45:53 +02:00
|
|
|
|
2020-10-09 23:47:56 +11:00
|
|
|
[ViewVariables] public MapId DefaultMap { get; private set; }
|
|
|
|
|
[ViewVariables] public GridId DefaultGridId { get; private set; }
|
2020-06-21 22:05:47 +02:00
|
|
|
|
2020-08-21 17:41:50 +02:00
|
|
|
public override void Initialize()
|
2018-11-22 10:37:58 +01:00
|
|
|
{
|
2020-08-21 17:41:50 +02:00
|
|
|
base.Initialize();
|
|
|
|
|
|
2018-11-22 10:37:58 +01:00
|
|
|
DebugTools.Assert(!_initialized);
|
2021-06-20 10:09:24 +02:00
|
|
|
DebugTools.Assert(!_postInitialized);
|
2018-11-22 10:37:58 +01:00
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
// Initialize the other parts of the game ticker.
|
|
|
|
|
InitializeStatusShell();
|
|
|
|
|
InitializeCVars();
|
|
|
|
|
InitializePlayer();
|
|
|
|
|
InitializeLobbyMusic();
|
|
|
|
|
InitializeGamePreset();
|
|
|
|
|
InitializeJobController();
|
|
|
|
|
InitializeUpdates();
|
2018-11-22 10:37:58 +01:00
|
|
|
|
|
|
|
|
_initialized = true;
|
2020-04-16 21:23:08 +02:00
|
|
|
}
|
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
public void PostInitialize()
|
2020-04-16 21:23:08 +02:00
|
|
|
{
|
2021-06-20 10:09:24 +02:00
|
|
|
DebugTools.Assert(_initialized);
|
|
|
|
|
DebugTools.Assert(!_postInitialized);
|
2018-11-25 19:04:49 +01:00
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
// We restart the round now that entities are initialized and prototypes have been loaded.
|
|
|
|
|
RestartRound();
|
2020-05-03 11:25:39 +02:00
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
_postInitialized = true;
|
2018-11-22 10:37:58 +01:00
|
|
|
}
|
|
|
|
|
|
2020-04-09 00:28:56 +02:00
|
|
|
private void SendServerMessage(string message)
|
|
|
|
|
{
|
|
|
|
|
var msg = _netManager.CreateNetMessage<MsgChatMessage>();
|
|
|
|
|
msg.Channel = ChatChannel.Server;
|
|
|
|
|
msg.Message = message;
|
|
|
|
|
IoCManager.Resolve<IServerNetManager>().ServerSendToAll(msg);
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
public override void Update(float frameTime)
|
2020-12-11 01:10:55 +00:00
|
|
|
{
|
2021-06-20 10:09:24 +02:00
|
|
|
base.Update(frameTime);
|
|
|
|
|
UpdateRoundFlow(frameTime);
|
2019-10-18 14:28:39 +02:00
|
|
|
}
|
2020-01-18 01:54:13 +01:00
|
|
|
|
2020-11-21 14:02:00 +01:00
|
|
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
|
|
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
|
|
|
|
[Dependency] private readonly IMapLoader _mapLoader = default!;
|
|
|
|
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
|
|
|
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
|
|
|
|
[Dependency] private readonly IChatManager _chatManager = default!;
|
|
|
|
|
[Dependency] private readonly IServerNetManager _netManager = default!;
|
|
|
|
|
[Dependency] private readonly IDynamicTypeFactory _dynamicTypeFactory = default!;
|
|
|
|
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
2020-08-24 14:10:28 +02:00
|
|
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
|
|
|
|
[Dependency] private readonly IServerPreferencesManager _prefsManager = default!;
|
|
|
|
|
[Dependency] private readonly IBaseServer _baseServer = default!;
|
|
|
|
|
[Dependency] private readonly IWatchdogApi _watchdogApi = default!;
|
2020-10-14 22:45:53 +02:00
|
|
|
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
2021-02-14 15:39:24 +01:00
|
|
|
[Dependency] private readonly IReflectionManager _reflectionManager = default!;
|
2018-11-22 10:37:58 +01:00
|
|
|
}
|
|
|
|
|
}
|