* Partial work on StationSystem refactor. * WIP station jobs API. * forgor to fire off grid events. * Partial implementation of StationSpawningSystem * whoops infinite loop. * Spawners should work now. * it compiles. * tfw * Vestigial code cleanup. * fix station deletion. * attempt to make tests go brr * add latejoin spawnpoints to test maps. * make sure the station still exists while destructing spawners. * forgot an exists check. * destruction order check. * hopefully fix final test. * fail-safe radstorm. * Deep-clean job code further. This is bugged!!!!! * Fix job bug. (init order moment) * whooo cleanup * New job selection algorithm that tries to distribute fairly across stations. * small nitpicks * Give the heads their weights to replace the head field. * make overflow assign take a station list. * moment * Fixes and test #1 of many. * please fix nullspace * AssignJobs should no longer even consider showing up on a trace. * add comment. * Introduce station configs, praying i didn't miss something. * in one small change stations are now fully serializable. * Further doc comments. * whoops. * Solve bug where assignjobs didn't account for roundstart. * Fix spawning, improve the API. Caught an oversight in stationsystem that should've broke everything but didn't, whoops. * Goodbye JobController. * minor fix.. * fix test fail, remove debug logs. * quick serialization fixes. * fixes.. * sus * partialing * Update Content.Server/Station/Systems/StationJobsSystem.Roundstart.cs Co-authored-by: Kara <lunarautomaton6@gmail.com> * Use dirtying to avoid rebuilding the list 2,100 times. * add a bajillion more lines of docs (mostly in AssignJobs so i don't ever forget how it works) * Update Content.IntegrationTests/Tests/Station/StationJobsTest.cs Co-authored-by: Kara <lunarautomaton6@gmail.com> * Add the Mysteriously Missing Captain Check. * Put maprender back the way it belongs. * I love addressing reviews. * Update Content.Server/Station/Systems/StationJobsSystem.cs Co-authored-by: Kara <lunarautomaton6@gmail.com> * doc cleanup. * Fix bureaucratic error, add job slot tests. * zero cost abstractions when * cri * saner error. * Fix spawning failing certain tests due to gameticker not handling falliability correctly. Can't fix this until I refactor the rest of spawning code. * submodule gaming * Packedenger. * Documentation consistency. Co-authored-by: Kara <lunarautomaton6@gmail.com>
126 lines
4.8 KiB
C#
126 lines
4.8 KiB
C#
using Content.Server.Administration.Logs;
|
|
using Content.Server.Administration.Managers;
|
|
using Content.Server.CharacterAppearance.Systems;
|
|
using Content.Server.Chat.Managers;
|
|
using Content.Server.Database;
|
|
using Content.Server.Ghost;
|
|
using Content.Server.Maps;
|
|
using Content.Server.PDA;
|
|
using Content.Server.Preferences.Managers;
|
|
using Content.Server.Station.Systems;
|
|
using Content.Shared.Chat;
|
|
using Content.Shared.Damage;
|
|
using Content.Shared.GameTicking;
|
|
using Content.Shared.Roles;
|
|
using Robust.Server;
|
|
using Robust.Server.Maps;
|
|
using Robust.Server.ServerStatus;
|
|
using Robust.Shared.Configuration;
|
|
using Robust.Shared.Console;
|
|
#if EXCEPTION_TOLERANCE
|
|
using Robust.Shared.Exceptions;
|
|
#endif
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Network;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Random;
|
|
using Robust.Shared.Timing;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Server.GameTicking
|
|
{
|
|
public sealed partial class GameTicker : SharedGameTicker
|
|
{
|
|
[ViewVariables] private bool _initialized;
|
|
[ViewVariables] private bool _postInitialized;
|
|
|
|
[ViewVariables] public MapId DefaultMap { get; private set; }
|
|
|
|
private ISawmill _sawmill = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
DebugTools.Assert(!_initialized);
|
|
DebugTools.Assert(!_postInitialized);
|
|
|
|
_sawmill = _logManager.GetSawmill("ticker");
|
|
|
|
// Initialize the other parts of the game ticker.
|
|
InitializeStatusShell();
|
|
InitializeCVars();
|
|
InitializePlayer();
|
|
InitializeLobbyMusic();
|
|
InitializeLobbyBackground();
|
|
InitializeGamePreset();
|
|
DebugTools.Assert(_prototypeManager.Index<JobPrototype>(FallbackOverflowJob).Name == Loc.GetString(FallbackOverflowJobName),
|
|
"Overflow role does not have the correct name!");
|
|
InitializeGameRules();
|
|
InitializeUpdates();
|
|
|
|
_initialized = true;
|
|
}
|
|
|
|
public void PostInitialize()
|
|
{
|
|
DebugTools.Assert(_initialized);
|
|
DebugTools.Assert(!_postInitialized);
|
|
|
|
// We restart the round now that entities are initialized and prototypes have been loaded.
|
|
RestartRound();
|
|
|
|
_postInitialized = true;
|
|
}
|
|
|
|
public override void Shutdown()
|
|
{
|
|
base.Shutdown();
|
|
|
|
ShutdownGameRules();
|
|
}
|
|
|
|
private void SendServerMessage(string message)
|
|
{
|
|
var msg = new MsgChatMessage();
|
|
msg.Channel = ChatChannel.Server;
|
|
msg.Message = message;
|
|
IoCManager.Resolve<IServerNetManager>().ServerSendToAll(msg);
|
|
}
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
UpdateRoundFlow(frameTime);
|
|
}
|
|
|
|
[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 IPrototypeManager _prototypeManager = default!;
|
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
|
[Dependency] private readonly IServerPreferencesManager _prefsManager = default!;
|
|
[Dependency] private readonly IBaseServer _baseServer = default!;
|
|
[Dependency] private readonly IWatchdogApi _watchdogApi = default!;
|
|
[Dependency] private readonly IGameMapManager _gameMapManager = default!;
|
|
[Dependency] private readonly IServerDbManager _db = default!;
|
|
[Dependency] private readonly ILogManager _logManager = default!;
|
|
[Dependency] private readonly IConsoleHost _consoleHost = default!;
|
|
#if EXCEPTION_TOLERANCE
|
|
[Dependency] private readonly IRuntimeLog _runtimeLog = default!;
|
|
#endif
|
|
[Dependency] private readonly StationSystem _stationSystem = default!;
|
|
[Dependency] private readonly StationSpawningSystem _stationSpawning = default!;
|
|
[Dependency] private readonly StationJobsSystem _stationJobs = default!;
|
|
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!;
|
|
[Dependency] private readonly HumanoidAppearanceSystem _humanoidAppearanceSystem = default!;
|
|
[Dependency] private readonly PDASystem _pdaSystem = default!;
|
|
[Dependency] private readonly DamageableSystem _damageable = default!;
|
|
[Dependency] private readonly GhostSystem _ghosts = default!;
|
|
[Dependency] private readonly RoleBanManager _roleBanManager = default!;
|
|
}
|
|
}
|