From e4a8caed84a251f6a893cd2d7763b379c4dbf45d Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sun, 11 Feb 2024 14:13:17 +0100 Subject: [PATCH 1/7] Use new Subs.CVar helper Removes manual config OnValueChanged calls, removes need to remember to manually unsubscribe. This both reduces boilerplate and fixes many issues where subscriptions weren't removed on entity system shutdown. --- Content.Client/Audio/AmbientSoundSystem.cs | 13 ++----- Content.Client/Audio/BackgroundAudioSystem.cs | 7 +--- .../Audio/ClientGlobalSoundSystem.cs | 4 +- .../Audio/ContentAudioSystem.AmbientMusic.cs | 3 +- Content.Client/Camera/CameraRecoilSystem.cs | 9 +---- .../TypingIndicator/TypingIndicatorSystem.cs | 3 +- Content.Client/CombatMode/CombatModeSystem.cs | 3 +- .../Instruments/InstrumentSystem.cs | 12 +----- Content.Client/Interaction/DragDropSystem.cs | 3 +- .../Outline/InteractionOutlineSystem.cs | 9 +---- Content.Client/StatusIcon/StatusIconSystem.cs | 12 +----- .../Administration/Systems/AdminSystem.cs | 22 ++++------- .../Administration/Systems/BwoinkSystem.cs | 19 +++------- Content.Server/Afk/AFKSystem.cs | 3 +- .../EntitySystems/AtmosphereSystem.CVars.cs | 38 +++++++++---------- .../EntitySystems/GasTileOverlaySystem.cs | 9 ++--- .../EntitySystems/HeatExchangerSystem.cs | 8 +--- .../Cartridges/CrewManifestCartridgeSystem.cs | 8 +--- Content.Server/Chat/Systems/ChatSystem.cs | 14 ++----- Content.Server/Chunking/ChunkingSystem.cs | 8 +--- Content.Server/Decals/DecalSystem.cs | 3 +- .../EntitySystems/ExplosionSystem.CVars.cs | 37 ++++-------------- .../EntitySystems/ExplosionSystem.cs | 1 - .../GameTicking/GameTicker.CVars.cs | 16 ++++---- Content.Server/Holiday/HolidaySystem.cs | 2 +- .../Instruments/InstrumentSystem.CVars.cs | 36 ++---------------- .../Instruments/InstrumentSystem.cs | 7 ---- Content.Server/Mapping/MappingSystem.cs | 9 +---- Content.Server/Motd/MOTDSystem.cs | 8 +--- .../NPC/Systems/NPCSteeringSystem.cs | 11 +----- Content.Server/NPC/Systems/NPCSystem.cs | 14 +------ Content.Server/Parallax/BiomeSystem.cs | 8 +--- .../Radiation/Systems/RadiationSystem.Cvar.cs | 36 ++---------------- .../Radiation/Systems/RadiationSystem.cs | 6 --- .../Salvage/SalvageSystem.Expeditions.cs | 7 +--- Content.Server/Salvage/SalvageSystem.cs | 6 --- .../Shuttles/Systems/ArrivalsSystem.cs | 8 +--- .../Systems/EmergencyShuttleSystem.Console.cs | 13 ++----- .../Systems/EmergencyShuttleSystem.cs | 8 +--- .../Systems/ShuttleSystem.GridFill.cs | 7 +--- .../Shuttles/Systems/ShuttleSystem.cs | 7 ---- .../Station/Systems/StationJobsSystem.cs | 2 +- .../Station/Systems/StationSpawningSystem.cs | 2 +- .../Station/Systems/StationSystem.cs | 6 +-- .../StationEvents/EventManagerSystem.cs | 8 +--- Content.Server/Tips/TipsSystem.cs | 8 ++-- .../Worldgen/Systems/WorldgenConfigSystem.cs | 4 +- .../Cryostorage/SharedCryostorageSystem.cs | 9 +---- .../Friction/TileFrictionController.cs | 16 +------- .../Systems/SharedMoverController.Input.cs | 13 +------ .../Movement/Systems/SharedMoverController.cs | 9 +---- 51 files changed, 119 insertions(+), 415 deletions(-) diff --git a/Content.Client/Audio/AmbientSoundSystem.cs b/Content.Client/Audio/AmbientSoundSystem.cs index d39073fa330c..9d30cabb1ecb 100644 --- a/Content.Client/Audio/AmbientSoundSystem.cs +++ b/Content.Client/Audio/AmbientSoundSystem.cs @@ -99,10 +99,10 @@ public override void Initialize() UpdatesOutsidePrediction = true; UpdatesAfter.Add(typeof(AmbientSoundTreeSystem)); - _cfg.OnValueChanged(CCVars.AmbientCooldown, SetCooldown, true); - _cfg.OnValueChanged(CCVars.MaxAmbientSources, SetAmbientCount, true); - _cfg.OnValueChanged(CCVars.AmbientRange, SetAmbientRange, true); - _cfg.OnValueChanged(CCVars.AmbienceVolume, SetAmbienceGain, true); + Subs.CVar(_cfg, CCVars.AmbientCooldown, SetCooldown, true); + Subs.CVar(_cfg, CCVars.MaxAmbientSources, SetAmbientCount, true); + Subs.CVar(_cfg, CCVars.AmbientRange, SetAmbientRange, true); + Subs.CVar(_cfg, CCVars.AmbienceVolume, SetAmbienceGain, true); SubscribeLocalEvent(OnShutdown); } @@ -138,11 +138,6 @@ public override void Shutdown() { base.Shutdown(); ClearSounds(); - - _cfg.UnsubValueChanged(CCVars.AmbientCooldown, SetCooldown); - _cfg.UnsubValueChanged(CCVars.MaxAmbientSources, SetAmbientCount); - _cfg.UnsubValueChanged(CCVars.AmbientRange, SetAmbientRange); - _cfg.UnsubValueChanged(CCVars.AmbienceVolume, SetAmbienceGain); } private int PlayingCount(string countSound) diff --git a/Content.Client/Audio/BackgroundAudioSystem.cs b/Content.Client/Audio/BackgroundAudioSystem.cs index 29279830627e..702f810e27cf 100644 --- a/Content.Client/Audio/BackgroundAudioSystem.cs +++ b/Content.Client/Audio/BackgroundAudioSystem.cs @@ -34,8 +34,8 @@ public override void Initialize() { base.Initialize(); - _configManager.OnValueChanged(CCVars.LobbyMusicEnabled, LobbyMusicCVarChanged); - _configManager.OnValueChanged(CCVars.LobbyMusicVolume, LobbyMusicVolumeCVarChanged); + Subs.CVar(_configManager, CCVars.LobbyMusicEnabled, LobbyMusicCVarChanged); + Subs.CVar(_configManager, CCVars.LobbyMusicVolume, LobbyMusicVolumeCVarChanged); _stateManager.OnStateChanged += StateManagerOnStateChanged; @@ -50,9 +50,6 @@ public override void Shutdown() { base.Shutdown(); - _configManager.UnsubValueChanged(CCVars.LobbyMusicEnabled, LobbyMusicCVarChanged); - _configManager.UnsubValueChanged(CCVars.LobbyMusicVolume, LobbyMusicVolumeCVarChanged); - _stateManager.OnStateChanged -= StateManagerOnStateChanged; _client.PlayerLeaveServer -= OnLeave; diff --git a/Content.Client/Audio/ClientGlobalSoundSystem.cs b/Content.Client/Audio/ClientGlobalSoundSystem.cs index 1d98564090a1..7c77865f7415 100644 --- a/Content.Client/Audio/ClientGlobalSoundSystem.cs +++ b/Content.Client/Audio/ClientGlobalSoundSystem.cs @@ -26,11 +26,11 @@ public override void Initialize() base.Initialize(); SubscribeLocalEvent(OnRoundRestart); SubscribeNetworkEvent(PlayAdminSound); - _cfg.OnValueChanged(CCVars.AdminSoundsEnabled, ToggleAdminSound, true); + Subs.CVar(_cfg, CCVars.AdminSoundsEnabled, ToggleAdminSound, true); SubscribeNetworkEvent(PlayStationEventMusic); SubscribeNetworkEvent(StopStationEventMusic); - _cfg.OnValueChanged(CCVars.EventMusicEnabled, ToggleStationEventMusic, true); + Subs.CVar(_cfg, CCVars.EventMusicEnabled, ToggleStationEventMusic, true); SubscribeNetworkEvent(PlayGameSound); } diff --git a/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs b/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs index 89324f22252f..cf084dc2ce66 100644 --- a/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs +++ b/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs @@ -59,7 +59,7 @@ public sealed partial class ContentAudioSystem private void InitializeAmbientMusic() { - _configManager.OnValueChanged(CCVars.AmbientMusicVolume, AmbienceCVarChanged, true); + Subs.CVar(_configManager, CCVars.AmbientMusicVolume, AmbienceCVarChanged, true); _sawmill = IoCManager.Resolve().GetSawmill("audio.ambience"); // Reset audio @@ -84,7 +84,6 @@ private void AmbienceCVarChanged(float obj) private void ShutdownAmbientMusic() { - _configManager.UnsubValueChanged(CCVars.AmbientMusicVolume, AmbienceCVarChanged); _state.OnStateChanged -= OnStateChange; _ambientMusicStream = _audio.Stop(_ambientMusicStream); } diff --git a/Content.Client/Camera/CameraRecoilSystem.cs b/Content.Client/Camera/CameraRecoilSystem.cs index bb419b465d32..562ceb21e5c9 100644 --- a/Content.Client/Camera/CameraRecoilSystem.cs +++ b/Content.Client/Camera/CameraRecoilSystem.cs @@ -16,14 +16,7 @@ public override void Initialize() base.Initialize(); SubscribeNetworkEvent(OnCameraKick); - _configManager.OnValueChanged(CCVars.ScreenShakeIntensity, OnCvarChanged, true); - } - - public override void Shutdown() - { - base.Shutdown(); - - _configManager.UnsubValueChanged(CCVars.ScreenShakeIntensity, OnCvarChanged); + Subs.CVar(_configManager, CCVars.ScreenShakeIntensity, OnCvarChanged, true); } private void OnCvarChanged(float value) diff --git a/Content.Client/Chat/TypingIndicator/TypingIndicatorSystem.cs b/Content.Client/Chat/TypingIndicator/TypingIndicatorSystem.cs index 0eea36aa573b..48a8ffb8df9f 100644 --- a/Content.Client/Chat/TypingIndicator/TypingIndicatorSystem.cs +++ b/Content.Client/Chat/TypingIndicator/TypingIndicatorSystem.cs @@ -20,7 +20,8 @@ public sealed class TypingIndicatorSystem : SharedTypingIndicatorSystem public override void Initialize() { base.Initialize(); - _cfg.OnValueChanged(CCVars.ChatShowTypingIndicator, OnShowTypingChanged); + + Subs.CVar(_cfg, CCVars.ChatShowTypingIndicator, OnShowTypingChanged); } public void ClientChangedChatText() diff --git a/Content.Client/CombatMode/CombatModeSystem.cs b/Content.Client/CombatMode/CombatModeSystem.cs index 34ae0b1338b5..cfb66bf39025 100644 --- a/Content.Client/CombatMode/CombatModeSystem.cs +++ b/Content.Client/CombatMode/CombatModeSystem.cs @@ -28,7 +28,7 @@ public override void Initialize() SubscribeLocalEvent(OnHandleState); - _cfg.OnValueChanged(CCVars.CombatModeIndicatorsPointShow, OnShowCombatIndicatorsChanged, true); + Subs.CVar(_cfg, CCVars.CombatModeIndicatorsPointShow, OnShowCombatIndicatorsChanged, true); } private void OnHandleState(EntityUid uid, CombatModeComponent component, ref AfterAutoHandleStateEvent args) @@ -38,7 +38,6 @@ private void OnHandleState(EntityUid uid, CombatModeComponent component, ref Aft public override void Shutdown() { - _cfg.UnsubValueChanged(CCVars.CombatModeIndicatorsPointShow, OnShowCombatIndicatorsChanged); _overlayManager.RemoveOverlay(); base.Shutdown(); diff --git a/Content.Client/Instruments/InstrumentSystem.cs b/Content.Client/Instruments/InstrumentSystem.cs index d9c9b66dcb67..5bdaa52359da 100644 --- a/Content.Client/Instruments/InstrumentSystem.cs +++ b/Content.Client/Instruments/InstrumentSystem.cs @@ -29,8 +29,8 @@ public override void Initialize() UpdatesOutsidePrediction = true; - _cfg.OnValueChanged(CCVars.MaxMidiEventsPerBatch, OnMaxMidiEventsPerBatchChanged, true); - _cfg.OnValueChanged(CCVars.MaxMidiEventsPerSecond, OnMaxMidiEventsPerSecondChanged, true); + Subs.CVar(_cfg, CCVars.MaxMidiEventsPerBatch, OnMaxMidiEventsPerBatchChanged, true); + Subs.CVar(_cfg, CCVars.MaxMidiEventsPerSecond, OnMaxMidiEventsPerSecondChanged, true); SubscribeNetworkEvent(OnMidiEventRx); SubscribeNetworkEvent(OnMidiStart); @@ -60,14 +60,6 @@ private void OnHandleState(EntityUid uid, SharedInstrumentComponent component, r EndRenderer(uid, true, component); } - public override void Shutdown() - { - base.Shutdown(); - - _cfg.UnsubValueChanged(CCVars.MaxMidiEventsPerBatch, OnMaxMidiEventsPerBatchChanged); - _cfg.UnsubValueChanged(CCVars.MaxMidiEventsPerSecond, OnMaxMidiEventsPerSecondChanged); - } - private void OnShutdown(EntityUid uid, InstrumentComponent component, ComponentShutdown args) { EndRenderer(uid, false, component); diff --git a/Content.Client/Interaction/DragDropSystem.cs b/Content.Client/Interaction/DragDropSystem.cs index 66571a9d27f7..b774b0d40e27 100644 --- a/Content.Client/Interaction/DragDropSystem.cs +++ b/Content.Client/Interaction/DragDropSystem.cs @@ -109,7 +109,7 @@ public override void Initialize() UpdatesOutsidePrediction = true; UpdatesAfter.Add(typeof(SharedEyeSystem)); - _cfgMan.OnValueChanged(CCVars.DragDropDeadZone, SetDeadZone, true); + Subs.CVar(_cfgMan, CCVars.DragDropDeadZone, SetDeadZone, true); _dropTargetInRangeShader = _prototypeManager.Index(ShaderDropTargetInRange).Instance(); _dropTargetOutOfRangeShader = _prototypeManager.Index(ShaderDropTargetOutOfRange).Instance(); @@ -126,7 +126,6 @@ private void SetDeadZone(float deadZone) public override void Shutdown() { - _cfgMan.UnsubValueChanged(CCVars.DragDropDeadZone, SetDeadZone); CommandBinds.Unregister(); base.Shutdown(); } diff --git a/Content.Client/Outline/InteractionOutlineSystem.cs b/Content.Client/Outline/InteractionOutlineSystem.cs index bb341785d038..b99a46d06473 100644 --- a/Content.Client/Outline/InteractionOutlineSystem.cs +++ b/Content.Client/Outline/InteractionOutlineSystem.cs @@ -40,17 +40,10 @@ public override void Initialize() { base.Initialize(); - _configManager.OnValueChanged(CCVars.OutlineEnabled, SetCvarEnabled); + Subs.CVar(_configManager, CCVars.OutlineEnabled, SetCvarEnabled); UpdatesAfter.Add(typeof(SharedEyeSystem)); } - public override void Shutdown() - { - base.Shutdown(); - - _configManager.UnsubValueChanged(CCVars.OutlineEnabled, SetCvarEnabled); - } - public void SetCvarEnabled(bool cvarEnabled) { _cvarEnabled = cvarEnabled; diff --git a/Content.Client/StatusIcon/StatusIconSystem.cs b/Content.Client/StatusIcon/StatusIconSystem.cs index bd708b63d019..980fd9f2a929 100644 --- a/Content.Client/StatusIcon/StatusIconSystem.cs +++ b/Content.Client/StatusIcon/StatusIconSystem.cs @@ -20,16 +20,8 @@ public sealed class StatusIconSystem : SharedStatusIconSystem /// public override void Initialize() { - _configuration.OnValueChanged(CCVars.LocalStatusIconsEnabled, OnLocalStatusIconChanged, true); - _configuration.OnValueChanged(CCVars.GlobalStatusIconsEnabled, OnGlobalStatusIconChanged, true); - } - - public override void Shutdown() - { - base.Shutdown(); - - _configuration.UnsubValueChanged(CCVars.LocalStatusIconsEnabled, OnLocalStatusIconChanged); - _configuration.UnsubValueChanged(CCVars.GlobalStatusIconsEnabled, OnGlobalStatusIconChanged); + Subs.CVar(_configuration, CCVars.LocalStatusIconsEnabled, OnLocalStatusIconChanged, true); + Subs.CVar(_configuration, CCVars.GlobalStatusIconsEnabled, OnGlobalStatusIconChanged, true); } private void OnLocalStatusIconChanged(bool obj) diff --git a/Content.Server/Administration/Systems/AdminSystem.cs b/Content.Server/Administration/Systems/AdminSystem.cs index 2d9e3393f318..9d41e9181988 100644 --- a/Content.Server/Administration/Systems/AdminSystem.cs +++ b/Content.Server/Administration/Systems/AdminSystem.cs @@ -70,13 +70,13 @@ public override void Initialize() _playerManager.PlayerStatusChanged += OnPlayerStatusChanged; _adminManager.OnPermsChanged += OnAdminPermsChanged; - _config.OnValueChanged(CCVars.PanicBunkerEnabled, OnPanicBunkerChanged, true); - _config.OnValueChanged(CCVars.PanicBunkerDisableWithAdmins, OnPanicBunkerDisableWithAdminsChanged, true); - _config.OnValueChanged(CCVars.PanicBunkerEnableWithoutAdmins, OnPanicBunkerEnableWithoutAdminsChanged, true); - _config.OnValueChanged(CCVars.PanicBunkerCountDeadminnedAdmins, OnPanicBunkerCountDeadminnedAdminsChanged, true); - _config.OnValueChanged(CCVars.PanicBunkerShowReason, OnShowReasonChanged, true); - _config.OnValueChanged(CCVars.PanicBunkerMinAccountAge, OnPanicBunkerMinAccountAgeChanged, true); - _config.OnValueChanged(CCVars.PanicBunkerMinOverallHours, OnPanicBunkerMinOverallHoursChanged, true); + Subs.CVar(_config, CCVars.PanicBunkerEnabled, OnPanicBunkerChanged, true); + Subs.CVar(_config, CCVars.PanicBunkerDisableWithAdmins, OnPanicBunkerDisableWithAdminsChanged, true); + Subs.CVar(_config, CCVars.PanicBunkerEnableWithoutAdmins, OnPanicBunkerEnableWithoutAdminsChanged, true); + Subs.CVar(_config, CCVars.PanicBunkerCountDeadminnedAdmins, OnPanicBunkerCountDeadminnedAdminsChanged, true); + Subs.CVar(_config, CCVars.PanicBunkerShowReason, OnShowReasonChanged, true); + Subs.CVar(_config, CCVars.PanicBunkerMinAccountAge, OnPanicBunkerMinAccountAgeChanged, true); + Subs.CVar(_config, CCVars.PanicBunkerMinOverallHours, OnPanicBunkerMinOverallHoursChanged, true); SubscribeLocalEvent(OnIdentityChanged); SubscribeLocalEvent(OnPlayerAttached); @@ -188,14 +188,6 @@ public override void Shutdown() base.Shutdown(); _playerManager.PlayerStatusChanged -= OnPlayerStatusChanged; _adminManager.OnPermsChanged -= OnAdminPermsChanged; - - _config.UnsubValueChanged(CCVars.PanicBunkerEnabled, OnPanicBunkerChanged); - _config.UnsubValueChanged(CCVars.PanicBunkerDisableWithAdmins, OnPanicBunkerDisableWithAdminsChanged); - _config.UnsubValueChanged(CCVars.PanicBunkerEnableWithoutAdmins, OnPanicBunkerEnableWithoutAdminsChanged); - _config.UnsubValueChanged(CCVars.PanicBunkerCountDeadminnedAdmins, OnPanicBunkerCountDeadminnedAdminsChanged); - _config.UnsubValueChanged(CCVars.PanicBunkerShowReason, OnShowReasonChanged); - _config.UnsubValueChanged(CCVars.PanicBunkerMinAccountAge, OnPanicBunkerMinAccountAgeChanged); - _config.UnsubValueChanged(CCVars.PanicBunkerMinOverallHours, OnPanicBunkerMinOverallHoursChanged); } private void OnPlayerStatusChanged(object? sender, SessionStatusEventArgs e) diff --git a/Content.Server/Administration/Systems/BwoinkSystem.cs b/Content.Server/Administration/Systems/BwoinkSystem.cs index 5439b27f4249..663754b8ccde 100644 --- a/Content.Server/Administration/Systems/BwoinkSystem.cs +++ b/Content.Server/Administration/Systems/BwoinkSystem.cs @@ -66,11 +66,11 @@ public sealed class BwoinkSystem : SharedBwoinkSystem public override void Initialize() { base.Initialize(); - _config.OnValueChanged(CCVars.DiscordAHelpWebhook, OnWebhookChanged, true); - _config.OnValueChanged(CCVars.DiscordAHelpFooterIcon, OnFooterIconChanged, true); - _config.OnValueChanged(CCVars.DiscordAHelpAvatar, OnAvatarChanged, true); - _config.OnValueChanged(CVars.GameHostName, OnServerNameChanged, true); - _config.OnValueChanged(CCVars.AdminAhelpOverrideClientName, OnOverrideChanged, true); + Subs.CVar(_config, CCVars.DiscordAHelpWebhook, OnWebhookChanged, true); + Subs.CVar(_config, CCVars.DiscordAHelpFooterIcon, OnFooterIconChanged, true); + Subs.CVar(_config, CCVars.DiscordAHelpAvatar, OnAvatarChanged, true); + Subs.CVar(_config, CVars.GameHostName, OnServerNameChanged, true); + Subs.CVar(_config, CCVars.AdminAhelpOverrideClientName, OnOverrideChanged, true); _sawmill = IoCManager.Resolve().GetSawmill("AHELP"); _maxAdditionalChars = GenerateAHelpMessage("", "", true, _gameTicker.RoundDuration().ToString("hh\\:mm\\:ss"), _gameTicker.RunLevel).Length; _playerManager.PlayerStatusChanged += OnPlayerStatusChanged; @@ -147,15 +147,6 @@ private void OnServerNameChanged(string obj) _serverName = obj; } - public override void Shutdown() - { - base.Shutdown(); - _config.UnsubValueChanged(CCVars.DiscordAHelpWebhook, OnWebhookChanged); - _config.UnsubValueChanged(CCVars.DiscordAHelpFooterIcon, OnFooterIconChanged); - _config.UnsubValueChanged(CVars.GameHostName, OnServerNameChanged); - _config.UnsubValueChanged(CCVars.AdminAhelpOverrideClientName, OnOverrideChanged); - } - private async void OnWebhookChanged(string url) { _webhookUrl = url; diff --git a/Content.Server/Afk/AFKSystem.cs b/Content.Server/Afk/AFKSystem.cs index b8cfdfe6b3dd..39d1e266d70e 100644 --- a/Content.Server/Afk/AFKSystem.cs +++ b/Content.Server/Afk/AFKSystem.cs @@ -30,7 +30,7 @@ public override void Initialize() { base.Initialize(); _playerManager.PlayerStatusChanged += OnPlayerChange; - _configManager.OnValueChanged(CCVars.AfkTime, SetAfkDelay, true); + Subs.CVar(_configManager, CCVars.AfkTime, SetAfkDelay, true); SubscribeNetworkEvent(HandleInputCmd); } @@ -60,7 +60,6 @@ public override void Shutdown() base.Shutdown(); _afkPlayers.Clear(); _playerManager.PlayerStatusChanged -= OnPlayerChange; - _configManager.UnsubValueChanged(CCVars.AfkTime, SetAfkDelay); } public override void Update(float frameTime) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs index 7f82e6fb57b9..3aaa5429fb03 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs @@ -36,25 +36,25 @@ public sealed partial class AtmosphereSystem private void InitializeCVars() { - _cfg.OnValueChanged(CCVars.SpaceWind, value => SpaceWind = value, true); - _cfg.OnValueChanged(CCVars.SpaceWindPressureForceDivisorThrow, value => SpaceWindPressureForceDivisorThrow = value, true); - _cfg.OnValueChanged(CCVars.SpaceWindPressureForceDivisorPush, value => SpaceWindPressureForceDivisorPush = value, true); - _cfg.OnValueChanged(CCVars.SpaceWindMaxVelocity, value => SpaceWindMaxVelocity = value, true); - _cfg.OnValueChanged(CCVars.SpaceWindMaxPushForce, value => SpaceWindMaxPushForce = value, true); - _cfg.OnValueChanged(CCVars.MonstermosEqualization, value => MonstermosEqualization = value, true); - _cfg.OnValueChanged(CCVars.MonstermosDepressurization, value => MonstermosDepressurization = value, true); - _cfg.OnValueChanged(CCVars.MonstermosRipTiles, value => MonstermosRipTiles = value, true); - _cfg.OnValueChanged(CCVars.AtmosGridImpulse, value => GridImpulse = value, true); - _cfg.OnValueChanged(CCVars.AtmosSpacingEscapeRatio, value => SpacingEscapeRatio = value, true); - _cfg.OnValueChanged(CCVars.AtmosSpacingMinGas, value => SpacingMinGas = value, true); - _cfg.OnValueChanged(CCVars.AtmosSpacingMaxWind, value => SpacingMaxWind = value, true); - _cfg.OnValueChanged(CCVars.Superconduction, value => Superconduction = value, true); - _cfg.OnValueChanged(CCVars.AtmosMaxProcessTime, value => AtmosMaxProcessTime = value, true); - _cfg.OnValueChanged(CCVars.AtmosTickRate, value => AtmosTickRate = value, true); - _cfg.OnValueChanged(CCVars.AtmosSpeedup, value => Speedup = value, true); - _cfg.OnValueChanged(CCVars.AtmosHeatScale, value => { HeatScale = value; InitializeGases(); }, true); - _cfg.OnValueChanged(CCVars.ExcitedGroups, value => ExcitedGroups = value, true); - _cfg.OnValueChanged(CCVars.ExcitedGroupsSpaceIsAllConsuming, value => ExcitedGroupsSpaceIsAllConsuming = value, true); + Subs.CVar(_cfg, CCVars.SpaceWind, value => SpaceWind = value, true); + Subs.CVar(_cfg, CCVars.SpaceWindPressureForceDivisorThrow, value => SpaceWindPressureForceDivisorThrow = value, true); + Subs.CVar(_cfg, CCVars.SpaceWindPressureForceDivisorPush, value => SpaceWindPressureForceDivisorPush = value, true); + Subs.CVar(_cfg, CCVars.SpaceWindMaxVelocity, value => SpaceWindMaxVelocity = value, true); + Subs.CVar(_cfg, CCVars.SpaceWindMaxPushForce, value => SpaceWindMaxPushForce = value, true); + Subs.CVar(_cfg, CCVars.MonstermosEqualization, value => MonstermosEqualization = value, true); + Subs.CVar(_cfg, CCVars.MonstermosDepressurization, value => MonstermosDepressurization = value, true); + Subs.CVar(_cfg, CCVars.MonstermosRipTiles, value => MonstermosRipTiles = value, true); + Subs.CVar(_cfg, CCVars.AtmosGridImpulse, value => GridImpulse = value, true); + Subs.CVar(_cfg, CCVars.AtmosSpacingEscapeRatio, value => SpacingEscapeRatio = value, true); + Subs.CVar(_cfg, CCVars.AtmosSpacingMinGas, value => SpacingMinGas = value, true); + Subs.CVar(_cfg, CCVars.AtmosSpacingMaxWind, value => SpacingMaxWind = value, true); + Subs.CVar(_cfg, CCVars.Superconduction, value => Superconduction = value, true); + Subs.CVar(_cfg, CCVars.AtmosMaxProcessTime, value => AtmosMaxProcessTime = value, true); + Subs.CVar(_cfg, CCVars.AtmosTickRate, value => AtmosTickRate = value, true); + Subs.CVar(_cfg, CCVars.AtmosSpeedup, value => Speedup = value, true); + Subs.CVar(_cfg, CCVars.AtmosHeatScale, value => { HeatScale = value; InitializeGases(); }, true); + Subs.CVar(_cfg, CCVars.ExcitedGroups, value => ExcitedGroups = value, true); + Subs.CVar(_cfg, CCVars.ExcitedGroupsSpaceIsAllConsuming, value => ExcitedGroupsSpaceIsAllConsuming = value, true); } } } diff --git a/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs b/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs index c0fc1896e3fe..8ae9517379e8 100644 --- a/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs @@ -76,9 +76,9 @@ public override void Initialize() }; _playerManager.PlayerStatusChanged += OnPlayerStatusChanged; - _confMan.OnValueChanged(CCVars.NetGasOverlayTickRate, UpdateTickRate, true); - _confMan.OnValueChanged(CCVars.GasOverlayThresholds, UpdateThresholds, true); - _confMan.OnValueChanged(CVars.NetPVS, OnPvsToggle, true); + Subs.CVar(_confMan, CCVars.NetGasOverlayTickRate, UpdateTickRate, true); + Subs.CVar(_confMan, CCVars.GasOverlayThresholds, UpdateThresholds, true); + Subs.CVar(_confMan, CVars.NetPVS, OnPvsToggle, true); SubscribeLocalEvent(Reset); SubscribeLocalEvent(OnStartup); @@ -95,9 +95,6 @@ public override void Shutdown() { base.Shutdown(); _playerManager.PlayerStatusChanged -= OnPlayerStatusChanged; - _confMan.UnsubValueChanged(CCVars.NetGasOverlayTickRate, UpdateTickRate); - _confMan.UnsubValueChanged(CCVars.GasOverlayThresholds, UpdateThresholds); - _confMan.UnsubValueChanged(CVars.NetPVS, OnPvsToggle); } private void OnPvsToggle(bool value) diff --git a/Content.Server/Atmos/EntitySystems/HeatExchangerSystem.cs b/Content.Server/Atmos/EntitySystems/HeatExchangerSystem.cs index af73bcd7f90c..286b154e96fa 100644 --- a/Content.Server/Atmos/EntitySystems/HeatExchangerSystem.cs +++ b/Content.Server/Atmos/EntitySystems/HeatExchangerSystem.cs @@ -30,13 +30,7 @@ public override void Initialize() SubscribeLocalEvent(OnAtmosUpdate); // Getting CVars is expensive, don't do it every tick - _cfg.OnValueChanged(CCVars.SuperconductionTileLoss, CacheTileLoss, true); - } - - public override void Shutdown() - { - base.Shutdown(); - _cfg.UnsubValueChanged(CCVars.SuperconductionTileLoss, CacheTileLoss); + Subs.CVar(_cfg, CCVars.SuperconductionTileLoss, CacheTileLoss, true); } private void CacheTileLoss(float val) diff --git a/Content.Server/CartridgeLoader/Cartridges/CrewManifestCartridgeSystem.cs b/Content.Server/CartridgeLoader/Cartridges/CrewManifestCartridgeSystem.cs index fca29a401327..5247aafbd518 100644 --- a/Content.Server/CartridgeLoader/Cartridges/CrewManifestCartridgeSystem.cs +++ b/Content.Server/CartridgeLoader/Cartridges/CrewManifestCartridgeSystem.cs @@ -31,7 +31,7 @@ public override void Initialize() SubscribeLocalEvent(OnUiMessage); SubscribeLocalEvent(OnUiReady); SubscribeLocalEvent(OnInstallationAttempt); - _configManager.OnValueChanged(CCVars.CrewManifestUnsecure, OnCrewManifestUnsecureChanged, true); + Subs.CVar(_configManager, CCVars.CrewManifestUnsecure, OnCrewManifestUnsecureChanged, true); } /// @@ -92,10 +92,4 @@ private void OnCrewManifestUnsecureChanged(bool unsecureViewersAllowed) _cartridgeLoader.UninstallProgram(loaderUid, program.Value, comp); } } - - public override void Shutdown() - { - base.Shutdown(); - _configManager.UnsubValueChanged(CCVars.CrewManifestUnsecure, OnCrewManifestUnsecureChanged); - } } diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 13cc6df67412..111e56a2a35a 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -72,21 +72,13 @@ public override void Initialize() { base.Initialize(); CacheEmotes(); - _configurationManager.OnValueChanged(CCVars.LoocEnabled, OnLoocEnabledChanged, true); - _configurationManager.OnValueChanged(CCVars.DeadLoocEnabled, OnDeadLoocEnabledChanged, true); - _configurationManager.OnValueChanged(CCVars.CritLoocEnabled, OnCritLoocEnabledChanged, true); + Subs.CVar(_configurationManager, CCVars.LoocEnabled, OnLoocEnabledChanged, true); + Subs.CVar(_configurationManager, CCVars.DeadLoocEnabled, OnDeadLoocEnabledChanged, true); + Subs.CVar(_configurationManager, CCVars.CritLoocEnabled, OnCritLoocEnabledChanged, true); SubscribeLocalEvent(OnGameChange); } - public override void Shutdown() - { - base.Shutdown(); - _configurationManager.UnsubValueChanged(CCVars.LoocEnabled, OnLoocEnabledChanged); - _configurationManager.UnsubValueChanged(CCVars.DeadLoocEnabled, OnDeadLoocEnabledChanged); - _configurationManager.UnsubValueChanged(CCVars.CritLoocEnabled, OnCritLoocEnabledChanged); - } - private void OnLoocEnabledChanged(bool val) { if (_loocEnabled == val) return; diff --git a/Content.Server/Chunking/ChunkingSystem.cs b/Content.Server/Chunking/ChunkingSystem.cs index 3919361af13d..e4775439cb61 100644 --- a/Content.Server/Chunking/ChunkingSystem.cs +++ b/Content.Server/Chunking/ChunkingSystem.cs @@ -29,13 +29,7 @@ public override void Initialize() { base.Initialize(); _xformQuery = GetEntityQuery(); - _configurationManager.OnValueChanged(CVars.NetMaxUpdateRange, OnPvsRangeChanged, true); - } - - public override void Shutdown() - { - base.Shutdown(); - _configurationManager.UnsubValueChanged(CVars.NetMaxUpdateRange, OnPvsRangeChanged); + Subs.CVar(_configurationManager, CVars.NetMaxUpdateRange, OnPvsRangeChanged, true); } private void OnPvsRangeChanged(float value) diff --git a/Content.Server/Decals/DecalSystem.cs b/Content.Server/Decals/DecalSystem.cs index 101d077d49d3..5bfd91486cae 100644 --- a/Content.Server/Decals/DecalSystem.cs +++ b/Content.Server/Decals/DecalSystem.cs @@ -70,7 +70,7 @@ public override void Initialize() SubscribeNetworkEvent(OnDecalRemovalRequest); SubscribeLocalEvent(OnGridSplit); - _conf.OnValueChanged(CVars.NetPVS, OnPvsToggle, true); + Subs.CVar(_conf, CVars.NetPVS, OnPvsToggle, true); } private void OnPvsToggle(bool value) @@ -153,7 +153,6 @@ public override void Shutdown() base.Shutdown(); _playerManager.PlayerStatusChanged -= OnPlayerStatusChanged; - _conf.UnsubValueChanged(CVars.NetPVS, OnPvsToggle); } private void OnTileChanged(ref TileChangedEvent args) diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.CVars.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.CVars.cs index d03c64fd378b..1f031093333f 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.CVars.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.CVars.cs @@ -15,34 +15,13 @@ public sealed partial class ExplosionSystem : EntitySystem private void SubscribeCvars() { - _cfg.OnValueChanged(CCVars.ExplosionTilesPerTick, SetTilesPerTick, true); - _cfg.OnValueChanged(CCVars.ExplosionThrowLimit, SetThrowLimit, true); - _cfg.OnValueChanged(CCVars.ExplosionSleepNodeSys, SetSleepNodeSys, true); - _cfg.OnValueChanged(CCVars.ExplosionMaxArea, SetMaxArea, true); - _cfg.OnValueChanged(CCVars.ExplosionMaxIterations, SetMaxIterations, true); - _cfg.OnValueChanged(CCVars.ExplosionMaxProcessingTime, SetMaxProcessingTime, true); - _cfg.OnValueChanged(CCVars.ExplosionIncrementalTileBreaking, SetIncrementalTileBreaking, true); - _cfg.OnValueChanged(CCVars.ExplosionSingleTickAreaLimit, SetSingleTickAreaLimit, true); + Subs.CVar(_cfg, CCVars.ExplosionTilesPerTick, value => TilesPerTick = value, true); + Subs.CVar(_cfg, CCVars.ExplosionThrowLimit, value => ThrowLimit = value, true); + Subs.CVar(_cfg, CCVars.ExplosionSleepNodeSys, value => SleepNodeSys = value, true); + Subs.CVar(_cfg, CCVars.ExplosionMaxArea, value => MaxArea = value, true); + Subs.CVar(_cfg, CCVars.ExplosionMaxIterations, value => MaxIterations = value, true); + Subs.CVar(_cfg, CCVars.ExplosionMaxProcessingTime, value => MaxProcessingTime = value, true); + Subs.CVar(_cfg, CCVars.ExplosionIncrementalTileBreaking, value => IncrementalTileBreaking = value, true); + Subs.CVar(_cfg, CCVars.ExplosionSingleTickAreaLimit, value => SingleTickAreaLimit = value, true); } - - private void UnsubscribeCvars() - { - _cfg.UnsubValueChanged(CCVars.ExplosionTilesPerTick, SetTilesPerTick); - _cfg.UnsubValueChanged(CCVars.ExplosionThrowLimit, SetThrowLimit); - _cfg.UnsubValueChanged(CCVars.ExplosionSleepNodeSys, SetSleepNodeSys); - _cfg.UnsubValueChanged(CCVars.ExplosionMaxArea, SetMaxArea); - _cfg.UnsubValueChanged(CCVars.ExplosionMaxIterations, SetMaxIterations); - _cfg.UnsubValueChanged(CCVars.ExplosionMaxProcessingTime, SetMaxProcessingTime); - _cfg.UnsubValueChanged(CCVars.ExplosionIncrementalTileBreaking, SetIncrementalTileBreaking); - _cfg.UnsubValueChanged(CCVars.ExplosionSingleTickAreaLimit, SetSingleTickAreaLimit); - } - - private void SetTilesPerTick(int value) => TilesPerTick = value; - private void SetThrowLimit(int value) => ThrowLimit = value; - private void SetSleepNodeSys(bool value) => SleepNodeSys = value; - private void SetMaxArea(int value) => MaxArea = value; - private void SetMaxIterations(int value) => MaxIterations = value; - private void SetMaxProcessingTime(float value) => MaxProcessingTime = value; - private void SetIncrementalTileBreaking(bool value) => IncrementalTileBreaking = value; - private void SetSingleTickAreaLimit(int value) => SingleTickAreaLimit = value; } diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs index 31df23b89d27..7495ecbb3490 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs @@ -122,7 +122,6 @@ private void OnReset(RoundRestartCleanupEvent ev) public override void Shutdown() { base.Shutdown(); - UnsubscribeCvars(); _nodeGroupSystem.PauseUpdating = false; _pathfindingSystem.PauseUpdating = false; } diff --git a/Content.Server/GameTicking/GameTicker.CVars.cs b/Content.Server/GameTicking/GameTicker.CVars.cs index c77d56ad14c1..6e1fda3e2d70 100644 --- a/Content.Server/GameTicking/GameTicker.CVars.cs +++ b/Content.Server/GameTicking/GameTicker.CVars.cs @@ -33,7 +33,7 @@ public sealed partial class GameTicker private void InitializeCVars() { - _configurationManager.OnValueChanged(CCVars.GameLobbyEnabled, value => + Subs.CVar(_configurationManager, CCVars.GameLobbyEnabled, value => { LobbyEnabled = value; foreach (var (userId, status) in _playerGameStatuses) @@ -44,23 +44,23 @@ private void InitializeCVars() LobbyEnabled ? PlayerGameStatus.NotReadyToPlay : PlayerGameStatus.ReadyToPlay; } }, true); - _configurationManager.OnValueChanged(CCVars.GameDummyTicker, value => DummyTicker = value, true); - _configurationManager.OnValueChanged(CCVars.GameLobbyDuration, value => LobbyDuration = TimeSpan.FromSeconds(value), true); - _configurationManager.OnValueChanged(CCVars.GameDisallowLateJoins, + Subs.CVar(_configurationManager, CCVars.GameDummyTicker, value => DummyTicker = value, true); + Subs.CVar(_configurationManager, CCVars.GameLobbyDuration, value => LobbyDuration = TimeSpan.FromSeconds(value), true); + Subs.CVar(_configurationManager, CCVars.GameDisallowLateJoins, value => { DisallowLateJoin = value; UpdateLateJoinStatus(); }, true); - _configurationManager.OnValueChanged(CCVars.AdminLogsServerName, value => + Subs.CVar(_configurationManager, CCVars.AdminLogsServerName, value => { // TODO why tf is the server name on admin logs ServerName = value; }, true); - _configurationManager.OnValueChanged(CCVars.DiscordRoundUpdateWebhook, value => + Subs.CVar(_configurationManager, CCVars.DiscordRoundUpdateWebhook, value => { if (!string.IsNullOrWhiteSpace(value)) { _discord.GetWebhook(value, data => _webhookIdentifier = data.ToIdentifier()); } }, true); - _configurationManager.OnValueChanged(CCVars.DiscordRoundEndRoleWebhook, value => + Subs.CVar(_configurationManager, CCVars.DiscordRoundEndRoleWebhook, value => { DiscordRoundEndRole = value; @@ -70,7 +70,7 @@ private void InitializeCVars() } }, true); #if EXCEPTION_TOLERANCE - _configurationManager.OnValueChanged(CCVars.RoundStartFailShutdownCount, value => RoundStartFailShutdownCount = value, true); + Subs.CVar(_configurationManager, CCVars.RoundStartFailShutdownCount, value => RoundStartFailShutdownCount = value, true); #endif } } diff --git a/Content.Server/Holiday/HolidaySystem.cs b/Content.Server/Holiday/HolidaySystem.cs index 865d78c8f115..001508593da3 100644 --- a/Content.Server/Holiday/HolidaySystem.cs +++ b/Content.Server/Holiday/HolidaySystem.cs @@ -23,7 +23,7 @@ public sealed class HolidaySystem : EntitySystem public override void Initialize() { - _configManager.OnValueChanged(CCVars.HolidaysEnabled, OnHolidaysEnableChange); + Subs.CVar(_configManager, CCVars.HolidaysEnabled, OnHolidaysEnableChange); SubscribeLocalEvent(OnRunLevelChanged); SubscribeLocalEvent(OnVisualsInit); } diff --git a/Content.Server/Instruments/InstrumentSystem.CVars.cs b/Content.Server/Instruments/InstrumentSystem.CVars.cs index 0467d94f2bbe..cf4cca30b3e1 100644 --- a/Content.Server/Instruments/InstrumentSystem.CVars.cs +++ b/Content.Server/Instruments/InstrumentSystem.CVars.cs @@ -11,37 +11,9 @@ public sealed partial class InstrumentSystem private void InitializeCVars() { - _cfg.OnValueChanged(CCVars.MaxMidiEventsPerSecond, OnMaxMidiEventsPerSecondChanged, true); - _cfg.OnValueChanged(CCVars.MaxMidiEventsPerBatch, OnMaxMidiEventsPerBatchChanged, true); - _cfg.OnValueChanged(CCVars.MaxMidiBatchesDropped, OnMaxMidiBatchesDroppedChanged, true); - _cfg.OnValueChanged(CCVars.MaxMidiLaggedBatches, OnMaxMidiLaggedBatchesChanged, true); - } - - private void ShutdownCVars() - { - _cfg.UnsubValueChanged(CCVars.MaxMidiEventsPerSecond, OnMaxMidiEventsPerSecondChanged); - _cfg.UnsubValueChanged(CCVars.MaxMidiEventsPerBatch, OnMaxMidiEventsPerBatchChanged); - _cfg.UnsubValueChanged(CCVars.MaxMidiBatchesDropped, OnMaxMidiBatchesDroppedChanged); - _cfg.UnsubValueChanged(CCVars.MaxMidiLaggedBatches, OnMaxMidiLaggedBatchesChanged); - } - - private void OnMaxMidiLaggedBatchesChanged(int obj) - { - MaxMidiLaggedBatches = obj; - } - - private void OnMaxMidiBatchesDroppedChanged(int obj) - { - MaxMidiBatchesDropped = obj; - } - - private void OnMaxMidiEventsPerBatchChanged(int obj) - { - MaxMidiEventsPerBatch = obj; - } - - private void OnMaxMidiEventsPerSecondChanged(int obj) - { - MaxMidiEventsPerSecond = obj; + Subs.CVar(_cfg, CCVars.MaxMidiEventsPerSecond, obj => MaxMidiEventsPerSecond = obj, true); + Subs.CVar(_cfg, CCVars.MaxMidiEventsPerBatch, obj => MaxMidiEventsPerBatch = obj, true); + Subs.CVar(_cfg, CCVars.MaxMidiBatchesDropped, obj => MaxMidiBatchesDropped = obj, true); + Subs.CVar(_cfg, CCVars.MaxMidiLaggedBatches, obj => MaxMidiLaggedBatches = obj, true); } } diff --git a/Content.Server/Instruments/InstrumentSystem.cs b/Content.Server/Instruments/InstrumentSystem.cs index 17899b723282..8dd9644e3c5e 100644 --- a/Content.Server/Instruments/InstrumentSystem.cs +++ b/Content.Server/Instruments/InstrumentSystem.cs @@ -191,13 +191,6 @@ private void OnMidiSetFilteredChannel(InstrumentSetFilteredChannelEvent msg, Ent Dirty(uid, instrument); } - public override void Shutdown() - { - base.Shutdown(); - - ShutdownCVars(); - } - private void OnBoundUIClosed(EntityUid uid, InstrumentComponent component, BoundUIClosedEvent args) { if (HasComp(uid) diff --git a/Content.Server/Mapping/MappingSystem.cs b/Content.Server/Mapping/MappingSystem.cs index 5b4609bcd67c..0678dab7ce2a 100644 --- a/Content.Server/Mapping/MappingSystem.cs +++ b/Content.Server/Mapping/MappingSystem.cs @@ -45,14 +45,7 @@ public override void Initialize() ToggleAutosaveCommand); _sawmill = Logger.GetSawmill("autosave"); - _cfg.OnValueChanged(CCVars.AutosaveEnabled, SetAutosaveEnabled, true); - } - - public override void Shutdown() - { - base.Shutdown(); - - _cfg.UnsubValueChanged(CCVars.AutosaveEnabled, SetAutosaveEnabled); + Subs.CVar(_cfg, CCVars.AutosaveEnabled, SetAutosaveEnabled, true); } private void SetAutosaveEnabled(bool b) diff --git a/Content.Server/Motd/MOTDSystem.cs b/Content.Server/Motd/MOTDSystem.cs index 65c14040658a..3cf77cdf0815 100644 --- a/Content.Server/Motd/MOTDSystem.cs +++ b/Content.Server/Motd/MOTDSystem.cs @@ -24,16 +24,10 @@ public sealed class MOTDSystem : EntitySystem public override void Initialize() { base.Initialize(); - _configurationManager.OnValueChanged(CCVars.MOTD, OnMOTDChanged, invokeImmediately: true); + Subs.CVar(_configurationManager, CCVars.MOTD, OnMOTDChanged, invokeImmediately: true); SubscribeLocalEvent(OnPlayerJoinedLobby); } - public override void Shutdown() - { - _configurationManager.UnsubValueChanged(CCVars.MOTD, OnMOTDChanged); - base.Shutdown(); - } - /// /// Sends the Message Of The Day, if any, to all connected players. /// diff --git a/Content.Server/NPC/Systems/NPCSteeringSystem.cs b/Content.Server/NPC/Systems/NPCSteeringSystem.cs index 3db7c586743d..149a330919f7 100644 --- a/Content.Server/NPC/Systems/NPCSteeringSystem.cs +++ b/Content.Server/NPC/Systems/NPCSteeringSystem.cs @@ -103,8 +103,8 @@ public override void Initialize() } UpdatesBefore.Add(typeof(SharedPhysicsSystem)); - _configManager.OnValueChanged(CCVars.NPCEnabled, SetNPCEnabled, true); - _configManager.OnValueChanged(CCVars.NPCPathfinding, SetNPCPathfinding, true); + Subs.CVar(_configManager, CCVars.NPCEnabled, SetNPCEnabled, true); + Subs.CVar(_configManager, CCVars.NPCPathfinding, SetNPCPathfinding, true); SubscribeLocalEvent(OnSteeringShutdown); SubscribeLocalEvent(OnSteeringUnpaused); @@ -140,13 +140,6 @@ private void SetNPCPathfinding(bool value) } } - public override void Shutdown() - { - base.Shutdown(); - _configManager.UnsubValueChanged(CCVars.NPCEnabled, SetNPCEnabled); - _configManager.UnsubValueChanged(CCVars.NPCPathfinding, SetNPCPathfinding); - } - private void OnDebugRequest(RequestNPCSteeringDebugEvent msg, EntitySessionEventArgs args) { if (!_admin.IsAdmin(args.SenderSession)) diff --git a/Content.Server/NPC/Systems/NPCSystem.cs b/Content.Server/NPC/Systems/NPCSystem.cs index 7d33133a3767..8abe0f7f54cc 100644 --- a/Content.Server/NPC/Systems/NPCSystem.cs +++ b/Content.Server/NPC/Systems/NPCSystem.cs @@ -34,8 +34,8 @@ public override void Initialize() { base.Initialize(); - _configurationManager.OnValueChanged(CCVars.NPCEnabled, SetEnabled, true); - _configurationManager.OnValueChanged(CCVars.NPCMaxUpdates, SetMaxUpdates, true); + Subs.CVar(_configurationManager, CCVars.NPCEnabled, value => Enabled = value, true); + Subs.CVar(_configurationManager, CCVars.NPCMaxUpdates, obj => _maxUpdates = obj, true); } public void OnPlayerNPCAttach(EntityUid uid, HTNComponent component, PlayerAttachedEvent args) @@ -51,16 +51,6 @@ public void OnPlayerNPCDetach(EntityUid uid, HTNComponent component, PlayerDetac WakeNPC(uid, component); } - private void SetMaxUpdates(int obj) => _maxUpdates = obj; - private void SetEnabled(bool value) => Enabled = value; - - public override void Shutdown() - { - base.Shutdown(); - _configurationManager.UnsubValueChanged(CCVars.NPCEnabled, SetEnabled); - _configurationManager.UnsubValueChanged(CCVars.NPCMaxUpdates, SetMaxUpdates); - } - public void OnNPCMapInit(EntityUid uid, HTNComponent component, MapInitEvent args) { component.Blackboard.SetValue(NPCBlackboard.Owner, uid); diff --git a/Content.Server/Parallax/BiomeSystem.cs b/Content.Server/Parallax/BiomeSystem.cs index f4514ac22854..0b8c7a4d82d9 100644 --- a/Content.Server/Parallax/BiomeSystem.cs +++ b/Content.Server/Parallax/BiomeSystem.cs @@ -83,17 +83,11 @@ public override void Initialize() SubscribeLocalEvent(OnBiomeMapInit); SubscribeLocalEvent(OnFTLStarted); SubscribeLocalEvent(OnShuttleFlatten); - _configManager.OnValueChanged(CVars.NetMaxUpdateRange, SetLoadRange, true); + Subs.CVar(_configManager, CVars.NetMaxUpdateRange, SetLoadRange, true); InitializeCommands(); SubscribeLocalEvent(ProtoReload); } - public override void Shutdown() - { - base.Shutdown(); - _configManager.UnsubValueChanged(CVars.NetMaxUpdateRange, SetLoadRange); - } - private void ProtoReload(PrototypesReloadedEventArgs obj) { if (!obj.ByType.TryGetValue(typeof(BiomeTemplatePrototype), out var reloads)) diff --git a/Content.Server/Radiation/Systems/RadiationSystem.Cvar.cs b/Content.Server/Radiation/Systems/RadiationSystem.Cvar.cs index ffe533f9a613..cd19367f380e 100644 --- a/Content.Server/Radiation/Systems/RadiationSystem.Cvar.cs +++ b/Content.Server/Radiation/Systems/RadiationSystem.Cvar.cs @@ -12,37 +12,9 @@ public partial class RadiationSystem private void SubscribeCvars() { - _cfg.OnValueChanged(CCVars.RadiationMinIntensity, SetMinRadiationIntensity, true); - _cfg.OnValueChanged(CCVars.RadiationGridcastUpdateRate, SetGridcastUpdateRate, true); - _cfg.OnValueChanged(CCVars.RadiationGridcastSimplifiedSameGrid, SetGridcastSimplifiedSameGrid, true); - _cfg.OnValueChanged(CCVars.RadiationGridcastMaxDistance, SetGridcastMaxDistance, true); - } - - private void UnsubscribeCvars() - { - _cfg.UnsubValueChanged(CCVars.RadiationMinIntensity, SetMinRadiationIntensity); - _cfg.UnsubValueChanged(CCVars.RadiationGridcastUpdateRate, SetGridcastUpdateRate); - _cfg.UnsubValueChanged(CCVars.RadiationGridcastSimplifiedSameGrid, SetGridcastSimplifiedSameGrid); - _cfg.UnsubValueChanged(CCVars.RadiationGridcastMaxDistance, SetGridcastMaxDistance); - } - - private void SetMinRadiationIntensity(float radiationMinIntensity) - { - MinIntensity = radiationMinIntensity; - } - - private void SetGridcastUpdateRate(float updateRate) - { - GridcastUpdateRate = updateRate; - } - - private void SetGridcastSimplifiedSameGrid(bool simplifiedSameGrid) - { - GridcastSimplifiedSameGrid = simplifiedSameGrid; - } - - private void SetGridcastMaxDistance(float maxDistance) - { - GridcastMaxDistance = maxDistance; + Subs.CVar(_cfg, CCVars.RadiationMinIntensity, radiationMinIntensity => MinIntensity = radiationMinIntensity, true); + Subs.CVar(_cfg, CCVars.RadiationGridcastUpdateRate, updateRate => GridcastUpdateRate = updateRate, true); + Subs.CVar(_cfg, CCVars.RadiationGridcastSimplifiedSameGrid, simplifiedSameGrid => GridcastSimplifiedSameGrid = simplifiedSameGrid, true); + Subs.CVar(_cfg, CCVars.RadiationGridcastMaxDistance, maxDistance => GridcastMaxDistance = maxDistance, true); } } diff --git a/Content.Server/Radiation/Systems/RadiationSystem.cs b/Content.Server/Radiation/Systems/RadiationSystem.cs index ffb7ab1a11f5..e184c022f2f4 100644 --- a/Content.Server/Radiation/Systems/RadiationSystem.cs +++ b/Content.Server/Radiation/Systems/RadiationSystem.cs @@ -21,12 +21,6 @@ public override void Initialize() InitRadBlocking(); } - public override void Shutdown() - { - base.Shutdown(); - UnsubscribeCvars(); - } - public override void Update(float frameTime) { base.Update(frameTime); diff --git a/Content.Server/Salvage/SalvageSystem.Expeditions.cs b/Content.Server/Salvage/SalvageSystem.Expeditions.cs index f0d4661a0709..1eb1cc3027f9 100644 --- a/Content.Server/Salvage/SalvageSystem.Expeditions.cs +++ b/Content.Server/Salvage/SalvageSystem.Expeditions.cs @@ -40,7 +40,7 @@ private void InitializeExpeditions() SubscribeLocalEvent(OnStructureExamine); _cooldown = _configurationManager.GetCVar(CCVars.SalvageExpeditionCooldown); - _configurationManager.OnValueChanged(CCVars.SalvageExpeditionCooldown, SetCooldownChange); + Subs.CVar(_configurationManager, CCVars.SalvageExpeditionCooldown, SetCooldownChange); } private void OnExpeditionGetState(EntityUid uid, SalvageExpeditionComponent component, ref ComponentGetState args) @@ -51,11 +51,6 @@ private void OnExpeditionGetState(EntityUid uid, SalvageExpeditionComponent comp }; } - private void ShutdownExpeditions() - { - _configurationManager.UnsubValueChanged(CCVars.SalvageExpeditionCooldown, SetCooldownChange); - } - private void SetCooldownChange(float obj) { // Update the active cooldowns if we change it. diff --git a/Content.Server/Salvage/SalvageSystem.cs b/Content.Server/Salvage/SalvageSystem.cs index 545a385bff85..a1a3b686b2f9 100644 --- a/Content.Server/Salvage/SalvageSystem.cs +++ b/Content.Server/Salvage/SalvageSystem.cs @@ -73,12 +73,6 @@ public override void Initialize() InitializeRunner(); } - public override void Shutdown() - { - base.Shutdown(); - ShutdownExpeditions(); - } - private void Report(EntityUid source, string channelName, string messageKey, params (string, object)[] args) { var message = args.Length == 0 ? Loc.GetString(messageKey) : Loc.GetString(messageKey, args); diff --git a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs index 08f3481cd72d..7d63b8358812 100644 --- a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs +++ b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs @@ -98,7 +98,7 @@ public override void Initialize() // Don't invoke immediately as it will get set in the natural course of things. Enabled = _cfgManager.GetCVar(CCVars.ArrivalsShuttles); - _cfgManager.OnValueChanged(CCVars.ArrivalsShuttles, SetArrivals); + Subs.CVar(_cfgManager, CCVars.ArrivalsShuttles, SetArrivals); // Command so admins can set these for funsies _console.RegisterCommand("arrivals", ArrivalsCommand, ArrivalsCompletion); @@ -182,12 +182,6 @@ private void ArrivalsCommand(IConsoleShell shell, string argstr, string[] args) } } - public override void Shutdown() - { - base.Shutdown(); - _cfgManager.UnsubValueChanged(CCVars.ArrivalsShuttles, SetArrivals); - } - /// /// First sends shuttle timer data, then kicks people off the shuttle if it isn't leaving the arrivals terminal /// diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs index b589a526403d..f8e6f2423f9d 100644 --- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs +++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs @@ -85,9 +85,9 @@ public sealed partial class EmergencyShuttleSystem private void InitializeEmergencyConsole() { - _configManager.OnValueChanged(CCVars.EmergencyShuttleMinTransitTime, SetMinTransitTime, true); - _configManager.OnValueChanged(CCVars.EmergencyShuttleMaxTransitTime, SetMaxTransitTime, true); - _configManager.OnValueChanged(CCVars.EmergencyShuttleAuthorizeTime, SetAuthorizeTime, true); + Subs.CVar(_configManager, CCVars.EmergencyShuttleMinTransitTime, SetMinTransitTime, true); + Subs.CVar(_configManager, CCVars.EmergencyShuttleMaxTransitTime, SetMaxTransitTime, true); + Subs.CVar(_configManager, CCVars.EmergencyShuttleAuthorizeTime, SetAuthorizeTime, true); SubscribeLocalEvent(OnEmergencyStartup); SubscribeLocalEvent(OnEmergencyAuthorize); SubscribeLocalEvent(OnEmergencyRepeal); @@ -123,13 +123,6 @@ private void SetMaxTransitTime(float obj) MaximumTransitTime = Math.Max(MinimumTransitTime, obj); } - private void ShutdownEmergencyConsole() - { - _configManager.UnsubValueChanged(CCVars.EmergencyShuttleAuthorizeTime, SetAuthorizeTime); - _configManager.UnsubValueChanged(CCVars.EmergencyShuttleMinTransitTime, SetMinTransitTime); - _configManager.UnsubValueChanged(CCVars.EmergencyShuttleMaxTransitTime, SetMaxTransitTime); - } - private void OnEmergencyStartup(EntityUid uid, EmergencyShuttleConsoleComponent component, ComponentStartup args) { UpdateConsoleState(uid, component); diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs index d9ba2de3e590..66214b0577ee 100644 --- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs @@ -77,7 +77,7 @@ public override void Initialize() _sawmill = Logger.GetSawmill("shuttle.emergency"); _emergencyShuttleEnabled = _configManager.GetCVar(CCVars.EmergencyShuttleEnabled); // Don't immediately invoke as roundstart will just handle it. - _configManager.OnValueChanged(CCVars.EmergencyShuttleEnabled, SetEmergencyShuttleEnabled); + Subs.CVar(_configManager, CCVars.EmergencyShuttleEnabled, SetEmergencyShuttleEnabled); SubscribeLocalEvent(OnRoundStart); SubscribeLocalEvent(OnStationStartup); @@ -152,12 +152,6 @@ public override void Update(float frameTime) UpdateEmergencyConsole(frameTime); } - public override void Shutdown() - { - _configManager.UnsubValueChanged(CCVars.EmergencyShuttleEnabled, SetEmergencyShuttleEnabled); - ShutdownEmergencyConsole(); - } - /// /// If the client is requesting debug info on where an emergency shuttle would dock. /// diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs index 84097e60ac22..71e022007665 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs @@ -18,12 +18,7 @@ private void InitializeGridFills() SubscribeLocalEvent(OnGridFillMapInit); - _cfg.OnValueChanged(CCVars.GridFill, OnGridFillChange); - } - - private void ShutdownGridFills() - { - _cfg.UnsubValueChanged(CCVars.GridFill, OnGridFillChange); + Subs.CVar(_cfg, CCVars.GridFill, OnGridFillChange); } private void OnGridFillChange(bool obj) diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.cs index a2e17b4321c4..471b46e507d7 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.cs @@ -69,13 +69,6 @@ public override void Initialize() SubscribeLocalEvent(OnGridFixtureChange); } - public override void Shutdown() - { - base.Shutdown(); - ShutdownGridFills(); - } - - public override void Update(float frameTime) { base.Update(frameTime); diff --git a/Content.Server/Station/Systems/StationJobsSystem.cs b/Content.Server/Station/Systems/StationJobsSystem.cs index 7bfc496deae1..a3b7a573545f 100644 --- a/Content.Server/Station/Systems/StationJobsSystem.cs +++ b/Content.Server/Station/Systems/StationJobsSystem.cs @@ -35,7 +35,7 @@ public override void Initialize() SubscribeLocalEvent(OnStationRenamed); SubscribeLocalEvent(OnStationDeletion); SubscribeLocalEvent(OnPlayerJoinedLobby); - _configurationManager.OnValueChanged(CCVars.GameDisallowLateJoins, _ => UpdateJobsAvailable(), true); + Subs.CVar(_configurationManager, CCVars.GameDisallowLateJoins, _ => UpdateJobsAvailable(), true); } public override void Update(float _) diff --git a/Content.Server/Station/Systems/StationSpawningSystem.cs b/Content.Server/Station/Systems/StationSpawningSystem.cs index a5fb66662c81..d0ebae9a0e64 100644 --- a/Content.Server/Station/Systems/StationSpawningSystem.cs +++ b/Content.Server/Station/Systems/StationSpawningSystem.cs @@ -56,7 +56,7 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem /// public override void Initialize() { - _configurationManager.OnValueChanged(CCVars.ICRandomCharacters, e => _randomizeCharacters = e, true); + Subs.CVar(_configurationManager, CCVars.ICRandomCharacters, e => _randomizeCharacters = e, true); _spawnerCallbacks = new Dictionary>() { diff --git a/Content.Server/Station/Systems/StationSystem.cs b/Content.Server/Station/Systems/StationSystem.cs index be3fc57967b3..4647392665b5 100644 --- a/Content.Server/Station/Systems/StationSystem.cs +++ b/Content.Server/Station/Systems/StationSystem.cs @@ -57,9 +57,9 @@ public override void Initialize() SubscribeLocalEvent(OnStationGridDeleted); SubscribeLocalEvent(OnStationSplitEvent); - _configurationManager.OnValueChanged(CCVars.StationOffset, x => _randomStationOffset = x, true); - _configurationManager.OnValueChanged(CCVars.MaxStationOffset, x => _maxRandomStationOffset = x, true); - _configurationManager.OnValueChanged(CCVars.StationRotation, x => _randomStationRotation = x, true); + Subs.CVar(_configurationManager, CCVars.StationOffset, x => _randomStationOffset = x, true); + Subs.CVar(_configurationManager, CCVars.MaxStationOffset, x => _maxRandomStationOffset = x, true); + Subs.CVar(_configurationManager, CCVars.StationRotation, x => _randomStationRotation = x, true); _player.PlayerStatusChanged += OnPlayerStatusChanged; } diff --git a/Content.Server/StationEvents/EventManagerSystem.cs b/Content.Server/StationEvents/EventManagerSystem.cs index 7779eafbbacb..fb3590dcd564 100644 --- a/Content.Server/StationEvents/EventManagerSystem.cs +++ b/Content.Server/StationEvents/EventManagerSystem.cs @@ -28,7 +28,7 @@ public override void Initialize() _sawmill = Logger.GetSawmill("events"); - _configurationManager.OnValueChanged(CCVars.EventsEnabled, SetEnabled, true); + Subs.CVar(_configurationManager, CCVars.EventsEnabled, SetEnabled, true); SubscribeLocalEvent(OnUnpaused); } @@ -40,12 +40,6 @@ private void OnUnpaused(EntityUid uid, StationEventComponent component, ref Enti component.EndTime = component.EndTime.Value + args.PausedTime; } - public override void Shutdown() - { - base.Shutdown(); - _configurationManager.UnsubValueChanged(CCVars.EventsEnabled, SetEnabled); - } - /// /// Randomly runs a valid event. /// diff --git a/Content.Server/Tips/TipsSystem.cs b/Content.Server/Tips/TipsSystem.cs index 1c342fcadf87..cc45a3a1d5eb 100644 --- a/Content.Server/Tips/TipsSystem.cs +++ b/Content.Server/Tips/TipsSystem.cs @@ -36,10 +36,10 @@ public override void Initialize() base.Initialize(); SubscribeLocalEvent(OnGameRunLevelChanged); - _cfg.OnValueChanged(CCVars.TipFrequencyOutOfRound, SetOutOfRound, true); - _cfg.OnValueChanged(CCVars.TipFrequencyInRound, SetInRound, true); - _cfg.OnValueChanged(CCVars.TipsEnabled, SetEnabled, true); - _cfg.OnValueChanged(CCVars.TipsDataset, SetDataset, true); + Subs.CVar(_cfg, CCVars.TipFrequencyOutOfRound, SetOutOfRound, true); + Subs.CVar(_cfg, CCVars.TipFrequencyInRound, SetInRound, true); + Subs.CVar(_cfg, CCVars.TipsEnabled, SetEnabled, true); + Subs.CVar(_cfg, CCVars.TipsDataset, SetDataset, true); RecalculateNextTipTime(); } diff --git a/Content.Server/Worldgen/Systems/WorldgenConfigSystem.cs b/Content.Server/Worldgen/Systems/WorldgenConfigSystem.cs index 70db152b4e29..d3eeeb6037ad 100644 --- a/Content.Server/Worldgen/Systems/WorldgenConfigSystem.cs +++ b/Content.Server/Worldgen/Systems/WorldgenConfigSystem.cs @@ -34,8 +34,8 @@ public override void Initialize() { SubscribeLocalEvent(OnLoadingMaps); _conHost.RegisterCommand("applyworldgenconfig", Loc.GetString("cmd-applyworldgenconfig-description"), Loc.GetString("cmd-applyworldgenconfig-help"), ApplyWorldgenConfigCommand); - _cfg.OnValueChanged(CCVars.WorldgenEnabled, b => _enabled = b, true); - _cfg.OnValueChanged(CCVars.WorldgenConfig, s => _worldgenConfig = s, true); + Subs.CVar(_cfg, CCVars.WorldgenEnabled, b => _enabled = b, true); + Subs.CVar(_cfg, CCVars.WorldgenConfig, s => _worldgenConfig = s, true); } [AdminCommand(AdminFlags.Mapping)] diff --git a/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs b/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs index 14a76ee45c0d..1197e019d07c 100644 --- a/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs +++ b/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs @@ -42,14 +42,7 @@ public override void Initialize() SubscribeLocalEvent(OnRoundRestart); - _configuration.OnValueChanged(CCVars.GameCryoSleepRejoining, OnCvarChanged, true); - } - - public override void Shutdown() - { - base.Shutdown(); - - _configuration.UnsubValueChanged(CCVars.GameCryoSleepRejoining, OnCvarChanged); + Subs.CVar(_configuration, CCVars.GameCryoSleepRejoining, OnCvarChanged, true); } private void OnCvarChanged(bool value) diff --git a/Content.Shared/Friction/TileFrictionController.cs b/Content.Shared/Friction/TileFrictionController.cs index 472f5b574b2a..ba4d9fc24f8b 100644 --- a/Content.Shared/Friction/TileFrictionController.cs +++ b/Content.Shared/Friction/TileFrictionController.cs @@ -31,20 +31,8 @@ public override void Initialize() { base.Initialize(); - _configManager.OnValueChanged(CCVars.TileFrictionModifier, SetFrictionModifier, true); - _configManager.OnValueChanged(CCVars.StopSpeed, SetStopSpeed, true); - } - - private void SetStopSpeed(float value) => _stopSpeed = value; - - private void SetFrictionModifier(float value) => _frictionModifier = value; - - public override void Shutdown() - { - base.Shutdown(); - - _configManager.UnsubValueChanged(CCVars.TileFrictionModifier, SetFrictionModifier); - _configManager.UnsubValueChanged(CCVars.StopSpeed, SetStopSpeed); + Subs.CVar(_configManager, CCVars.TileFrictionModifier, value => _frictionModifier = value, true); + Subs.CVar(_configManager, CCVars.StopSpeed, value => _stopSpeed = value, true); } public override void UpdateBeforeMapSolve(bool prediction, PhysicsMapComponent mapComponent, float frameTime) diff --git a/Content.Shared/Movement/Systems/SharedMoverController.Input.cs b/Content.Shared/Movement/Systems/SharedMoverController.Input.cs index 6fb8c64b8e77..bce3aeff5271 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.Input.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.Input.cs @@ -57,13 +57,8 @@ private void InitializeInput() SubscribeLocalEvent(OnFollowedParentChange); - _configManager.OnValueChanged(CCVars.CameraRotationLocked, SetCameraRotationLocked, true); - _configManager.OnValueChanged(CCVars.GameDiagonalMovement, SetDiagonalMovement, true); - } - - private void SetCameraRotationLocked(bool obj) - { - CameraRotationLocked = obj; + Subs.CVar(_configManager, CCVars.CameraRotationLocked, obj => CameraRotationLocked = obj, true); + Subs.CVar(_configManager, CCVars.GameDiagonalMovement, value => DiagonalMovementEnabled = value, true); } /// @@ -141,14 +136,10 @@ private void OnMoverGetState(EntityUid uid, InputMoverComponent component, ref C private void ShutdownInput() { CommandBinds.Unregister(); - _configManager.UnsubValueChanged(CCVars.CameraRotationLocked, SetCameraRotationLocked); - _configManager.UnsubValueChanged(CCVars.GameDiagonalMovement, SetDiagonalMovement); } public bool DiagonalMovementEnabled { get; private set; } - private void SetDiagonalMovement(bool value) => DiagonalMovementEnabled = value; - protected virtual void HandleShuttleInput(EntityUid uid, ShuttleButtons button, ushort subTick, bool state) {} private void OnAutoParentChange(EntityUid uid, AutoOrientComponent component, ref EntParentChangedMessage args) diff --git a/Content.Shared/Movement/Systems/SharedMoverController.cs b/Content.Shared/Movement/Systems/SharedMoverController.cs index 7d5e24a15b18..2c03507f6174 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.cs @@ -92,20 +92,15 @@ public override void Initialize() InitializeInput(); InitializeRelay(); - _configManager.OnValueChanged(CCVars.RelativeMovement, SetRelativeMovement, true); - _configManager.OnValueChanged(CCVars.StopSpeed, SetStopSpeed, true); + Subs.CVar(_configManager, CCVars.RelativeMovement, value => _relativeMovement = value, true); + Subs.CVar(_configManager, CCVars.StopSpeed, value => _stopSpeed = value, true); UpdatesBefore.Add(typeof(TileFrictionController)); } - private void SetRelativeMovement(bool value) => _relativeMovement = value; - private void SetStopSpeed(float value) => _stopSpeed = value; - public override void Shutdown() { base.Shutdown(); ShutdownInput(); - _configManager.UnsubValueChanged(CCVars.RelativeMovement, SetRelativeMovement); - _configManager.UnsubValueChanged(CCVars.StopSpeed, SetStopSpeed); } public override void UpdateAfterSolve(bool prediction, float frameTime) From 46030cfe64f94b2521671ceb1df4ea2892951b01 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sun, 11 Feb 2024 14:56:22 +0100 Subject: [PATCH 2/7] Fix a bunch of warnings --- Content.Server/Access/AccessWireAction.cs | 8 ++--- .../Access/Systems/AccessOverriderSystem.cs | 2 +- .../Access/Systems/AgentIDCardSystem.cs | 2 +- Content.Server/Access/Systems/IdCardSystem.cs | 8 ++--- .../Administration/Commands/BanCommand.cs | 4 ++- .../Administration/Notes/AdminNotesSystem.cs | 16 ++------- .../Administration/PlayerLocator.cs | 17 +++++++--- .../Administration/UI/PermissionsEui.cs | 34 ++++++++++--------- .../Administration/UI/SpawnExplosionEui.cs | 11 +++++- Content.Server/AlertLevel/AlertLevelSystem.cs | 2 +- .../Commands/SetAlertLevelCommand.cs | 32 ++++++++--------- Content.Server/Ame/AmeNodeGroup.cs | 9 ++--- .../ConstructionSystem.Initial.cs | 12 +++---- .../ConstructionSystem.Interactions.cs | 12 +++---- .../Construction/ConstructionSystem.cs | 15 +++----- .../EntitySystems/ClusterGrenadeSystem.cs | 3 -- .../EntitySystems/SmokeOnTriggerSystem.cs | 2 -- Content.Server/Flash/FlashSystem.cs | 2 -- Content.Server/Info/InfoSystem.cs | 7 ++-- .../Light/EntitySystems/PoweredLightSystem.cs | 5 --- .../MassMedia/Systems/NewsSystem.cs | 12 ------- Content.Server/Mind/MindSystem.cs | 8 +---- .../NPC/Systems/NPCCombatSystem.Melee.cs | 3 -- .../Systems/ObjectiveLimitSystem.cs | 2 +- Content.Server/PDA/Ringer/RingerSystem.cs | 1 - Content.Server/Pinpointer/PinpointerSystem.cs | 19 ++--------- .../CursedEntityStorageSystem.cs | 4 --- .../Store/Conditions/BuyerSpeciesCondition.cs | 2 -- .../Access/Systems/SharedAccessSystem.cs | 8 ++--- Content.Shared/Actions/SharedActionsSystem.cs | 1 - Content.Shared/Alert/AlertPrototype.cs | 15 ++------ .../Effects/SharedGravityAnomalySystem.cs | 14 +++++--- Content.Shared/Anomaly/SharedAnomalySystem.cs | 22 ++++++------ .../Bed/Sleep/SharedSleepingSystem.cs | 1 - Content.Shared/Blocking/BlockingSystem.cs | 1 - .../SharedCartridgeLoaderSystem.cs | 1 - .../Charges/Systems/SharedChargesSystem.cs | 2 +- .../EntitySystems/StealthClothingSystem.cs | 4 +-- .../Construction/SharedFlatpackSystem.cs | 1 - .../Damage/Systems/DamageableSystem.cs | 1 - .../Damage/Systems/PassiveDamageSystem.cs | 5 ++- .../Doors/Systems/SharedDoorSystem.cs | 1 - Content.Shared/Examine/ExamineSystemShared.cs | 5 +-- .../OnTrigger/SmokeOnTriggerComponent.cs | 2 -- .../Blinding/Systems/BlurryVisionSystem.cs | 2 -- Content.Shared/Fluids/SharedDrainSystem.cs | 2 +- .../Gibbing/Systems/GibbingSystem.cs | 1 - .../Hands/EntitySystems/SharedHandsSystem.cs | 1 - .../Inventory/InventorySystem.Slots.cs | 2 +- .../Systems/SharedMoverController.Relay.cs | 4 +-- .../Pinpointer/SharedPinpointerSystem.cs | 10 +++--- Content.Shared/Placeable/ItemPlacerSystem.cs | 1 - .../Generator/ActiveGeneratorRevvingSystem.cs | 5 --- Content.Shared/RCD/Systems/RCDSystem.cs | 1 - Content.Shared/Spider/SharedSpiderSystem.cs | 1 - .../SprayPainter/SharedSprayPainterSystem.cs | 1 - Content.Shared/Stealth/SharedStealthSystem.cs | 1 - .../Storage/EntitySystems/DumpableSystem.cs | 2 +- Content.Shared/Tiles/FloorTileSystem.cs | 1 - 59 files changed, 147 insertions(+), 226 deletions(-) diff --git a/Content.Server/Access/AccessWireAction.cs b/Content.Server/Access/AccessWireAction.cs index 4ed9871c4033..7676ce489f43 100644 --- a/Content.Server/Access/AccessWireAction.cs +++ b/Content.Server/Access/AccessWireAction.cs @@ -25,7 +25,7 @@ public override bool Cut(EntityUid user, Wire wire, AccessReaderComponent comp) { WiresSystem.TryCancelWireAction(wire.Owner, PulseTimeoutKey.Key); comp.Enabled = false; - EntityManager.Dirty(comp); + EntityManager.Dirty(wire.Owner, comp); return true; } @@ -34,7 +34,7 @@ public override bool Mend(EntityUid user, Wire wire, AccessReaderComponent comp) if (!EntityManager.HasComponent(wire.Owner)) { comp.Enabled = true; - EntityManager.Dirty(comp); + EntityManager.Dirty(wire.Owner, comp); } return true; } @@ -42,7 +42,7 @@ public override bool Mend(EntityUid user, Wire wire, AccessReaderComponent comp) public override void Pulse(EntityUid user, Wire wire, AccessReaderComponent comp) { comp.Enabled = false; - EntityManager.Dirty(comp); + EntityManager.Dirty(wire.Owner, comp); WiresSystem.StartWireAction(wire.Owner, _pulseTimeout, PulseTimeoutKey.Key, new TimedWireEvent(AwaitPulseCancel, wire)); } @@ -61,7 +61,7 @@ private void AwaitPulseCancel(Wire wire) if (EntityManager.TryGetComponent(wire.Owner, out var access) && !EntityManager.HasComponent(wire.Owner)) { access.Enabled = true; - EntityManager.Dirty(access); + EntityManager.Dirty(wire.Owner, access); } } } diff --git a/Content.Server/Access/Systems/AccessOverriderSystem.cs b/Content.Server/Access/Systems/AccessOverriderSystem.cs index 2aa22575782a..10d7fd0f7a7f 100644 --- a/Content.Server/Access/Systems/AccessOverriderSystem.cs +++ b/Content.Server/Access/Systems/AccessOverriderSystem.cs @@ -249,7 +249,7 @@ private void TryWriteToTargetAccessReaderId(EntityUid uid, $"{ToPrettyString(player):player} has modified {ToPrettyString(component.TargetAccessReaderId):entity} with the following allowed access level holders: [{string.Join(", ", addedTags.Union(removedTags))}] [{string.Join(", ", newAccessList)}]"); accessReader.AccessLists = ConvertAccessListToHashSet(newAccessList); - Dirty(accessReader); + Dirty(component.TargetAccessReaderId, accessReader); } /// diff --git a/Content.Server/Access/Systems/AgentIDCardSystem.cs b/Content.Server/Access/Systems/AgentIDCardSystem.cs index 29657b509a96..bd4d3b3f2330 100644 --- a/Content.Server/Access/Systems/AgentIDCardSystem.cs +++ b/Content.Server/Access/Systems/AgentIDCardSystem.cs @@ -48,7 +48,7 @@ private void OnAfterInteract(EntityUid uid, AgentIDCardComponent component, Afte return; } - Dirty(access); + Dirty(uid, access); if (addedLength == 1) { diff --git a/Content.Server/Access/Systems/IdCardSystem.cs b/Content.Server/Access/Systems/IdCardSystem.cs index def5e950d2ce..6b3d8db595fc 100644 --- a/Content.Server/Access/Systems/IdCardSystem.cs +++ b/Content.Server/Access/Systems/IdCardSystem.cs @@ -61,7 +61,7 @@ private void OnMicrowaved(EntityUid uid, IdCardComponent component, BeingMicrowa _popupSystem.PopupEntity(Loc.GetString("id-card-component-microwave-bricked", ("id", uid)), uid); access.Tags.Clear(); - Dirty(access); + Dirty(uid, access); _adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(args.Microwave)} cleared access on {ToPrettyString(uid):entity}"); @@ -75,7 +75,7 @@ private void OnMicrowaved(EntityUid uid, IdCardComponent component, BeingMicrowa var random = _random.Pick(_prototypeManager.EnumeratePrototypes().ToArray()); access.Tags.Add(random.ID); - Dirty(access); + Dirty(uid, access); _adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(args.Microwave)} added {random.ID} access to {ToPrettyString(uid):entity}"); @@ -109,7 +109,7 @@ public bool TryChangeJobTitle(EntityUid uid, string? jobTitle, IdCardComponent? if (id.JobTitle == jobTitle) return true; id.JobTitle = jobTitle; - Dirty(id); + Dirty(uid, id); UpdateEntityName(uid, id); if (player != null) @@ -187,7 +187,7 @@ public bool TryChangeFullName(EntityUid uid, string? fullName, IdCardComponent? if (id.FullName == fullName) return true; id.FullName = fullName; - Dirty(id); + Dirty(uid, id); UpdateEntityName(uid, id); if (player != null) diff --git a/Content.Server/Administration/Commands/BanCommand.cs b/Content.Server/Administration/Commands/BanCommand.cs index 156fdf496a9a..f76cfded814e 100644 --- a/Content.Server/Administration/Commands/BanCommand.cs +++ b/Content.Server/Administration/Commands/BanCommand.cs @@ -18,6 +18,7 @@ public sealed class BanCommand : LocalizedCommands [Dependency] private readonly IBanManager _bans = default!; [Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; + [Dependency] private readonly ILogManager _logManager = default!; public override string Command => "ban"; @@ -28,7 +29,8 @@ public override async void Execute(IConsoleShell shell, string argStr, string[] uint minutes; if (!Enum.TryParse(_cfg.GetCVar(CCVars.ServerBanDefaultSeverity), out NoteSeverity severity)) { - Logger.WarningS("admin.server_ban", "Server ban severity could not be parsed from config! Defaulting to high."); + _logManager.GetSawmill("admin.server_ban") + .Warning("Server ban severity could not be parsed from config! Defaulting to high."); severity = NoteSeverity.High; } diff --git a/Content.Server/Administration/Notes/AdminNotesSystem.cs b/Content.Server/Administration/Notes/AdminNotesSystem.cs index 8fc7a8ebaa7e..069b8603ce4a 100644 --- a/Content.Server/Administration/Notes/AdminNotesSystem.cs +++ b/Content.Server/Administration/Notes/AdminNotesSystem.cs @@ -3,7 +3,6 @@ using Content.Server.EUI; using Content.Shared.Database; using Content.Shared.Verbs; -using Robust.Server.GameObjects; using Robust.Server.Player; using Robust.Shared.Console; using Robust.Shared.Enums; @@ -12,18 +11,14 @@ namespace Content.Server.Administration.Notes; -public sealed class AdminNotesSystem : EntitySystem, IPostInjectInit +public sealed class AdminNotesSystem : EntitySystem { [Dependency] private readonly IConsoleHost _console = default!; [Dependency] private readonly IAdminNotesManager _notes = default!; - [Dependency] private readonly ILogManager _logManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IChatManager _chat = default!; [Dependency] private readonly EuiManager _euis = default!; - public const string SawmillId = "admin.notes_system"; - private ISawmill _sawmill = default!; - public override void Initialize() { SubscribeLocalEvent>(AddVerbs); @@ -65,7 +60,7 @@ private async void OnPlayerStatusChanged(object? sender, SessionStatusEventArgs if (!_playerManager.TryGetPlayerData(e.Session.UserId, out var playerData)) { - _sawmill.Error($"Could not get player data for ID {e.Session.UserId}"); + Log.Error($"Could not get player data for ID {e.Session.UserId}"); } var username = playerData?.UserName ?? e.Session.UserId.ToString(); @@ -83,15 +78,10 @@ private async void OnPlayerStatusChanged(object? sender, SessionStatusEventArgs var ui = new AdminMessageEui(); _euis.OpenEui(ui, e.Session); ui.SetMessage(message); - + // Only send the message if they haven't seen it yet _chat.DispatchServerMessage(e.Session, messageString); } } } - - public void PostInject() - { - _sawmill = _logManager.GetSawmill(SawmillId); - } } diff --git a/Content.Server/Administration/PlayerLocator.cs b/Content.Server/Administration/PlayerLocator.cs index e2f48c9f7f93..64a85f19ad0b 100644 --- a/Content.Server/Administration/PlayerLocator.cs +++ b/Content.Server/Administration/PlayerLocator.cs @@ -44,13 +44,15 @@ public interface IPlayerLocator Task LookupIdAsync(NetUserId userId, CancellationToken cancel = default); } - internal sealed class PlayerLocator : IPlayerLocator, IDisposable + internal sealed class PlayerLocator : IPlayerLocator, IDisposable, IPostInjectInit { [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!; [Dependency] private readonly IServerDbManager _db = default!; + [Dependency] private readonly ILogManager _logManager = default!; private readonly HttpClient _httpClient = new(); + private ISawmill _sawmill = default!; public PlayerLocator() { @@ -87,7 +89,7 @@ public PlayerLocator() if (!resp.IsSuccessStatusCode) { - Logger.ErrorS("PlayerLocate", "Auth server returned bad response {StatusCode}!", resp.StatusCode); + _sawmill.Error("Auth server returned bad response {StatusCode}!", resp.StatusCode); return null; } @@ -95,7 +97,7 @@ public PlayerLocator() if (responseData == null) { - Logger.ErrorS("PlayerLocate", "Auth server returned null response!"); + _sawmill.Error("Auth server returned null response!"); return null; } @@ -127,7 +129,7 @@ public PlayerLocator() if (!resp.IsSuccessStatusCode) { - Logger.ErrorS("PlayerLocate", "Auth server returned bad response {StatusCode}!", resp.StatusCode); + _sawmill.Error("Auth server returned bad response {StatusCode}!", resp.StatusCode); return null; } @@ -135,7 +137,7 @@ public PlayerLocator() if (responseData == null) { - Logger.ErrorS("PlayerLocate", "Auth server returned null response!"); + _sawmill.Error("Auth server returned null response!"); return null; } @@ -163,5 +165,10 @@ void IDisposable.Dispose() { _httpClient.Dispose(); } + + void IPostInjectInit.PostInject() + { + _sawmill = _logManager.GetSawmill("PlayerLocate"); + } } } diff --git a/Content.Server/Administration/UI/PermissionsEui.cs b/Content.Server/Administration/UI/PermissionsEui.cs index 82ec10577d00..7c2d2cbaf20a 100644 --- a/Content.Server/Administration/UI/PermissionsEui.cs +++ b/Content.Server/Administration/UI/PermissionsEui.cs @@ -18,7 +18,9 @@ public sealed class PermissionsEui : BaseEui [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IServerDbManager _db = default!; [Dependency] private readonly IAdminManager _adminManager = default!; + [Dependency] private readonly ILogManager _logManager = default!; + private readonly ISawmill _sawmill; private bool _isLoading; private readonly List<(Admin a, string? lastUserName)> _admins = new List<(Admin, string? lastUserName)>(); @@ -27,6 +29,7 @@ public sealed class PermissionsEui : BaseEui public PermissionsEui() { IoCManager.InjectDependencies(this); + _sawmill = _logManager.GetSawmill("admin.perms"); } public override void Opened() @@ -143,7 +146,7 @@ private async Task HandleRemoveAdminRank(RemoveAdminRank rr) if (!CanTouchRank(rank)) { - Logger.WarningS("admin.perms", $"{Player} tried to remove higher-ranked admin rank {rank.Name}"); + _sawmill.Warning($"{Player} tried to remove higher-ranked admin rank {rank.Name}"); return; } @@ -162,13 +165,13 @@ private async Task HandleUpdateAdminRank(UpdateAdminRank ur) if (!CanTouchRank(rank)) { - Logger.WarningS("admin.perms", $"{Player} tried to update higher-ranked admin rank {rank.Name}"); + _sawmill.Warning($"{Player} tried to update higher-ranked admin rank {rank.Name}"); return; } if (!UserAdminFlagCheck(ur.Flags)) { - Logger.WarningS("admin.perms", $"{Player} tried to give a rank permissions above their authorization."); + _sawmill.Warning($"{Player} tried to give a rank permissions above their authorization."); return; } @@ -178,7 +181,7 @@ private async Task HandleUpdateAdminRank(UpdateAdminRank ur) await _db.UpdateAdminRankAsync(rank); var flagText = string.Join(' ', AdminFlagsHelper.FlagsToNames(ur.Flags).Select(f => $"+{f}")); - Logger.InfoS("admin.perms", $"{Player} updated admin rank {rank.Name}/{flagText}."); + _sawmill.Info($"{Player} updated admin rank {rank.Name}/{flagText}."); _adminManager.ReloadAdminsWithRank(ur.Id); } @@ -187,7 +190,7 @@ private async Task HandleAddAdminRank(AddAdminRank ar) { if (!UserAdminFlagCheck(ar.Flags)) { - Logger.WarningS("admin.perms", $"{Player} tried to give a rank permissions above their authorization."); + _sawmill.Warning($"{Player} tried to give a rank permissions above their authorization."); return; } @@ -200,7 +203,7 @@ private async Task HandleAddAdminRank(AddAdminRank ar) await _db.AddAdminRankAsync(rank); var flagText = string.Join(' ', AdminFlagsHelper.FlagsToNames(ar.Flags).Select(f => $"+{f}")); - Logger.InfoS("admin.perms", $"{Player} added admin rank {rank.Name}/{flagText}."); + _sawmill.Info($"{Player} added admin rank {rank.Name}/{flagText}."); } private async Task HandleRemoveAdmin(RemoveAdmin ra) @@ -214,14 +217,14 @@ private async Task HandleRemoveAdmin(RemoveAdmin ra) if (!CanTouchAdmin(admin)) { - Logger.WarningS("admin.perms", $"{Player} tried to remove higher-ranked admin {ra.UserId.ToString()}"); + _sawmill.Warning($"{Player} tried to remove higher-ranked admin {ra.UserId.ToString()}"); return; } await _db.RemoveAdminAsync(ra.UserId); var record = await _db.GetPlayerRecordByUserId(ra.UserId); - Logger.InfoS("admin.perms", $"{Player} removed admin {record?.LastSeenUserName ?? ra.UserId.ToString()}"); + _sawmill.Info($"{Player} removed admin {record?.LastSeenUserName ?? ra.UserId.ToString()}"); if (_playerManager.TryGetSessionById(ra.UserId, out var player)) { @@ -245,7 +248,7 @@ private async Task HandleUpdateAdmin(UpdateAdmin ua) if (!CanTouchAdmin(admin)) { - Logger.WarningS("admin.perms", $"{Player} tried to modify higher-ranked admin {ua.UserId.ToString()}"); + _sawmill.Warning($"{Player} tried to modify higher-ranked admin {ua.UserId.ToString()}"); return; } @@ -266,7 +269,7 @@ private async Task HandleUpdateAdmin(UpdateAdmin ua) var title = ua.Title ?? ""; var flags = AdminFlagsHelper.PosNegFlagsText(ua.PosFlags, ua.NegFlags); - Logger.InfoS("admin.perms", $"{Player} updated admin {name} to {title}/{rankName}/{flags}"); + _sawmill.Info($"{Player} updated admin {name} to {title}/{rankName}/{flags}"); if (_playerManager.TryGetSessionById(ua.UserId, out var player)) { @@ -304,8 +307,7 @@ private async Task HandleCreateAdmin(AddAdmin ca) { // username not in DB. // TODO: Notify user. - Logger.WarningS("admin.perms", - $"{Player} tried to add admin with unknown username {ca.UserNameOrId}."); + _sawmill.Warning($"{Player} tried to add admin with unknown username {ca.UserNameOrId}."); return; } @@ -341,7 +343,7 @@ private async Task HandleCreateAdmin(AddAdmin ca) var title = ca.Title ?? ""; var flags = AdminFlagsHelper.PosNegFlagsText(ca.PosFlags, ca.NegFlags); - Logger.InfoS("admin.perms", $"{Player} added admin {name} as {title}/{rankName}/{flags}"); + _sawmill.Info($"{Player} added admin {name} as {title}/{rankName}/{flags}"); if (_playerManager.TryGetSessionById(userId, out var player)) { @@ -362,7 +364,7 @@ private bool CheckCreatePerms(AdminFlags posFlags, AdminFlags negFlags) if (!UserAdminFlagCheck(posFlags)) { // Can't create an admin with higher perms than yourself, obviously. - Logger.WarningS("admin.perms", $"{Player} tried to grant admin powers above their authorization."); + _sawmill.Warning($"{Player} tried to grant admin powers above their authorization."); return false; } @@ -378,7 +380,7 @@ private bool CheckCreatePerms(AdminFlags posFlags, AdminFlags negFlags) if (rank == null) { // Tried to set to nonexistent rank. - Logger.WarningS("admin.perms", $"{Player} tried to assign nonexistent admin rank."); + _sawmill.Warning($"{Player} tried to assign nonexistent admin rank."); return (true, null); } @@ -388,7 +390,7 @@ private bool CheckCreatePerms(AdminFlags posFlags, AdminFlags negFlags) if (!UserAdminFlagCheck(rankFlags)) { // Can't assign a rank with flags you don't have yourself. - Logger.WarningS("admin.perms", $"{Player} tried to assign admin rank above their authorization."); + _sawmill.Warning($"{Player} tried to assign admin rank above their authorization."); return (true, null); } } diff --git a/Content.Server/Administration/UI/SpawnExplosionEui.cs b/Content.Server/Administration/UI/SpawnExplosionEui.cs index 98dc30727841..a3729b145439 100644 --- a/Content.Server/Administration/UI/SpawnExplosionEui.cs +++ b/Content.Server/Administration/UI/SpawnExplosionEui.cs @@ -12,6 +12,15 @@ namespace Content.Server.Administration.UI; [UsedImplicitly] public sealed class SpawnExplosionEui : BaseEui { + private readonly ExplosionSystem _explosionSystem; + private readonly ISawmill _sawmill; + + public SpawnExplosionEui() + { + _explosionSystem = IoCManager.Resolve().GetEntitySystem(); + _sawmill = IoCManager.Resolve().GetSawmill("explosion"); + } + public override void HandleMessage(EuiMessageBase msg) { base.HandleMessage(msg); @@ -26,7 +35,7 @@ public override void HandleMessage(EuiMessageBase msg) if (explosion == null) { - Logger.Error("Failed to generate explosion preview."); + _sawmill.Error("Failed to generate explosion preview."); return; } diff --git a/Content.Server/AlertLevel/AlertLevelSystem.cs b/Content.Server/AlertLevel/AlertLevelSystem.cs index 04e274ceeb5c..848170ba9dc0 100644 --- a/Content.Server/AlertLevel/AlertLevelSystem.cs +++ b/Content.Server/AlertLevel/AlertLevelSystem.cs @@ -168,7 +168,7 @@ public void SetLevel(EntityUid station, string level, bool playSound, bool annou if (detail.Sound != null) { var filter = _stationSystem.GetInOwningStation(station); - _audio.PlayGlobal(detail.Sound.GetSound(), filter, true, detail.Sound.Params); + _audio.PlayGlobal(detail.Sound, filter, true, detail.Sound.Params); } else { diff --git a/Content.Server/AlertLevel/Commands/SetAlertLevelCommand.cs b/Content.Server/AlertLevel/Commands/SetAlertLevelCommand.cs index 2c432a24190d..f52fc2b7187a 100644 --- a/Content.Server/AlertLevel/Commands/SetAlertLevelCommand.cs +++ b/Content.Server/AlertLevel/Commands/SetAlertLevelCommand.cs @@ -9,19 +9,19 @@ namespace Content.Server.AlertLevel.Commands { [UsedImplicitly] [AdminCommand(AdminFlags.Admin)] - public sealed class SetAlertLevelCommand : IConsoleCommand + public sealed class SetAlertLevelCommand : LocalizedCommands { - public string Command => "setalertlevel"; - public string Description => Loc.GetString("cmd-setalertlevel-desc"); - public string Help => Loc.GetString("cmd-setalertlevel-help"); + [Dependency] private readonly IEntitySystemManager _entitySystems = default!; - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override string Command => "setalertlevel"; + + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { var levelNames = new string[] {}; var player = shell.Player; if (player?.AttachedEntity != null) { - var stationUid = EntitySystem.Get().GetOwningStation(player.AttachedEntity.Value); + var stationUid = _entitySystems.GetEntitySystem().GetOwningStation(player.AttachedEntity.Value); if (stationUid != null) { levelNames = GetStationLevelNames(stationUid.Value); @@ -31,39 +31,39 @@ public CompletionResult GetCompletion(IConsoleShell shell, string[] args) return args.Length switch { 1 => CompletionResult.FromHintOptions(levelNames, - Loc.GetString("cmd-setalertlevel-hint-1")), + LocalizationManager.GetString("cmd-setalertlevel-hint-1")), 2 => CompletionResult.FromHintOptions(CompletionHelper.Booleans, - Loc.GetString("cmd-setalertlevel-hint-2")), + LocalizationManager.GetString("cmd-setalertlevel-hint-2")), _ => CompletionResult.Empty, }; } - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 1) { - shell.WriteError(Loc.GetString("shell-wrong-arguments-number")); + shell.WriteError(LocalizationManager.GetString("shell-wrong-arguments-number")); return; } var locked = false; if (args.Length > 1 && !bool.TryParse(args[1], out locked)) { - shell.WriteLine(Loc.GetString("shell-argument-must-be-boolean")); + shell.WriteLine(LocalizationManager.GetString("shell-argument-must-be-boolean")); return; } var player = shell.Player; if (player?.AttachedEntity == null) { - shell.WriteLine(Loc.GetString("shell-only-players-can-run-this-command")); + shell.WriteLine(LocalizationManager.GetString("shell-only-players-can-run-this-command")); return; } - var stationUid = EntitySystem.Get().GetOwningStation(player.AttachedEntity.Value); + var stationUid = _entitySystems.GetEntitySystem().GetOwningStation(player.AttachedEntity.Value); if (stationUid == null) { - shell.WriteLine(Loc.GetString("cmd-setalertlevel-invalid-grid")); + shell.WriteLine(LocalizationManager.GetString("cmd-setalertlevel-invalid-grid")); return; } @@ -71,11 +71,11 @@ public void Execute(IConsoleShell shell, string argStr, string[] args) var levelNames = GetStationLevelNames(stationUid.Value); if (!levelNames.Contains(level)) { - shell.WriteLine(Loc.GetString("cmd-setalertlevel-invalid-level")); + shell.WriteLine(LocalizationManager.GetString("cmd-setalertlevel-invalid-level")); return; } - EntitySystem.Get().SetLevel(stationUid.Value, level, true, true, true, locked); + _entitySystems.GetEntitySystem().SetLevel(stationUid.Value, level, true, true, true, locked); } private string[] GetStationLevelNames(EntityUid station) diff --git a/Content.Server/Ame/AmeNodeGroup.cs b/Content.Server/Ame/AmeNodeGroup.cs index 25d98bf9942d..608356f76059 100644 --- a/Content.Server/Ame/AmeNodeGroup.cs +++ b/Content.Server/Ame/AmeNodeGroup.cs @@ -5,7 +5,8 @@ using Content.Server.Explosion.EntitySystems; using Content.Server.NodeContainer.NodeGroups; using Content.Server.NodeContainer.Nodes; -using Robust.Shared.Map; +using Robust.Server.GameObjects; +using Robust.Shared.Map.Components; using Robust.Shared.Random; namespace Content.Server.Ame; @@ -18,7 +19,6 @@ public sealed class AmeNodeGroup : BaseNodeGroup { [Dependency] private readonly IChatManager _chat = default!; [Dependency] private readonly IEntityManager _entMan = default!; - [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IRobustRandom _random = default!; /// @@ -46,6 +46,7 @@ public override void LoadNodes(List groupNodes) var ameControllerSystem = _entMan.System(); var ameShieldingSystem = _entMan.System(); + var mapSystem = _entMan.System(); var shieldQuery = _entMan.GetEntityQuery(); var controllerQuery = _entMan.GetEntityQuery(); @@ -57,7 +58,7 @@ public override void LoadNodes(List groupNodes) continue; if (!xformQuery.TryGetComponent(nodeOwner, out var xform)) continue; - if (!_mapManager.TryGetGrid(xform.GridUid, out var grid)) + if (!_entMan.TryGetComponent(xform.GridUid, out MapGridComponent? grid)) continue; if (gridEnt == null) @@ -65,7 +66,7 @@ public override void LoadNodes(List groupNodes) else if (gridEnt != xform.GridUid) continue; - var nodeNeighbors = grid.GetCellsInSquareArea(xform.Coordinates, 1) + var nodeNeighbors = mapSystem.GetCellsInSquareArea(xform.GridUid.Value, grid, xform.Coordinates, 1) .Where(entity => entity != nodeOwner && shieldQuery.HasComponent(entity)); if (nodeNeighbors.Count() >= 8) diff --git a/Content.Server/Construction/ConstructionSystem.Initial.cs b/Content.Server/Construction/ConstructionSystem.Initial.cs index 52cde02d2156..e0bdf096296f 100644 --- a/Content.Server/Construction/ConstructionSystem.Initial.cs +++ b/Content.Server/Construction/ConstructionSystem.Initial.cs @@ -269,7 +269,7 @@ void ShutdownContainers() if (!TryComp(newEntity, out ConstructionComponent? construction)) { - _sawmill.Error($"Initial construction does not have a valid target entity! It is missing a ConstructionComponent.\nGraph: {graph.ID}, Initial Target: {edge.Target}, Ent. Prototype: {newEntityProto}\nCreated Entity {ToPrettyString(newEntity)} will be deleted."); + Log.Error($"Initial construction does not have a valid target entity! It is missing a ConstructionComponent.\nGraph: {graph.ID}, Initial Target: {edge.Target}, Ent. Prototype: {newEntityProto}\nCreated Entity {ToPrettyString(newEntity)} will be deleted."); Del(newEntity); // Screw you, make proper construction graphs. return null; } @@ -321,14 +321,14 @@ public async Task TryStartItemConstruction(string prototype, EntityUid use { if (!_prototypeManager.TryIndex(prototype, out ConstructionPrototype? constructionPrototype)) { - _sawmill.Error($"Tried to start construction of invalid recipe '{prototype}'!"); + Log.Error($"Tried to start construction of invalid recipe '{prototype}'!"); return false; } if (!_prototypeManager.TryIndex(constructionPrototype.Graph, out ConstructionGraphPrototype? constructionGraph)) { - _sawmill.Error( + Log.Error( $"Invalid construction graph '{constructionPrototype.Graph}' in recipe '{prototype}'!"); return false; } @@ -394,21 +394,21 @@ private async void HandleStartStructureConstruction(TryStartStructureConstructio { if (!_prototypeManager.TryIndex(ev.PrototypeName, out ConstructionPrototype? constructionPrototype)) { - _sawmill.Error($"Tried to start construction of invalid recipe '{ev.PrototypeName}'!"); + Log.Error($"Tried to start construction of invalid recipe '{ev.PrototypeName}'!"); RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack)); return; } if (!_prototypeManager.TryIndex(constructionPrototype.Graph, out ConstructionGraphPrototype? constructionGraph)) { - _sawmill.Error($"Invalid construction graph '{constructionPrototype.Graph}' in recipe '{ev.PrototypeName}'!"); + Log.Error($"Invalid construction graph '{constructionPrototype.Graph}' in recipe '{ev.PrototypeName}'!"); RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack)); return; } if (args.SenderSession.AttachedEntity is not {Valid: true} user) { - _sawmill.Error($"Client sent {nameof(TryStartStructureConstructionMessage)} with no attached entity!"); + Log.Error($"Client sent {nameof(TryStartStructureConstructionMessage)} with no attached entity!"); return; } diff --git a/Content.Server/Construction/ConstructionSystem.Interactions.cs b/Content.Server/Construction/ConstructionSystem.Interactions.cs index a19ee8df6d9a..946aaa0d3ee2 100644 --- a/Content.Server/Construction/ConstructionSystem.Interactions.cs +++ b/Content.Server/Construction/ConstructionSystem.Interactions.cs @@ -147,7 +147,7 @@ private HandleResult HandleEdge(EntityUid uid, object ev, ConstructionGraphEdge if (step == null) { - _sawmill.Warning($"Called {nameof(HandleEdge)} on entity {ToPrettyString(uid)} but the current state is not valid for that!"); + Log.Warning($"Called {nameof(HandleEdge)} on entity {ToPrettyString(uid)} but the current state is not valid for that!"); return HandleResult.False; } @@ -513,10 +513,10 @@ private void UpdateInteractions() { if (construction.Deleted) { - _sawmill.Error($"Construction component was deleted while still processing interactions." + - $"Entity {ToPrettyString(uid)}, graph: {construction.Graph}, " + - $"Next: {interaction.GetType().Name}, " + - $"Remaining Queue: {string.Join(", ", construction.InteractionQueue.Select(x => x.GetType().Name))}"); + Log.Error($"Construction component was deleted while still processing interactions." + + $"Entity {ToPrettyString(uid)}, graph: {construction.Graph}, " + + $"Next: {interaction.GetType().Name}, " + + $"Remaining Queue: {string.Join(", ", construction.InteractionQueue.Select(x => x.GetType().Name))}"); break; } @@ -527,7 +527,7 @@ private void UpdateInteractions() } catch (Exception e) { - _sawmill.Error($"Caught exception while processing construction queue. Entity {ToPrettyString(uid)}, graph: {construction.Graph}"); + Log.Error($"Caught exception while processing construction queue. Entity {ToPrettyString(uid)}, graph: {construction.Graph}"); _runtimeLog.LogException(e, $"{nameof(ConstructionSystem)}.{nameof(UpdateInteractions)}"); Del(uid); } diff --git a/Content.Server/Construction/ConstructionSystem.cs b/Content.Server/Construction/ConstructionSystem.cs index 6e40b7b856c3..44c6318b7891 100644 --- a/Content.Server/Construction/ConstructionSystem.cs +++ b/Content.Server/Construction/ConstructionSystem.cs @@ -2,7 +2,6 @@ using Content.Server.Stack; using Content.Shared.Construction; using Content.Shared.DoAfter; -using Content.Shared.Tools; using JetBrains.Annotations; using Robust.Server.Containers; using Robust.Shared.Prototypes; @@ -17,7 +16,6 @@ namespace Content.Server.Construction [UsedImplicitly] public sealed partial class ConstructionSystem : SharedConstructionSystem { - [Dependency] private readonly ILogManager _logManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!; @@ -25,15 +23,10 @@ public sealed partial class ConstructionSystem : SharedConstructionSystem [Dependency] private readonly StackSystem _stackSystem = default!; [Dependency] private readonly SharedToolSystem _toolSystem = default!; - private const string SawmillName = "Construction"; - private ISawmill _sawmill = default!; - public override void Initialize() { base.Initialize(); - _sawmill = _logManager.GetSawmill(SawmillName); - InitializeComputer(); InitializeGraphs(); InitializeGuided(); @@ -50,13 +43,13 @@ private void OnConstructionInit(Entity ent, ref Component var construction = ent.Comp; if (GetCurrentGraph(ent, construction) is not {} graph) { - _sawmill.Warning($"Prototype {EntityManager.GetComponent(ent).EntityPrototype?.ID}'s construction component has an invalid graph specified."); + Log.Warning($"Prototype {EntityManager.GetComponent(ent).EntityPrototype?.ID}'s construction component has an invalid graph specified."); return; } if (GetNodeFromGraph(graph, construction.Node) is not {} node) { - _sawmill.Warning($"Prototype {EntityManager.GetComponent(ent).EntityPrototype?.ID}'s construction component has an invalid node specified."); + Log.Warning($"Prototype {EntityManager.GetComponent(ent).EntityPrototype?.ID}'s construction component has an invalid node specified."); return; } @@ -65,7 +58,7 @@ private void OnConstructionInit(Entity ent, ref Component { if (GetEdgeFromNode(node, edgeIndex) is not {} currentEdge) { - _sawmill.Warning($"Prototype {EntityManager.GetComponent(ent).EntityPrototype?.ID}'s construction component has an invalid edge index specified."); + Log.Warning($"Prototype {EntityManager.GetComponent(ent).EntityPrototype?.ID}'s construction component has an invalid edge index specified."); return; } @@ -76,7 +69,7 @@ private void OnConstructionInit(Entity ent, ref Component { if (GetNodeFromGraph(graph, targetNodeId) is not { } targetNode) { - _sawmill.Warning($"Prototype {EntityManager.GetComponent(ent).EntityPrototype?.ID}'s construction component has an invalid target node specified."); + Log.Warning($"Prototype {EntityManager.GetComponent(ent).EntityPrototype?.ID}'s construction component has an invalid target node specified."); return; } diff --git a/Content.Server/Explosion/EntitySystems/ClusterGrenadeSystem.cs b/Content.Server/Explosion/EntitySystems/ClusterGrenadeSystem.cs index 09c2be33a0ed..78e41c59ae2e 100644 --- a/Content.Server/Explosion/EntitySystems/ClusterGrenadeSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ClusterGrenadeSystem.cs @@ -1,15 +1,12 @@ using Content.Server.Explosion.Components; using Content.Shared.Flash.Components; -using Content.Shared.Explosion; using Content.Shared.Interaction; -using Content.Shared.Interaction.Events; using Content.Shared.Throwing; using Robust.Shared.Containers; using Robust.Shared.Random; using Content.Server.Weapons.Ranged.Systems; using System.Numerics; using Content.Shared.Explosion.Components; -using Content.Shared.Flash.Components; using Robust.Server.Containers; using Robust.Server.GameObjects; diff --git a/Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs b/Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs index 2f475a07b44c..c0775947ba44 100644 --- a/Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs @@ -3,8 +3,6 @@ using Content.Server.Fluids.EntitySystems; using Content.Shared.Chemistry.Components; using Content.Shared.Coordinates.Helpers; -using Content.Shared.Explosion.Components.OnTrigger; -using Content.Shared.Explosion.EntitySystems; using Content.Shared.Maps; using Robust.Shared.Map; diff --git a/Content.Server/Flash/FlashSystem.cs b/Content.Server/Flash/FlashSystem.cs index 4f0ccc27fdc4..bc2cca5c0b81 100644 --- a/Content.Server/Flash/FlashSystem.cs +++ b/Content.Server/Flash/FlashSystem.cs @@ -8,7 +8,6 @@ using Content.Shared.Charges.Systems; using Content.Shared.Eye.Blinding.Components; using Content.Shared.Flash; -using Content.Shared.Flash.Components; using Content.Shared.IdentityManagement; using Content.Shared.Interaction; using Content.Shared.Interaction.Events; @@ -20,7 +19,6 @@ using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Audio; -using Robust.Shared.Player; using Robust.Shared.Timing; using InventoryComponent = Content.Shared.Inventory.InventoryComponent; diff --git a/Content.Server/Info/InfoSystem.cs b/Content.Server/Info/InfoSystem.cs index 69bce80592d0..04fa6a57e597 100644 --- a/Content.Server/Info/InfoSystem.cs +++ b/Content.Server/Info/InfoSystem.cs @@ -2,7 +2,6 @@ using Content.Shared.Info; using Robust.Shared.Configuration; using Robust.Shared.ContentPack; -using Robust.Shared.Log; namespace Content.Server.Info; @@ -16,9 +15,9 @@ public override void Initialize() SubscribeNetworkEvent(OnRequestRules); } - protected void OnRequestRules(RequestRulesMessage message, EntitySessionEventArgs eventArgs) + private void OnRequestRules(RequestRulesMessage message, EntitySessionEventArgs eventArgs) { - Logger.DebugS("info", "Client requested rules."); + Log.Debug("info", "Client requested rules."); var title = Loc.GetString(_cfg.GetCVar(CCVars.RulesHeader)); var path = _cfg.GetCVar(CCVars.RulesFile); var rules = "Server could not read its rules."; @@ -28,7 +27,7 @@ protected void OnRequestRules(RequestRulesMessage message, EntitySessionEventArg } catch (Exception) { - Logger.ErrorS("info", "Could not read server rules file."); + Log.Debug("info", "Could not read server rules file."); } var response = new RulesMessage(title, rules); RaiseNetworkEvent(response, eventArgs.SenderSession.Channel); diff --git a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs index ca44b1a4c99d..e880cec5bbb3 100644 --- a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs +++ b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs @@ -23,11 +23,6 @@ using Robust.Shared.Containers; using Robust.Shared.Player; using Robust.Shared.Timing; -using Content.Shared.DoAfter; -using Content.Server.Emp; -using Content.Server.DeviceLinking.Events; -using Content.Server.DeviceLinking.Systems; -using Content.Shared.Inventory; using Robust.Shared.Audio.Systems; namespace Content.Server.Light.EntitySystems diff --git a/Content.Server/MassMedia/Systems/NewsSystem.cs b/Content.Server/MassMedia/Systems/NewsSystem.cs index 40e2a0911b36..01dee54cabc0 100644 --- a/Content.Server/MassMedia/Systems/NewsSystem.cs +++ b/Content.Server/MassMedia/Systems/NewsSystem.cs @@ -17,22 +17,10 @@ using Content.Shared.MassMedia.Systems; using Content.Shared.PDA; using Robust.Server.GameObjects; -using System.Linq; -using Content.Server.Administration.Logs; -using Content.Server.CartridgeLoader.Cartridges; -using Content.Shared.CartridgeLoader; -using Content.Shared.CartridgeLoader.Cartridges; -using Content.Server.CartridgeLoader; -using Content.Server.GameTicking; using Robust.Shared.Timing; -using Content.Server.Popups; -using Content.Server.StationRecords.Systems; -using Content.Shared.Database; -using Robust.Shared.Audio; using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Player; -using Robust.Shared.Timing; namespace Content.Server.MassMedia.Systems; diff --git a/Content.Server/Mind/MindSystem.cs b/Content.Server/Mind/MindSystem.cs index 5e84e6c94e95..4035fa0f8641 100644 --- a/Content.Server/Mind/MindSystem.cs +++ b/Content.Server/Mind/MindSystem.cs @@ -122,12 +122,6 @@ public override bool TryGetMind(NetUserId user, [NotNullWhen(true)] out EntityUi return false; } - public bool TryGetSession(EntityUid? mindId, [NotNullWhen(true)] out ICommonSession? session) - { - session = null; - return TryComp(mindId, out MindComponent? mind) && (session = mind.Session) != null; - } - public ICommonSession? GetSession(MindComponent mind) { return mind.Session; @@ -251,7 +245,7 @@ public override void TransferTo(EntityUid mindId, EntityUid? entity, bool ghostC var position = Deleted(mind.OwnedEntity) ? _gameTicker.GetObserverSpawnPoint().ToMap(EntityManager, _transform) - : Transform(mind.OwnedEntity.Value).MapPosition; + : _transform.GetMapCoordinates(mind.OwnedEntity.Value); entity = Spawn(GameTicker.ObserverPrototypeName, position); component = EnsureComp(entity.Value); diff --git a/Content.Server/NPC/Systems/NPCCombatSystem.Melee.cs b/Content.Server/NPC/Systems/NPCCombatSystem.Melee.cs index 11ba4d102b10..2ae20817e28a 100644 --- a/Content.Server/NPC/Systems/NPCCombatSystem.Melee.cs +++ b/Content.Server/NPC/Systems/NPCCombatSystem.Melee.cs @@ -1,10 +1,7 @@ using System.Numerics; using Content.Server.NPC.Components; -using Content.Server.NPC.Events; using Content.Shared.CombatMode; using Content.Shared.NPC; -using Content.Shared.NPC; -using Content.Shared.Weapons.Melee; using Robust.Shared.Map; using Robust.Shared.Physics.Components; using Robust.Shared.Random; diff --git a/Content.Server/Objectives/Systems/ObjectiveLimitSystem.cs b/Content.Server/Objectives/Systems/ObjectiveLimitSystem.cs index 010230466891..1954f2bdc10b 100644 --- a/Content.Server/Objectives/Systems/ObjectiveLimitSystem.cs +++ b/Content.Server/Objectives/Systems/ObjectiveLimitSystem.cs @@ -53,7 +53,7 @@ public bool HasObjective(EntityUid mindId, string proto, MindComponent? mind = n if (!Resolve(mindId, ref mind)) return false; - foreach (var objective in mind.AllObjectives) + foreach (var objective in mind.Objectives) { if (Prototype(objective)?.ID == proto) return true; diff --git a/Content.Server/PDA/Ringer/RingerSystem.cs b/Content.Server/PDA/Ringer/RingerSystem.cs index f8aadac461de..885503713f83 100644 --- a/Content.Server/PDA/Ringer/RingerSystem.cs +++ b/Content.Server/PDA/Ringer/RingerSystem.cs @@ -13,7 +13,6 @@ using Robust.Shared.Random; using Robust.Shared.Timing; using Robust.Shared.Utility; -using System.Linq; using Robust.Server.Audio; namespace Content.Server.PDA.Ringer diff --git a/Content.Server/Pinpointer/PinpointerSystem.cs b/Content.Server/Pinpointer/PinpointerSystem.cs index 63b39b388c65..be9a715d5d57 100644 --- a/Content.Server/Pinpointer/PinpointerSystem.cs +++ b/Content.Server/Pinpointer/PinpointerSystem.cs @@ -24,7 +24,7 @@ public override void Initialize() SubscribeLocalEvent(OnLocateTarget); } - public bool TogglePinpointer(EntityUid uid, PinpointerComponent? pinpointer = null) + public override bool TogglePinpointer(EntityUid uid, PinpointerComponent? pinpointer = null) { if (!Resolve(uid, ref pinpointer)) return false; @@ -128,26 +128,13 @@ public override void Update(float frameTime) } /// - /// Set pinpointers target to track + /// Update direction from pinpointer to selected target (if it was set) /// - public void SetTarget(EntityUid uid, EntityUid? target, PinpointerComponent? pinpointer = null) + protected override void UpdateDirectionToTarget(EntityUid uid, PinpointerComponent? pinpointer = null) { if (!Resolve(uid, ref pinpointer)) return; - if (pinpointer.Target == target) - return; - - pinpointer.Target = target; - if (pinpointer.IsActive) - UpdateDirectionToTarget(uid, pinpointer); - } - - /// - /// Update direction from pinpointer to selected target (if it was set) - /// - private void UpdateDirectionToTarget(EntityUid uid, PinpointerComponent pinpointer) - { if (!pinpointer.IsActive) return; diff --git a/Content.Server/Storage/EntitySystems/CursedEntityStorageSystem.cs b/Content.Server/Storage/EntitySystems/CursedEntityStorageSystem.cs index 7c58bcccca7e..9b65daf461a8 100644 --- a/Content.Server/Storage/EntitySystems/CursedEntityStorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/CursedEntityStorageSystem.cs @@ -2,11 +2,7 @@ using Content.Server.Storage.Components; using Content.Shared.Audio; using Content.Shared.Storage.Components; -using Robust.Shared.Audio; -using Robust.Shared.Player; using Robust.Shared.Random; -using System.Linq; -using Content.Shared.Storage.Components; using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; diff --git a/Content.Server/Store/Conditions/BuyerSpeciesCondition.cs b/Content.Server/Store/Conditions/BuyerSpeciesCondition.cs index 3a3df725c458..1df4fce177f4 100644 --- a/Content.Server/Store/Conditions/BuyerSpeciesCondition.cs +++ b/Content.Server/Store/Conditions/BuyerSpeciesCondition.cs @@ -1,9 +1,7 @@ -using Content.Server.Humanoid; using Content.Shared.Humanoid; using Content.Shared.Store; using Content.Shared.Humanoid.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; -using Content.Shared.Humanoid; namespace Content.Server.Store.Conditions; diff --git a/Content.Shared/Access/Systems/SharedAccessSystem.cs b/Content.Shared/Access/Systems/SharedAccessSystem.cs index eaacaf277b3e..965ccb24128e 100644 --- a/Content.Shared/Access/Systems/SharedAccessSystem.cs +++ b/Content.Shared/Access/Systems/SharedAccessSystem.cs @@ -27,7 +27,7 @@ private void OnAccessInit(EntityUid uid, AccessComponent component, MapInitEvent continue; component.Tags.UnionWith(proto.Tags); - Dirty(component); + Dirty(uid, component); } } @@ -58,7 +58,7 @@ public bool TrySetTags(EntityUid uid, IEnumerable newTags, AccessCompone access.Tags.Clear(); access.Tags.UnionWith(newTags); - Dirty(access); + Dirty(uid, access); return true; } @@ -85,7 +85,7 @@ public bool TryAddGroups(EntityUid uid, IEnumerable newGroups, AccessCom access.Tags.UnionWith(proto.Tags); } - Dirty(access); + Dirty(uid, access); return true; } @@ -107,7 +107,7 @@ public void SetAccessToJob( access.Tags.Clear(); access.Tags.UnionWith(prototype.Access); - Dirty(access); + Dirty(uid, access); TryAddGroups(uid, prototype.AccessGroups, access); diff --git a/Content.Shared/Actions/SharedActionsSystem.cs b/Content.Shared/Actions/SharedActionsSystem.cs index 4eaa641eeb77..90508bff9d76 100644 --- a/Content.Shared/Actions/SharedActionsSystem.cs +++ b/Content.Shared/Actions/SharedActionsSystem.cs @@ -30,7 +30,6 @@ public abstract class SharedActionsSystem : EntitySystem [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedTransformSystem _transformSystem = default!; [Dependency] private readonly ActionContainerSystem _actionContainer = default!; - [Dependency] private readonly MetaDataSystem _metaData = default!; public override void Initialize() { diff --git a/Content.Shared/Alert/AlertPrototype.cs b/Content.Shared/Alert/AlertPrototype.cs index c24ac8582b01..ac43cb45f3b5 100644 --- a/Content.Shared/Alert/AlertPrototype.cs +++ b/Content.Shared/Alert/AlertPrototype.cs @@ -1,5 +1,4 @@ using Robust.Shared.Prototypes; -using Robust.Shared.Serialization; using Robust.Shared.Utility; namespace Content.Shared.Alert @@ -8,7 +7,7 @@ namespace Content.Shared.Alert /// An alert popup with associated icon, tooltip, and other data. /// [Prototype("alert")] - public sealed partial class AlertPrototype : IPrototype, ISerializationHooks + public sealed partial class AlertPrototype : IPrototype { [ViewVariables] string IPrototype.ID => AlertType.ToString(); @@ -52,7 +51,7 @@ public sealed partial class AlertPrototype : IPrototype, ISerializationHooks /// Key which is unique w.r.t category semantics (alerts with same category have equal keys, /// alerts with no category have different keys). /// - public AlertKey AlertKey { get; private set; } + public AlertKey AlertKey => new(AlertType, Category); /// /// -1 (no effect) unless MaxSeverity is specified. Defaults to 1. Minimum severity level supported by this state. @@ -80,16 +79,6 @@ public sealed partial class AlertPrototype : IPrototype, ISerializationHooks [DataField("onClick", serverOnly: true)] public IAlertClick? OnClick { get; private set; } - void ISerializationHooks.AfterDeserialization() - { - if (AlertType == AlertType.Error) - { - Logger.ErrorS("alert", "missing or invalid alertType for alert with name {0}", Name); - } - - AlertKey = new AlertKey(AlertType, Category); - } - /// severity level, if supported by this alert /// the icon path to the texture for the provided severity level public SpriteSpecifier GetIcon(short? severity = null) diff --git a/Content.Shared/Anomaly/Effects/SharedGravityAnomalySystem.cs b/Content.Shared/Anomaly/Effects/SharedGravityAnomalySystem.cs index eca71e6fd733..f4b7cc8bf4ff 100644 --- a/Content.Shared/Anomaly/Effects/SharedGravityAnomalySystem.cs +++ b/Content.Shared/Anomaly/Effects/SharedGravityAnomalySystem.cs @@ -5,16 +5,17 @@ using Content.Shared.Throwing; using Robust.Shared.Map; using Content.Shared.Physics; +using Robust.Shared.Map.Components; using Robust.Shared.Physics.Components; namespace Content.Shared.Anomaly.Effects; public abstract class SharedGravityAnomalySystem : EntitySystem { - [Dependency] private readonly IMapManager _map = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly ThrowingSystem _throwing = default!; [Dependency] private readonly SharedTransformSystem _xform = default!; + [Dependency] private readonly SharedMapSystem _mapSystem = default!; /// public override void Initialize() @@ -47,13 +48,18 @@ private void OnAnomalyPulse(EntityUid uid, GravityAnomalyComponent component, re private void OnSupercritical(EntityUid uid, GravityAnomalyComponent component, ref AnomalySupercriticalEvent args) { var xform = Transform(uid); - if (!_map.TryGetGrid(xform.GridUid, out var grid)) + if (!TryComp(xform.GridUid, out MapGridComponent? grid)) return; var worldPos = _xform.GetWorldPosition(xform); - var tileref = grid.GetTilesIntersecting(new Circle(worldPos, component.SpaceRange)).ToArray(); + var tileref = _mapSystem.GetTilesIntersecting( + xform.GridUid.Value, + grid, + new Circle(worldPos, component.SpaceRange)) + .ToArray(); + var tiles = tileref.Select(t => (t.GridIndices, Tile.Empty)).ToList(); - grid.SetTiles(tiles); + _mapSystem.SetTiles(xform.GridUid.Value, grid, tiles); var range = component.MaxThrowRange * 2; var strength = component.MaxThrowStrength * 2; diff --git a/Content.Shared/Anomaly/SharedAnomalySystem.cs b/Content.Shared/Anomaly/SharedAnomalySystem.cs index 711f9d1493cf..6eba4221b498 100644 --- a/Content.Shared/Anomaly/SharedAnomalySystem.cs +++ b/Content.Shared/Anomaly/SharedAnomalySystem.cs @@ -27,7 +27,7 @@ public abstract class SharedAnomalySystem : EntitySystem [Dependency] protected readonly IGameTiming Timing = default!; [Dependency] private readonly INetManager _net = default!; [Dependency] protected readonly IRobustRandom Random = default!; - [Dependency] protected readonly ISharedAdminLogManager Log = default!; + [Dependency] protected readonly ISharedAdminLogManager AdminLog = default!; [Dependency] private readonly DamageableSystem _damageable = default!; [Dependency] protected readonly SharedAudioSystem Audio = default!; [Dependency] protected readonly SharedAppearanceSystem Appearance = default!; @@ -92,7 +92,7 @@ public void DoAnomalyBurnDamage(EntityUid source, EntityUid target, AnomalyCompo private void OnAnomalyUnpause(EntityUid uid, AnomalyComponent component, ref EntityUnpausedEvent args) { component.NextPulseTime += args.PausedTime; - Dirty(component); + Dirty(uid, component); } private void OnPulsingUnpause(EntityUid uid, AnomalyPulsingComponent component, ref EntityUnpausedEvent args) @@ -103,7 +103,7 @@ private void OnPulsingUnpause(EntityUid uid, AnomalyPulsingComponent component, private void OnSupercriticalUnpause(EntityUid uid, AnomalySupercriticalComponent component, ref EntityUnpausedEvent args) { component.EndTime += args.PausedTime; - Dirty(component); + Dirty(uid, component); } public void DoAnomalyPulse(EntityUid uid, AnomalyComponent? component = null) @@ -132,7 +132,7 @@ public void DoAnomalyPulse(EntityUid uid, AnomalyComponent? component = null) var stability = Random.NextFloat(minStability, maxStability); ChangeAnomalyStability(uid, stability, component); - Log.Add(LogType.Anomaly, LogImpact.Medium, $"Anomaly {ToPrettyString(uid)} pulsed with severity {component.Severity}."); + AdminLog.Add(LogType.Anomaly, LogImpact.Medium, $"Anomaly {ToPrettyString(uid)} pulsed with severity {component.Severity}."); if (_net.IsServer) Audio.PlayPvs(component.PulseSound, uid); @@ -154,14 +154,14 @@ public void StartSupercriticalEvent(EntityUid uid) if (HasComp(uid)) return; - Log.Add(LogType.Anomaly, LogImpact.High, $"Anomaly {ToPrettyString(uid)} began to go supercritical."); + AdminLog.Add(LogType.Anomaly, LogImpact.High, $"Anomaly {ToPrettyString(uid)} began to go supercritical."); if (_net.IsServer) _sawmill.Info($"Anomaly is going supercritical. Entity: {ToPrettyString(uid)}"); - var super = EnsureComp(uid); + var super = AddComp(uid); super.EndTime = Timing.CurTime + super.SupercriticalDuration; Appearance.SetData(uid, AnomalyVisuals.Supercritical, true); - Dirty(super); + Dirty(uid, super); } /// @@ -201,7 +201,7 @@ public void EndAnomaly(EntityUid uid, AnomalyComponent? component = null, bool s // Logging before resolve, in case the anomaly has deleted itself. if (_net.IsServer) _sawmill.Info($"Ending anomaly. Entity: {ToPrettyString(uid)}"); - Log.Add(LogType.Anomaly, LogImpact.Extreme, $"Anomaly {ToPrettyString(uid)} went supercritical."); + AdminLog.Add(LogType.Anomaly, LogImpact.Extreme, $"Anomaly {ToPrettyString(uid)} went supercritical."); if (!Resolve(uid, ref component)) return; @@ -231,7 +231,7 @@ public void ChangeAnomalyStability(EntityUid uid, float change, AnomalyComponent var newVal = component.Stability + change; component.Stability = Math.Clamp(newVal, 0, 1); - Dirty(component); + Dirty(uid, component); var ev = new AnomalyStabilityChangedEvent(uid, component.Stability, component.Severity); RaiseLocalEvent(uid, ref ev, true); @@ -254,7 +254,7 @@ public void ChangeAnomalySeverity(EntityUid uid, float change, AnomalyComponent? StartSupercriticalEvent(uid); component.Severity = Math.Clamp(newVal, 0, 1); - Dirty(component); + Dirty(uid, component); var ev = new AnomalySeverityChangedEvent(uid, component.Stability, component.Severity); RaiseLocalEvent(uid, ref ev, true); @@ -280,7 +280,7 @@ public void ChangeAnomalyHealth(EntityUid uid, float change, AnomalyComponent? c } component.Health = Math.Clamp(newVal, 0, 1); - Dirty(component); + Dirty(uid, component); var ev = new AnomalyHealthChangedEvent(uid, component.Health); RaiseLocalEvent(uid, ref ev, true); diff --git a/Content.Shared/Bed/Sleep/SharedSleepingSystem.cs b/Content.Shared/Bed/Sleep/SharedSleepingSystem.cs index 505b2a18e7b9..8e76ce3a3e60 100644 --- a/Content.Shared/Bed/Sleep/SharedSleepingSystem.cs +++ b/Content.Shared/Bed/Sleep/SharedSleepingSystem.cs @@ -13,7 +13,6 @@ namespace Content.Server.Bed.Sleep public abstract class SharedSleepingSystem : EntitySystem { [Dependency] private readonly IGameTiming _gameTiming = default!; - [Dependency] private readonly INetManager _net = default!; [Dependency] private readonly SharedActionsSystem _actionsSystem = default!; [Dependency] private readonly BlindableSystem _blindableSystem = default!; diff --git a/Content.Shared/Blocking/BlockingSystem.cs b/Content.Shared/Blocking/BlockingSystem.cs index f2d41e5be953..3e1ff4284c71 100644 --- a/Content.Shared/Blocking/BlockingSystem.cs +++ b/Content.Shared/Blocking/BlockingSystem.cs @@ -26,7 +26,6 @@ namespace Content.Shared.Blocking; public sealed partial class BlockingSystem : EntitySystem { - [Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly SharedActionsSystem _actionsSystem = default!; [Dependency] private readonly ActionContainerSystem _actionContainer = default!; [Dependency] private readonly SharedTransformSystem _transformSystem = default!; diff --git a/Content.Shared/CartridgeLoader/SharedCartridgeLoaderSystem.cs b/Content.Shared/CartridgeLoader/SharedCartridgeLoaderSystem.cs index ac12c5e79165..859a9f37a812 100644 --- a/Content.Shared/CartridgeLoader/SharedCartridgeLoaderSystem.cs +++ b/Content.Shared/CartridgeLoader/SharedCartridgeLoaderSystem.cs @@ -11,7 +11,6 @@ public abstract class SharedCartridgeLoaderSystem : EntitySystem [Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!; [Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!; [Dependency] private readonly SharedContainerSystem _container = default!; - [Dependency] private readonly INetManager _netMan = default!; public override void Initialize() { diff --git a/Content.Shared/Charges/Systems/SharedChargesSystem.cs b/Content.Shared/Charges/Systems/SharedChargesSystem.cs index 653a7f22a5a3..021191ac2634 100644 --- a/Content.Shared/Charges/Systems/SharedChargesSystem.cs +++ b/Content.Shared/Charges/Systems/SharedChargesSystem.cs @@ -38,7 +38,7 @@ public void AddCharges(EntityUid uid, int change, LimitedChargesComponent? comp var old = comp.Charges; comp.Charges = Math.Clamp(comp.Charges + change, 0, comp.MaxCharges); if (comp.Charges != old) - Dirty(comp); + Dirty(uid, comp); } /// diff --git a/Content.Shared/Clothing/EntitySystems/StealthClothingSystem.cs b/Content.Shared/Clothing/EntitySystems/StealthClothingSystem.cs index 4bf2f76ca348..e96d9f866aa4 100644 --- a/Content.Shared/Clothing/EntitySystems/StealthClothingSystem.cs +++ b/Content.Shared/Clothing/EntitySystems/StealthClothingSystem.cs @@ -114,7 +114,7 @@ private void OnUnequipped(EntityUid uid, StealthClothingComponent comp, GotUnequ /// /// Raised on the stealth clothing when attempting to add an action. /// -public class AddStealthActionEvent : CancellableEntityEventArgs +public sealed class AddStealthActionEvent : CancellableEntityEventArgs { /// /// User that equipped the stealth clothing. @@ -130,7 +130,7 @@ public AddStealthActionEvent(EntityUid user) /// /// Raised on the stealth clothing when the user is attemping to enable it. /// -public class AttemptStealthEvent : CancellableEntityEventArgs +public sealed class AttemptStealthEvent : CancellableEntityEventArgs { /// /// User that is attempting to enable the stealth clothing. diff --git a/Content.Shared/Construction/SharedFlatpackSystem.cs b/Content.Shared/Construction/SharedFlatpackSystem.cs index c6f3e89744d2..d4c2513cd3d7 100644 --- a/Content.Shared/Construction/SharedFlatpackSystem.cs +++ b/Content.Shared/Construction/SharedFlatpackSystem.cs @@ -20,7 +20,6 @@ namespace Content.Shared.Construction; public abstract class SharedFlatpackSystem : EntitySystem { [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; - [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly INetManager _net = default!; [Dependency] protected readonly IPrototypeManager PrototypeManager = default!; [Dependency] protected readonly SharedAppearanceSystem Appearance = default!; diff --git a/Content.Shared/Damage/Systems/DamageableSystem.cs b/Content.Shared/Damage/Systems/DamageableSystem.cs index 9337e79439f1..4aaf380c47df 100644 --- a/Content.Shared/Damage/Systems/DamageableSystem.cs +++ b/Content.Shared/Damage/Systems/DamageableSystem.cs @@ -18,7 +18,6 @@ namespace Content.Shared.Damage public sealed class DamageableSystem : EntitySystem { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] private readonly INetManager _netMan = default!; [Dependency] private readonly MobThresholdSystem _mobThreshold = default!; diff --git a/Content.Shared/Damage/Systems/PassiveDamageSystem.cs b/Content.Shared/Damage/Systems/PassiveDamageSystem.cs index 5a37d6a6e6c2..e750863e243f 100644 --- a/Content.Shared/Damage/Systems/PassiveDamageSystem.cs +++ b/Content.Shared/Damage/Systems/PassiveDamageSystem.cs @@ -10,7 +10,6 @@ public sealed class PassiveDamageSystem : EntitySystem { [Dependency] private readonly DamageableSystem _damageable = default!; [Dependency] private readonly IGameTiming _timing = default!; - [Dependency] private readonly MobStateSystem _mobState = default!; public override void Initialize() { @@ -33,14 +32,14 @@ public override void Update(float frameTime) // Go through every entity with the component var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var comp, out var damage, out var mobState)) - { + { // Make sure they're up for a damage tick if (comp.NextDamage > curTime) continue; if (comp.DamageCap != 0 && damage.TotalDamage >= comp.DamageCap) continue; - + // Set the next time they can take damage comp.NextDamage = curTime + TimeSpan.FromSeconds(1f); diff --git a/Content.Shared/Doors/Systems/SharedDoorSystem.cs b/Content.Shared/Doors/Systems/SharedDoorSystem.cs index 53d79cada7ac..f04f6c6dfe01 100644 --- a/Content.Shared/Doors/Systems/SharedDoorSystem.cs +++ b/Content.Shared/Doors/Systems/SharedDoorSystem.cs @@ -14,7 +14,6 @@ using Robust.Shared.Physics.Events; using Robust.Shared.Physics.Systems; using Robust.Shared.Timing; -using Content.Shared.Prying.Components; using Robust.Shared.Audio.Systems; namespace Content.Shared.Doors.Systems; diff --git a/Content.Shared/Examine/ExamineSystemShared.cs b/Content.Shared/Examine/ExamineSystemShared.cs index a06a4b704993..3454ec7fe3f4 100644 --- a/Content.Shared/Examine/ExamineSystemShared.cs +++ b/Content.Shared/Examine/ExamineSystemShared.cs @@ -17,6 +17,7 @@ namespace Content.Shared.Examine { public abstract partial class ExamineSystemShared : EntitySystem { + [Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] protected readonly MobStateSystem MobStateSystem = default!; @@ -77,7 +78,7 @@ public bool CanExamine(EntityUid examiner, EntityUid examined) if (IsClientSide(examined)) return true; - return !Deleted(examined) && CanExamine(examiner, EntityManager.GetComponent(examined).MapPosition, + return !Deleted(examined) && CanExamine(examiner, _transform.GetMapCoordinates(examined), entity => entity == examiner || entity == examined, examined); } @@ -109,7 +110,7 @@ public virtual bool CanExamine(EntityUid examiner, MapCoordinates target, Ignore return false; return InRangeUnOccluded( - EntityManager.GetComponent(examiner).MapPosition, + _transform.GetMapCoordinates(examiner), target, GetExaminerRange(examiner), predicate: predicate, diff --git a/Content.Shared/Explosion/Components/OnTrigger/SmokeOnTriggerComponent.cs b/Content.Shared/Explosion/Components/OnTrigger/SmokeOnTriggerComponent.cs index cfbe1fcb3d9f..80d65f4c2cdc 100644 --- a/Content.Shared/Explosion/Components/OnTrigger/SmokeOnTriggerComponent.cs +++ b/Content.Shared/Explosion/Components/OnTrigger/SmokeOnTriggerComponent.cs @@ -1,9 +1,7 @@ using Content.Shared.Explosion.EntitySystems; using Content.Shared.Chemistry.Components; -using Content.Shared.Explosion.EntitySystems; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; -using Robust.Shared.GameStates; namespace Content.Shared.Explosion.Components; diff --git a/Content.Shared/Eye/Blinding/Systems/BlurryVisionSystem.cs b/Content.Shared/Eye/Blinding/Systems/BlurryVisionSystem.cs index 4577bcda99a9..099753d51e06 100644 --- a/Content.Shared/Eye/Blinding/Systems/BlurryVisionSystem.cs +++ b/Content.Shared/Eye/Blinding/Systems/BlurryVisionSystem.cs @@ -6,8 +6,6 @@ namespace Content.Shared.Eye.Blinding.Systems; public sealed class BlurryVisionSystem : EntitySystem { - [Dependency] private readonly IEntityManager _entityManager = default!; - public override void Initialize() { base.Initialize(); diff --git a/Content.Shared/Fluids/SharedDrainSystem.cs b/Content.Shared/Fluids/SharedDrainSystem.cs index f9bcee44eee9..d65dddb0df9a 100644 --- a/Content.Shared/Fluids/SharedDrainSystem.cs +++ b/Content.Shared/Fluids/SharedDrainSystem.cs @@ -3,7 +3,7 @@ namespace Content.Shared.Fluids; -public partial class SharedDrainSystem : EntitySystem +public abstract partial class SharedDrainSystem : EntitySystem { [Serializable, NetSerializable] public sealed partial class DrainDoAfterEvent : SimpleDoAfterEvent diff --git a/Content.Shared/Gibbing/Systems/GibbingSystem.cs b/Content.Shared/Gibbing/Systems/GibbingSystem.cs index 2f5a9cb61c0c..f3d982977a75 100644 --- a/Content.Shared/Gibbing/Systems/GibbingSystem.cs +++ b/Content.Shared/Gibbing/Systems/GibbingSystem.cs @@ -15,7 +15,6 @@ public sealed class GibbingSystem : EntitySystem { [Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly SharedTransformSystem _transformSystem = default!; - [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly SharedAudioSystem _audioSystem = default!; [Dependency] private readonly SharedPhysicsSystem _physicsSystem = default!; [Dependency] private readonly IRobustRandom _random = default!; diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.cs index 699fb64ee8de..b72a7c4eb3c5 100644 --- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.cs +++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.cs @@ -18,7 +18,6 @@ public abstract partial class SharedHandsSystem [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; [Dependency] protected readonly SharedContainerSystem ContainerSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; - [Dependency] private readonly SharedItemSystem _items = default!; [Dependency] private readonly SharedStorageSystem _storage = default!; [Dependency] protected readonly SharedTransformSystem TransformSystem = default!; [Dependency] private readonly SharedVirtualItemSystem _virtualSystem = default!; diff --git a/Content.Shared/Inventory/InventorySystem.Slots.cs b/Content.Shared/Inventory/InventorySystem.Slots.cs index 210e21c2c9d1..cbbee3a85bd7 100644 --- a/Content.Shared/Inventory/InventorySystem.Slots.cs +++ b/Content.Shared/Inventory/InventorySystem.Slots.cs @@ -51,7 +51,7 @@ public bool TryGetSlotContainer(EntityUid uid, string slot, [NotNullWhen(true)] if (!TryGetSlot(uid, slot, out slotDefinition, inventory: inventory)) return false; - if (!containerComp.TryGetContainer(slotDefinition.Name, out var container)) + if (!_containerSystem.TryGetContainer(uid, slotDefinition.Name, out var container, containerComp)) { if (inventory.LifeStage >= ComponentLifeStage.Initialized) Log.Error($"Missing inventory container {slot} on entity {ToPrettyString(uid)}"); diff --git a/Content.Shared/Movement/Systems/SharedMoverController.Relay.cs b/Content.Shared/Movement/Systems/SharedMoverController.Relay.cs index 846fbfaf7e0a..8568290bffbb 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.Relay.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.Relay.cs @@ -57,8 +57,8 @@ public void SetRelay(EntityUid uid, EntityUid relayEntity) Physics.UpdateIsPredicted(relayEntity); component.RelayEntity = relayEntity; targetComp.Source = uid; - Dirty(component); - Dirty(targetComp); + Dirty(uid, component); + Dirty(relayEntity, targetComp); } private void OnRelayShutdown(EntityUid uid, RelayInputMoverComponent component, ComponentShutdown args) diff --git a/Content.Shared/Pinpointer/SharedPinpointerSystem.cs b/Content.Shared/Pinpointer/SharedPinpointerSystem.cs index 43550f29195c..7f6b88912559 100644 --- a/Content.Shared/Pinpointer/SharedPinpointerSystem.cs +++ b/Content.Shared/Pinpointer/SharedPinpointerSystem.cs @@ -41,7 +41,7 @@ private void OnAfterInteract(EntityUid uid, PinpointerComponent component, After /// /// Set pinpointers target to track /// - public void SetTarget(EntityUid uid, EntityUid? target, PinpointerComponent? pinpointer = null) + public virtual void SetTarget(EntityUid uid, EntityUid? target, PinpointerComponent? pinpointer = null) { if (!Resolve(uid, ref pinpointer)) return; @@ -84,7 +84,7 @@ public void SetDistance(EntityUid uid, Distance distance, PinpointerComponent? p return; pinpointer.DistanceToTarget = distance; - Dirty(pinpointer); + Dirty(uid, pinpointer); } /// @@ -101,7 +101,7 @@ public bool TrySetArrowAngle(EntityUid uid, Angle arrowAngle, PinpointerComponen return false; pinpointer.ArrowAngle = arrowAngle; - Dirty(pinpointer); + Dirty(uid, pinpointer); return true; } @@ -117,7 +117,7 @@ public void SetActive(EntityUid uid, bool isActive, PinpointerComponent? pinpoin return; pinpointer.IsActive = isActive; - Dirty(pinpointer); + Dirty(uid, pinpointer); } @@ -125,7 +125,7 @@ public void SetActive(EntityUid uid, bool isActive, PinpointerComponent? pinpoin /// Toggle Pinpointer screen. If it has target it will start tracking it. /// /// True if pinpointer was activated, false otherwise - public bool TogglePinpointer(EntityUid uid, PinpointerComponent? pinpointer = null) + public virtual bool TogglePinpointer(EntityUid uid, PinpointerComponent? pinpointer = null) { if (!Resolve(uid, ref pinpointer)) return false; diff --git a/Content.Shared/Placeable/ItemPlacerSystem.cs b/Content.Shared/Placeable/ItemPlacerSystem.cs index f2fe58adcb83..9be6a4acd5a6 100644 --- a/Content.Shared/Placeable/ItemPlacerSystem.cs +++ b/Content.Shared/Placeable/ItemPlacerSystem.cs @@ -11,7 +11,6 @@ public sealed class ItemPlacerSystem : EntitySystem { [Dependency] private readonly CollisionWakeSystem _wake = default!; [Dependency] private readonly PlaceableSurfaceSystem _placeableSurface = default!; - [Dependency] private readonly SharedPhysicsSystem _physics = default!; public override void Initialize() { diff --git a/Content.Shared/Power/Generator/ActiveGeneratorRevvingSystem.cs b/Content.Shared/Power/Generator/ActiveGeneratorRevvingSystem.cs index 1c39997f30d8..9cd11ae60453 100644 --- a/Content.Shared/Power/Generator/ActiveGeneratorRevvingSystem.cs +++ b/Content.Shared/Power/Generator/ActiveGeneratorRevvingSystem.cs @@ -1,12 +1,7 @@ -using Content.Shared.DoAfter; - namespace Content.Shared.Power.Generator; public sealed class ActiveGeneratorRevvingSystem: EntitySystem { - [Dependency] private readonly SharedDoAfterSystem _doAfter = default!; - [Dependency] private readonly EntityManager _entity = default!; - public override void Initialize() { base.Initialize(); diff --git a/Content.Shared/RCD/Systems/RCDSystem.cs b/Content.Shared/RCD/Systems/RCDSystem.cs index 402b424fb6dc..187c8d8a9d84 100644 --- a/Content.Shared/RCD/Systems/RCDSystem.cs +++ b/Content.Shared/RCD/Systems/RCDSystem.cs @@ -34,7 +34,6 @@ public sealed class RCDSystem : EntitySystem [Dependency] private readonly SharedChargesSystem _charges = default!; [Dependency] private readonly SharedDoAfterSystem _doAfter = default!; [Dependency] private readonly SharedInteractionSystem _interaction = default!; - [Dependency] private readonly SharedMapSystem _mapSystem = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly TagSystem _tag = default!; [Dependency] private readonly TurfSystem _turf = default!; diff --git a/Content.Shared/Spider/SharedSpiderSystem.cs b/Content.Shared/Spider/SharedSpiderSystem.cs index 2795d64b939a..33473303aa91 100644 --- a/Content.Shared/Spider/SharedSpiderSystem.cs +++ b/Content.Shared/Spider/SharedSpiderSystem.cs @@ -7,7 +7,6 @@ namespace Content.Shared.Spider; public abstract class SharedSpiderSystem : EntitySystem { [Dependency] private readonly SharedActionsSystem _action = default!; - [Dependency] private readonly INetManager _net = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; diff --git a/Content.Shared/SprayPainter/SharedSprayPainterSystem.cs b/Content.Shared/SprayPainter/SharedSprayPainterSystem.cs index 1e784797e338..529e321f8daa 100644 --- a/Content.Shared/SprayPainter/SharedSprayPainterSystem.cs +++ b/Content.Shared/SprayPainter/SharedSprayPainterSystem.cs @@ -24,7 +24,6 @@ public abstract class SharedSprayPainterSystem : EntitySystem [Dependency] protected readonly SharedAudioSystem Audio = default!; [Dependency] protected readonly SharedDoAfterSystem DoAfter = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; - [Dependency] private readonly SharedUserInterfaceSystem _ui = default!; public List Styles { get; private set; } = new(); public List Groups { get; private set; } = new(); diff --git a/Content.Shared/Stealth/SharedStealthSystem.cs b/Content.Shared/Stealth/SharedStealthSystem.cs index aeb42453ca02..d0ea8045347f 100644 --- a/Content.Shared/Stealth/SharedStealthSystem.cs +++ b/Content.Shared/Stealth/SharedStealthSystem.cs @@ -10,7 +10,6 @@ namespace Content.Shared.Stealth; public abstract class SharedStealthSystem : EntitySystem { [Dependency] private readonly IGameTiming _timing = default!; - [Dependency] private readonly MobStateSystem _mobState = default!; public override void Initialize() { diff --git a/Content.Shared/Storage/EntitySystems/DumpableSystem.cs b/Content.Shared/Storage/EntitySystems/DumpableSystem.cs index cf548693f9d6..c87174ba88c4 100644 --- a/Content.Shared/Storage/EntitySystems/DumpableSystem.cs +++ b/Content.Shared/Storage/EntitySystems/DumpableSystem.cs @@ -141,7 +141,7 @@ private void OnDoAfter(EntityUid uid, DumpableComponent component, DoAfterEvent { var transform = Transform(entity); _container.AttachParentToContainerOrGrid((entity, transform)); - _transformSystem.SetLocalPositionRotation(transform, transform.LocalPosition + _random.NextVector2Box() / 2, _random.NextAngle()); + _transformSystem.SetLocalPositionRotation(entity, transform.LocalPosition + _random.NextVector2Box() / 2, _random.NextAngle(), transform); } if (args.Args.Target == null) diff --git a/Content.Shared/Tiles/FloorTileSystem.cs b/Content.Shared/Tiles/FloorTileSystem.cs index 04aa100cd1d4..1f8408319d3e 100644 --- a/Content.Shared/Tiles/FloorTileSystem.cs +++ b/Content.Shared/Tiles/FloorTileSystem.cs @@ -27,7 +27,6 @@ public sealed class FloorTileSystem : EntitySystem [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly INetManager _netManager = default!; - [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!; From da33d6116fa24565beb84695b81ee258b95de528 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sun, 11 Feb 2024 15:51:07 +0100 Subject: [PATCH 3/7] More warning fixes --- .../ColorInterpolateBenchmark.cs | 8 ++-- Content.Benchmarks/Program.cs | 5 --- Content.Client/Actions/ActionsSystem.cs | 18 ++++----- .../Managers/ClientAdminManager.cs | 18 +++++---- .../SpawnExplosionWindow.xaml.cs | 2 +- .../AdminbusTab/LoadBlueprintsWindow.xaml.cs | 2 +- .../UI/Tabs/AtmosTab/AddAtmosWindow.xaml.cs | 2 +- .../UI/Tabs/AtmosTab/AddGasWindow.xaml.cs | 2 +- .../UI/Tabs/AtmosTab/FillGasWindow.xaml.cs | 2 +- .../AtmosTab/SetTemperatureWindow.xaml.cs | 2 +- Content.Client/Alerts/ClientAlertsSystem.cs | 12 +++--- .../Animations/EntityPickupAnimationSystem.cs | 2 +- .../UI/Widgets/ThresholdBoundControl.xaml | 2 +- .../UI/Widgets/ThresholdBoundControl.xaml.cs | 1 - .../Audio/ContentAudioSystem.AmbientMusic.cs | 2 +- Content.Client/Audio/ContentAudioSystem.cs | 7 ---- Content.Client/Camera/CameraRecoilSystem.cs | 8 ++-- .../CardboardBox/CardboardBoxSystem.cs | 11 ++++-- .../CharacterInfo/CharacterInfoSystem.cs | 2 +- .../TypingIndicator/TypingIndicatorSystem.cs | 2 +- .../UI/CloningConsoleWindow.xaml.cs | 2 +- Content.Client/CombatMode/CombatModeSystem.cs | 4 +- .../Commands/DebugPathfindingCommand.cs | 2 +- .../Construction/ConstructionSystem.cs | 2 +- .../ContextMenu/UI/EntityMenuUIController.cs | 4 +- Content.Client/Damage/DamageVisualsSystem.cs | 38 +++++++++---------- Content.Client/DoAfter/DoAfterSystem.cs | 4 +- Content.Client/Doors/FirelockSystem.cs | 2 +- Content.Client/Drugs/DrugOverlaySystem.cs | 4 +- Content.Client/Drugs/RainbowOverlay.cs | 4 +- Content.Client/Drunk/DrunkOverlay.cs | 4 +- Content.Client/Drunk/DrunkSystem.cs | 4 +- Content.Client/Examine/ExamineSystem.cs | 10 ++--- Content.Client/Eye/Blinding/BlindingSystem.cs | 4 +- .../Eye/Blinding/BlurryVisionSystem.cs | 4 +- Content.Client/Eye/EyeLerpingSystem.cs | 4 +- Content.Client/Flash/FlashOverlay.cs | 2 +- Content.Client/Flash/FlashSystem.cs | 2 +- .../Forensics/ForensicScannerMenu.xaml | 2 +- .../Forensics/ForensicScannerMenu.xaml.cs | 4 +- .../GameTicking/Managers/ClientGameTicker.cs | 1 - Content.Client/Gameplay/GameplayStateBase.cs | 2 +- Content.Client/Ghost/GhostSystem.cs | 2 +- Content.Client/Gravity/GravitySystem.Shake.cs | 4 +- Content.Client/Guidebook/GuidebookSystem.cs | 2 +- Content.Client/Hands/Systems/HandsSystem.cs | 20 +++++----- Content.Client/HotPotato/HotPotatoSystem.cs | 6 ++- .../Instruments/UI/InstrumentMenu.xaml.cs | 12 +++--- Content.Client/Interaction/DragDropSystem.cs | 6 +-- .../MassMedia/Ui/MiniArticleCardControl.xaml | 2 +- .../Ui/MiniArticleCardControl.xaml.cs | 4 +- .../MassMedia/Ui/NewsWriteMenu.xaml.cs | 4 +- .../MouseRotator/MouseRotatorSystem.cs | 2 +- .../Movement/Systems/ContentEyeSystem.cs | 2 +- .../Systems/NetworkConfiguratorSystem.cs | 5 +-- .../Outline/InteractionOutlineSystem.cs | 8 ++-- Content.Client/Outline/TargetOutlineSystem.cs | 2 +- .../Physics/Controllers/MoverController.cs | 8 ++-- .../JobRequirementsManager.cs | 2 +- .../Replay/ContentReplayPlaybackManager.cs | 2 +- .../Research/UI/ResearchConsoleMenu.xaml.cs | 2 +- Content.Client/Salvage/SalvageSystem.cs | 2 +- .../Shuttles/Systems/ShuttleConsoleSystem.cs | 2 +- Content.Client/Sprite/SpriteFadeSystem.cs | 2 +- Content.Client/SubFloor/TrayScannerSystem.cs | 2 +- Content.Client/Tabletop/TabletopSystem.cs | 7 ++-- Content.Client/Traits/ParacusiaSystem.cs | 2 +- .../UserInterface/Controls/SplitBar.xaml.cs | 1 + .../Systems/Bwoink/AHelpUIController.cs | 8 ++-- .../Systems/Chat/ChatUIController.cs | 4 +- .../Systems/Chat/Widgets/ChatBox.xaml.cs | 6 +-- .../DamageOverlayUiController.cs | 4 +- .../DamageOverlays/Overlays/DamageOverlay.cs | 2 +- .../Ghost/Controls/Roles/MakeGhostRoleEui.cs | 8 ++-- .../Systems/Viewport/ViewportUIController.cs | 2 +- Content.Client/Verbs/VerbSystem.cs | 2 +- .../Weapons/Melee/MeleeArcOverlay.cs | 2 +- .../Weapons/Melee/MeleeWeaponSystem.cs | 2 +- .../Weapons/Misc/GrapplingGunSystem.cs | 2 +- .../Weapons/Misc/TetherGunSystem.cs | 2 +- .../Weapons/Ranged/GunSpreadOverlay.cs | 2 +- .../Ranged/Systems/FlyBySoundSystem.cs | 2 +- .../Weapons/Ranged/Systems/GunSystem.cs | 2 +- .../Pair/TestPair.Recycle.cs | 2 +- .../Tests/Actions/ActionsAddedTest.cs | 2 +- .../Components/Mobs/AlertsComponentTests.cs | 5 +-- .../Tests/Interaction/InteractionTest.cs | 8 ++-- Content.MapRenderer/Painters/GridPainter.cs | 2 +- Content.MapRenderer/Painters/TilePainter.cs | 5 ++- .../GameTicking/GameTicker.Spawning.cs | 6 +-- Content.Server/Info/ShowRulesCommand.cs | 2 +- 91 files changed, 204 insertions(+), 210 deletions(-) diff --git a/Content.Benchmarks/ColorInterpolateBenchmark.cs b/Content.Benchmarks/ColorInterpolateBenchmark.cs index 2243bb4819ed..eb182328d466 100644 --- a/Content.Benchmarks/ColorInterpolateBenchmark.cs +++ b/Content.Benchmarks/ColorInterpolateBenchmark.cs @@ -131,8 +131,8 @@ public static Color InterpolateSysVector4(Color a, Color b, public static Color InterpolateSysVector4In(in Color endPoint1, in Color endPoint2, float lambda) { - ref var sva = ref Unsafe.As(ref Unsafe.AsRef(endPoint1)); - ref var svb = ref Unsafe.As(ref Unsafe.AsRef(endPoint2)); + ref var sva = ref Unsafe.As(ref Unsafe.AsRef(in endPoint1)); + ref var svb = ref Unsafe.As(ref Unsafe.AsRef(in endPoint2)); var res = SysVector4.Lerp(svb, sva, lambda); @@ -156,8 +156,8 @@ public static Color InterpolateSimd(Color a, Color b, public static Color InterpolateSimdIn(in Color a, in Color b, float lambda) { - var vecA = Unsafe.As>(ref Unsafe.AsRef(a)); - var vecB = Unsafe.As>(ref Unsafe.AsRef(b)); + var vecA = Unsafe.As>(ref Unsafe.AsRef(in a)); + var vecB = Unsafe.As>(ref Unsafe.AsRef(in b)); vecB = Fma.MultiplyAdd(Sse.Subtract(vecB, vecA), Vector128.Create(lambda), vecA); diff --git a/Content.Benchmarks/Program.cs b/Content.Benchmarks/Program.cs index 0beb0a613d5e..42a436597d52 100644 --- a/Content.Benchmarks/Program.cs +++ b/Content.Benchmarks/Program.cs @@ -18,11 +18,6 @@ internal static class Program public static void Main(string[] args) { - MainAsync(args).GetAwaiter().GetResult(); - } - - public static async Task MainAsync(string[] args) - { #if DEBUG Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\nWARNING: YOU ARE RUNNING A DEBUG BUILD, USE A RELEASE BUILD FOR AN ACCURATE BENCHMARK"); diff --git a/Content.Client/Actions/ActionsSystem.cs b/Content.Client/Actions/ActionsSystem.cs index 508f3404bac6..2343b9eac152 100644 --- a/Content.Client/Actions/ActionsSystem.cs +++ b/Content.Client/Actions/ActionsSystem.cs @@ -101,7 +101,7 @@ private void BaseHandleState(EntityUid uid, BaseActionComponent component, Ba component.ItemIconStyle = state.ItemIconStyle; component.Sound = state.Sound; - if (_playerManager.LocalPlayer?.ControlledEntity == component.AttachedEntity) + if (_playerManager.LocalEntity == component.AttachedEntity) ActionsUpdated?.Invoke(); } @@ -111,7 +111,7 @@ protected override void UpdateAction(EntityUid? actionId, BaseActionComponent? a return; base.UpdateAction(actionId, action); - if (_playerManager.LocalPlayer?.ControlledEntity != action.AttachedEntity) + if (_playerManager.LocalEntity != action.AttachedEntity) return; ActionsUpdated?.Invoke(); @@ -144,7 +144,7 @@ private void HandleComponentState(EntityUid uid, ActionsComponent component, ref _added.Add((actionId, action)); } - if (_playerManager.LocalPlayer?.ControlledEntity != uid) + if (_playerManager.LocalEntity != uid) return; foreach (var action in _removed) @@ -177,7 +177,7 @@ public static int ActionComparer((EntityUid, BaseActionComponent?) a, (EntityUid protected override void ActionAdded(EntityUid performer, EntityUid actionId, ActionsComponent comp, BaseActionComponent action) { - if (_playerManager.LocalPlayer?.ControlledEntity != performer) + if (_playerManager.LocalEntity != performer) return; OnActionAdded?.Invoke(actionId); @@ -185,7 +185,7 @@ protected override void ActionAdded(EntityUid performer, EntityUid actionId, Act protected override void ActionRemoved(EntityUid performer, EntityUid actionId, ActionsComponent comp, BaseActionComponent action) { - if (_playerManager.LocalPlayer?.ControlledEntity != performer) + if (_playerManager.LocalEntity != performer) return; OnActionRemoved?.Invoke(actionId); @@ -193,7 +193,7 @@ protected override void ActionRemoved(EntityUid performer, EntityUid actionId, A public IEnumerable<(EntityUid Id, BaseActionComponent Comp)> GetClientActions() { - if (_playerManager.LocalPlayer?.ControlledEntity is not { } user) + if (_playerManager.LocalEntity is not { } user) return Enumerable.Empty<(EntityUid, BaseActionComponent)>(); return GetActions(user); @@ -216,7 +216,7 @@ public void UnlinkAllActions() public void LinkAllActions(ActionsComponent? actions = null) { - if (_playerManager.LocalPlayer?.ControlledEntity is not { } user || + if (_playerManager.LocalEntity is not { } user || !Resolve(user, ref actions, false)) { return; @@ -233,7 +233,7 @@ public override void Shutdown() public void TriggerAction(EntityUid actionId, BaseActionComponent action) { - if (_playerManager.LocalPlayer?.ControlledEntity is not { } user || + if (_playerManager.LocalEntity is not { } user || !TryComp(user, out ActionsComponent? actions)) { return; @@ -261,7 +261,7 @@ public void TriggerAction(EntityUid actionId, BaseActionComponent action) /// public void LoadActionAssignments(string path, bool userData) { - if (_playerManager.LocalPlayer?.ControlledEntity is not { } user) + if (_playerManager.LocalEntity is not { } user) return; var file = new ResPath(path).ToRootedPath(); diff --git a/Content.Client/Administration/Managers/ClientAdminManager.cs b/Content.Client/Administration/Managers/ClientAdminManager.cs index 1a1366c6f2eb..c3eb5edfb9d7 100644 --- a/Content.Client/Administration/Managers/ClientAdminManager.cs +++ b/Content.Client/Administration/Managers/ClientAdminManager.cs @@ -15,11 +15,14 @@ public sealed class ClientAdminManager : IClientAdminManager, IClientConGroupImp [Dependency] private readonly IClientNetManager _netMgr = default!; [Dependency] private readonly IClientConGroupController _conGroup = default!; [Dependency] private readonly IResourceManager _res = default!; + [Dependency] private readonly ILogManager _logManager = default!; + private AdminData? _adminData; private readonly HashSet _availableCommands = new(); private readonly AdminCommandPermissions _localCommandPermissions = new(); + private ISawmill _sawmill = default!; public event Action? AdminStatusUpdated; @@ -92,17 +95,17 @@ private void UpdateMessageRx(MsgUpdateAdminStatus message) } _availableCommands.UnionWith(message.AvailableCommands); - Logger.DebugS("admin", $"Have {message.AvailableCommands.Length} commands available"); + _sawmill.Debug($"Have {message.AvailableCommands.Length} commands available"); _adminData = message.Admin; if (_adminData != null) { var flagsText = string.Join("|", AdminFlagsHelper.FlagsToNames(_adminData.Flags)); - Logger.InfoS("admin", $"Updated admin status: {_adminData.Active}/{_adminData.Title}/{flagsText}"); + _sawmill.Info($"Updated admin status: {_adminData.Active}/{_adminData.Title}/{flagsText}"); } else { - Logger.InfoS("admin", "Updated admin status: Not admin"); + _sawmill.Info("Updated admin status: Not admin"); } AdminStatusUpdated?.Invoke(); @@ -114,18 +117,17 @@ private void UpdateMessageRx(MsgUpdateAdminStatus message) void IPostInjectInit.PostInject() { _conGroup.Implementation = this; + _sawmill = _logManager.GetSawmill("admin"); } public AdminData? GetAdminData(EntityUid uid, bool includeDeAdmin = false) { - return uid == _player.LocalPlayer?.ControlledEntity - ? _adminData - : null; + return uid == _player.LocalEntity ? _adminData : null; } public AdminData? GetAdminData(ICommonSession session, bool includeDeAdmin = false) { - if (_player.LocalPlayer?.UserId == session.UserId) + if (_player.LocalUser == session.UserId) return _adminData; return null; @@ -133,7 +135,7 @@ void IPostInjectInit.PostInject() public AdminData? GetAdminData(bool includeDeAdmin = false) { - if (_player.LocalPlayer is { Session: { } session }) + if (_player.LocalSession is { } session) return GetAdminData(session, includeDeAdmin); return null; diff --git a/Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs b/Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs index 04219fe39b01..5f187cad794e 100644 --- a/Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs +++ b/Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs @@ -99,7 +99,7 @@ private void SetLocation() { UpdateMapOptions(); - if (!_entMan.TryGetComponent(_playerManager.LocalPlayer?.ControlledEntity, out TransformComponent? transform)) + if (!_entMan.TryGetComponent(_playerManager.LocalEntity, out TransformComponent? transform)) return; _pausePreview = true; diff --git a/Content.Client/Administration/UI/Tabs/AdminbusTab/LoadBlueprintsWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AdminbusTab/LoadBlueprintsWindow.xaml.cs index 34611f51aff2..97c84e5d2fc6 100644 --- a/Content.Client/Administration/UI/Tabs/AdminbusTab/LoadBlueprintsWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AdminbusTab/LoadBlueprintsWindow.xaml.cs @@ -42,7 +42,7 @@ private void Reset() var entManager = IoCManager.Resolve(); var xformSystem = entManager.System(); var playerManager = IoCManager.Resolve(); - var player = playerManager.LocalPlayer?.ControlledEntity; + var player = playerManager.LocalEntity; var currentMap = MapId.Nullspace; var position = Vector2.Zero; diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/AddAtmosWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/AddAtmosWindow.xaml.cs index 7e2fdda3e25a..03fd52f446ae 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/AddAtmosWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/AddAtmosWindow.xaml.cs @@ -28,7 +28,7 @@ protected override void EnteredTree() { _data.Clear(); - var player = _players.LocalPlayer?.ControlledEntity; + var player = _players.LocalEntity; var playerGrid = _entities.GetComponentOrNull(player)?.GridUid; var query = IoCManager.Resolve().AllEntityQueryEnumerator(); diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs index d273ea3e55af..c06d91613348 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs @@ -31,7 +31,7 @@ protected override void EnteredTree() while (gridQuery.MoveNext(out var uid, out _)) { _gridData.Add(entManager.GetNetEntity(uid)); - var player = playerManager.LocalPlayer?.ControlledEntity; + var player = playerManager.LocalEntity; var playerGrid = entManager.GetComponentOrNull(player)?.GridUid; GridOptions.AddItem($"{uid} {(playerGrid == uid ? " (Current)" : "")}"); } diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs index 276ec3d67dfe..3353d0873eff 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs @@ -34,7 +34,7 @@ protected override void EnteredTree() while (gridQuery.MoveNext(out var uid, out _)) { - var player = playerManager.LocalPlayer?.ControlledEntity; + var player = playerManager.LocalEntity; var playerGrid = entManager.GetComponentOrNull(player)?.GridUid; GridOptions.AddItem($"{uid} {(playerGrid == uid ? " (Current)" : "")}"); _gridData.Add(entManager.GetNetEntity(uid)); diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/SetTemperatureWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/SetTemperatureWindow.xaml.cs index 850e43e4188e..1183efb9b5b6 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/SetTemperatureWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/SetTemperatureWindow.xaml.cs @@ -30,7 +30,7 @@ protected override void EnteredTree() while (gridQuery.MoveNext(out var uid, out _)) { - var player = playerManager.LocalPlayer?.ControlledEntity; + var player = playerManager.LocalEntity; var playerGrid = entManager.GetComponentOrNull(player)?.GridUid; GridOptions.AddItem($"{uid} {(playerGrid == uid ? " (Current)" : "")}"); _data.Add(entManager.GetNetEntity(uid)); diff --git a/Content.Client/Alerts/ClientAlertsSystem.cs b/Content.Client/Alerts/ClientAlertsSystem.cs index 83327ad77b5a..ab296a96195c 100644 --- a/Content.Client/Alerts/ClientAlertsSystem.cs +++ b/Content.Client/Alerts/ClientAlertsSystem.cs @@ -40,7 +40,7 @@ public IReadOnlyDictionary? ActiveAlerts { get { - var ent = _playerManager.LocalPlayer?.ControlledEntity; + var ent = _playerManager.LocalEntity; return ent is not null ? GetActiveAlerts(ent.Value) : null; @@ -49,7 +49,7 @@ public IReadOnlyDictionary? ActiveAlerts protected override void AfterShowAlert(Entity alerts) { - if (_playerManager.LocalPlayer?.ControlledEntity != alerts.Owner) + if (_playerManager.LocalEntity != alerts.Owner) return; SyncAlerts?.Invoke(this, alerts.Comp.Alerts); @@ -57,7 +57,7 @@ protected override void AfterShowAlert(Entity alerts) protected override void AfterClearAlert(Entity alertsComponent) { - if (_playerManager.LocalPlayer?.ControlledEntity != alertsComponent.Owner) + if (_playerManager.LocalEntity != alertsComponent.Owner) return; SyncAlerts?.Invoke(this, alertsComponent.Comp.Alerts); @@ -65,13 +65,13 @@ protected override void AfterClearAlert(Entity alertsComponent) private void ClientAlertsHandleState(EntityUid uid, AlertsComponent component, ref AfterAutoHandleStateEvent args) { - if (_playerManager.LocalPlayer?.ControlledEntity == uid) + if (_playerManager.LocalEntity == uid) SyncAlerts?.Invoke(this, component.Alerts); } private void OnPlayerAttached(EntityUid uid, AlertsComponent component, LocalPlayerAttachedEvent args) { - if (_playerManager.LocalPlayer?.ControlledEntity != uid) + if (_playerManager.LocalEntity != uid) return; SyncAlerts?.Invoke(this, component.Alerts); @@ -81,7 +81,7 @@ protected override void HandleComponentShutdown(EntityUid uid, AlertsComponent c { base.HandleComponentShutdown(uid, component, args); - if (_playerManager.LocalPlayer?.ControlledEntity != uid) + if (_playerManager.LocalEntity != uid) return; ClearAlerts?.Invoke(this, EventArgs.Empty); diff --git a/Content.Client/Animations/EntityPickupAnimationSystem.cs b/Content.Client/Animations/EntityPickupAnimationSystem.cs index 2ac51e6eba02..abeac664c75c 100644 --- a/Content.Client/Animations/EntityPickupAnimationSystem.cs +++ b/Content.Client/Animations/EntityPickupAnimationSystem.cs @@ -65,7 +65,7 @@ public void AnimateEntityPickup(EntityUid uid, EntityCoordinates initial, Vector despawn.Lifetime = 0.25f; _transform.SetLocalRotationNoLerp(animatableClone, initialAngle); - _animations.Play(animatableClone, animations, new Animation + _animations.Play(new Entity(animatableClone, animations), new Animation { Length = TimeSpan.FromMilliseconds(125), AnimationTracks = diff --git a/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdBoundControl.xaml b/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdBoundControl.xaml index 388512738461..0d5e741d0f66 100644 --- a/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdBoundControl.xaml +++ b/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdBoundControl.xaml @@ -2,6 +2,6 @@ HorizontalExpand="True" Orientation="Vertical" Margin = "20 0 0 0" MinSize="160 0" > public EntityUid GetGuidebookUser() { - var user = _playerManager.LocalPlayer!.ControlledEntity; + var user = _playerManager.LocalEntity; if (user != null) return user.Value; diff --git a/Content.Client/Hands/Systems/HandsSystem.cs b/Content.Client/Hands/Systems/HandsSystem.cs index 9ea094a73abc..8daddc545d58 100644 --- a/Content.Client/Hands/Systems/HandsSystem.cs +++ b/Content.Client/Hands/Systems/HandsSystem.cs @@ -147,7 +147,7 @@ public override void DoDrop(EntityUid uid, Hand hand, bool doDropInteraction = t /// public bool TryGetPlayerHands([NotNullWhen(true)] out HandsComponent? hands) { - var player = _playerManager.LocalPlayer?.ControlledEntity; + var player = _playerManager.LocalEntity; hands = null; return player != null && TryComp(player.Value, out hands); } @@ -248,7 +248,7 @@ protected override void HandleEntityInserted(EntityUid uid, HandsComponent hands UpdateHandVisuals(uid, args.Entity, hand); _stripSys.UpdateUi(uid); - if (uid != _playerManager.LocalPlayer?.ControlledEntity) + if (uid != _playerManager.LocalEntity) return; OnPlayerItemAdded?.Invoke(hand.Name, args.Entity); @@ -266,7 +266,7 @@ protected override void HandleEntityRemoved(EntityUid uid, HandsComponent hands, UpdateHandVisuals(uid, args.Entity, hand); _stripSys.UpdateUi(uid); - if (uid != _playerManager.LocalPlayer?.ControlledEntity) + if (uid != _playerManager.LocalEntity) return; OnPlayerItemRemoved?.Invoke(hand.Name, args.Entity); @@ -284,7 +284,7 @@ private void UpdateHandVisuals(EntityUid uid, EntityUid held, Hand hand, HandsCo return; // visual update might involve changes to the entity's effective sprite -> need to update hands GUI. - if (uid == _playerManager.LocalPlayer?.ControlledEntity) + if (uid == _playerManager.LocalEntity) OnPlayerItemAdded?.Invoke(hand.Name, held); if (!handComp.ShowInHands) @@ -375,13 +375,13 @@ private void HandlePlayerDetached(EntityUid uid, HandsComponent component, Local private void OnHandsStartup(EntityUid uid, HandsComponent component, ComponentStartup args) { - if (_playerManager.LocalPlayer?.ControlledEntity == uid) + if (_playerManager.LocalEntity == uid) OnPlayerHandsAdded?.Invoke(component); } private void OnHandsShutdown(EntityUid uid, HandsComponent component, ComponentShutdown args) { - if (_playerManager.LocalPlayer?.ControlledEntity == uid) + if (_playerManager.LocalEntity == uid) OnPlayerHandsRemoved?.Invoke(); } #endregion @@ -395,7 +395,7 @@ public override void AddHand(EntityUid uid, string handName, HandLocation handLo { base.AddHand(uid, handName, handLocation, handsComp); - if (uid == _playerManager.LocalPlayer?.ControlledEntity) + if (uid == _playerManager.LocalEntity) OnPlayerAddHand?.Invoke(handName, handLocation); if (handsComp == null) @@ -406,9 +406,9 @@ public override void AddHand(EntityUid uid, string handName, HandLocation handLo } public override void RemoveHand(EntityUid uid, string handName, HandsComponent? handsComp = null) { - if (uid == _playerManager.LocalPlayer?.ControlledEntity && handsComp != null && + if (uid == _playerManager.LocalEntity && handsComp != null && handsComp.Hands.ContainsKey(handName) && uid == - _playerManager.LocalPlayer?.ControlledEntity) + _playerManager.LocalEntity) { OnPlayerRemoveHand?.Invoke(handName); } @@ -421,7 +421,7 @@ private void OnHandActivated(Entity? ent) if (ent is not { } hand) return; - if (_playerManager.LocalPlayer?.ControlledEntity != hand.Owner) + if (_playerManager.LocalEntity != hand.Owner) return; if (hand.Comp.ActiveHand == null) diff --git a/Content.Client/HotPotato/HotPotatoSystem.cs b/Content.Client/HotPotato/HotPotatoSystem.cs index 8e9c0f9e1993..04233a920f30 100644 --- a/Content.Client/HotPotato/HotPotatoSystem.cs +++ b/Content.Client/HotPotato/HotPotatoSystem.cs @@ -2,10 +2,14 @@ using Robust.Shared.Random; using Robust.Shared.Timing; +namespace Content.Client.HotPotato; + public sealed class HotPotatoSystem : SharedHotPotatoSystem { [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly SharedTransformSystem _transform = default!; + public override void Update(float frameTime) { @@ -20,7 +24,7 @@ public override void Update(float frameTime) if (_timing.CurTime < comp.TargetTime) continue; comp.TargetTime = _timing.CurTime + TimeSpan.FromSeconds(comp.EffectCooldown); - Spawn("HotPotatoEffect", Transform(uid).MapPosition.Offset(_random.NextVector2(0.25f))); + Spawn("HotPotatoEffect", _transform.GetMapCoordinates(uid).Offset(_random.NextVector2(0.25f))); } } } diff --git a/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs b/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs index 85c9cc1447e7..da443e3fb5bb 100644 --- a/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs +++ b/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs @@ -168,14 +168,14 @@ private bool PlayCheck() if (instrument == null) return false; - var localPlayer = _owner.PlayerManager.LocalPlayer; + var localEntity = _owner.PlayerManager.LocalEntity; // If we don't have a player or controlled entity, we return. - if (localPlayer?.ControlledEntity == null) + if (localEntity == null) return false; // By default, allow an instrument to play itself and skip all other checks - if (localPlayer.ControlledEntity == instrumentEnt) + if (localEntity == instrumentEnt) return true; var container = _owner.Entities.System(); @@ -183,14 +183,14 @@ private bool PlayCheck() container.TryGetContainingContainer(instrumentEnt, out var conMan); // If the instrument is handheld and we're not holding it, we return. - if ((instrument.Handheld && (conMan == null || conMan.Owner != localPlayer.ControlledEntity))) + if ((instrument.Handheld && (conMan == null || conMan.Owner != localEntity))) return false; - if (!_owner.ActionBlocker.CanInteract(localPlayer.ControlledEntity.Value, instrumentEnt)) + if (!_owner.ActionBlocker.CanInteract(localEntity.Value, instrumentEnt)) return false; // We check that we're in range unobstructed just in case. - return _owner.Interactions.InRangeUnobstructed(localPlayer.ControlledEntity.Value, instrumentEnt); + return _owner.Interactions.InRangeUnobstructed(localEntity.Value, instrumentEnt); } private void MidiStopButtonOnPressed(ButtonEventArgs? obj) diff --git a/Content.Client/Interaction/DragDropSystem.cs b/Content.Client/Interaction/DragDropSystem.cs index b774b0d40e27..8baa4d15fe4b 100644 --- a/Content.Client/Interaction/DragDropSystem.cs +++ b/Content.Client/Interaction/DragDropSystem.cs @@ -268,7 +268,7 @@ private bool UpdateDrag(float frameTime) return false; } - var player = _playerManager.LocalPlayer?.ControlledEntity; + var player = _playerManager.LocalEntity; // still in range of the thing we are dragging? if (player == null || !_interactionSystem.InRangeUnobstructed(player.Value, _draggedEntity.Value)) @@ -345,7 +345,7 @@ private bool OnUseMouseUp(in PointerInputCmdHandler.PointerInputCmdArgs args) return false; } - var localPlayer = _playerManager.LocalPlayer?.ControlledEntity; + var localPlayer = _playerManager.LocalEntity; if (localPlayer == null || !Exists(_draggedEntity)) { @@ -409,7 +409,7 @@ private void HighlightTargets() return; } - var user = _playerManager.LocalPlayer?.ControlledEntity; + var user = _playerManager.LocalEntity; if (user == null) return; diff --git a/Content.Client/MassMedia/Ui/MiniArticleCardControl.xaml b/Content.Client/MassMedia/Ui/MiniArticleCardControl.xaml index 2da84e9eb1e9..ede51fc23b05 100644 --- a/Content.Client/MassMedia/Ui/MiniArticleCardControl.xaml +++ b/Content.Client/MassMedia/Ui/MiniArticleCardControl.xaml @@ -6,7 +6,7 @@ - public void ToggleVisualization(EntityUid uid, bool toggle, NetworkConfiguratorComponent? component = null) { - if (_playerManager.LocalPlayer == null - || _playerManager.LocalPlayer.ControlledEntity == null + if (_playerManager.LocalEntity == null || !Resolve(uid, ref component) || component.ActiveDeviceList == null) return; @@ -77,7 +76,7 @@ public void ToggleVisualization(EntityUid uid, bool toggle, NetworkConfiguratorC { var overlay = new NetworkConfiguratorLinkOverlay(); _overlay.AddOverlay(overlay); - var player = _playerManager.LocalPlayer.ControlledEntity.Value; + var player = _playerManager.LocalEntity.Value; overlay.Action = Spawn(Action); _actions.AddActionDirect(player, overlay.Action.Value); } diff --git a/Content.Client/Outline/InteractionOutlineSystem.cs b/Content.Client/Outline/InteractionOutlineSystem.cs index b99a46d06473..3dbbafbcaa3b 100644 --- a/Content.Client/Outline/InteractionOutlineSystem.cs +++ b/Content.Client/Outline/InteractionOutlineSystem.cs @@ -87,8 +87,8 @@ public override void FrameUpdate(float frameTime) return; // If there is no local player, there is no session, and therefore nothing to do here. - var localPlayer = _playerManager.LocalPlayer; - if (localPlayer == null) + var localSession = _playerManager.LocalSession; + if (localSession == null) return; // TODO InteractionOutlineComponent @@ -128,9 +128,9 @@ public override void FrameUpdate(float frameTime) } var inRange = false; - if (localPlayer.ControlledEntity != null && !Deleted(entityToClick)) + if (localSession.AttachedEntity != null && !Deleted(entityToClick)) { - inRange = _interactionSystem.InRangeUnobstructed(localPlayer.ControlledEntity.Value, entityToClick.Value); + inRange = _interactionSystem.InRangeUnobstructed(localSession.AttachedEntity.Value, entityToClick.Value); } InteractionOutlineComponent? outline; diff --git a/Content.Client/Outline/TargetOutlineSystem.cs b/Content.Client/Outline/TargetOutlineSystem.cs index 1c396585b3d9..2a6867f51f55 100644 --- a/Content.Client/Outline/TargetOutlineSystem.cs +++ b/Content.Client/Outline/TargetOutlineSystem.cs @@ -114,7 +114,7 @@ public override void Update(float frameTime) private void HighlightTargets() { - if (_playerManager.LocalPlayer?.ControlledEntity is not { Valid: true } player) + if (_playerManager.LocalEntity is not { Valid: true } player) return; // remove current highlights diff --git a/Content.Client/Physics/Controllers/MoverController.cs b/Content.Client/Physics/Controllers/MoverController.cs index 763f7b01145b..7a8a6e39cffc 100644 --- a/Content.Client/Physics/Controllers/MoverController.cs +++ b/Content.Client/Physics/Controllers/MoverController.cs @@ -30,13 +30,13 @@ public override void Initialize() private void OnUpdatePredicted(EntityUid uid, InputMoverComponent component, ref UpdateIsPredictedEvent args) { // Enable prediction if an entity is controlled by the player - if (uid == _playerManager.LocalPlayer?.ControlledEntity) + if (uid == _playerManager.LocalEntity) args.IsPredicted = true; } private void OnUpdateRelayTargetPredicted(EntityUid uid, MovementRelayTargetComponent component, ref UpdateIsPredictedEvent args) { - if (component.Source == _playerManager.LocalPlayer?.ControlledEntity) + if (component.Source == _playerManager.LocalEntity) args.IsPredicted = true; } @@ -45,7 +45,7 @@ private void OnUpdatePullablePredicted(EntityUid uid, SharedPullableComponent co // Enable prediction if an entity is being pulled by the player. // Disable prediction if an entity is being pulled by some non-player entity. - if (component.Puller == _playerManager.LocalPlayer?.ControlledEntity) + if (component.Puller == _playerManager.LocalEntity) args.IsPredicted = true; else if (component.Puller != null) args.BlockPrediction = true; @@ -84,7 +84,7 @@ public override void UpdateBeforeSolve(bool prediction, float frameTime) { base.UpdateBeforeSolve(prediction, frameTime); - if (_playerManager.LocalPlayer?.ControlledEntity is not {Valid: true} player) + if (_playerManager.LocalEntity is not {Valid: true} player) return; if (RelayQuery.TryGetComponent(player, out var relayMover)) diff --git a/Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs b/Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs index 0929b90a411f..f896d7fa39b0 100644 --- a/Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs +++ b/Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs @@ -94,7 +94,7 @@ public bool IsAllowed(JobPrototype job, [NotNullWhen(false)] out FormattedMessag return true; } - var player = _playerManager.LocalPlayer?.Session; + var player = _playerManager.LocalSession; if (player == null) return true; diff --git a/Content.Client/Replay/ContentReplayPlaybackManager.cs b/Content.Client/Replay/ContentReplayPlaybackManager.cs index 37c066f59427..bc979575f586 100644 --- a/Content.Client/Replay/ContentReplayPlaybackManager.cs +++ b/Content.Client/Replay/ContentReplayPlaybackManager.cs @@ -121,7 +121,7 @@ private bool OnHandleReplayMessage(object message, bool skipEffects) // Mark as handled -- the event won't get raised. return true; case TickerJoinGameEvent: - if (!_entMan.EntityExists(_player.LocalPlayer?.ControlledEntity)) + if (!_entMan.EntityExists(_player.LocalEntity)) _entMan.System().SetSpectatorPosition(default); return true; case ChatMessage chat: diff --git a/Content.Client/Research/UI/ResearchConsoleMenu.xaml.cs b/Content.Client/Research/UI/ResearchConsoleMenu.xaml.cs index 52abd0df0841..b364b8331247 100644 --- a/Content.Client/Research/UI/ResearchConsoleMenu.xaml.cs +++ b/Content.Client/Research/UI/ResearchConsoleMenu.xaml.cs @@ -63,7 +63,7 @@ public void UpdatePanels(ResearchConsoleBoundInterfaceState state) MinHeight = 10 }); - var hasAccess = _player.LocalPlayer?.ControlledEntity is not { } local || + var hasAccess = _player.LocalEntity is not { } local || !_entity.TryGetComponent(Entity, out var access) || _accessReader.IsAllowed(local, Entity, access); foreach (var techId in _technologyDatabase.CurrentTechnologyCards) diff --git a/Content.Client/Salvage/SalvageSystem.cs b/Content.Client/Salvage/SalvageSystem.cs index 0a73c727a4ed..fb305c5fdc4a 100644 --- a/Content.Client/Salvage/SalvageSystem.cs +++ b/Content.Client/Salvage/SalvageSystem.cs @@ -36,7 +36,7 @@ private void OnPlayAmbientMusic(ref PlayAmbientMusicEvent ev) if (ev.Cancelled) return; - var player = _playerManager.LocalPlayer?.ControlledEntity; + var player = _playerManager.LocalEntity; if (!TryComp(player, out var xform) || !TryComp(xform.MapUid, out var expedition) || diff --git a/Content.Client/Shuttles/Systems/ShuttleConsoleSystem.cs b/Content.Client/Shuttles/Systems/ShuttleConsoleSystem.cs index 20fff4acfad2..3bf4bc966a55 100644 --- a/Content.Client/Shuttles/Systems/ShuttleConsoleSystem.cs +++ b/Content.Client/Shuttles/Systems/ShuttleConsoleSystem.cs @@ -35,7 +35,7 @@ public override void Shutdown() protected override void HandlePilotShutdown(EntityUid uid, PilotComponent component, ComponentShutdown args) { base.HandlePilotShutdown(uid, component, args); - if (_playerManager.LocalPlayer?.ControlledEntity != uid) return; + if (_playerManager.LocalEntity != uid) return; _input.Contexts.SetActiveContext("human"); } diff --git a/Content.Client/Sprite/SpriteFadeSystem.cs b/Content.Client/Sprite/SpriteFadeSystem.cs index d4ed1285a893..dda3a6c948ee 100644 --- a/Content.Client/Sprite/SpriteFadeSystem.cs +++ b/Content.Client/Sprite/SpriteFadeSystem.cs @@ -39,7 +39,7 @@ public override void FrameUpdate(float frameTime) { base.FrameUpdate(frameTime); - var player = _playerManager.LocalPlayer?.ControlledEntity; + var player = _playerManager.LocalEntity; var spriteQuery = GetEntityQuery(); var change = ChangeRate * frameTime; diff --git a/Content.Client/SubFloor/TrayScannerSystem.cs b/Content.Client/SubFloor/TrayScannerSystem.cs index f4ba455303ca..95bce03c0f9c 100644 --- a/Content.Client/SubFloor/TrayScannerSystem.cs +++ b/Content.Client/SubFloor/TrayScannerSystem.cs @@ -33,7 +33,7 @@ public override void Update(float frameTime) return; // TODO: Multiple viewports or w/e - var player = _player.LocalPlayer?.ControlledEntity; + var player = _player.LocalEntity; var xformQuery = GetEntityQuery(); if (!xformQuery.TryGetComponent(player, out var playerXform)) diff --git a/Content.Client/Tabletop/TabletopSystem.cs b/Content.Client/Tabletop/TabletopSystem.cs index c71c34d0efdf..696c1455e0c1 100644 --- a/Content.Client/Tabletop/TabletopSystem.cs +++ b/Content.Client/Tabletop/TabletopSystem.cs @@ -64,7 +64,8 @@ public override void FrameUpdate(float frameTime) return; // If there is no player entity, return - if (_playerManager.LocalPlayer is not { ControlledEntity: { } playerEntity }) return; + if (_playerManager.LocalEntity is not { } playerEntity) + return; if (!CanSeeTable(playerEntity, _table)) { @@ -85,7 +86,7 @@ public override void FrameUpdate(float frameTime) // If the dragged entity has another dragging player, drop the item // This should happen if the local player is dragging an item, and another player grabs it out of their hand if (draggableComponent.DraggingPlayer != null && - draggableComponent.DraggingPlayer != _playerManager.LocalPlayer?.Session.UserId) + draggableComponent.DraggingPlayer != _playerManager.LocalSession!.UserId) { StopDragging(false); return; @@ -186,7 +187,7 @@ private bool OnUseSecondary(in PointerInputCmdArgs args) private bool OnMouseDown(in PointerInputCmdArgs args) { // Return if no player entity - if (_playerManager.LocalPlayer is not {ControlledEntity: { } playerEntity}) + if (_playerManager.LocalEntity is not { } playerEntity) return false; var entity = args.EntityUid; diff --git a/Content.Client/Traits/ParacusiaSystem.cs b/Content.Client/Traits/ParacusiaSystem.cs index c661254bc950..3789f24cb0d0 100644 --- a/Content.Client/Traits/ParacusiaSystem.cs +++ b/Content.Client/Traits/ParacusiaSystem.cs @@ -30,7 +30,7 @@ public override void Update(float frameTime) if (!_timing.IsFirstTimePredicted) return; - if (_player.LocalPlayer?.ControlledEntity is not EntityUid localPlayer) + if (_player.LocalEntity is not EntityUid localPlayer) return; PlayParacusiaSounds(localPlayer); diff --git a/Content.Client/UserInterface/Controls/SplitBar.xaml.cs b/Content.Client/UserInterface/Controls/SplitBar.xaml.cs index 7273f327bfbe..2c0b716448e2 100644 --- a/Content.Client/UserInterface/Controls/SplitBar.xaml.cs +++ b/Content.Client/UserInterface/Controls/SplitBar.xaml.cs @@ -7,6 +7,7 @@ namespace Content.Client.UserInterface.Controls { [GenerateTypedNameReferences] + [Virtual] public partial class SplitBar : BoxContainer { public Vector2 MinBarSize = new(24, 0); diff --git a/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs b/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs index a8c4a2b1b412..791d5910f411 100644 --- a/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs +++ b/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs @@ -169,7 +169,7 @@ public void EnsureUIHelper() return; UIHelper?.Dispose(); - var ownerUserId = _playerManager.LocalPlayer!.UserId; + var ownerUserId = _playerManager.LocalUser!.Value; UIHelper = isAdmin ? new AdminAHelpUIHandler(ownerUserId) : new UserAHelpUIHandler(ownerUserId); UIHelper.DiscordRelayChanged(_discordRelayActive); @@ -182,15 +182,15 @@ public void EnsureUIHelper() public void Open() { - var localPlayer = _playerManager.LocalPlayer; - if (localPlayer == null) + var localUser = _playerManager.LocalUser; + if (localUser == null) { return; } EnsureUIHelper(); if (UIHelper!.IsOpen) return; - UIHelper!.Open(localPlayer.UserId, _discordRelayActive); + UIHelper!.Open(localUser.Value, _discordRelayActive); } public void Open(NetUserId userId) diff --git a/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs b/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs index 2d15f92f7786..1adf9ae59bd5 100644 --- a/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs +++ b/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs @@ -587,7 +587,7 @@ private void UpdateQueuedSpeechBubbles(FrameEventArgs delta) CreateSpeechBubble(entity, msg); } - var player = _player.LocalPlayer?.ControlledEntity; + var player = _player.LocalEntity; var predicate = static (EntityUid uid, (EntityUid compOwner, EntityUid? attachedEntity) data) => uid == data.compOwner || uid == data.attachedEntity; var playerPos = player != null @@ -644,7 +644,7 @@ public ChatSelectChannel MapLocalIfGhost(ChatSelectChannel channel) private bool TryGetRadioChannel(string text, out RadioChannelPrototype? radioChannel) { radioChannel = null; - return _player.LocalPlayer?.ControlledEntity is EntityUid { Valid: true } uid + return _player.LocalEntity is EntityUid { Valid: true } uid && _chatSys != null && _chatSys.TryProccessRadioMessage(uid, text, out _, out radioChannel, quiet: true); } diff --git a/Content.Client/UserInterface/Systems/Chat/Widgets/ChatBox.xaml.cs b/Content.Client/UserInterface/Systems/Chat/Widgets/ChatBox.xaml.cs index 936e7cdecd4b..a33bee20f9f9 100644 --- a/Content.Client/UserInterface/Systems/Chat/Widgets/ChatBox.xaml.cs +++ b/Content.Client/UserInterface/Systems/Chat/Widgets/ChatBox.xaml.cs @@ -33,7 +33,7 @@ public ChatBox() _entManager = IoCManager.Resolve(); ChatInput.Input.OnTextEntered += OnTextEntered; - ChatInput.Input.OnKeyBindDown += OnKeyBindDown; + ChatInput.Input.OnKeyBindDown += OnInputKeyBindDown; ChatInput.Input.OnTextChanged += OnTextChanged; ChatInput.ChannelSelector.OnChannelSelect += OnChannelSelect; ChatInput.FilterButton.Popup.OnChannelFilter += OnChannelFilter; @@ -142,7 +142,7 @@ public void SafelySelectChannel(ChatSelectChannel toSelect) ChatInput.ChannelSelector.Select(toSelect); } - private void OnKeyBindDown(GUIBoundKeyEventArgs args) + private void OnInputKeyBindDown(GUIBoundKeyEventArgs args) { if (args.Function == EngineKeyFunctions.TextReleaseFocus) { @@ -182,7 +182,7 @@ protected override void Dispose(bool disposing) if (!disposing) return; _controller.UnregisterChat(this); ChatInput.Input.OnTextEntered -= OnTextEntered; - ChatInput.Input.OnKeyBindDown -= OnKeyBindDown; + ChatInput.Input.OnKeyBindDown -= OnInputKeyBindDown; ChatInput.Input.OnTextChanged -= OnTextChanged; ChatInput.ChannelSelector.OnChannelSelect -= OnChannelSelect; } diff --git a/Content.Client/UserInterface/Systems/DamageOverlays/DamageOverlayUiController.cs b/Content.Client/UserInterface/Systems/DamageOverlays/DamageOverlayUiController.cs index 0485ea5dff88..c10c33a99020 100644 --- a/Content.Client/UserInterface/Systems/DamageOverlays/DamageOverlayUiController.cs +++ b/Content.Client/UserInterface/Systems/DamageOverlays/DamageOverlayUiController.cs @@ -48,7 +48,7 @@ private void OnPlayerDetached(LocalPlayerDetachedEvent args) private void OnMobStateChanged(MobStateChangedEvent args) { - if (args.Target != _playerManager.LocalPlayer?.ControlledEntity) + if (args.Target != _playerManager.LocalEntity) return; UpdateOverlays(args.Target, args.Component); @@ -57,7 +57,7 @@ private void OnMobStateChanged(MobStateChangedEvent args) private void OnThresholdCheck(ref MobThresholdChecked args) { - if (args.Target != _playerManager.LocalPlayer?.ControlledEntity) + if (args.Target != _playerManager.LocalEntity) return; UpdateOverlays(args.Target, args.MobState, args.Damageable, args.Threshold); } diff --git a/Content.Client/UserInterface/Systems/DamageOverlays/Overlays/DamageOverlay.cs b/Content.Client/UserInterface/Systems/DamageOverlays/Overlays/DamageOverlay.cs index 03d7a865f717..fd748153166b 100644 --- a/Content.Client/UserInterface/Systems/DamageOverlays/Overlays/DamageOverlay.cs +++ b/Content.Client/UserInterface/Systems/DamageOverlays/Overlays/DamageOverlay.cs @@ -56,7 +56,7 @@ public DamageOverlay() protected override void Draw(in OverlayDrawArgs args) { - if (!_entityManager.TryGetComponent(_playerManager.LocalPlayer?.ControlledEntity, out EyeComponent? eyeComp)) + if (!_entityManager.TryGetComponent(_playerManager.LocalEntity, out EyeComponent? eyeComp)) return; if (args.Viewport.Eye != eyeComp.Eye) diff --git a/Content.Client/UserInterface/Systems/Ghost/Controls/Roles/MakeGhostRoleEui.cs b/Content.Client/UserInterface/Systems/Ghost/Controls/Roles/MakeGhostRoleEui.cs index 926a830e71c4..5c5e31de03b5 100644 --- a/Content.Client/UserInterface/Systems/Ghost/Controls/Roles/MakeGhostRoleEui.cs +++ b/Content.Client/UserInterface/Systems/Ghost/Controls/Roles/MakeGhostRoleEui.cs @@ -43,8 +43,8 @@ public override void Opened() private void OnMake(NetEntity entity, string name, string description, string rules, bool makeSentient) { - var player = _playerManager.LocalPlayer; - if (player == null) + var session = _playerManager.LocalSession; + if (session == null) { return; } @@ -56,12 +56,12 @@ private void OnMake(NetEntity entity, string name, string description, string ru $"\"{CommandParsing.Escape(description)}\" " + $"\"{CommandParsing.Escape(rules)}\""; - _consoleHost.ExecuteCommand(player.Session, makeGhostRoleCommand); + _consoleHost.ExecuteCommand(session, makeGhostRoleCommand); if (makeSentient) { var makeSentientCommand = $"makesentient \"{CommandParsing.Escape(entity.ToString())}\""; - _consoleHost.ExecuteCommand(player.Session, makeSentientCommand); + _consoleHost.ExecuteCommand(session, makeSentientCommand); } _window.Close(); diff --git a/Content.Client/UserInterface/Systems/Viewport/ViewportUIController.cs b/Content.Client/UserInterface/Systems/Viewport/ViewportUIController.cs index 668c8f2d5988..d117043f425f 100644 --- a/Content.Client/UserInterface/Systems/Viewport/ViewportUIController.cs +++ b/Content.Client/UserInterface/Systems/Viewport/ViewportUIController.cs @@ -80,7 +80,7 @@ public override void FrameUpdate(FrameEventArgs e) // verify that the current eye is not "null". Fuck IEyeManager. - var ent = _playerMan.LocalPlayer?.ControlledEntity; + var ent = _playerMan.LocalEntity; if (_eyeManager.CurrentEye.Position != default || ent == null) return; diff --git a/Content.Client/Verbs/VerbSystem.cs b/Content.Client/Verbs/VerbSystem.cs index 34634482c61c..329a8977a684 100644 --- a/Content.Client/Verbs/VerbSystem.cs +++ b/Content.Client/Verbs/VerbSystem.cs @@ -57,7 +57,7 @@ public bool TryGetEntityMenuEntities(MapCoordinates targetPos, [NotNullWhen(true if (_stateManager.CurrentState is not GameplayStateBase gameScreenBase) return false; - var player = _playerManager.LocalPlayer?.ControlledEntity; + var player = _playerManager.LocalEntity; if (player == null) return false; diff --git a/Content.Client/Weapons/Melee/MeleeArcOverlay.cs b/Content.Client/Weapons/Melee/MeleeArcOverlay.cs index 29bfa0956508..dbd68c15e247 100644 --- a/Content.Client/Weapons/Melee/MeleeArcOverlay.cs +++ b/Content.Client/Weapons/Melee/MeleeArcOverlay.cs @@ -35,7 +35,7 @@ public MeleeArcOverlay(IEntityManager entManager, IEyeManager eyeManager, IInput protected override void Draw(in OverlayDrawArgs args) { - var player = _playerManager.LocalPlayer?.ControlledEntity; + var player = _playerManager.LocalEntity; if (!_entManager.TryGetComponent(player, out var xform) || !_combatMode.IsInCombatMode(player)) diff --git a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs index 2676a7ea6a92..641d56d3d14b 100644 --- a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs +++ b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs @@ -50,7 +50,7 @@ public override void Update(float frameTime) if (!Timing.IsFirstTimePredicted) return; - var entityNull = _player.LocalPlayer?.ControlledEntity; + var entityNull = _player.LocalEntity; if (entityNull == null) return; diff --git a/Content.Client/Weapons/Misc/GrapplingGunSystem.cs b/Content.Client/Weapons/Misc/GrapplingGunSystem.cs index b54b11ee09f7..df20042b4be9 100644 --- a/Content.Client/Weapons/Misc/GrapplingGunSystem.cs +++ b/Content.Client/Weapons/Misc/GrapplingGunSystem.cs @@ -26,7 +26,7 @@ public override void Update(float frameTime) if (!Timing.IsFirstTimePredicted) return; - var local = _player.LocalPlayer?.ControlledEntity; + var local = _player.LocalEntity; var handUid = _hands.GetActiveHandEntity(); if (!TryComp(handUid, out var grappling)) diff --git a/Content.Client/Weapons/Misc/TetherGunSystem.cs b/Content.Client/Weapons/Misc/TetherGunSystem.cs index dd8f283cbf5a..634dbd24e792 100644 --- a/Content.Client/Weapons/Misc/TetherGunSystem.cs +++ b/Content.Client/Weapons/Misc/TetherGunSystem.cs @@ -54,7 +54,7 @@ public override void Update(float frameTime) if (!_timing.IsFirstTimePredicted) return; - var player = _player.LocalPlayer?.ControlledEntity; + var player = _player.LocalEntity; if (player == null || !TryGetTetherGun(player.Value, out var gunUid, out var gun) || diff --git a/Content.Client/Weapons/Ranged/GunSpreadOverlay.cs b/Content.Client/Weapons/Ranged/GunSpreadOverlay.cs index 84b6ce404801..62df764ae50c 100644 --- a/Content.Client/Weapons/Ranged/GunSpreadOverlay.cs +++ b/Content.Client/Weapons/Ranged/GunSpreadOverlay.cs @@ -33,7 +33,7 @@ protected override void Draw(in OverlayDrawArgs args) { var worldHandle = args.WorldHandle; - var player = _player.LocalPlayer?.ControlledEntity; + var player = _player.LocalEntity; if (player == null || !_entManager.TryGetComponent(player, out var xform)) diff --git a/Content.Client/Weapons/Ranged/Systems/FlyBySoundSystem.cs b/Content.Client/Weapons/Ranged/Systems/FlyBySoundSystem.cs index 565672ad383d..401b7cdfafe7 100644 --- a/Content.Client/Weapons/Ranged/Systems/FlyBySoundSystem.cs +++ b/Content.Client/Weapons/Ranged/Systems/FlyBySoundSystem.cs @@ -24,7 +24,7 @@ public override void Initialize() private void OnCollide(EntityUid uid, FlyBySoundComponent component, ref StartCollideEvent args) { - var attachedEnt = _player.LocalPlayer?.ControlledEntity; + var attachedEnt = _player.LocalEntity; // If it's not our ent or we shot it. if (attachedEnt == null || diff --git a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs index ce43057d6310..9e50cab3e10f 100644 --- a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs @@ -132,7 +132,7 @@ public override void Update(float frameTime) if (!Timing.IsFirstTimePredicted) return; - var entityNull = _player.LocalPlayer?.ControlledEntity; + var entityNull = _player.LocalEntity; if (entityNull == null || !TryComp(entityNull, out var combat) || !combat.IsInCombatMode) { diff --git a/Content.IntegrationTests/Pair/TestPair.Recycle.cs b/Content.IntegrationTests/Pair/TestPair.Recycle.cs index 872af8334fb5..52fdf600bb46 100644 --- a/Content.IntegrationTests/Pair/TestPair.Recycle.cs +++ b/Content.IntegrationTests/Pair/TestPair.Recycle.cs @@ -189,7 +189,7 @@ public void ValidateSettings(PoolSettings settings) var sPlayer = Server.ResolveDependency(); Assert.That(sPlayer.Sessions.Count(), Is.EqualTo(1)); var session = sPlayer.Sessions.Single(); - Assert.That(cPlayer.LocalPlayer?.Session.UserId, Is.EqualTo(session.UserId)); + Assert.That(cPlayer.LocalSession?.UserId, Is.EqualTo(session.UserId)); if (ticker.DummyTicker) return; diff --git a/Content.IntegrationTests/Tests/Actions/ActionsAddedTest.cs b/Content.IntegrationTests/Tests/Actions/ActionsAddedTest.cs index 913dcf4a40a1..32b152522618 100644 --- a/Content.IntegrationTests/Tests/Actions/ActionsAddedTest.cs +++ b/Content.IntegrationTests/Tests/Actions/ActionsAddedTest.cs @@ -23,7 +23,7 @@ public async Task TestCombatActionsAdded() var client = pair.Client; var sEntMan = server.ResolveDependency(); var cEntMan = client.ResolveDependency(); - var clientSession = client.ResolveDependency().LocalPlayer?.Session; + var clientSession = client.Session; var serverSession = server.ResolveDependency().Sessions.Single(); var sActionSystem = server.System(); var cActionSystem = client.System(); diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/AlertsComponentTests.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/AlertsComponentTests.cs index bbcd24b41564..1da77ac55892 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/AlertsComponentTests.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/AlertsComponentTests.cs @@ -24,7 +24,6 @@ public async Task AlertsTest() var server = pair.Server; var client = pair.Client; - var clientPlayerMgr = client.ResolveDependency(); var clientUIMgr = client.ResolveDependency(); var clientEntManager = client.ResolveDependency(); @@ -57,9 +56,9 @@ await server.WaitAssertion(() => AlertsUI clientAlertsUI = default; await client.WaitAssertion(() => { - var local = clientPlayerMgr.LocalPlayer; + var local = client.Session; Assert.That(local, Is.Not.Null); - var controlled = local.ControlledEntity; + var controlled = local.AttachedEntity; #pragma warning disable NUnit2045 // Interdependent assertions. Assert.That(controlled, Is.Not.Null); // Making sure it exists diff --git a/Content.IntegrationTests/Tests/Interaction/InteractionTest.cs b/Content.IntegrationTests/Tests/Interaction/InteractionTest.cs index 45a880fe867a..bed27ba6efe0 100644 --- a/Content.IntegrationTests/Tests/Interaction/InteractionTest.cs +++ b/Content.IntegrationTests/Tests/Interaction/InteractionTest.cs @@ -189,10 +189,10 @@ public virtual async Task Setup() // Get player data var sPlayerMan = Server.ResolveDependency(); var cPlayerMan = Client.ResolveDependency(); - if (cPlayerMan.LocalPlayer?.Session == null) + if (Client.Session == null) Assert.Fail("No player"); - ClientSession = cPlayerMan.LocalPlayer!.Session!; - ServerSession = sPlayerMan.GetSessionByUserId(ClientSession.UserId); + ClientSession = Client.Session!; + ServerSession = sPlayerMan.GetSessionById(ClientSession.UserId); // Spawn player entity & attach EntityUid? old = default; @@ -240,7 +240,7 @@ await Server.WaitPost(() => Assert.Multiple(() => { Assert.That(CEntMan.GetNetEntity(cPlayerMan.LocalEntity), Is.EqualTo(Player)); - Assert.That(sPlayerMan.GetSessionByUserId(ClientSession.UserId).AttachedEntity, Is.EqualTo(SEntMan.GetEntity(Player))); + Assert.That(sPlayerMan.GetSessionById(ClientSession.UserId).AttachedEntity, Is.EqualTo(SEntMan.GetEntity(Player))); }); } diff --git a/Content.MapRenderer/Painters/GridPainter.cs b/Content.MapRenderer/Painters/GridPainter.cs index 3079db436ba4..416ec0519953 100644 --- a/Content.MapRenderer/Painters/GridPainter.cs +++ b/Content.MapRenderer/Painters/GridPainter.cs @@ -85,7 +85,7 @@ private ConcurrentDictionary> GetEntities() } var transform = _sEntityManager.GetComponent(serverEntity); - if (_sMapManager.TryGetGrid(transform.GridUid, out var grid)) + if (_sEntityManager.TryGetComponent(transform.GridUid, out MapGridComponent? grid)) { var position = transform.LocalPosition; diff --git a/Content.MapRenderer/Painters/TilePainter.cs b/Content.MapRenderer/Painters/TilePainter.cs index cac0f960c460..7084d2caf4a5 100644 --- a/Content.MapRenderer/Painters/TilePainter.cs +++ b/Content.MapRenderer/Painters/TilePainter.cs @@ -20,12 +20,15 @@ public sealed class TilePainter public const int TileImageSize = EyeManager.PixelsPerMeter; private readonly ITileDefinitionManager _sTileDefinitionManager; + private readonly SharedMapSystem _sMapSystem; private readonly IResourceManager _resManager; public TilePainter(ClientIntegrationInstance client, ServerIntegrationInstance server) { _sTileDefinitionManager = server.ResolveDependency(); _resManager = client.ResolveDependency(); + var esm = server.ResolveDependency(); + _sMapSystem = esm.GetEntitySystem(); } public void Run(Image gridCanvas, EntityUid gridUid, MapGridComponent grid) @@ -41,7 +44,7 @@ public void Run(Image gridCanvas, EntityUid gridUid, MapGridComponent grid) var images = GetTileImages(_sTileDefinitionManager, _resManager, tileSize); var i = 0; - grid.GetAllTiles().AsParallel().ForAll(tile => + _sMapSystem.GetAllTiles(gridUid, grid).AsParallel().ForAll(tile => { var path = _sTileDefinitionManager[tile.Tile.TypeId].Sprite.ToString(); diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs index 07c79747c0fc..882d5e37d8df 100644 --- a/Content.Server/GameTicking/GameTicker.Spawning.cs +++ b/Content.Server/GameTicking/GameTicker.Spawning.cs @@ -93,7 +93,7 @@ private void SpawnPlayers(List readyPlayers, Dictionary readyPlayers, Dictionary _playerManager.GetSessionByUserId(x)).ToArray(), profiles, force)); + RaiseLocalEvent(new RulePlayerJobsAssignedEvent(assignedJobs.Keys.Select(x => _playerManager.GetSessionById(x)).ToArray(), profiles, force)); } private void SpawnPlayer(ICommonSession player, EntityUid station, string? jobId = null, bool lateJoin = true, bool silent = false) diff --git a/Content.Server/Info/ShowRulesCommand.cs b/Content.Server/Info/ShowRulesCommand.cs index 66273e4f6328..32c24c299950 100644 --- a/Content.Server/Info/ShowRulesCommand.cs +++ b/Content.Server/Info/ShowRulesCommand.cs @@ -60,7 +60,7 @@ public async void Execute(IConsoleShell shell, string argStr, string[] args) var message = new SharedRulesManager.ShowRulesPopupMessage(); message.PopupTime = seconds; - var player = IoCManager.Resolve().GetSessionByUserId(located.UserId); + var player = IoCManager.Resolve().GetSessionById(located.UserId); netManager.ServerSendMessage(message, player.Channel); } } From df71b5d5730c67e7fb5f72d6a6e11d9e86938d97 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sun, 11 Feb 2024 16:41:45 +0100 Subject: [PATCH 4/7] Use new DateTime serializer to get rid of ISerializationHooks in changelog code. --- Content.Client/Changelog/ChangelogManager.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Content.Client/Changelog/ChangelogManager.cs b/Content.Client/Changelog/ChangelogManager.cs index 396af99d2cfa..4383f4661795 100644 --- a/Content.Client/Changelog/ChangelogManager.cs +++ b/Content.Client/Changelog/ChangelogManager.cs @@ -1,10 +1,8 @@ -using System.Globalization; using System.Linq; using System.Threading.Tasks; using Content.Shared.CCVar; using Robust.Shared.Configuration; using Robust.Shared.ContentPack; -using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager; using Robust.Shared.Serialization.Markdown; using Robust.Shared.Serialization.Markdown.Mapping; @@ -162,7 +160,7 @@ public sealed partial class Changelog } [DataDefinition] - public sealed partial class ChangelogEntry : ISerializationHooks + public sealed partial class ChangelogEntry { [DataField("id")] public int Id { get; private set; } @@ -170,17 +168,11 @@ public sealed partial class ChangelogEntry : ISerializationHooks [DataField("author")] public string Author { get; private set; } = ""; - [DataField("time")] private string _time = default!; - + [DataField] public DateTime Time { get; private set; } [DataField("changes")] public List Changes { get; private set; } = default!; - - void ISerializationHooks.AfterDeserialization() - { - Time = DateTime.Parse(_time, null, DateTimeStyles.RoundtripKind); - } } [DataDefinition] From 98d96a709db1f4a5ea89a92399d8a12039c92adb Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sun, 11 Feb 2024 16:51:24 +0100 Subject: [PATCH 5/7] Get rid of some more ISerializationHooks for enums --- .../RandomAppearanceComponent.cs | 24 +++---------------- .../UserInterface/ActivatableUIComponent.cs | 18 +++----------- .../UserInterface/OpenUiActionEvent.cs | 19 +++------------ 3 files changed, 9 insertions(+), 52 deletions(-) diff --git a/Content.Server/RandomAppearance/RandomAppearanceComponent.cs b/Content.Server/RandomAppearance/RandomAppearanceComponent.cs index 8560eebb57f2..4631abc13ce5 100644 --- a/Content.Server/RandomAppearance/RandomAppearanceComponent.cs +++ b/Content.Server/RandomAppearance/RandomAppearanceComponent.cs @@ -1,11 +1,10 @@ -using Robust.Shared.Reflection; -using Robust.Shared.Serialization; +using Robust.Shared.Serialization.TypeSerializers.Implementations; namespace Content.Server.RandomAppearance; [RegisterComponent] [Access(typeof(RandomAppearanceSystem))] -public sealed partial class RandomAppearanceComponent : Component, ISerializationHooks +public sealed partial class RandomAppearanceComponent : Component { [DataField("spriteStates")] public string[] SpriteStates = { "0", "1", "2", "3", "4" }; @@ -13,23 +12,6 @@ public sealed partial class RandomAppearanceComponent : Component, ISerializatio /// /// What appearance enum key should be set to the random sprite state? /// - [DataField("key", required: true)] - public string EnumKeyRaw = default!; - - /// - /// The actual enum after reflection. - /// + [DataField(required: true, customTypeSerializer: typeof(EnumSerializer))] public Enum? EnumKey; - - void ISerializationHooks.AfterDeserialization() - { - if (IoCManager.Resolve().TryParseEnumReference(EnumKeyRaw, out var @enum)) - { - EnumKey = @enum; - } - else - { - Logger.Error($"RandomAppearance enum key {EnumKeyRaw} could not be parsed!"); - } - } } diff --git a/Content.Server/UserInterface/ActivatableUIComponent.cs b/Content.Server/UserInterface/ActivatableUIComponent.cs index 34f9c0f3970c..54639dd2b052 100644 --- a/Content.Server/UserInterface/ActivatableUIComponent.cs +++ b/Content.Server/UserInterface/ActivatableUIComponent.cs @@ -1,14 +1,12 @@ using Robust.Shared.Player; -using Robust.Shared.Reflection; -using Robust.Shared.Serialization; +using Robust.Shared.Serialization.TypeSerializers.Implementations; namespace Content.Server.UserInterface { [RegisterComponent] - public sealed partial class ActivatableUIComponent : Component, - ISerializationHooks + public sealed partial class ActivatableUIComponent : Component { - [ViewVariables] + [DataField(required: true, customTypeSerializer:typeof(EnumSerializer))] public Enum? Key { get; set; } [ViewVariables(VVAccess.ReadWrite)] @@ -22,9 +20,6 @@ public sealed partial class ActivatableUIComponent : Component, [DataField] public bool AdminOnly { get; set; } = false; - [DataField("key", required: true)] - private string _keyRaw = default!; - [DataField] public LocId VerbText = "ui-verb-toggle-open"; @@ -66,13 +61,6 @@ public sealed partial class ActivatableUIComponent : Component, /// [ViewVariables] public ICommonSession? CurrentSingleUser; - - void ISerializationHooks.AfterDeserialization() - { - var reflectionManager = IoCManager.Resolve(); - if (reflectionManager.TryParseEnumReference(_keyRaw, out var key)) - Key = key; - } } } diff --git a/Content.Shared/UserInterface/OpenUiActionEvent.cs b/Content.Shared/UserInterface/OpenUiActionEvent.cs index 3053861ea15b..1c5ca3d62c70 100644 --- a/Content.Shared/UserInterface/OpenUiActionEvent.cs +++ b/Content.Shared/UserInterface/OpenUiActionEvent.cs @@ -1,23 +1,10 @@ using Content.Shared.Actions; -using Robust.Shared.Reflection; -using Robust.Shared.Serialization; +using Robust.Shared.Serialization.TypeSerializers.Implementations; namespace Content.Shared.UserInterface; -public sealed partial class OpenUiActionEvent : InstantActionEvent, ISerializationHooks +public sealed partial class OpenUiActionEvent : InstantActionEvent { - [ViewVariables] + [DataField(required: true, customTypeSerializer: typeof(EnumSerializer))] public Enum? Key { get; private set; } - - [DataField("key", required: true)] - private string _keyRaw = default!; - - void ISerializationHooks.AfterDeserialization() - { - var reflectionManager = IoCManager.Resolve(); - if (reflectionManager.TryParseEnumReference(_keyRaw, out var key)) - Key = key; - else - Logger.Error($"Invalid UI key ({_keyRaw}) in open-UI action"); - } } From 1706185eb8baf8f34e16c0d2288ce5b32caba6f5 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sun, 11 Feb 2024 16:54:52 +0100 Subject: [PATCH 6/7] And a little more --- Content.Client/Anomaly/Ui/AnomalyGeneratorWindow.xaml.cs | 1 - Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs | 1 - Content.Client/Cargo/UI/BountyEntry.xaml.cs | 1 - Content.Client/Examine/ExamineSystem.cs | 1 - Content.Client/Explosion/ExplosionOverlay.cs | 1 - Content.Client/Fluids/PuddleOverlay.cs | 1 - Content.Client/Ghost/GhostSystem.cs | 1 - Content.Client/Hands/Systems/HandsSystem.cs | 1 - Content.Client/Inventory/StrippableBoundUserInterface.cs | 5 ++--- Content.Client/LateJoin/LateJoinGui.cs | 1 - Content.Client/Parallax/ParallaxSystem.cs | 1 - Content.Client/Replay/ReplayConGroup.cs | 2 +- Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs | 2 -- Content.Client/Weather/WeatherSystem.cs | 1 - 14 files changed, 3 insertions(+), 17 deletions(-) diff --git a/Content.Client/Anomaly/Ui/AnomalyGeneratorWindow.xaml.cs b/Content.Client/Anomaly/Ui/AnomalyGeneratorWindow.xaml.cs index ca8682e72d68..08438e2a1b28 100644 --- a/Content.Client/Anomaly/Ui/AnomalyGeneratorWindow.xaml.cs +++ b/Content.Client/Anomaly/Ui/AnomalyGeneratorWindow.xaml.cs @@ -11,7 +11,6 @@ namespace Content.Client.Anomaly.Ui; [GenerateTypedNameReferences] public sealed partial class AnomalyGeneratorWindow : FancyWindow { - [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IGameTiming _timing = default!; private TimeSpan _cooldownEnd = TimeSpan.Zero; diff --git a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs index de26eb5f1959..43be67c9d6bb 100644 --- a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs +++ b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs @@ -22,7 +22,6 @@ public sealed partial class AirAlarmWindow : FancyWindow public event Action? AtmosAlarmThresholdChanged; public event Action? AirAlarmModeChanged; public event Action? AutoModeChanged; - public event Action? ResyncDeviceRequested; public event Action? ResyncAllRequested; public event Action? AirAlarmTabChange; diff --git a/Content.Client/Cargo/UI/BountyEntry.xaml.cs b/Content.Client/Cargo/UI/BountyEntry.xaml.cs index 05c5673dddf5..1fc8a4986a2a 100644 --- a/Content.Client/Cargo/UI/BountyEntry.xaml.cs +++ b/Content.Client/Cargo/UI/BountyEntry.xaml.cs @@ -12,7 +12,6 @@ namespace Content.Client.Cargo.UI; [GenerateTypedNameReferences] public sealed partial class BountyEntry : BoxContainer { - [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IPrototypeManager _prototype = default!; public Action? OnButtonPressed; diff --git a/Content.Client/Examine/ExamineSystem.cs b/Content.Client/Examine/ExamineSystem.cs index b428a65ab037..1be472b06d67 100644 --- a/Content.Client/Examine/ExamineSystem.cs +++ b/Content.Client/Examine/ExamineSystem.cs @@ -33,7 +33,6 @@ public sealed class ExamineSystem : ExamineSystemShared [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly VerbSystem _verbSystem = default!; - [Dependency] private readonly IBaseClient _client = default!; public const string StyleClassEntityTooltip = "entity-tooltip"; diff --git a/Content.Client/Explosion/ExplosionOverlay.cs b/Content.Client/Explosion/ExplosionOverlay.cs index 94e8ca598237..2d8c15f1b9f9 100644 --- a/Content.Client/Explosion/ExplosionOverlay.cs +++ b/Content.Client/Explosion/ExplosionOverlay.cs @@ -14,7 +14,6 @@ namespace Content.Client.Explosion; public sealed class ExplosionOverlay : Overlay { [Dependency] private readonly IRobustRandom _robustRandom = default!; - [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IEntityManager _entMan = default!; [Dependency] private readonly IPrototypeManager _proto = default!; diff --git a/Content.Client/Fluids/PuddleOverlay.cs b/Content.Client/Fluids/PuddleOverlay.cs index 8c8b13a1efe7..ac6661cfdd83 100644 --- a/Content.Client/Fluids/PuddleOverlay.cs +++ b/Content.Client/Fluids/PuddleOverlay.cs @@ -9,7 +9,6 @@ namespace Content.Client.Fluids; public sealed class PuddleOverlay : Overlay { - [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; diff --git a/Content.Client/Ghost/GhostSystem.cs b/Content.Client/Ghost/GhostSystem.cs index 7513491e3316..c42e7cd0e0c5 100644 --- a/Content.Client/Ghost/GhostSystem.cs +++ b/Content.Client/Ghost/GhostSystem.cs @@ -15,7 +15,6 @@ public sealed class GhostSystem : SharedGhostSystem [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly SharedActionsSystem _actions = default!; [Dependency] private readonly ContentEyeSystem _contentEye = default!; - [Dependency] private readonly EyeSystem _eye = default!; public int AvailableGhostRoleCount { get; private set; } diff --git a/Content.Client/Hands/Systems/HandsSystem.cs b/Content.Client/Hands/Systems/HandsSystem.cs index 8daddc545d58..7319b97b42b7 100644 --- a/Content.Client/Hands/Systems/HandsSystem.cs +++ b/Content.Client/Hands/Systems/HandsSystem.cs @@ -22,7 +22,6 @@ namespace Content.Client.Hands.Systems [UsedImplicitly] public sealed class HandsSystem : SharedHandsSystem { - [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IUserInterfaceManager _ui = default!; diff --git a/Content.Client/Inventory/StrippableBoundUserInterface.cs b/Content.Client/Inventory/StrippableBoundUserInterface.cs index 028c035e8a78..f8eb12df9140 100644 --- a/Content.Client/Inventory/StrippableBoundUserInterface.cs +++ b/Content.Client/Inventory/StrippableBoundUserInterface.cs @@ -30,10 +30,9 @@ namespace Content.Client.Inventory [UsedImplicitly] public sealed class StrippableBoundUserInterface : BoundUserInterface { - [Dependency] private readonly IPrototypeManager _protoMan = default!; [Dependency] private readonly IUserInterfaceManager _ui = default!; - private readonly ExamineSystem _examine = default!; - private readonly InventorySystem _inv = default!; + private readonly ExamineSystem _examine; + private readonly InventorySystem _inv; private readonly SharedCuffableSystem _cuffable; [ViewVariables] diff --git a/Content.Client/LateJoin/LateJoinGui.cs b/Content.Client/LateJoin/LateJoinGui.cs index 9acfb0312610..3e7ca574763b 100644 --- a/Content.Client/LateJoin/LateJoinGui.cs +++ b/Content.Client/LateJoin/LateJoinGui.cs @@ -23,7 +23,6 @@ public sealed class LateJoinGui : DefaultWindow [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IClientConsoleHost _consoleHost = default!; [Dependency] private readonly IConfigurationManager _configManager = default!; - [Dependency] private readonly IEntityManager _entManager = default!; [Dependency] private readonly IEntitySystemManager _entitySystem = default!; [Dependency] private readonly JobRequirementsManager _jobRequirements = default!; diff --git a/Content.Client/Parallax/ParallaxSystem.cs b/Content.Client/Parallax/ParallaxSystem.cs index 720da72e80ed..db4cec0be80e 100644 --- a/Content.Client/Parallax/ParallaxSystem.cs +++ b/Content.Client/Parallax/ParallaxSystem.cs @@ -13,7 +13,6 @@ public sealed class ParallaxSystem : SharedParallaxSystem [Dependency] private readonly IMapManager _map = default!; [Dependency] private readonly IOverlayManager _overlay = default!; [Dependency] private readonly IParallaxManager _parallax = default!; - [Dependency] private readonly IPrototypeManager _protoManager = default!; [ValidatePrototypeId] private const string Fallback = "Default"; diff --git a/Content.Client/Replay/ReplayConGroup.cs b/Content.Client/Replay/ReplayConGroup.cs index 8e856326831b..cec20df4125c 100644 --- a/Content.Client/Replay/ReplayConGroup.cs +++ b/Content.Client/Replay/ReplayConGroup.cs @@ -4,7 +4,7 @@ namespace Content.Client.Replay; public sealed class ReplayConGroup : IClientConGroupImplementation { - public event Action? ConGroupUpdated; + public event Action? ConGroupUpdated { add { } remove { } } public bool CanAdminMenu() => true; public bool CanAdminPlace() => true; public bool CanCommand(string cmdName) => true; diff --git a/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs b/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs index 565c3b8e43ca..4135490416f7 100644 --- a/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs +++ b/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs @@ -19,8 +19,6 @@ public sealed partial class LawDisplay : Control [Dependency] private readonly IChatManager _chatManager = default!; [Dependency] private readonly EntityManager _entityManager = default!; - public event Action? OnLawAnnouncementButtonPressed; - public LawDisplay(EntityUid uid, SiliconLaw law, HashSet? radioChannels) { RobustXamlLoader.Load(this); diff --git a/Content.Client/Weather/WeatherSystem.cs b/Content.Client/Weather/WeatherSystem.cs index a9c29f96c935..24de0bc8c4c4 100644 --- a/Content.Client/Weather/WeatherSystem.cs +++ b/Content.Client/Weather/WeatherSystem.cs @@ -22,7 +22,6 @@ public sealed class WeatherSystem : SharedWeatherSystem [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly AudioSystem _audio = default!; [Dependency] private readonly MapSystem _mapSystem = default!; - [Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; public override void Initialize() From 9a7738fa5dd89f04aed05acc3b6820b8573a1ea9 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sun, 11 Feb 2024 20:00:42 +0100 Subject: [PATCH 7/7] Apply suggestions from code review Co-authored-by: 0x6273 <0x40@keemail.me> --- Content.Client/Administration/Managers/ClientAdminManager.cs | 1 - Content.Client/CardboardBox/CardboardBoxSystem.cs | 1 - Content.Client/HotPotato/HotPotatoSystem.cs | 1 - 3 files changed, 3 deletions(-) diff --git a/Content.Client/Administration/Managers/ClientAdminManager.cs b/Content.Client/Administration/Managers/ClientAdminManager.cs index c3eb5edfb9d7..d33761be8f23 100644 --- a/Content.Client/Administration/Managers/ClientAdminManager.cs +++ b/Content.Client/Administration/Managers/ClientAdminManager.cs @@ -17,7 +17,6 @@ public sealed class ClientAdminManager : IClientAdminManager, IClientConGroupImp [Dependency] private readonly IResourceManager _res = default!; [Dependency] private readonly ILogManager _logManager = default!; - private AdminData? _adminData; private readonly HashSet _availableCommands = new(); diff --git a/Content.Client/CardboardBox/CardboardBoxSystem.cs b/Content.Client/CardboardBox/CardboardBoxSystem.cs index e5a766265c7b..50f9de239d52 100644 --- a/Content.Client/CardboardBox/CardboardBoxSystem.cs +++ b/Content.Client/CardboardBox/CardboardBoxSystem.cs @@ -12,7 +12,6 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem [Dependency] private readonly EntityLookupSystem _entityLookup = default!; [Dependency] private readonly TransformSystem _transform = default!; - public override void Initialize() { base.Initialize(); diff --git a/Content.Client/HotPotato/HotPotatoSystem.cs b/Content.Client/HotPotato/HotPotatoSystem.cs index 04233a920f30..028a3b70d9f4 100644 --- a/Content.Client/HotPotato/HotPotatoSystem.cs +++ b/Content.Client/HotPotato/HotPotatoSystem.cs @@ -10,7 +10,6 @@ public sealed class HotPotatoSystem : SharedHotPotatoSystem [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; - public override void Update(float frameTime) { base.Update(frameTime);