2021-11-26 03:02:46 -06:00
|
|
|
using Content.Server.Administration.Logs;
|
2022-02-21 14:11:39 -08:00
|
|
|
using Content.Server.Administration.Managers;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Chat.Managers;
|
2022-06-23 20:11:03 +10:00
|
|
|
using Content.Server.Chat.Systems;
|
2022-03-04 23:25:41 +01:00
|
|
|
using Content.Server.Database;
|
2021-12-21 21:23:29 +01:00
|
|
|
using Content.Server.Ghost;
|
2021-11-20 12:32:07 -06:00
|
|
|
using Content.Server.Maps;
|
2022-08-07 08:00:42 +02:00
|
|
|
using Content.Server.Players.PlayTimeTracking;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Preferences.Managers;
|
2022-05-30 10:09:50 +02:00
|
|
|
using Content.Server.ServerUpdates;
|
2023-03-22 20:29:55 +11:00
|
|
|
using Content.Server.Shuttles.Systems;
|
2022-05-10 13:43:30 -05:00
|
|
|
using Content.Server.Station.Systems;
|
2020-04-09 00:28:56 +02:00
|
|
|
using Content.Shared.Chat;
|
2021-12-21 21:23:29 +01:00
|
|
|
using Content.Shared.Damage;
|
2020-10-14 22:45:53 +02:00
|
|
|
using Content.Shared.GameTicking;
|
2023-08-30 21:46:11 -07:00
|
|
|
using Content.Shared.Mind;
|
2023-06-21 13:04:07 +12:00
|
|
|
using Content.Shared.Mobs.Systems;
|
2022-05-10 13:43:30 -05:00
|
|
|
using Content.Shared.Roles;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Server;
|
2022-11-13 17:47:48 +11:00
|
|
|
using Robust.Server.GameObjects;
|
2023-08-22 16:55:52 +12:00
|
|
|
using Robust.Server.GameStates;
|
2023-11-27 22:12:34 +11:00
|
|
|
using Robust.Shared.Audio;
|
|
|
|
|
using Robust.Shared.Audio.Systems;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Shared.Configuration;
|
2022-04-25 19:07:14 +02:00
|
|
|
using Robust.Shared.Console;
|
2019-04-15 21:11:38 -06:00
|
|
|
using Robust.Shared.Map;
|
2019-11-17 11:18:39 -05:00
|
|
|
using Robust.Shared.Prototypes;
|
2019-08-17 21:09:09 +02:00
|
|
|
using Robust.Shared.Random;
|
2019-04-15 21:11:38 -06:00
|
|
|
using Robust.Shared.Timing;
|
|
|
|
|
using Robust.Shared.Utility;
|
2023-08-28 16:53:24 -07:00
|
|
|
#if EXCEPTION_TOLERANCE
|
|
|
|
|
using Robust.Shared.Exceptions;
|
|
|
|
|
#endif
|
2018-11-22 10:37:58 +01:00
|
|
|
|
|
|
|
|
namespace Content.Server.GameTicking
|
|
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed partial class GameTicker : SharedGameTicker
|
2018-11-22 10:37:58 +01:00
|
|
|
{
|
2023-08-25 18:50:46 +10:00
|
|
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
|
|
|
|
[Dependency] private readonly IBanManager _banManager = default!;
|
|
|
|
|
[Dependency] private readonly IBaseServer _baseServer = default!;
|
|
|
|
|
[Dependency] private readonly IChatManager _chatManager = default!;
|
|
|
|
|
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
|
|
|
|
[Dependency] private readonly IConsoleHost _consoleHost = default!;
|
|
|
|
|
[Dependency] private readonly IGameMapManager _gameMapManager = default!;
|
|
|
|
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
|
|
|
[Dependency] private readonly ILogManager _logManager = default!;
|
|
|
|
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
|
|
|
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
|
|
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
|
|
|
|
#if EXCEPTION_TOLERANCE
|
|
|
|
|
[Dependency] private readonly IRuntimeLog _runtimeLog = default!;
|
|
|
|
|
#endif
|
|
|
|
|
[Dependency] private readonly IServerPreferencesManager _prefsManager = default!;
|
|
|
|
|
[Dependency] private readonly IServerDbManager _db = default!;
|
2023-03-22 20:29:55 +11:00
|
|
|
[Dependency] private readonly ArrivalsSystem _arrivals = default!;
|
2023-08-25 18:50:46 +10:00
|
|
|
[Dependency] private readonly ChatSystem _chatSystem = default!;
|
|
|
|
|
[Dependency] private readonly DamageableSystem _damageable = default!;
|
2022-11-13 17:47:48 +11:00
|
|
|
[Dependency] private readonly MapLoaderSystem _map = default!;
|
2023-06-21 13:04:07 +12:00
|
|
|
[Dependency] private readonly GhostSystem _ghost = default!;
|
2023-08-30 21:46:11 -07:00
|
|
|
[Dependency] private readonly SharedMindSystem _mind = default!;
|
2023-06-21 13:04:07 +12:00
|
|
|
[Dependency] private readonly MobStateSystem _mobState = default!;
|
2023-08-25 18:50:46 +10:00
|
|
|
[Dependency] private readonly PlayTimeTrackingSystem _playTimeTrackings = default!;
|
2023-08-22 16:55:52 +12:00
|
|
|
[Dependency] private readonly PvsOverrideSystem _pvsOverride = default!;
|
2023-08-25 18:50:46 +10:00
|
|
|
[Dependency] private readonly ServerUpdateManager _serverUpdates = default!;
|
2023-11-27 22:12:34 +11:00
|
|
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
2023-08-25 18:50:46 +10:00
|
|
|
[Dependency] private readonly StationJobsSystem _stationJobs = default!;
|
|
|
|
|
[Dependency] private readonly StationSpawningSystem _stationSpawning = default!;
|
|
|
|
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
|
|
|
|
[Dependency] private readonly UserDbDataManager _userDb = default!;
|
2023-08-28 11:20:31 +02:00
|
|
|
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
2023-08-30 21:46:11 -07:00
|
|
|
[Dependency] private readonly SharedRoleSystem _roles = default!;
|
2023-12-06 23:48:56 +01:00
|
|
|
[Dependency] private readonly ServerDbEntryManager _dbEntryManager = default!;
|
2022-11-13 17:47:48 +11: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; }
|
2020-06-21 22:05:47 +02:00
|
|
|
|
2022-03-05 11:01:51 +01:00
|
|
|
private ISawmill _sawmill = default!;
|
|
|
|
|
|
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
|
|
|
|
2022-03-05 11:01:51 +01:00
|
|
|
_sawmill = _logManager.GetSawmill("ticker");
|
2023-07-23 16:02:23 +02:00
|
|
|
_sawmillReplays = _logManager.GetSawmill("ticker.replays");
|
2022-03-05 11:01:51 +01:00
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
// Initialize the other parts of the game ticker.
|
|
|
|
|
InitializeStatusShell();
|
|
|
|
|
InitializeCVars();
|
|
|
|
|
InitializePlayer();
|
2022-03-13 19:33:19 -07:00
|
|
|
InitializeLobbyBackground();
|
2021-06-20 10:09:24 +02:00
|
|
|
InitializeGamePreset();
|
2022-06-28 15:55:05 +03:00
|
|
|
DebugTools.Assert(_prototypeManager.Index<JobPrototype>(FallbackOverflowJob).Name == FallbackOverflowJobName,
|
2022-05-10 13:43:30 -05:00
|
|
|
"Overflow role does not have the correct name!");
|
2022-04-25 19:07:14 +02:00
|
|
|
InitializeGameRules();
|
2023-07-23 16:02:23 +02:00
|
|
|
InitializeReplays();
|
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.
|
2023-08-06 14:30:28 +12:00
|
|
|
if (!DummyTicker)
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2022-04-25 19:07:14 +02:00
|
|
|
public override void Shutdown()
|
|
|
|
|
{
|
|
|
|
|
base.Shutdown();
|
|
|
|
|
|
|
|
|
|
ShutdownGameRules();
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-09 00:28:56 +02:00
|
|
|
private void SendServerMessage(string message)
|
|
|
|
|
{
|
2023-08-01 17:11:50 -04:00
|
|
|
var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", message));
|
|
|
|
|
_chatManager.ChatMessageToAll(ChatChannel.Server, message, wrappedMessage, default, false, true);
|
2020-04-09 00:28:56 +02:00
|
|
|
}
|
|
|
|
|
|
2021-06-20 10:09:24 +02:00
|
|
|
public override void Update(float frameTime)
|
2020-12-11 01:10:55 +00:00
|
|
|
{
|
2023-08-06 14:30:28 +12:00
|
|
|
if (DummyTicker)
|
|
|
|
|
return;
|
2021-06-20 10:09:24 +02:00
|
|
|
base.Update(frameTime);
|
|
|
|
|
UpdateRoundFlow(frameTime);
|
2019-10-18 14:28:39 +02:00
|
|
|
}
|
2018-11-22 10:37:58 +01:00
|
|
|
}
|
|
|
|
|
}
|