From 68ce53ae17985876d6d112b764b2144964a9f42e Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Tue, 13 Feb 2024 22:48:39 +0100 Subject: [PATCH] Random spontaneous cleanup PR (#25131) * 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. * Fix a bunch of warnings * More warning fixes * Use new DateTime serializer to get rid of ISerializationHooks in changelog code. * Get rid of some more ISerializationHooks for enums * And a little more * Apply suggestions from code review Co-authored-by: 0x6273 <0x40@keemail.me> --------- Co-authored-by: 0x6273 <0x40@keemail.me> --- .../ColorInterpolateBenchmark.cs | 8 ++-- Content.Benchmarks/Program.cs | 5 --- Content.Client/Actions/ActionsSystem.cs | 18 ++++----- .../Managers/ClientAdminManager.cs | 17 +++++---- .../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 +- .../Anomaly/Ui/AnomalyGeneratorWindow.xaml.cs | 1 - .../Atmos/Monitor/UI/AirAlarmWindow.xaml.cs | 1 - .../UI/Widgets/ThresholdBoundControl.xaml | 2 +- .../UI/Widgets/ThresholdBoundControl.xaml.cs | 1 - Content.Client/Audio/AmbientSoundSystem.cs | 13 ++----- Content.Client/Audio/BackgroundAudioSystem.cs | 7 +--- .../Audio/ClientGlobalSoundSystem.cs | 4 +- .../Audio/ContentAudioSystem.AmbientMusic.cs | 5 +-- Content.Client/Audio/ContentAudioSystem.cs | 7 ---- Content.Client/Camera/CameraRecoilSystem.cs | 17 +++------ .../CardboardBox/CardboardBoxSystem.cs | 10 +++-- Content.Client/Cargo/UI/BountyEntry.xaml.cs | 1 - Content.Client/Changelog/ChangelogManager.cs | 12 +----- .../CharacterInfo/CharacterInfoSystem.cs | 2 +- .../TypingIndicator/TypingIndicatorSystem.cs | 5 ++- .../UI/CloningConsoleWindow.xaml.cs | 2 +- Content.Client/CombatMode/CombatModeSystem.cs | 7 ++-- .../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 | 11 ++---- Content.Client/Explosion/ExplosionOverlay.cs | 1 - 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 +- Content.Client/Fluids/PuddleOverlay.cs | 1 - .../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 | 3 +- Content.Client/Gravity/GravitySystem.Shake.cs | 4 +- Content.Client/Guidebook/GuidebookSystem.cs | 2 +- Content.Client/Hands/Systems/HandsSystem.cs | 21 +++++----- Content.Client/HotPotato/HotPotatoSystem.cs | 5 ++- .../Instruments/InstrumentSystem.cs | 12 +----- .../Instruments/UI/InstrumentMenu.xaml.cs | 12 +++--- Content.Client/Interaction/DragDropSystem.cs | 9 ++--- .../Inventory/StrippableBoundUserInterface.cs | 5 +-- Content.Client/LateJoin/LateJoinGui.cs | 1 - .../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 | 17 +++------ Content.Client/Outline/TargetOutlineSystem.cs | 2 +- Content.Client/Parallax/ParallaxSystem.cs | 1 - .../Physics/Controllers/MoverController.cs | 8 ++-- .../JobRequirementsManager.cs | 2 +- .../Replay/ContentReplayPlaybackManager.cs | 2 +- Content.Client/Replay/ReplayConGroup.cs | 2 +- .../Research/UI/ResearchConsoleMenu.xaml.cs | 2 +- Content.Client/Salvage/SalvageSystem.cs | 2 +- .../Shuttles/Systems/ShuttleConsoleSystem.cs | 2 +- .../Silicons/Laws/Ui/LawDisplay.xaml.cs | 2 - Content.Client/Sprite/SpriteFadeSystem.cs | 2 +- Content.Client/StatusIcon/StatusIconSystem.cs | 12 +----- 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 +- Content.Client/Weather/WeatherSystem.cs | 1 - .../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 ++- 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/Systems/AdminSystem.cs | 22 ++++------- .../Administration/Systems/BwoinkSystem.cs | 19 +++------- .../Administration/UI/PermissionsEui.cs | 34 +++++++++-------- .../Administration/UI/SpawnExplosionEui.cs | 11 +++++- Content.Server/Afk/AFKSystem.cs | 3 +- Content.Server/AlertLevel/AlertLevelSystem.cs | 2 +- .../Commands/SetAlertLevelCommand.cs | 32 ++++++++-------- Content.Server/Ame/AmeNodeGroup.cs | 9 +++-- .../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 +--- .../ConstructionSystem.Initial.cs | 12 +++--- .../ConstructionSystem.Interactions.cs | 12 +++--- .../Construction/ConstructionSystem.cs | 15 ++------ Content.Server/Decals/DecalSystem.cs | 3 +- .../EntitySystems/ClusterGrenadeSystem.cs | 3 -- .../EntitySystems/ExplosionSystem.CVars.cs | 37 ++++-------------- .../EntitySystems/ExplosionSystem.cs | 1 - .../EntitySystems/SmokeOnTriggerSystem.cs | 2 - Content.Server/Flash/FlashSystem.cs | 2 - .../GameTicking/GameTicker.CVars.cs | 16 ++++---- .../GameTicking/GameTicker.Spawning.cs | 6 +-- Content.Server/Holiday/HolidaySystem.cs | 2 +- Content.Server/Info/InfoSystem.cs | 7 ++-- Content.Server/Info/ShowRulesCommand.cs | 2 +- .../Instruments/InstrumentSystem.CVars.cs | 36 ++---------------- .../Instruments/InstrumentSystem.cs | 7 ---- .../Light/EntitySystems/PoweredLightSystem.cs | 5 --- Content.Server/Mapping/MappingSystem.cs | 9 +---- .../MassMedia/Systems/NewsSystem.cs | 12 ------ Content.Server/Mind/MindSystem.cs | 8 +--- Content.Server/Motd/MOTDSystem.cs | 8 +--- .../NPC/Systems/NPCCombatSystem.Melee.cs | 3 -- .../NPC/Systems/NPCSteeringSystem.cs | 11 +----- Content.Server/NPC/Systems/NPCSystem.cs | 14 +------ .../Systems/ObjectiveLimitSystem.cs | 2 +- Content.Server/PDA/Ringer/RingerSystem.cs | 1 - Content.Server/Parallax/BiomeSystem.cs | 8 +--- Content.Server/Pinpointer/PinpointerSystem.cs | 19 ++-------- .../Radiation/Systems/RadiationSystem.Cvar.cs | 36 ++---------------- .../Radiation/Systems/RadiationSystem.cs | 6 --- .../RandomAppearanceComponent.cs | 24 ++---------- .../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 +--- .../CursedEntityStorageSystem.cs | 4 -- .../Store/Conditions/BuyerSpeciesCondition.cs | 2 - Content.Server/Tips/TipsSystem.cs | 8 ++-- .../UserInterface/ActivatableUIComponent.cs | 18 ++------- .../Worldgen/Systems/WorldgenConfigSystem.cs | 4 +- .../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 +++++------ .../Cryostorage/SharedCryostorageSystem.cs | 9 +---- .../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 +- .../Friction/TileFrictionController.cs | 16 +------- .../Gibbing/Systems/GibbingSystem.cs | 1 - .../Hands/EntitySystems/SharedHandsSystem.cs | 1 - .../Inventory/InventorySystem.Slots.cs | 2 +- .../Systems/SharedMoverController.Input.cs | 13 +------ .../Systems/SharedMoverController.Relay.cs | 4 +- .../Movement/Systems/SharedMoverController.cs | 9 +---- .../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 - .../UserInterface/OpenUiActionEvent.cs | 19 ++-------- 210 files changed, 481 insertions(+), 930 deletions(-) diff --git a/Content.Benchmarks/ColorInterpolateBenchmark.cs b/Content.Benchmarks/ColorInterpolateBenchmark.cs index 2243bb4819..eb182328d4 100644 --- a/Content.Benchmarks/ColorInterpolateBenchmark.cs +++ b/Content.Benchmarks/ColorInterpolateBenchmark.cs @@ -131,8 +131,8 @@ namespace Content.Benchmarks 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 @@ namespace Content.Benchmarks 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 0beb0a613d..42a436597d 100644 --- a/Content.Benchmarks/Program.cs +++ b/Content.Benchmarks/Program.cs @@ -18,11 +18,6 @@ namespace Content.Benchmarks 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 508f3404ba..2343b9eac1 100644 --- a/Content.Client/Actions/ActionsSystem.cs +++ b/Content.Client/Actions/ActionsSystem.cs @@ -101,7 +101,7 @@ namespace Content.Client.Actions 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 @@ namespace Content.Client.Actions return; base.UpdateAction(actionId, action); - if (_playerManager.LocalPlayer?.ControlledEntity != action.AttachedEntity) + if (_playerManager.LocalEntity != action.AttachedEntity) return; ActionsUpdated?.Invoke(); @@ -144,7 +144,7 @@ namespace Content.Client.Actions _added.Add((actionId, action)); } - if (_playerManager.LocalPlayer?.ControlledEntity != uid) + if (_playerManager.LocalEntity != uid) return; foreach (var action in _removed) @@ -177,7 +177,7 @@ namespace Content.Client.Actions 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 @@ namespace Content.Client.Actions 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 @@ namespace Content.Client.Actions 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 @@ namespace Content.Client.Actions 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 @@ namespace Content.Client.Actions 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 @@ namespace Content.Client.Actions /// 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 1a1366c6f2..d33761be8f 100644 --- a/Content.Client/Administration/Managers/ClientAdminManager.cs +++ b/Content.Client/Administration/Managers/ClientAdminManager.cs @@ -15,11 +15,13 @@ namespace Content.Client.Administration.Managers [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 +94,17 @@ namespace Content.Client.Administration.Managers } _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 +116,17 @@ namespace Content.Client.Administration.Managers 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 +134,7 @@ namespace Content.Client.Administration.Managers 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 04219fe39b..5f187cad79 100644 --- a/Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs +++ b/Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs @@ -99,7 +99,7 @@ public sealed partial class SpawnExplosionWindow : DefaultWindow { 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 34611f51af..97c84e5d2f 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 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab 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 7e2fdda3e2..03fd52f446 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 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab { _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 d273ea3e55..c06d916133 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 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab 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 276ec3d67d..3353d0873e 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 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab 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 850e43e418..1183efb9b5 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 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab 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 83327ad77b..ab296a9619 100644 --- a/Content.Client/Alerts/ClientAlertsSystem.cs +++ b/Content.Client/Alerts/ClientAlertsSystem.cs @@ -40,7 +40,7 @@ public sealed class ClientAlertsSystem : AlertsSystem { get { - var ent = _playerManager.LocalPlayer?.ControlledEntity; + var ent = _playerManager.LocalEntity; return ent is not null ? GetActiveAlerts(ent.Value) : null; @@ -49,7 +49,7 @@ public sealed class ClientAlertsSystem : AlertsSystem 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 @@ public sealed class ClientAlertsSystem : AlertsSystem 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 @@ public sealed class ClientAlertsSystem : AlertsSystem 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 @@ public sealed class ClientAlertsSystem : AlertsSystem { 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 2ac51e6eba..abeac664c7 100644 --- a/Content.Client/Animations/EntityPickupAnimationSystem.cs +++ b/Content.Client/Animations/EntityPickupAnimationSystem.cs @@ -65,7 +65,7 @@ public sealed class EntityPickupAnimationSystem : EntitySystem 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/Anomaly/Ui/AnomalyGeneratorWindow.xaml.cs b/Content.Client/Anomaly/Ui/AnomalyGeneratorWindow.xaml.cs index ca8682e72d..08438e2a1b 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 de26eb5f19..43be67c9d6 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/Atmos/Monitor/UI/Widgets/ThresholdBoundControl.xaml b/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdBoundControl.xaml index 3885127384..0d5e741d0f 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" >