Move GameTicker to Shared (#45834)

* Scope creep my ass

* why was this shit not pushed????

* gone...

* fix that

* review plus buildd

* asfsafsafsafsafas

* grug

* burber

* I'll fix this later

* shrimply die

* also this

* it's snerf or snuthin

* assaads

* round snend

* aaaa

* fix this shit for real

* actually, don't start GameRules until MapInit now that I think aboot it.

* forgot u

* don't actually need this part nullable

* Deffer comp removal

* one liner

* do that too

* chungus

* Honestly makes more sense here, plus WHY are we doing all that shit on "GameRuleAdded" rather than GameRuleStarted(?)

* deferred removal :V

* aaaaaaaaaaaaaaa

* whhop

* Whoop

* better

* landmine that I placed for myself then forgot about lmao

* cleanup

* FUCKING `!`

* gotovo

* amogus

* please don't check by metadata I beg

* waawsasfdfsasfa

* sfafsasfafsas

* fdsaasffsasfa

* code

* fix

* fasasffasfasfsad

* chungaas

* I may be stupid

* gra

* graaaaaaaaaaaaaaaaa

* comment

* gra

* clearing is not predicted and would require major refactors, so don't cache on client.

* lame shit :P

* last holes

* nukeopsfsafsasafsfafsa

* why  was that shit public bruh

* bubrbgwahrghfaka

* dynamic

* revert change that did nothing lmao
This commit is contained in:
Princess Cheeseballs 2026-09-16 19:34:19 +00:00 • committed by GitHub
parent 687367e7bd
commit 2c6ffecf62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
354 changed files with 6188 additions and 5201 deletions

View file

@ -3,8 +3,8 @@ using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using Content.IntegrationTests;
using Content.IntegrationTests.Pair;
using Content.Server.Station.Systems;
using Content.Shared.Roles;
using Content.Shared.Station.Systems;
using Robust.Shared;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;

View file

@ -1,6 +1,6 @@
using Content.Client.Administration.Managers;
using Content.Client.Station;
using Content.Client.UserInterface.Controls;
using Content.Shared.Station.Systems;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.Graphics;
@ -79,7 +79,7 @@ public sealed partial class ObjectsTab : Control
// teleport to the station's largest grid, not to the station entity (which is in nullspace)
if (!_entityManager.TryGetEntity(nent, out var station))
break;
var largestGrid = _entityManager.EntitySysManager.GetEntitySystem<StationSystem>().GetLargestGrid(station.Value);
var largestGrid = _entityManager.System<StationSystem>().GetLargestGrid(station.Value);
if (largestGrid == null)
break;
_console.ExecuteCommand($"tpto {largestGrid.Value}");
@ -107,7 +107,7 @@ public sealed partial class ObjectsTab : Control
switch (selection)
{
case ObjectsTabSelection.Stations:
entities.AddRange(_entityManager.EntitySysManager.GetEntitySystem<StationSystem>().GetStationNames());
entities.AddRange(_entityManager.System<StationSystem>().GetStationNames());
break;
case ObjectsTabSelection.Grids:
{

View file

@ -0,0 +1,32 @@
using Content.Shared.Antag;
using Content.Shared.Antag.Components;
using Content.Shared.Roles;
using Robust.Shared.Audio;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
namespace Content.Client.Antag;
/// <inheritdoc/>
public sealed partial class ClientAntagSelectionSystem : AntagSelectionSystem
{
public override void SendBriefing(ICommonSession? session, string briefing, Color? briefingColor, SoundSpecifier? briefingSound)
{
}
public override IEnumerable<ProtoId<AntagPrototype>> GetValidAntagPreferences(ICommonSession session, List<ProtoId<AntagPrototype>>? filter = null)
{
yield break;
}
public override bool IsAntagBanned(ICommonSession session, AntagSpecifierPrototype definition)
{
return false;
}
protected override Entity<AntagSelectionComponent>? ForceGetGameRuleEnt<T>(string id)
{
return null;
}
}

View file

@ -1,4 +1,5 @@
using System.Linq;
using Content.Client.GameTicking;
using Content.Client.GameTicking.Managers;
using Content.Client.Lobby;
using Content.Shared.Audio.Events;

View file

@ -2,7 +2,7 @@ using Content.Shared.CCVar;
using Content.Shared.Chat;
using Content.Shared.AlertLevel;
using Content.Shared.Communications;
using Content.Shared.Station;
using Content.Shared.Station.Systems;
using Robust.Client.UserInterface;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
@ -18,7 +18,7 @@ namespace Content.Client.Communications.UI;
public sealed partial class CommunicationsConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : BoundUserInterface(owner, uiKey)
{
[Dependency] private IConfigurationManager _cfg = default!;
[Dependency] private SharedStationSystem _station = default!;
[Dependency] private StationSystem _station = default!;
[Dependency] private AlertLevelSystem _alertLevel = default!;
[ViewVariables]

View file

@ -128,8 +128,6 @@ namespace Content.Client.Entry
_prototypeManager.RegisterIgnore("alertLevels");
_prototypeManager.RegisterIgnore("nukeopsRole");
_prototypeManager.RegisterIgnore("ghostRoleRaffleDecider");
_prototypeManager.RegisterIgnore("codewordGenerator");
_prototypeManager.RegisterIgnore("codewordFaction");
_componentFactory.GenerateNetIds();
_adminManager.Initialize();

View file

@ -0,0 +1,190 @@
using System.Numerics;
using Content.Client.Administration.Managers;
using Content.Client.Gameplay;
using Content.Client.Lobby;
using Content.Client.RoundEnd;
using Content.Shared.GameTicking;
using Content.Shared.GameTicking.Prototypes;
using Content.Shared.GameWindow;
using Content.Shared.Maps;
using Content.Shared.Roles;
using JetBrains.Annotations;
using Robust.Client.Graphics;
using Robust.Client.State;
using Robust.Client.UserInterface;
using Robust.Shared.Audio;
using Robust.Shared.EntitySerialization;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
namespace Content.Client.GameTicking;
[UsedImplicitly]
public sealed partial class ClientGameTicker : GameTicker
{
[Dependency] private IStateManager _stateManager = default!;
[Dependency] private IClientAdminManager _admin = default!;
[Dependency] private IClyde _clyde = default!;
[Dependency] private IUserInterfaceManager _userInterfaceManager = default!;
private Dictionary<NetEntity, Dictionary<ProtoId<JobPrototype>, int?>> _jobsAvailable = new();
private Dictionary<NetEntity, string> _stationNames = new();
private Dictionary<NetEntity, ProtoId<JobWeightPrototype>?> _jobWeightsByStation = new();
[ViewVariables] public bool AreWeReady { get; private set; }
[ViewVariables] public bool IsGameStarted { get; private set; }
[ViewVariables] public ResolvedSoundSpecifier? RestartSound { get; private set; }
[ViewVariables] public ProtoId<LobbyBackgroundPrototype>? LobbyBackground { get; private set; }
[ViewVariables] public bool DisallowedLateJoin { get; private set; }
[ViewVariables] public string? ServerInfoBlob { get; private set; }
[ViewVariables] public TimeSpan StartTime { get; private set; }
[ViewVariables] public new bool Paused { get; private set; }
[ViewVariables] public IReadOnlyDictionary<NetEntity, Dictionary<ProtoId<JobPrototype>, int?>> JobsAvailable => _jobsAvailable;
[ViewVariables] public IReadOnlyDictionary<NetEntity, string> StationNames => _stationNames;
[ViewVariables] public IReadOnlyDictionary<NetEntity, ProtoId<JobWeightPrototype>?> JobWeightsByStation => _jobWeightsByStation;
public event Action? InfoBlobUpdated;
public event Action? LobbyStatusUpdated;
public event Action? LobbyLateJoinStatusUpdated;
public event Action<IReadOnlyDictionary<NetEntity, Dictionary<ProtoId<JobPrototype>, int?>>>? LobbyJobsAvailableUpdated;
public override void Initialize()
{
base.Initialize();
_admin.AdminStatusUpdated += OnAdminUpdated;
OnAdminUpdated();
}
public override void Shutdown()
{
_admin.AdminStatusUpdated -= OnAdminUpdated;
base.Shutdown();
}
public override IReadOnlyList<EntityUid> LoadGameMap(GameMapPrototype proto,
out MapId mapId,
DeserializationOptions? options = null,
string? stationName = null,
Vector2? offset = null,
Angle? rot = null)
{
throw new NotImplementedException();
}
public override int ReadyPlayerCount()
{
throw new NotImplementedException();
}
public override void PlayerJoinGame(ICommonSession session, bool silent = false)
{
// TODO: Can probably move some logic into here :P
}
private void OnAdminUpdated()
{
// TODO: We REALLY should not be logging parent changed events for parents the client cannot see :V
// Hide some map/grid related logs from clients. This is to try prevent some easy metagaming by just
// reading the console. E.g., logs like this one could leak the nuke station/grid:
// > Grid NT-Arrivals 1101 (122/n25896) changed parent. Old parent: map 10 (121/n25895). New parent: FTL (123/n26470)
#if !DEBUG
Map.Log.Level = _admin.IsAdmin() ? LogLevel.Info : LogLevel.Warning;
#endif
}
[SubscribeNetworkEvent]
private void OnAttentionRequest(RequestWindowAttentionEvent ev)
{
_clyde.RequestWindowAttention();
}
[SubscribeNetworkEvent]
private void LateJoinStatus(TickerLateJoinStatusEvent message)
{
DisallowedLateJoin = message.Disallowed;
LobbyLateJoinStatusUpdated?.Invoke();
}
[SubscribeNetworkEvent]
private void UpdateJobsAvailable(TickerJobsAvailableEvent message)
{
_jobsAvailable.Clear();
foreach (var (job, data) in message.JobsAvailableByStation)
{
_jobsAvailable[job] = data;
}
_stationNames.Clear();
foreach (var weh in message.StationNames)
{
_stationNames[weh.Key] = weh.Value;
}
_jobWeightsByStation.Clear();
foreach (var (station, jobWeights) in message.JobWeightsByStation)
{
_jobWeightsByStation[station] = jobWeights;
}
LobbyJobsAvailableUpdated?.Invoke(JobsAvailable);
}
[SubscribeNetworkEvent]
private void JoinLobby(TickerJoinLobbyEvent message)
{
_stateManager.RequestStateChange<LobbyState>();
}
[SubscribeNetworkEvent]
private void ConnectionStatus(TickerConnectionStatusEvent message)
{
RoundStartTimeSpan = message.RoundStartTimeSpan;
}
[SubscribeNetworkEvent]
private void LobbyStatus(TickerLobbyStatusEvent message)
{
StartTime = message.StartTime;
RoundStartTimeSpan = message.RoundStartTimeSpan;
IsGameStarted = message.IsRoundStarted;
AreWeReady = message.YouAreReady;
LobbyBackground = message.LobbyBackground;
Paused = message.Paused;
LobbyStatusUpdated?.Invoke();
}
[SubscribeNetworkEvent]
private void LobbyInfo(TickerLobbyInfoEvent message)
{
ServerInfoBlob = message.TextBlob;
InfoBlobUpdated?.Invoke();
}
[SubscribeNetworkEvent]
private void JoinGame(TickerJoinGameEvent message)
{
_stateManager.RequestStateChange<GameplayState>();
}
[SubscribeNetworkEvent]
private void LobbyCountdown(TickerLobbyCountdownEvent message)
{
StartTime = message.StartTime;
Paused = message.Paused;
}
[SubscribeNetworkEvent]
private void RoundEnd(RoundEndMessageEvent message)
{
// Force an update in the event of this song being the same as the last.
RestartSound = message.RestartSound;
_userInterfaceManager.GetUIController<RoundEndSummaryUIController>().OpenRoundEndSummaryWindow(message);
}
}

View file

@ -1,168 +0,0 @@
using Content.Client.Administration.Managers;
using Content.Client.Gameplay;
using Content.Client.Lobby;
using Content.Client.RoundEnd;
using Content.Shared.GameTicking;
using Content.Shared.GameWindow;
using Content.Shared.Roles;
using JetBrains.Annotations;
using Robust.Client.Graphics;
using Robust.Client.State;
using Robust.Client.UserInterface;
using Robust.Shared.Prototypes;
using Robust.Shared.Audio;
using Content.Shared.GameTicking.Prototypes;
namespace Content.Client.GameTicking.Managers
{
[UsedImplicitly]
public sealed partial class ClientGameTicker : SharedGameTicker
{
[Dependency] private IStateManager _stateManager = default!;
[Dependency] private IClientAdminManager _admin = default!;
[Dependency] private IClyde _clyde = default!;
[Dependency] private IUserInterfaceManager _userInterfaceManager = default!;
private Dictionary<NetEntity, Dictionary<ProtoId<JobPrototype>, int?>> _jobsAvailable = new();
private Dictionary<NetEntity, string> _stationNames = new();
private Dictionary<NetEntity, ProtoId<JobWeightPrototype>?> _jobWeightsByStation = new();
[ViewVariables] public bool AreWeReady { get; private set; }
[ViewVariables] public bool IsGameStarted { get; private set; }
[ViewVariables] public ResolvedSoundSpecifier? RestartSound { get; private set; }
[ViewVariables] public ProtoId<LobbyBackgroundPrototype>? LobbyBackground { get; private set; }
[ViewVariables] public bool DisallowedLateJoin { get; private set; }
[ViewVariables] public string? ServerInfoBlob { get; private set; }
[ViewVariables] public TimeSpan StartTime { get; private set; }
[ViewVariables] public new bool Paused { get; private set; }
public override IReadOnlyList<(TimeSpan, string)> AllPreviousGameRules => new List<(TimeSpan, string)>();
[ViewVariables] public IReadOnlyDictionary<NetEntity, Dictionary<ProtoId<JobPrototype>, int?>> JobsAvailable => _jobsAvailable;
[ViewVariables] public IReadOnlyDictionary<NetEntity, string> StationNames => _stationNames;
[ViewVariables] public IReadOnlyDictionary<NetEntity, ProtoId<JobWeightPrototype>?> JobWeightsByStation => _jobWeightsByStation;
public event Action? InfoBlobUpdated;
public event Action? LobbyStatusUpdated;
public event Action? LobbyLateJoinStatusUpdated;
public event Action<IReadOnlyDictionary<NetEntity, Dictionary<ProtoId<JobPrototype>, int?>>>? LobbyJobsAvailableUpdated;
public override void Initialize()
{
base.Initialize();
SubscribeNetworkEvent<TickerJoinLobbyEvent>(JoinLobby);
SubscribeNetworkEvent<TickerJoinGameEvent>(JoinGame);
SubscribeNetworkEvent<TickerConnectionStatusEvent>(ConnectionStatus);
SubscribeNetworkEvent<TickerLobbyStatusEvent>(LobbyStatus);
SubscribeNetworkEvent<TickerLobbyInfoEvent>(LobbyInfo);
SubscribeNetworkEvent<TickerLobbyCountdownEvent>(LobbyCountdown);
SubscribeNetworkEvent<RoundEndMessageEvent>(RoundEnd);
SubscribeNetworkEvent<RequestWindowAttentionEvent>(OnAttentionRequest);
SubscribeNetworkEvent<TickerLateJoinStatusEvent>(LateJoinStatus);
SubscribeNetworkEvent<TickerJobsAvailableEvent>(UpdateJobsAvailable);
_admin.AdminStatusUpdated += OnAdminUpdated;
OnAdminUpdated();
}
public override void Shutdown()
{
_admin.AdminStatusUpdated -= OnAdminUpdated;
base.Shutdown();
}
private void OnAdminUpdated()
{
// Hide some map/grid related logs from clients. This is to try prevent some easy metagaming by just
// reading the console. E.g., logs like this one could leak the nuke station/grid:
// > Grid NT-Arrivals 1101 (122/n25896) changed parent. Old parent: map 10 (121/n25895). New parent: FTL (123/n26470)
#if !DEBUG
EntityManager.System<SharedMapSystem>().Log.Level = _admin.IsAdmin() ? LogLevel.Info : LogLevel.Warning;
#endif
}
private void OnAttentionRequest(RequestWindowAttentionEvent ev)
{
_clyde.RequestWindowAttention();
}
private void LateJoinStatus(TickerLateJoinStatusEvent message)
{
DisallowedLateJoin = message.Disallowed;
LobbyLateJoinStatusUpdated?.Invoke();
}
private void UpdateJobsAvailable(TickerJobsAvailableEvent message)
{
_jobsAvailable.Clear();
foreach (var (job, data) in message.JobsAvailableByStation)
{
_jobsAvailable[job] = data;
}
_stationNames.Clear();
foreach (var weh in message.StationNames)
{
_stationNames[weh.Key] = weh.Value;
}
_jobWeightsByStation.Clear();
foreach (var (station, jobWeights) in message.JobWeightsByStation)
{
_jobWeightsByStation[station] = jobWeights;
}
LobbyJobsAvailableUpdated?.Invoke(JobsAvailable);
}
private void JoinLobby(TickerJoinLobbyEvent message)
{
_stateManager.RequestStateChange<LobbyState>();
}
private void ConnectionStatus(TickerConnectionStatusEvent message)
{
RoundStartTimeSpan = message.RoundStartTimeSpan;
}
private void LobbyStatus(TickerLobbyStatusEvent message)
{
StartTime = message.StartTime;
RoundStartTimeSpan = message.RoundStartTimeSpan;
IsGameStarted = message.IsRoundStarted;
AreWeReady = message.YouAreReady;
LobbyBackground = message.LobbyBackground;
Paused = message.Paused;
LobbyStatusUpdated?.Invoke();
}
private void LobbyInfo(TickerLobbyInfoEvent message)
{
ServerInfoBlob = message.TextBlob;
InfoBlobUpdated?.Invoke();
}
private void JoinGame(TickerJoinGameEvent message)
{
_stateManager.RequestStateChange<GameplayState>();
}
private void LobbyCountdown(TickerLobbyCountdownEvent message)
{
StartTime = message.StartTime;
Paused = message.Paused;
}
private void RoundEnd(RoundEndMessageEvent message)
{
// Force an update in the event of this song being the same as the last.
RestartSound = message.RestartSound;
_userInterfaceManager.GetUIController<RoundEndSummaryUIController>().OpenRoundEndSummaryWindow(message);
}
}
}

View file

@ -1,14 +1,13 @@
using System.Linq;
using System.Numerics;
using Content.Client.CrewManifest;
using Content.Client.GameTicking.Managers;
using Content.Client.GameTicking;
using Content.Client.Lobby;
using Content.Client.UserInterface.Controls;
using Content.Client.Players.PlayTimeTracking;
using Content.Shared.CCVar;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Content.Shared.StatusIcon;
using Robust.Client.Console;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;

View file

@ -1,6 +1,6 @@
using System.Diagnostics.Contracts;
using System.Numerics;
using Content.Client.GameTicking.Managers;
using Content.Shared.GameTicking;
using Content.Shared.Light.Components;
using Content.Shared.Light.EntitySystems;
using Robust.Shared.Timing;
@ -10,7 +10,7 @@ namespace Content.Client.Light.EntitySystems;
public sealed partial class SunShadowSystem : SharedSunShadowSystem
{
[Dependency] private ClientGameTicker _ticker = default!;
[Dependency] private GameTicker _ticker = default!;
[Dependency] private IGameTiming _timing = default!;
[Dependency] private MetaDataSystem _metadata = default!;

View file

@ -1,5 +1,4 @@
using Content.Client.GameTicking.Managers;
using Content.Shared;
using Content.Shared.GameTicking;
using Content.Shared.Light.Components;
using Content.Shared.Light.EntitySystems;
using Robust.Shared.Map.Components;
@ -10,7 +9,7 @@ namespace Content.Client.Light;
/// <inheritdoc/>
public sealed partial class LightCycleSystem : SharedLightCycleSystem
{
[Dependency] private ClientGameTicker _ticker = default!;
[Dependency] private GameTicker _ticker = default!;
[Dependency] private IGameTiming _timing = default!;
[Dependency] private MetaDataSystem _metadata = default!;

View file

@ -1,5 +1,5 @@
using Content.Client.Audio;
using Content.Client.GameTicking.Managers;
using Content.Client.GameTicking;
using Content.Client.LateJoin;
using Content.Client.Lobby.UI;
using Content.Client.Message;

View file

@ -265,7 +265,7 @@ namespace Content.Client.Lobby.UI
(int)PreferenceUnavailableMode.StayInLobby);
PreferenceUnavailableButton.AddItem(
Loc.GetString("humanoid-profile-editor-preference-unavailable-spawn-as-overflow-button",
("overflowJob", Loc.GetString(SharedGameTicker.FallbackOverflowJobName))),
("overflowJob", Loc.GetString(GameTicker.FallbackOverflowJobName))),
(int)PreferenceUnavailableMode.SpawnAsOverflow);
PreferenceUnavailableButton.OnItemSelected += args =>

View file

@ -1,15 +1,12 @@
using System.Linq;
using Content.Client.Humanoid;
using Content.Client.Station;
using Content.Shared.Body;
using Content.Shared.Clothing;
using Content.Shared.GameTicking;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Inventory;
using Content.Shared.Preferences;
using Content.Shared.Preferences.Loadouts;
using Content.Shared.Roles;
using Content.Shared.Station.Systems;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
@ -80,7 +77,7 @@ public sealed partial class ProfilePreviewSpriteView
{
var highPriorityJob = profile.JobPriorities.FirstOrDefault(p => p.Value == JobPriority.High).Key;
// ReSharper disable once NullCoalescingConditionIsAlwaysNotNullAccordingToAPIContract (what is resharper smoking?)
return _prototypeManager.Index<JobPrototype>(highPriorityJob.Id ?? SharedGameTicker.FallbackOverflowJob);
return _prototypeManager.Index<JobPrototype>(highPriorityJob.Id ?? GameTicker.FallbackOverflowJob);
}
private void GiveDummyLoadout(RoleLoadout? roleLoadout)

View file

@ -1,9 +1,9 @@
using Content.Client.GameTicking.Managers;
using Content.Shared.PDA;
using Robust.Shared.Utility;
using Content.Shared.CartridgeLoader;
using Content.Client.Message;
using Content.Shared.AlertLevel;
using Content.Shared.GameTicking;
using Robust.Client.UserInterface;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
@ -20,7 +20,7 @@ namespace Content.Client.PDA
[Dependency] private IGameTiming _gameTiming = default!;
[Dependency] private IEntitySystemManager _entitySystem = default!;
private readonly AlertLevelSystem _alert = default!;
private readonly ClientGameTicker _gameTicker;
private readonly GameTicker _gameTicker;
public const int HomeView = 0;
public const int ProgramListView = 1;
@ -45,7 +45,7 @@ namespace Content.Client.PDA
{
IoCManager.InjectDependencies(this);
_alert = _entitySystem.GetEntitySystem<AlertLevelSystem>();
_gameTicker = _entitySystem.GetEntitySystem<ClientGameTicker>();
_gameTicker = _entitySystem.GetEntitySystem<GameTicker>();
RobustXamlLoader.Load(this);
ViewContainer.OnChildAdded += control => control.Visible = false;

View file

@ -1,4 +1,4 @@
using Content.Client.GameTicking.Managers;
using Content.Client.GameTicking;
using Content.Shared.GameTicking;
using Content.Shared.Input;
using JetBrains.Annotations;

View file

@ -0,0 +1,6 @@
using Content.Shared.Shuttles.Systems;
namespace Content.Client.Shuttles;
/// <inheritdoc/>
public sealed partial class ClientArrivalsSystem : ArrivalsSystem;

View file

@ -0,0 +1,6 @@
using Content.Shared.Station.Systems;
namespace Content.Client.Station;
/// <inheritdoc/>
public sealed partial class ClientStationSystem : StationSystem;

View file

@ -1,5 +0,0 @@
using Content.Shared.Station;
namespace Content.Client.Station;
public sealed partial class StationSpawningSystem : SharedStationSpawningSystem;

View file

@ -1,6 +0,0 @@
using Content.Shared.Station;
namespace Content.Client.Station;
/// <inheritdoc/>
public sealed partial class StationSystem : SharedStationSystem;

View file

@ -1,4 +1,4 @@
using Content.Shared.Station;
using Content.Shared.Station.Systems;
using Content.Shared.StationRecords;
using Content.Shared.StationRecords.Components;
using Content.Shared.StationRecords.Systems;
@ -11,7 +11,7 @@ public sealed partial class GeneralStationRecordConsoleBoundUserInterface : Boun
[ViewVariables]
private GeneralStationRecordConsoleWindow? _window;
[Dependency] private SharedStationSystem _stationSys = default!;
[Dependency] private StationSystem _stationSys = default!;
[Dependency] private StationRecordsSystem _recordsSys = default!;
public GeneralStationRecordConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)

View file

@ -1,4 +1,4 @@
using Content.Client.GameTicking.Managers;
using Content.Shared.GameTicking;
using Content.Shared.Store;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
@ -15,7 +15,7 @@ public sealed partial class StoreListingControl : Control
[Dependency] private IPrototypeManager _prototype = default!;
[Dependency] private IEntityManager _entity = default!;
[Dependency] private IGameTiming _timing = default!;
private readonly ClientGameTicker _ticker;
private readonly GameTicker _ticker;
private readonly ListingDataWithCostModifiers _data;
@ -27,7 +27,7 @@ public sealed partial class StoreListingControl : Control
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);
_ticker = _entity.System<ClientGameTicker>();
_ticker = _entity.System<GameTicker>();
_data = data;
_hasBalance = hasBalance;

View file

@ -35,7 +35,7 @@ public sealed partial class TestPair
protected override async Task Recycle(PairSettings next, TextWriter testOut)
{
// Move to pre-round lobby. Required to toggle dummy ticker on and off
var gameTicker = Server.System<GameTicker>();
var gameTicker = Server.System<ServerGameTicker>();
if (gameTicker.RunLevel != GameRunLevel.PreRoundLobby)
{
await testOut.WriteLineAsync($"Recycling: {Watch.Elapsed.TotalMilliseconds} ms: Restarting round.");
@ -68,7 +68,7 @@ public sealed partial class TestPair
Assert.That(cfg.GetCVar(CCVars.GameLobbyEnabled), Is.EqualTo(settings.InLobby));
Assert.That(cfg.GetCVar(CCVars.GameDummyTicker), Is.EqualTo(settings.DummyTicker));
var ticker = Server.System<GameTicker>();
var ticker = Server.System<ServerGameTicker>();
Assert.That(ticker.DummyTicker, Is.EqualTo(settings.DummyTicker));
var expectPreRound = settings.InLobby | settings.DummyTicker;

View file

@ -40,7 +40,7 @@ public sealed partial class TestPair : RobustIntegrationTest.TestPair
var settings = (PoolSettings)Settings;
if (!settings.DummyTicker)
{
var gameTicker = Server.System<GameTicker>();
var gameTicker = Server.System<ServerGameTicker>();
await Server.WaitPost(() => gameTicker.RestartRound());
}
}

View file

@ -25,7 +25,7 @@ public sealed class AddTests : GameTest
[SidedDependency(Side.Server)] private readonly IAdminLogManager _sAdminLogManager = null!;
[SidedDependency(Side.Server)] private readonly IServerDbManager _sDbManager = null!;
[SidedDependency(Side.Server)] private readonly GameTicker _sGameTicker = null!;
[SidedDependency(Side.Server)] private readonly ServerGameTicker _sGameTicker = null!;
[SidedDependency(Side.Server)] private readonly IPlayerManager _sPlayerManager = null!;
[Test]
@ -238,7 +238,7 @@ public sealed class PreRoundAddTests : GameTest
[SidedDependency(Side.Server)] private readonly IAdminLogManager _sAdminLogManager = null!;
[SidedDependency(Side.Server)] private readonly IServerDbManager _sDbManager = null!;
[SidedDependency(Side.Server)] private readonly GameTicker _sGameTicker = null!;
[SidedDependency(Side.Server)] private readonly ServerGameTicker _sGameTicker = null!;
[Test]
public async Task PreRoundAddAndGetSingle()

View file

@ -31,7 +31,7 @@ public sealed class QueryTests : GameTest
var sPlayers = server.ResolveDependency<IPlayerManager>();
var sAdminLogSystem = server.ResolveDependency<IAdminLogManager>();
var sGamerTicker = sSystems.GetEntitySystem<GameTicker>();
var sGamerTicker = sSystems.GetEntitySystem<ServerGameTicker>();
var date = DateTime.UtcNow;
var guid = Guid.NewGuid();

View file

@ -2,6 +2,7 @@ using Content.IntegrationTests.Fixtures;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Commands;
using Content.Shared.CCVar;
using Content.Shared.GameTicking;
using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
@ -29,7 +30,7 @@ namespace Content.IntegrationTests.Tests.Commands
var configManager = server.ResolveDependency<IConfigurationManager>();
var entityManager = server.ResolveDependency<IEntityManager>();
var gameTicker = entityManager.System<GameTicker>();
var gameTicker = entityManager.System<ServerGameTicker>();
await pair.RunUntilSynced();

View file

@ -21,7 +21,7 @@ namespace Content.IntegrationTests.Tests
[TestOf(typeof(EntityUid))]
public sealed class EntityTest : GameTest
{
private static readonly HashSet<ProtoId<EntityCategoryPrototype>> IgnoredCategories = ["Spawner", "Debug"];
private static readonly HashSet<ProtoId<EntityCategoryPrototype>> IgnoredCategories = ["Spawner", "Debug", "GameRules"];
public override PoolSettings PoolSettings => new()
{
@ -413,6 +413,7 @@ namespace Content.IntegrationTests.Tests
"Broadphase",
"StationData", // errors when removed mid-round
"StationJobs",
"ActiveGameRule", // Requires GameRule :P
"Actor", // We aren't testing actor components, those need their player session set.
"BiomeSelection", // Whaddya know, requires config.
"ActivatableUI", // Requires enum key

View file

@ -33,11 +33,11 @@ public sealed class FollowerSystemTest : GameTest
mapSys.CreateMap(out var map);
// Spawn an observer to be followed.
var followed = entMan.SpawnEntity(GameTicker.ObserverPrototypeName, new MapCoordinates(0, 0, map));
var followed = entMan.SpawnEntity(ServerGameTicker.ObserverPrototypeName, new MapCoordinates(0, 0, map));
logger.Info($"Spawned followed observer: {entMan.ToPrettyString(followed)}");
// Spawn an observer to follow another observer.
var follower = entMan.SpawnEntity(GameTicker.ObserverPrototypeName, new MapCoordinates(0, 0, map));
var follower = entMan.SpawnEntity(ServerGameTicker.ObserverPrototypeName, new MapCoordinates(0, 0, map));
logger.Info($"Spawned follower observer: {entMan.ToPrettyString(follower)}");
followerSystem.StartFollowingEntity(follower, followed);

View file

@ -2,14 +2,13 @@
using System.Linq;
using Content.IntegrationTests.Fixtures.Attributes;
using Content.IntegrationTests.Utility;
using Content.Server.Antag;
using Content.Server.Antag.Components;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Presets;
using Content.Server.Shuttles.Components;
using Content.Shared.Antag;
using Content.Shared.Antag.Components;
using Content.Shared.CCVar;
using Content.Shared.GameTicking;
using Content.Shared.GameTicking.Prototypes;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
@ -28,7 +27,7 @@ public sealed class AllGamePresetsStartTest : AntagTest
// Tests that all game modes can start given ideal circumstances.
[Test]
[TestOf(typeof(GameTicker)), TestOf(typeof(AntagSelectionSystem)), TestOf(typeof(AntagSelectionComponent))]
[TestOf(typeof(ServerGameTicker)), TestOf(typeof(AntagSelectionSystem)), TestOf(typeof(AntagSelectionComponent))]
[TestCaseSource(nameof(_gamePresets))]
[Description("Ensures all Game Presets are able to start and assign all antags correctly without spawning anyone in nullspace.")]
[EnsureCVar(Side.Server, typeof(CCVars), nameof(CCVars.GameTickerIgnoredPresets), GameTicker.DummyGameRule)]

View file

@ -2,12 +2,11 @@
using System.Collections.Generic;
using Content.IntegrationTests.Fixtures.Attributes;
using Content.IntegrationTests.Utility;
using Content.Server.Antag;
using Content.Server.Antag.Components;
using Content.Server.GameTicking;
using Content.Server.Ghost.Roles;
using Content.Server.Ghost.Roles.Components;
using Content.Shared.Antag;
using Content.Shared.Antag.Components;
using Content.Shared.Players;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
@ -33,7 +32,7 @@ public sealed partial class AntagGhostRoleTest : AntagTest
private static readonly string[] AntagGameRules = GameDataScrounger.EntitiesWithComponent("AntagSelection");
[Test]
[TestOf(typeof(GameTicker)), TestOf(typeof(AntagSelectionSystem)), TestOf(typeof(AntagSelectionComponent)), TestOf(typeof(GhostRoleSystem))]
[TestOf(typeof(ServerGameTicker)), TestOf(typeof(AntagSelectionSystem)), TestOf(typeof(AntagSelectionComponent)), TestOf(typeof(GhostRoleSystem))]
[TestCaseSource(nameof(AntagGameRules))]
[Description($"Ensures all GameRule entities with {nameof(AntagSelectionComponent)} can properly spawn those roles and they can be taken.")]
[RunOnSide(Side.Server)]
@ -64,7 +63,7 @@ public sealed partial class AntagGhostRoleTest : AntagTest
while (roleEnumerator.MoveNext(out var spawner, out var role, out var xform))
{
// Ensure the ghost role spawner spawned correctly!
Assert.That(spawner.Rule, Is.EqualTo(gameRule));
Assert.That(spawner.Rule, Is.EqualTo(gameRule?.Owner));
Assert.That(spawner.Definition, Is.Not.Null);
AssertGhostRoleTaken(spawner, role, xform);
var value = rules[spawner.Definition.Value];
@ -80,7 +79,7 @@ public sealed partial class AntagGhostRoleTest : AntagTest
}
[Test]
[TestOf(typeof(GameTicker)), TestOf(typeof(AntagSelectionSystem)), TestOf(typeof(AntagSelectionComponent)), TestOf(typeof(GhostRoleSystem))]
[TestOf(typeof(ServerGameTicker)), TestOf(typeof(AntagSelectionSystem)), TestOf(typeof(AntagSelectionComponent)), TestOf(typeof(GhostRoleSystem))]
[Description("Ensures a player can take all antag ghost roles sequentially without transferring unwanted mind data.")]
[RunOnSide(Side.Server)]
public void TestAntagGhostRolesSequential()

View file

@ -1,7 +1,5 @@
using System.Linq;
using Content.IntegrationTests.Fixtures;
using Content.IntegrationTests.Fixtures;
using Content.IntegrationTests.Fixtures.Attributes;
using Content.Server.Antag;
using Content.Server.GameTicking;
using Content.Server.Mind;
using Content.Shared.Antag;
@ -25,7 +23,7 @@ public abstract partial class AntagTest : GameTest
};
[SidedDependency(Side.Server)] protected AntagSelectionSystem AntagSys = default!;
[SidedDependency(Side.Server)] protected GameTicker STicker = default!;
[SidedDependency(Side.Server)] protected ServerGameTicker STicker = default!;
[SidedDependency(Side.Server)] protected MindSystem SMind = default!;
/// <summary>

View file

@ -1,10 +1,10 @@
#nullable enable
using Content.IntegrationTests.Fixtures;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Presets;
using Content.Shared.CCVar;
using Content.Shared.GameTicking;
using Content.Shared.GameTicking.Components;
using Content.Shared.GameTicking.Prototypes;
using Robust.Shared.GameObjects;
namespace Content.IntegrationTests.Tests.GameRules;
@ -72,7 +72,7 @@ public sealed class FailAndStartPresetTest : GameTest
var server = pair.Server;
var client = pair.Client;
var entMan = server.EntMan;
var ticker = server.System<GameTicker>();
var ticker = server.System<ServerGameTicker>();
server.System<TestRuleSystem>().Run = true;
Assert.That(server.CfgMan.GetCVar(CCVars.GridFill), Is.False);

View file

@ -4,17 +4,17 @@ using System.Linq;
using Content.IntegrationTests.Fixtures;
using Content.Server.Body.Components;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Presets;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Mind;
using Content.Server.Roles;
using Content.Server.RoundEnd;
using Content.Server.Shuttles.Components;
using Content.Shared.CCVar;
using Content.Shared.Damage.Components;
using Content.Shared.Damage.Systems;
using Content.Shared.FixedPoint;
using Content.Shared.GameTicking;
using Content.Shared.GameTicking.Prototypes;
using Content.Shared.GameTicking.Rules.Components;
using Content.Shared.Hands.Components;
using Content.Shared.Inventory;
using Content.Shared.NPC.Prototypes;
@ -57,7 +57,7 @@ public sealed class NukeOpsTest : GameTest
var client = pair.Client;
var entMan = server.EntMan;
var mapSys = server.System<MapSystem>();
var ticker = server.System<GameTicker>();
var ticker = server.System<ServerGameTicker>();
var mindSys = server.System<MindSystem>();
var roleSys = server.System<RoleSystem>();
var invSys = server.System<InventorySystem>();

View file

@ -2,6 +2,7 @@ using Content.IntegrationTests.Fixtures;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Rules;
using Content.Server.GameTicking.Rules.Components;
using Content.Shared.GameTicking;
using Content.Shared.GameTicking.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;
@ -27,14 +28,14 @@ namespace Content.IntegrationTests.Tests.GameRules
Assert.That(server.EntMan.Count<ActiveGameRuleComponent>(), Is.Zero);
var entityManager = server.ResolveDependency<IEntityManager>();
var sGameTicker = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<GameTicker>();
var sGameTicker = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<ServerGameTicker>();
var sGameTiming = server.ResolveDependency<IGameTiming>();
MaxTimeRestartRuleComponent maxTime = null;
await server.WaitPost(() =>
{
sGameTicker.StartGameRule(MaxTimeRestartGameRule, out var ruleEntity);
Assert.That(entityManager.TryGetComponent<MaxTimeRestartRuleComponent>(ruleEntity, out maxTime));
Assert.That(entityManager.TryGetComponent(ruleEntity, out maxTime));
});
Assert.That(server.EntMan.Count<GameRuleComponent>(), Is.EqualTo(1));

View file

@ -23,8 +23,7 @@ public sealed class SecretStartsTest : GameTest
var server = pair.Server;
await server.WaitIdleAsync();
var entMan = server.ResolveDependency<IEntityManager>();
var gameTicker = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<GameTicker>();
var gameTicker = server.System<ServerGameTicker>();
await server.WaitAssertion(() =>
{

View file

@ -26,7 +26,7 @@ public sealed class StartEndGameRulesTest : GameTest
var pair = Pair;
var server = pair.Server;
await server.WaitIdleAsync();
var gameTicker = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<GameTicker>();
var gameTicker = server.System<ServerGameTicker>();
var cfg = server.ResolveDependency<IConfigurationManager>();
Assert.That(cfg.GetCVar(CCVars.GridFill), Is.False);

View file

@ -8,6 +8,7 @@ using Content.Server.Mind;
using Content.Server.Roles;
using Content.Shared.GameTicking;
using Content.Shared.GameTicking.Components;
using Content.Shared.GameTicking.Rules.Components;
using Content.Shared.Mind;
using Content.Shared.NPC.Prototypes;
using Content.Shared.NPC.Systems;
@ -42,11 +43,10 @@ public sealed class TraitorRuleTest : GameTest
var entMan = server.EntMan;
var protoMan = server.ProtoMan;
var compFact = server.ResolveDependency<IComponentFactory>();
var ticker = server.System<GameTicker>();
var ticker = server.System<ServerGameTicker>();
var mindSys = server.System<MindSystem>();
var roleSys = server.System<RoleSystem>();
var factionSys = server.System<NpcFactionSystem>();
var traitorRuleSys = server.System<TraitorRuleSystem>();
// Look up the minimum player count and max total objective difficulty for the game rule
var minPlayers = 1;
@ -96,7 +96,7 @@ public sealed class TraitorRuleTest : GameTest
// Start the round
ticker.StartRound();
// Force traitor mode to start (skip the delay)
ticker.StartGameRule(gameRuleEnt);
ticker.StartGameRule(gameRuleEnt!.Value);
});
await pair.RunTicksSync(10);

View file

@ -1,9 +1,8 @@
#nullable enable
using System.Collections.Generic;
using Content.Client.GameTicking.Managers;
using Content.Client.GameTicking;
using Content.IntegrationTests.Fixtures;
using Content.IntegrationTests.Fixtures.Attributes;
using Content.IntegrationTests.NUnit.Constraints;
using Content.Server.GameTicking;
using Content.Shared.GameTicking;
using Robust.Shared.GameObjects;
@ -14,8 +13,8 @@ namespace Content.IntegrationTests.Tests.GameTestTests;
[TestOf(typeof(SidedDependencyAttribute))]
public sealed class DependencyTests : GameTest
{
[SidedDependency(Side.Server)] private readonly SharedGameTicker _sGameTicker = null!;
[SidedDependency(Side.Client)] private readonly SharedGameTicker _cGameTicker = null!;
[SidedDependency(Side.Server)] private readonly GameTicker _sGameTicker = null!;
[SidedDependency(Side.Client)] private readonly GameTicker _cGameTicker = null!;
[SidedDependency(Side.Server)] private readonly EntityQuery<TransformComponent> _sXformQuery = default!;
[Test]
@ -38,7 +37,7 @@ public sealed class DependencyTests : GameTest
{
Assert.That(!ReferenceEquals(_sGameTicker, _cGameTicker),
"Server and client gametickers should be distinct");
Assert.That(_sGameTicker, Is.TypeOf<GameTicker>());
Assert.That(_sGameTicker, Is.TypeOf<ServerGameTicker>());
Assert.That(_cGameTicker, Is.TypeOf<ClientGameTicker>());
}
}

View file

@ -1,8 +1,8 @@
using Content.IntegrationTests.Fixtures;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Systems;
using Content.Server.Station.Systems;
using Content.Shared.Preferences;
using Content.Shared.Station.Systems;
namespace Content.IntegrationTests.Tests.Internals;

View file

@ -174,7 +174,7 @@ public sealed partial class MindTests
EntityUid ghost = default!;
await server.WaitAssertion(() =>
{
ghost = entMan.SpawnEntity(GameTicker.ObserverPrototypeName, MapCoordinates.Nullspace);
ghost = entMan.SpawnEntity(ServerGameTicker.ObserverPrototypeName, MapCoordinates.Nullspace);
mindSystem.Visit(mind.Id, ghost);
});
@ -223,7 +223,7 @@ public sealed partial class MindTests
var ghost = await BecomeGhost(pair);
// Player is a normal ghost (not admin ghost).
Assert.That(entMan.GetComponent<MetaDataComponent>(player.AttachedEntity!.Value).EntityPrototype?.ID, Is.Not.EqualTo(GameTicker.AdminObserverPrototypeName));
Assert.That(entMan.GetComponent<MetaDataComponent>(player.AttachedEntity!.Value).EntityPrototype?.ID, Is.Not.EqualTo(ServerGameTicker.AdminObserverPrototypeName));
// Try to become an admin ghost
await server.WaitAssertion(() => serverConsole.ExecuteCommand(player, "aghost"));
@ -234,7 +234,7 @@ public sealed partial class MindTests
{
Assert.That(player.AttachedEntity, Is.Not.EqualTo(ghost), "Player is still attached to the old ghost");
Assert.That(entMan.HasComponent<GhostComponent>(player.AttachedEntity), "Player did not become a new ghost");
Assert.That(entMan.GetComponent<MetaDataComponent>(player.AttachedEntity!.Value).EntityPrototype?.ID, Is.EqualTo(GameTicker.AdminObserverPrototypeName));
Assert.That(entMan.GetComponent<MetaDataComponent>(player.AttachedEntity!.Value).EntityPrototype?.ID, Is.EqualTo(ServerGameTicker.AdminObserverPrototypeName));
});
var mindId = player.ContentData()?.Mind;

View file

@ -80,7 +80,7 @@ public sealed partial class MindTests
await pair.Server.WaitAssertion(() =>
{
var oldUid = player.AttachedEntity;
ghostUid = entMan.SpawnEntity(GameTicker.ObserverPrototypeName, MapCoordinates.Nullspace);
ghostUid = entMan.SpawnEntity(ServerGameTicker.ObserverPrototypeName, MapCoordinates.Nullspace);
mindId = mindSys.GetMind(player.UserId)!.Value;
Assert.That(mindId, Is.Not.EqualTo(default(EntityUid)));
mind = entMan.GetComponent<MindComponent>(mindId);

View file

@ -10,11 +10,11 @@ using Content.Server.Administration.Systems;
using Content.Server.GameTicking;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Systems;
using Content.Server.Spawners.Components;
using Content.Server.Station.Components;
using Content.Shared.CCVar;
using Content.Shared.Maps;
using Content.Shared.Roles;
using Content.Shared.Shuttles.Components;
using Content.Shared.Spawners.Components;
using Content.Shared.Station.Components;
using Robust.Shared.Configuration;
using Robust.Shared.ContentPack;
@ -333,7 +333,7 @@ namespace Content.IntegrationTests.Tests
var mapLoader = entManager.System<MapLoaderSystem>();
var mapSystem = entManager.System<SharedMapSystem>();
var protoManager = server.ResolveDependency<IPrototypeManager>();
var ticker = entManager.EntitySysManager.GetEntitySystem<GameTicker>();
var ticker = entManager.EntitySysManager.GetEntitySystem<ServerGameTicker>();
var shuttleSystem = entManager.EntitySysManager.GetEntitySystem<ShuttleSystem>();
var cfg = server.ResolveDependency<IConfigurationManager>();

View file

@ -50,7 +50,7 @@ public sealed class StationPowerTests : GameTest
var entMan = server.EntMan;
var protoMan = server.ProtoMan;
var ticker = entMan.System<GameTicker>();
var ticker = entMan.System<ServerGameTicker>();
var batterySys = entMan.System<BatterySystem>();
// Load the map
@ -108,7 +108,7 @@ public sealed class StationPowerTests : GameTest
var entMan = server.EntMan;
var protoMan = server.ProtoMan;
var ticker = entMan.System<GameTicker>();
var ticker = entMan.System<ServerGameTicker>();
var xform = entMan.System<TransformSystem>();
// Load the map

View file

@ -4,6 +4,7 @@ using Content.Server.Station.Systems;
using Content.Shared.Inventory;
using Content.Shared.Preferences;
using Content.Shared.Preferences.Loadouts;
using Content.Shared.Station.Systems;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;

View file

@ -38,7 +38,7 @@ public sealed class ReplayTests : GameTest
server.CfgMan.SetCVar(CCVars.ReplayAutoRecordName, $"c/d/{autoRecName}");
// Restart the round a few times
var ticker = server.System<GameTicker>();
var ticker = server.System<ServerGameTicker>();
await server.WaitPost(() => ticker.RestartRound());
await pair.RunTicksSync(25);
Assert.That(recordMan.IsRecording, Is.True);

View file

@ -41,7 +41,7 @@ namespace Content.IntegrationTests.Tests
var server = pair.Server;
var entitySystemManager = server.ResolveDependency<IEntitySystemManager>();
var gameTicker = entitySystemManager.GetEntitySystem<GameTicker>();
var gameTicker = entitySystemManager.GetEntitySystem<ServerGameTicker>();
await server.WaitAssertion(() =>
{

View file

@ -23,7 +23,7 @@ namespace Content.IntegrationTests.Tests
await server.WaitPost(() =>
{
sysManager.GetEntitySystem<GameTicker>().RestartRound();
sysManager.GetEntitySystem<ServerGameTicker>().RestartRound();
});
await pair.RunUntilSynced();

View file

@ -85,7 +85,7 @@ public sealed class JobTest : GameTest
var jobSys = pair.Server.System<SharedJobSystem>();
var mindSys = pair.Server.System<MindSystem>();
var roleSys = pair.Server.System<RoleSystem>();
var ticker = pair.Server.System<GameTicker>();
var ticker = pair.Server.System<ServerGameTicker>();
user ??= pair.Client.User!.Value;
@ -110,7 +110,7 @@ public sealed class JobTest : GameTest
var pair = Pair;
pair.Server.CfgMan.SetCVar(CCVars.GameMap, _map);
var ticker = pair.Server.System<GameTicker>();
var ticker = pair.Server.System<ServerGameTicker>();
// Initially in the lobby
Assert.That(ticker.RunLevel, Is.EqualTo(GameRunLevel.PreRoundLobby));
@ -137,7 +137,7 @@ public sealed class JobTest : GameTest
var pair = Pair;
pair.Server.CfgMan.SetCVar(CCVars.GameMap, _map);
var ticker = pair.Server.System<GameTicker>();
var ticker = pair.Server.System<ServerGameTicker>();
Assert.That(ticker.RunLevel, Is.EqualTo(GameRunLevel.PreRoundLobby));
Assert.That(pair.Client.AttachedEntity, Is.Null);
@ -170,11 +170,11 @@ public sealed class JobTest : GameTest
var pair = Pair;
pair.Server.CfgMan.SetCVar(CCVars.GameMap, _map);
var ticker = pair.Server.System<GameTicker>();
var ticker = pair.Server.System<ServerGameTicker>();
Assert.That(ticker.RunLevel, Is.EqualTo(GameRunLevel.PreRoundLobby));
Assert.That(pair.Client.AttachedEntity, Is.Null);
var stationJobs = pair.Server.System<StationJobsSystem>();
var stationJobs = pair.Server.System<ServerStationJobsSystem>();
var captain = pair.Server.ProtoMan.Index(Captain);
var engineer = pair.Server.ProtoMan.Index(Engineer);
var passenger = pair.Server.ProtoMan.Index(Passenger);
@ -202,9 +202,9 @@ public sealed class JobTest : GameTest
{
var pair = Pair;
pair.Server.CfgMan.SetCVar(CCVars.GameMap, JobWeightOverrideMap);
var ticker = pair.Server.System<GameTicker>();
var ticker = pair.Server.System<ServerGameTicker>();
var stationJobs = pair.Server.System<StationJobsSystem>();
var stationJobs = pair.Server.System<ServerStationJobsSystem>();
var passenger = pair.Server.ProtoMan.Index(Passenger);
var engineer = pair.Server.ProtoMan.Index(Engineer);
var captain = pair.Server.ProtoMan.Index(Captain);
@ -256,7 +256,7 @@ public sealed class JobTest : GameTest
var pair = Pair;
pair.Server.CfgMan.SetCVar(CCVars.GameMap, _map);
var ticker = pair.Server.System<GameTicker>();
var ticker = pair.Server.System<ServerGameTicker>();
Assert.That(ticker.RunLevel, Is.EqualTo(GameRunLevel.PreRoundLobby));
Assert.That(pair.Client.AttachedEntity, Is.Null);

View file

@ -2,6 +2,7 @@ using Content.IntegrationTests.Fixtures;
using Content.Server.GameTicking;
using Content.Server.RoundEnd;
using Content.Shared.CCVar;
using Content.Shared.GameTicking;
using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
@ -43,7 +44,7 @@ namespace Content.IntegrationTests.Tests
var config = server.ResolveDependency<IConfigurationManager>();
var sysManager = server.ResolveDependency<IEntitySystemManager>();
var ticker = sysManager.GetEntitySystem<GameTicker>();
var ticker = sysManager.GetEntitySystem<ServerGameTicker>();
var roundEndSystem = sysManager.GetEntitySystem<RoundEndSystem>();
var sys = server.System<RoundEndTestSystem>();
sys.RoundCount = 0;

View file

@ -1,6 +1,7 @@
using System.Numerics;
using Content.IntegrationTests.Fixtures;
using Content.Server.Shuttles.Components;
using Content.Shared.Shuttles.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Physics;

View file

@ -4,6 +4,7 @@ using Content.Server.GameTicking;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Systems;
using Content.Shared.CCVar;
using Content.Shared.GameTicking;
using Content.Shared.Shuttles.Components;
using Content.Shared.Station.Components;
using Robust.Shared.GameObjects;
@ -30,7 +31,7 @@ public sealed class EvacShuttleTest : GameTest
var pair = Pair;
var server = pair.Server;
var entMan = server.EntMan;
var ticker = server.System<GameTicker>();
var ticker = server.System<ServerGameTicker>();
// Dummy ticker tests should not have centcomm
Assert.That(entMan.Count<StationCentcommComponent>(), Is.Zero);

View file

@ -6,6 +6,7 @@ using Content.Shared.CCVar;
using Content.Shared.Maps;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Content.Shared.Station.Components;
using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
using Robust.Shared.Network;
@ -14,7 +15,7 @@ using Robust.Shared.Prototypes;
namespace Content.IntegrationTests.Tests.Station;
[TestFixture]
[TestOf(typeof(StationJobsSystem))]
[TestOf(typeof(ServerStationJobsSystem))]
public sealed class StationJobsTest : GameTest
{
private const string StationMapId = "FooStation";
@ -137,8 +138,8 @@ public sealed class StationJobsTest : GameTest
var prototypeManager = server.ResolveDependency<IPrototypeManager>();
var barStationProto = prototypeManager.Index<GameMapPrototype>(SecondStationMapId);
var entSysMan = server.ResolveDependency<IEntityManager>().EntitySysManager;
var stationJobs = entSysMan.GetEntitySystem<StationJobsSystem>();
var stationSystem = entSysMan.GetEntitySystem<StationSystem>();
var stationJobs = entSysMan.GetEntitySystem<ServerStationJobsSystem>();
var stationSystem = entSysMan.GetEntitySystem<ServerStationSystem>();
var firstStation = EntityUid.Invalid;
var secondStation = EntityUid.Invalid;
@ -198,8 +199,8 @@ public sealed class StationJobsTest : GameTest
var prototypeManager = server.ResolveDependency<IPrototypeManager>();
var barStationProto = prototypeManager.Index<GameMapPrototype>(SecondStationMapId);
var entSysMan = server.ResolveDependency<IEntityManager>().EntitySysManager;
var stationJobs = entSysMan.GetEntitySystem<StationJobsSystem>();
var stationSystem = entSysMan.GetEntitySystem<StationSystem>();
var stationJobs = entSysMan.GetEntitySystem<ServerStationJobsSystem>();
var stationSystem = entSysMan.GetEntitySystem<ServerStationSystem>();
var station = EntityUid.Invalid;
await server.WaitPost(() =>
@ -264,8 +265,8 @@ public sealed class StationJobsTest : GameTest
var prototypeManager = server.ResolveDependency<IPrototypeManager>();
var fooStationProto = prototypeManager.Index<GameMapPrototype>(StationMapId);
var entSysMan = server.ResolveDependency<IEntityManager>().EntitySysManager;
var stationJobs = entSysMan.GetEntitySystem<StationJobsSystem>();
var stationSystem = entSysMan.GetEntitySystem<StationSystem>();
var stationJobs = entSysMan.GetEntitySystem<ServerStationJobsSystem>();
var stationSystem = entSysMan.GetEntitySystem<ServerStationSystem>();
var station = EntityUid.Invalid;
await server.WaitPost(() =>

View file

@ -172,7 +172,7 @@ namespace Content.MapRenderer.Painters
if (_map is RenderMapPrototype)
{
var mapId = sEntityManager.System<GameTicker>().DefaultMap;
var mapId = sEntityManager.System<ServerGameTicker>().DefaultMap;
_grids = mapSys.GetAllGrids(mapId).ToArray();
}

View file

@ -1,9 +1,9 @@
using Content.Server.Access.Components;
using Content.Server.GameTicking;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Shared.Access.Systems;
using Content.Shared.GameTicking;
using Content.Shared.Roles;
using Content.Shared.Station.Components;
namespace Content.Server.Access.Systems;
@ -11,7 +11,7 @@ public sealed partial class PresetIdCardSystem : EntitySystem
{
[Dependency] private IdCardSystem _cardSystem = default!;
[Dependency] private SharedAccessSystem _accessSystem = default!;
[Dependency] private StationSystem _stationSystem = default!;
[Dependency] private ServerStationSystem _stationSystem = default!;
public override void Initialize()
{

View file

@ -20,7 +20,7 @@ public sealed partial class AdminEventLogEui : BaseEui
[Dependency] private EventWebhook _eventWebhook = default!;
[Dependency] private IEntityManager _e = default!;
private int CurrentRoundId => _e.System<GameTicker>().RoundId;
private int CurrentRoundId => _e.System<ServerGameTicker>().RoundId;
public AdminEventLogEui()
{

View file

@ -75,7 +75,7 @@ public sealed partial class AGhostCommand : LocalizedCommands
var metaDataSystem = _entities.System<MetaDataSystem>();
var ghostSystem = _entities.System<SharedGhostSystem>();
var transformSystem = _entities.System<TransformSystem>();
var gameTicker = _entities.System<GameTicker>();
var gameTicker = _entities.System<ServerGameTicker>();
if (!mindSystem.TryGetMind(player, out var mindId, out var mind))
{
@ -102,7 +102,7 @@ public sealed partial class AGhostCommand : LocalizedCommands
coordinates = gameTicker.GetObserverSpawnPoint();
}
var ghost = _entities.SpawnEntity(GameTicker.AdminObserverPrototypeName, coordinates.Value);
var ghost = _entities.SpawnEntity(ServerGameTicker.AdminObserverPrototypeName, coordinates.Value);
if (canReturn)
{

View file

@ -12,7 +12,7 @@ namespace Content.Server.Administration.Commands;
public sealed partial class ForceGhostCommand : LocalizedEntityCommands
{
[Dependency] private IPlayerManager _playerManager = default!;
[Dependency] private GameTicker _gameTicker = default!;
[Dependency] private ServerGameTicker _gameTicker = default!;
[Dependency] private SharedMindSystem _mind = default!;
[Dependency] private GhostSystem _ghost = default!;

View file

@ -12,7 +12,7 @@ namespace Content.Server.Administration.Commands
public sealed partial class LoadGameMapCommand : LocalizedEntityCommands
{
[Dependency] private IPrototypeManager _prototypeManager = default!;
[Dependency] private GameTicker _gameTicker = default!;
[Dependency] private ServerGameTicker _gameTicker = default!;
[Dependency] private SharedMapSystem _mapSystem = default!;
public override string Command => "loadgamemap";

View file

@ -1,5 +1,6 @@
using Content.Server.GameTicking;
using Content.Shared.Administration;
using Content.Shared.GameTicking;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands;
@ -7,7 +8,7 @@ namespace Content.Server.Administration.Commands;
[AdminCommand(AdminFlags.Round)]
public sealed partial class ReadyAllCommand : LocalizedEntityCommands
{
[Dependency] private GameTicker _gameTicker = default!;
[Dependency] private ServerGameTicker _gameTicker = default!;
public override string Command => "readyall";

View file

@ -22,6 +22,6 @@ public sealed partial class ThrowScoreboardCommand : IConsoleCommand
shell.WriteLine(Help);
return;
}
_e.System<GameTicker>().ShowRoundEndScoreboard();
_e.System<ServerGameTicker>().ShowRoundEndScoreboard();
}
}

View file

@ -5,11 +5,11 @@ using System.Threading.Tasks;
using Content.Server.Administration.Systems;
using Content.Server.Database;
using Content.Server.EUI;
using Content.Server.GameTicking;
using Content.Shared.Administration.Logs;
using Content.Shared.CCVar;
using Content.Shared.Chat;
using Content.Shared.Database;
using Content.Shared.GameTicking;
using Content.Shared.Mind;
using Content.Shared.Players.PlayTimeTracking;
using Prometheus;

View file

@ -1,5 +1,5 @@
using Content.Server.GameTicking;
using Content.Server.GameTicking.Events;
using Content.Shared.GameTicking;
using Content.Shared.GameTicking.Events;
namespace Content.Server.Administration.Logs;

View file

@ -52,7 +52,7 @@ public sealed partial class AdminLogsEui : BaseEui
};
}
private int CurrentRoundId => _e.System<GameTicker>().RoundId;
private int CurrentRoundId => _e.System<ServerGameTicker>().RoundId;
public override async void Opened()
{

View file

@ -1,9 +1,8 @@
using System.Text.Json;
using System.Threading.Tasks;
using Content.Server.Database;
using Content.Server.GameTicking;
using Content.Shared.Administration.Logs;
using Robust.Shared.Network;
using Content.Shared.GameTicking;
using Robust.Shared.Player;
namespace Content.Server.Administration.Logs;

View file

@ -276,7 +276,7 @@ public sealed partial class BanManager : IBanManager, IPostInjectInit
{
roundIds = [..banInfo.RoundIds];
}
else if (_systems.TryGetEntitySystem<GameTicker>(out var ticker) && ticker.RoundId != 0)
else if (_systems.TryGetEntitySystem<ServerGameTicker>(out var ticker) && ticker.RoundId != 0)
{
roundIds = [ticker.RoundId];
}

View file

@ -122,7 +122,7 @@ public sealed partial class AdminNotesManager : IAdminNotesManager, IPostInjectI
_sawmill.Info(sb.ToString());
_systems.TryGetEntitySystem(out GameTicker? ticker);
_systems.TryGetEntitySystem(out ServerGameTicker? ticker);
int? roundId = ticker == null || ticker.RoundId == 0 ? null : ticker.RoundId;
var serverName = _config.GetCVar(CCVars.AdminLogsServerName); // This could probably be done another way, but this is fine. For displaying only.
var createdAt = DateTime.UtcNow;

View file

@ -10,14 +10,14 @@ using Content.Server.Administration.Managers;
using Content.Server.Administration.Systems;
using Content.Server.Database;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Presets;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Maps;
using Content.Server.RoundEnd;
using Content.Shared.Administration.Managers;
using Content.Shared.CCVar;
using Content.Shared.Database;
using Content.Shared.GameTicking;
using Content.Shared.GameTicking.Components;
using Content.Shared.GameTicking.Prototypes;
using Content.Shared.Prototypes;
using Robust.Server.ServerStatus;
using Robust.Shared.Asynchronous;
@ -218,7 +218,7 @@ public sealed partial class ServerApi : IPostInjectInit
await RunOnMainThread(async () =>
{
var ticker = _entitySystemManager.GetEntitySystem<GameTicker>();
var ticker = _entitySystemManager.GetEntitySystem<ServerGameTicker>();
if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
{
await RespondError(
@ -258,7 +258,7 @@ public sealed partial class ServerApi : IPostInjectInit
await RunOnMainThread(async () =>
{
var ticker = _entitySystemManager.GetEntitySystem<GameTicker>();
var ticker = _entitySystemManager.GetEntitySystem<ServerGameTicker>();
var gameRule = ticker
.GetActiveGameRules()
.FirstOrNull(rule =>
@ -292,7 +292,7 @@ public sealed partial class ServerApi : IPostInjectInit
await RunOnMainThread(async () =>
{
var ticker = _entitySystemManager.GetEntitySystem<GameTicker>();
var ticker = _entitySystemManager.GetEntitySystem<ServerGameTicker>();
if (!_prototypeManager.HasIndex<EntityPrototype>(body.GameRuleId))
{
await RespondError(context,
@ -302,11 +302,13 @@ public sealed partial class ServerApi : IPostInjectInit
return;
}
var ruleEntity = ticker.AddGameRule(body.GameRuleId);
if (ticker.AddGameRule(body.GameRuleId) is not { } ruleEntity)
return;
_sawmill.Info($"Added game rule {body.GameRuleId} by {FormatLogActor(actor)}.");
if (ticker.RunLevel == GameRunLevel.InRound)
{
ticker.StartGameRule(ruleEntity);
ticker.StartGameRule(ruleEntity.AsNullable());
_sawmill.Info($"Started game rule {body.GameRuleId} by {FormatLogActor(actor)}.");
}
@ -418,7 +420,7 @@ public sealed partial class ServerApi : IPostInjectInit
{
await RunOnMainThread(async () =>
{
var ticker = _entitySystemManager.GetEntitySystem<GameTicker>();
var ticker = _entitySystemManager.GetEntitySystem<ServerGameTicker>();
if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
{
@ -441,7 +443,7 @@ public sealed partial class ServerApi : IPostInjectInit
await RunOnMainThread(async () =>
{
var roundEndSystem = _entitySystemManager.GetEntitySystem<RoundEndSystem>();
var ticker = _entitySystemManager.GetEntitySystem<GameTicker>();
var ticker = _entitySystemManager.GetEntitySystem<ServerGameTicker>();
if (ticker.RunLevel != GameRunLevel.InRound)
{
@ -463,7 +465,7 @@ public sealed partial class ServerApi : IPostInjectInit
{
await RunOnMainThread(async () =>
{
var ticker = _entitySystemManager.GetEntitySystem<GameTicker>();
var ticker = _entitySystemManager.GetEntitySystem<ServerGameTicker>();
ticker.RestartRound();
_sawmill.Info($"Forced instant round restart by {FormatLogActor(actor)}");
@ -544,7 +546,7 @@ public sealed partial class ServerApi : IPostInjectInit
var info = await RunOnMainThread<InfoResponse>(() =>
{
var ticker = _entitySystemManager.GetEntitySystem<GameTicker>();
var ticker = _entitySystemManager.GetEntitySystem<ServerGameTicker>();
var adminSystem = _entitySystemManager.GetEntitySystem<AdminSystem>();
var players = new List<InfoResponse.Player>();

View file

@ -49,7 +49,7 @@ public sealed partial class AdminSystem : EntitySystem
[Dependency] private PhysicsSystem _physics = default!;
[Dependency] private PlayTimeTrackingManager _playTime = default!;
[Dependency] private SharedRoleSystem _role = default!;
[Dependency] private GameTicker _gameTicker = default!;
[Dependency] private ServerGameTicker _gameTicker = default!;
[Dependency] private SharedAudioSystem _audio = default!;
[Dependency] private StationRecordsSystem _stationRecords = default!;
[Dependency] private TransformSystem _transform = default!;

View file

@ -1,10 +1,10 @@
using Content.Server.Antag;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Zombies;
using Content.Shared.Administration;
using Content.Server.Clothing.Systems;
using Content.Shared.Antag;
using Content.Shared.Database;
using Content.Shared.GameTicking.Rules.Components;
using Content.Shared.Humanoid;
using Content.Shared.Mind.Components;
using Content.Shared.Roles;
@ -20,7 +20,7 @@ public sealed partial class AdminVerbSystem
{
[Dependency] private AntagSelectionSystem _antag = default!;
[Dependency] private ZombieSystem _zombie = default!;
[Dependency] private GameTicker _gameTicker = default!;
[Dependency] private ServerGameTicker _gameTicker = default!;
[Dependency] private OutfitSystem _outfit = default!;
private static readonly EntProtoId DefaultTraitorRule = "Traitor";
@ -179,14 +179,15 @@ public sealed partial class AdminVerbSystem
Icon = new SpriteSpecifier.Rsi(new("/Textures/Interface/Misc/job_icons.rsi"), "ParadoxClone"),
Act = () =>
{
var ruleEnt = _gameTicker.AddGameRule(ParadoxCloneRuleId);
if (_gameTicker.AddGameRule(ParadoxCloneRuleId) is not { } ruleEnt)
return;
if (!TryComp<ParadoxCloneRuleComponent>(ruleEnt, out var paradoxCloneRuleComp))
return;
paradoxCloneRuleComp.OriginalBody = args.Target; // override the target player
_gameTicker.StartGameRule(ruleEnt);
_gameTicker.StartGameRule(ruleEnt.AsNullable());
},
Impact = LogImpact.High,
Message = string.Join(": ", paradoxCloneName, Loc.GetString("admin-verb-make-paradox-clone")),

View file

@ -47,7 +47,7 @@ public sealed partial class AdminVerbSystem
[Dependency] private HandsSystem _handsSystem = default!;
[Dependency] private QuickDialogSystem _quickDialog = default!;
[Dependency] private AdminTestArenaSystem _adminTestArenaSystem = default!;
[Dependency] private StationJobsSystem _stationJobsSystem = default!;
[Dependency] private ServerStationJobsSystem _stationJobsSystem = default!;
[Dependency] private JointSystem _jointSystem = default!;
[Dependency] private SharedBatterySystem _batterySystem = default!;
[Dependency] private MetaDataSystem _metaSystem = default!;

View file

@ -7,7 +7,6 @@ using Content.Server.Ghost.Roles;
using Content.Server.Mind;
using Content.Server.Prayer;
using Content.Server.Silicons.Laws;
using Content.Server.Station.Systems;
using Content.Shared.Administration;
using Content.Shared.Administration.Systems;
using Content.Shared.Chemistry.Components.SolutionManager;
@ -36,7 +35,7 @@ using Robust.Shared.Toolshed;
using Robust.Shared.Utility;
using System.Linq;
using Content.Shared.Chemistry.Components;
using Content.Shared.Mind;
using Content.Shared.Station.Systems;
using static Content.Shared.Configurable.ConfigurationComponent;
namespace Content.Server.Administration.Systems

View file

@ -38,7 +38,7 @@ namespace Content.Server.Administration.Systems
[Dependency] private IConfigurationManager _config = default!;
[Dependency] private IGameTiming _timing = default!;
[Dependency] private IPlayerLocator _playerLocator = default!;
[Dependency] private GameTicker _gameTicker = default!;
[Dependency] private ServerGameTicker _gameTicker = default!;
[Dependency] private SharedMindSystem _minds = default!;
[Dependency] private IAfkManager _afkManager = default!;
[Dependency] private IServerDbManager _dbManager = default!;

View file

@ -2,6 +2,7 @@ using Content.Server.Administration.Managers;
using Content.Server.GameTicking;
using Content.Shared.Afk.Events;
using Content.Shared.CCVar;
using Content.Shared.GameTicking;
using Content.Shared.Instruments;
using Robust.Server.Player;
using Robust.Shared.Configuration;
@ -21,7 +22,7 @@ public sealed partial class AfkSystem : EntitySystem
[Dependency] private IAfkManager _afkManager = default!;
[Dependency] private IPlayerManager _playerManager = default!;
[Dependency] private IGameTiming _timing = default!;
[Dependency] private GameTicker _ticker = default!;
[Dependency] private ServerGameTicker _ticker = default!;
[Dependency] private IConfigurationManager _cfg = default!;
/// <summary>

View file

@ -7,7 +7,7 @@ namespace Content.Server.AlertLevel;
public sealed partial class AlertLevelDisplaySystem : EntitySystem
{
[Dependency] private StationSystem _stationSystem = default!;
[Dependency] private ServerStationSystem _stationSystem = default!;
[Dependency] private SharedAppearanceSystem _appearance = default!;
public override void Initialize()

View file

@ -2,6 +2,7 @@
using Content.Shared.Administration;
using Content.Shared.AlertLevel;
using Content.Shared.Station;
using Content.Shared.Station.Systems;
using Robust.Shared.Console;
using Robust.Shared.Prototypes;
@ -11,7 +12,7 @@ namespace Content.Server.AlertLevel.Commands;
public sealed partial class SetAlertLevelCommand : LocalizedEntityCommands
{
[Dependency] private AlertLevelSystem _alertLevelSystem = default!;
[Dependency] private SharedStationSystem _stationSystem = default!;
[Dependency] private StationSystem _stationSystem = default!;
[Dependency] private IPrototypeManager _prototype = default!;
public override string Command => "setalertlevel";

View file

@ -5,12 +5,12 @@ using Content.Server.Explosion.EntitySystems;
using Content.Server.Materials;
using Content.Server.Radiation.Systems;
using Content.Server.Radio.EntitySystems;
using Content.Server.Station.Systems;
using Content.Shared.Anomaly;
using Content.Shared.Anomaly.Components;
using Content.Shared.Anomaly.Prototypes;
using Content.Shared.Random;
using Content.Shared.Random.Helpers;
using Content.Shared.Station.Systems;
using Robust.Server.GameObjects;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;

View file

@ -1,4 +1,5 @@
using Content.Server.Antag.Components;
using Content.Shared.Antag;
using Robust.Shared.Random;
namespace Content.Server.Antag;

View file

@ -1,7 +1,6 @@
using Content.Server.Antag.Components;
using Content.Server.Objectives;
using Content.Shared.Antag;
using Content.Shared.Mind;
using Content.Shared.Objectives.Systems;
namespace Content.Server.Antag;

View file

@ -1,8 +1,8 @@
using Content.Server.Antag.Components;
using Content.Server.Objectives;
using Content.Shared.Antag;
using Content.Shared.Mind;
using Content.Shared.Objectives.Components;
using Content.Shared.Objectives.Systems;
using Robust.Shared.Random;
namespace Content.Server.Antag;

View file

@ -1,11 +1,14 @@
using Content.Server.Antag.Components;
using Content.Server.Station.Systems;
using Content.Shared.Antag;
using Content.Shared.GameTicking.Components;
using Content.Server.GameTicking.Rules;
using Content.Shared.GameTicking.Rules;
namespace Content.Server.Antag;
public sealed partial class AntagRandomSpawnSystem : GameRuleSystem<AntagRandomSpawnComponent>
{
[Dependency] private ServerStationSystem _station = default!;
[Dependency] private SharedTransformSystem _transform = default!;
public override void Initialize()
@ -15,15 +18,15 @@ public sealed partial class AntagRandomSpawnSystem : GameRuleSystem<AntagRandomS
SubscribeLocalEvent<AntagRandomSpawnComponent, AntagSelectLocationEvent>(OnSelectLocation);
}
protected override void Added(EntityUid uid, AntagRandomSpawnComponent comp, GameRuleComponent gameRule, GameRuleAddedEvent args)
protected override void Added(Entity<AntagRandomSpawnComponent, GameRuleComponent> rule, ref GameRuleAddedEvent args)
{
base.Added(uid, comp, gameRule, args);
base.Added(rule, ref args);
// we have to select this here because AntagSelectLocationEvent is raised twice because MakeAntag is called twice
// once when a ghost role spawner is created and once when someone takes the ghost role
if (TryFindRandomTile(out _, out _, out _, out var coords))
comp.Coords = coords;
if (_station.TryFindRandomTile(out _, out _, out _, out var coords))
rule.Comp1.Coords = coords;
}
private void OnSelectLocation(Entity<AntagRandomSpawnComponent> ent, ref AntagSelectLocationEvent args)

View file

@ -1,4 +1,5 @@
using Content.Server.Antag.Components;
using Content.Shared.Antag;
namespace Content.Server.Antag;

View file

@ -1,5 +1,4 @@
using Content.Shared.Antag;
using Content.Shared.Roles;
using Robust.Shared.Prototypes;
namespace Content.Server.Antag.Components;

View file

@ -1,3 +1,4 @@
using Content.Shared.Antag.Components;
using Robust.Shared.Map;
namespace Content.Server.Antag.Components;

View file

@ -1,6 +1,7 @@
using Content.Server.Antag.Mimic;
using Content.Server.GameTicking.Rules;
using Content.Shared.GameTicking.Components;
using Content.Shared.GameTicking.Rules;
using Content.Shared.VendingMachines.Components;
using Robust.Shared.Map;
using Robust.Shared.Random;

View file

@ -0,0 +1,167 @@
using System.Diagnostics;
using System.Linq;
using Content.Server.Administration.Managers;
using Content.Server.Chat.Managers;
using Content.Server.GameTicking.Events;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Ghost.Roles;
using Content.Server.Ghost.Roles.Components;
using Content.Server.Objectives;
using Content.Server.Players.PlayTimeTracking;
using Content.Server.Preferences.Managers;
using Content.Shared.Antag;
using Content.Shared.Antag.Components;
using Content.Shared.Chat;
using Content.Shared.Roles;
using Robust.Shared.Audio;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
namespace Content.Server.Antag;
/// <inheritdoc/>
public sealed partial class ServerAntagSelectionSystem : AntagSelectionSystem
{
[Dependency] private IBanManager _ban = default!;
[Dependency] private IChatManager _chat = default!;
[Dependency] private IServerPreferencesManager _pref = default!;
[Dependency] private GhostRoleSystem _ghostRole = default!;
[Dependency] private PlayTimeTrackingSystem _playTime = default!;
[SubscribeLocalEvent]
private void OnTakeGhostRole(Entity<GhostRoleAntagSpawnerComponent> ent, ref TakeGhostRoleEvent args)
{
if (args.TookRole)
return;
if (ent.Comp.Rule is not { } rule || ent.Comp.Definition is not { } proto)
return;
if (!ProtoMan.Resolve(proto, out var def))
return;
if (!Exists(rule) || !RuleQuery.TryComp(rule, out var select))
return;
// Ensure the player is allowed to play this antagonist!
if (IsAntagBanned(args.Player, def) || !_playTime.IsAllowed(args.Player, def.PrefRoles))
return;
if (!TrySpawnAntagonist((rule, select), def, args.Player, XForm.GetMapCoordinates(ent), out var uid))
{
Log.Error($"Tried to make {args.Player.UserId} into an antagonist but was unable to spawn an entity for them. Game rule {ToPrettyString(ent)}");
return;
}
// We do this after TrySpawnAntagonist so we don't have to worry about a failed spawn adding permanent pre selections to a game rule.
PreSelectSession((rule, select), def, args.Player);
InitializeAntag((rule, select), def, uid.Value, args.Player);
args.TookRole = true;
// Move ghosts that were watching the raffle on the spawner over to the freshly spawned antag.
Follower.TransferFollowers(ent.Owner, uid.Value);
_ghostRole.UnregisterGhostRole((ent, Comp<GhostRoleComponent>(ent)));
}
[SubscribeLocalEvent]
private void OnObjectivesTextGetInfo(Entity<AntagSelectionComponent> ent, ref ObjectivesTextGetInfoEvent args)
{
if (ent.Comp.AgentName is not { } name)
return;
args.Minds = GetAntagIdentities(ent.AsNullable()).ToList();
args.AgentName = Loc.GetString(name);
}
[SubscribeLocalEvent]
private void OnJobNotAssigned(NoJobsAvailableSpawningEvent args)
{
// If someone fails to spawn in due to there being no jobs, they should be removed from any preselected antags.
// We only care about delayed rules, since if they're active the player should have already been removed via MakeAntag.
var query = QueryDelayedRules();
while (query.MoveNext(out var uid, out var comp, out _, out _))
{
if (comp.SelectionTime == AntagSelectionTime.RuleStarted)
continue;
Debug.Assert(comp.SelectionTime != AntagSelectionTime.Never, $"Player: {args.Player.Name}, was pre selected for an game rule {ToPrettyString(uid)} which does not do pre-selections");
if (!comp.RemoveUponFailedSpawn)
continue;
foreach (var antag in comp.Antags)
{
if (!comp.PreSelectedSessions.TryGetValue(antag, out var session))
break;
session.Remove(args.Player);
}
}
}
public override IEnumerable<ProtoId<AntagPrototype>> GetValidAntagPreferences(ICommonSession session, List<ProtoId<AntagPrototype>>? filter = null)
{
if (!_pref.TryGetCachedPreferences(session.UserId, out var prefs))
yield break;
foreach (var antag in prefs.SelectedCharacter.AntagPreferences)
{
// We also check this in IsSessionValid, but we also check it here since this is public API.
if (_ban.IsRoleBanned(session, antag) || !_playTime.IsAllowed(session, antag))
continue;
if (filter != null && !filter.Contains(antag))
continue;
yield return antag;
}
}
public override void SendBriefing(ICommonSession? session, string briefing, Color? briefingColor, SoundSpecifier? briefingSound)
{
if (session == null)
return;
Audio.PlayGlobal(briefingSound, session);
if (!string.IsNullOrEmpty(briefing))
{
var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", briefing));
_chat.ChatMessageToOne(ChatChannel.Server, briefing, wrappedMessage, default, false, session.Channel, briefingColor);
}
}
public override bool IsAntagBanned(ICommonSession session, AntagSpecifierPrototype definition)
{
if (_ban.GetAntagBans(session.UserId) is not { } bans)
return false;
foreach (var role in definition.PrefRoles)
{
// banned!
if (bans.Contains(role))
return true;
}
return false;
}
protected override Entity<AntagSelectionComponent>? ForceGetGameRuleEnt<T>(string id)
{
var query = EntityQueryEnumerator<T, AntagSelectionComponent>();
while (query.MoveNext(out var uid, out _, out var comp))
{
if (MetaData(uid).EntityPrototype?.ID == id)
return (uid, comp);
}
// Game Rule is invalid. You *really* fucked up.
if (GameTicker.AddGameRule(id) is not { } ruleEnt)
return null;
RemComp<LoadMapRuleComponent>(ruleEnt);
var antag = RuleQuery.Comp(ruleEnt);
antag.AssignmentHandled = true; // don't do normal selection.
GameTicker.StartGameRule(ruleEnt.AsNullable());
return (ruleEnt, antag);
}
}

View file

@ -5,6 +5,7 @@ using Content.Shared.Audio;
using Content.Shared.Audio.Events;
using Content.Shared.CCVar;
using Content.Shared.GameTicking;
using Content.Shared.GameTicking.Events;
using Robust.Server.Audio;
using Robust.Shared.Audio;
using Robust.Shared.Configuration;

View file

@ -10,7 +10,7 @@ namespace Content.Server.Audio;
public sealed partial class ServerGlobalSoundSystem : SharedGlobalSoundSystem
{
[Dependency] private IConsoleHost _conHost = default!;
[Dependency] private StationSystem _stationSystem = default!;
[Dependency] private ServerStationSystem _stationSystem = default!;
[Dependency] private SharedAudioSystem _audio = default!;
public override void Shutdown()

View file

@ -1,6 +1,6 @@
using System.Globalization;
using Content.Server.Chat.Managers;
using Content.Server.Ghost;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Shared.Access.Systems;
using Content.Shared.Bed.Cryostorage;
@ -10,22 +10,22 @@ using Content.Shared.Clothing.Components;
using Content.Shared.Database;
using Content.Shared.GameTicking;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Inventory;
using Content.Shared.Mind.Components;
using Content.Shared.Popups;
using Content.Shared.Station.Components;
using Content.Shared.Station.Systems;
using Content.Shared.StationRecords;
using Content.Shared.StationRecords.Components;
using Content.Shared.StationRecords.Systems;
using Content.Shared.UserInterface;
using Robust.Server.Player;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Enums;
using Robust.Shared.Network;
using Robust.Shared.Player;
using System.Globalization;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Inventory;
using Content.Shared.Popups;
using Content.Shared.Station;
using Content.Shared.StationRecords.Components;
using Content.Shared.StationRecords.Systems;
using Robust.Shared.Audio.Systems;
namespace Content.Server.Bed.Cryostorage;
@ -43,8 +43,8 @@ public sealed partial class CryostorageSystem : SharedCryostorageSystem
[Dependency] private SharedHandsSystem _hands = default!;
[Dependency] private InventorySystem _inventory = default!;
[Dependency] private SharedPopupSystem _popup = default!;
[Dependency] private SharedStationSystem _station = default!;
[Dependency] private StationJobsSystem _stationJobs = default!;
[Dependency] private StationSystem _station = default!;
[Dependency] private ServerStationJobsSystem _stationJobs = default!;
[Dependency] private StationRecordsSystem _stationRecords = default!;
[Dependency] private SharedTransformSystem _transform = default!;
[Dependency] private SharedUserInterfaceSystem _ui = default!;

View file

@ -137,7 +137,7 @@ public sealed partial class CargoSystem
if (_station.GetOwningStation(ent) is not { } station)
{
station = _random.Pick(_station.GetStations().Where(HasComp<StationCargoOrderDatabaseComponent>).ToList());
station = _random.Pick(_station.GetStations().Where(x => HasComp<StationCargoOrderDatabaseComponent>(x.Owner)).ToList());
}
if (!TryComp<StationCargoOrderDatabaseComponent>(station, out var db) ||

View file

@ -34,7 +34,7 @@ public sealed partial class CargoSystem : SharedCargoSystem
[Dependency] private SharedAppearanceSystem _appearance = default!;
[Dependency] private SharedAudioSystem _audio = default!;
[Dependency] private StackSystem _stack = default!;
[Dependency] private StationSystem _station = default!;
[Dependency] private ServerStationSystem _station = default!;
[Dependency] private UserInterfaceSystem _uiSystem = default!;
[Dependency] private MetaDataSystem _metaSystem = default!;
[Dependency] private RadioSystem _radio = default!;

View file

@ -14,7 +14,7 @@ public sealed partial class CrewManifestCartridgeSystem : EntitySystem
[Dependency] private CartridgeLoaderSystem _cartridgeLoader = default!;
[Dependency] private IConfigurationManager _configManager = default!;
[Dependency] private CrewManifestSystem _crewManifest = default!;
[Dependency] private StationSystem _stationSystem = default!;
[Dependency] private ServerStationSystem _stationSystem = default!;
private static readonly EntProtoId CartridgePrototypeName = "CrewManifestCartridge";

View file

@ -1,4 +1,3 @@
using Content.Server.Antag;
using Content.Shared.Antag;
using Content.Shared.Changeling.Components;
using Content.Shared.Changeling.Systems;

View file

@ -2,14 +2,13 @@ using System.Globalization;
using Content.Server.Administration.Logs;
using Content.Server.Administration.Managers;
using Content.Server.Chat.Managers;
using Content.Server.GameTicking;
using Content.Server.Station.Systems;
using Content.Shared.ActionBlocker;
using Content.Shared.Administration;
using Content.Shared.CCVar;
using Content.Shared.Chat;
using Content.Shared.Examine;
using Content.Shared.Ghost;
using Content.Shared.GameTicking;
using Content.Shared.Ghost.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Players.RateLimiting;
@ -40,7 +39,7 @@ public sealed partial class ChatSystem : SharedChatSystem
[Dependency] private IRobustRandom _random = default!;
[Dependency] private IAdminLogManager _adminLogger = default!;
[Dependency] private ActionBlockerSystem _actionBlocker = default!;
[Dependency] private StationSystem _stationSystem = default!;
[Dependency] private ServerStationSystem _stationSystem = default!;
[Dependency] private MobStateSystem _mobStateSystem = default!;
[Dependency] private SharedAudioSystem _audio = default!;
[Dependency] private ReplacementAccentSystem _wordreplacement = default!;

View file

@ -1,6 +1,7 @@
using Content.Server.GameTicking.Events;
using Content.Shared.Clock;
using Content.Shared.Destructible;
using Content.Shared.GameTicking.Events;
using Robust.Server.GameStates;
using Robust.Shared.Random;

View file

@ -13,6 +13,7 @@ using Content.Shared.Preferences.Loadouts;
using Content.Shared.Roles;
using Content.Shared.Station;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Station.Systems;
using Content.Shared.Storage;
using Robust.Shared.Player;
@ -23,7 +24,7 @@ public sealed partial class OutfitSystem : EntitySystem
[Dependency] private IServerPreferencesManager _preferenceManager = default!;
[Dependency] private HandsSystem _handSystem = default!;
[Dependency] private InventorySystem _invSystem = default!;
[Dependency] private SharedStationSpawningSystem _spawningSystem = default!;
[Dependency] private StationSpawningSystem _spawningSystem = default!;
[Dependency] private ItemSlotsSystem _itemSlotsSystem = default!;
[Dependency] private StorageSystem _storageSystem = default!;
@ -43,7 +44,7 @@ public sealed partial class OutfitSystem : EntitySystem
session = actorComponent.PlayerSession;
var userId = actorComponent.PlayerSession.UserId;
var prefs = _preferenceManager.GetPreferences(userId);
profile = prefs.SelectedCharacter as HumanoidCharacterProfile;
profile = prefs.SelectedCharacter;
}
if (_invSystem.TryGetSlots(target, out var slots))

View file

@ -1,8 +1,8 @@
using Content.Server.Chat.Systems;
using Content.Server.GameTicking;
using Content.Server.Ninja.Systems;
using Content.Shared.Communications;
using Content.Shared.DoAfter;
using Content.Shared.GameTicking;
using Content.Shared.Interaction;
using Content.Shared.Random;
using Content.Shared.Random.Helpers;

View file

@ -16,6 +16,7 @@ using Content.Shared.DeviceNetwork.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.Popups;
using Content.Shared.Screens;
using Content.Shared.Station.Systems;
using Robust.Server.GameObjects;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;

View file

@ -64,7 +64,7 @@ namespace Content.Server.Connection
[Dependency] private IAdminManager _adminManager = default!;
[Dependency] private IEntityManager _entityManager = default!;
private GameTicker? _ticker;
private ServerGameTicker? _ticker;
private ISawmill _sawmill = default!;
private readonly Dictionary<NetUserId, TimeSpan> _temporaryBypasses = [];
@ -291,7 +291,7 @@ namespace Content.Server.Connection
}
}
_ticker ??= _entityManager.SystemOrNull<GameTicker>();
_ticker ??= _entityManager.SystemOrNull<ServerGameTicker>();
var wasInGame = _ticker != null &&
_ticker.PlayerGameStatuses.TryGetValue(userId, out var status) &&
status == PlayerGameStatus.JoinedGame;

View file

@ -1,6 +1,6 @@
using System.Linq;
using Content.Server.Station.Systems;
using Content.Shared.Construction.Components;
using Content.Shared.Station.Systems;
using Robust.Server.GameObjects;
namespace Content.Server.Construction;

Some files were not shown because too many files have changed in this diff Show more