diff --git a/Content.Client/DoAfter/UI/DoAfterGui.cs b/Content.Client/DoAfter/UI/DoAfterGui.cs index 2e6a5076c9..1b7b2d4da9 100644 --- a/Content.Client/DoAfter/UI/DoAfterGui.cs +++ b/Content.Client/DoAfter/UI/DoAfterGui.cs @@ -146,7 +146,13 @@ namespace Content.Client.DoAfter.UI { base.FrameUpdate(args); - if (AttachedEntity?.IsValid() != true || + IEntity? tempQualifier = AttachedEntity; + if (tempQualifier != null) + { + IoCManager.Resolve().EntityExists(tempQualifier.Uid); + } + + if (RETURNED_VALUE != true || !AttachedEntity.TryGetComponent(out DoAfterComponent? doAfterComponent)) { Visible = false; diff --git a/Content.Client/IconSmoothing/IconSmoothSystem.cs b/Content.Client/IconSmoothing/IconSmoothSystem.cs index eefbc01e8a..3ad65b1727 100644 --- a/Content.Client/IconSmoothing/IconSmoothSystem.cs +++ b/Content.Client/IconSmoothing/IconSmoothSystem.cs @@ -51,7 +51,7 @@ namespace Content.Client.IconSmoothing // Yes, we updates ALL smoothing entities surrounding us even if they would never smooth with us. // This is simpler to implement. If you want to optimize it be my guest. var senderEnt = ev.Sender; - if (senderEnt.IsValid() && + if (IoCManager.Resolve().EntityExists(senderEnt.Uid) && _mapManager.TryGetGrid(senderEnt.Transform.GridID, out var grid1) && senderEnt.TryGetComponent(out IconSmoothComponent? iconSmooth) && iconSmooth.Running) diff --git a/Content.IntegrationTests/Tests/MindEntityDeletionTest.cs b/Content.IntegrationTests/Tests/MindEntityDeletionTest.cs index f63a7d100a..edfa665574 100644 --- a/Content.IntegrationTests/Tests/MindEntityDeletionTest.cs +++ b/Content.IntegrationTests/Tests/MindEntityDeletionTest.cs @@ -98,7 +98,7 @@ namespace Content.IntegrationTests.Tests server.Assert(() => { - Assert.That(mind.CurrentEntity.IsValid(), Is.True); + Assert.That(IoCManager.Resolve().EntityExists(mind.CurrentEntity.Uid), Is.True); }); await server.WaitIdleAsync(); @@ -149,7 +149,7 @@ namespace Content.IntegrationTests.Tests server.Assert(() => { - Assert.That(mind.CurrentEntity.IsValid(), Is.True); + Assert.That(IoCManager.Resolve().EntityExists(mind.CurrentEntity.Uid), Is.True); Assert.That(mind.CurrentEntity, Is.Not.EqualTo(playerEnt)); }); diff --git a/Content.Server/Cargo/Components/CargoConsoleComponent.cs b/Content.Server/Cargo/Components/CargoConsoleComponent.cs index cf9636635f..a5fe03a8c4 100644 --- a/Content.Server/Cargo/Components/CargoConsoleComponent.cs +++ b/Content.Server/Cargo/Components/CargoConsoleComponent.cs @@ -201,7 +201,7 @@ namespace Content.Server.Cargo.Components private void UpdateUIState() { - if (_bankAccount == null || !Owner.IsValid()) + if (_bankAccount == null || !IoCManager.Resolve().EntityExists(Owner.Uid)) { return; } diff --git a/Content.Server/Hands/Systems/HandsSystem.cs b/Content.Server/Hands/Systems/HandsSystem.cs index 640214e96c..6c2c10156f 100644 --- a/Content.Server/Hands/Systems/HandsSystem.cs +++ b/Content.Server/Hands/Systems/HandsSystem.cs @@ -191,7 +191,7 @@ namespace Content.Server.Hands.Systems var playerEnt = playerSession.AttachedEntity; - if (playerEnt == null || !playerEnt.IsValid()) + if (playerEnt == null || !IoCManager.Resolve().EntityExists(playerEnt.Uid)) return false; return playerEnt.TryGetComponent(out hands); @@ -221,7 +221,7 @@ namespace Content.Server.Hands.Systems var playerEnt = playerSession.AttachedEntity; if (playerEnt == null || - !playerEnt.IsValid() || + !IoCManager.Resolve().EntityExists(playerEnt.Uid) || playerEnt.IsInContainer() || !playerEnt.TryGetComponent(out SharedHandsComponent? hands) || !hands.TryGetActiveHeldEntity(out var throwEnt) || @@ -269,7 +269,7 @@ namespace Content.Server.Hands.Systems var plyEnt = playerSession.AttachedEntity; - if (plyEnt == null || !plyEnt.IsValid()) + if (plyEnt == null || !IoCManager.Resolve().EntityExists(plyEnt.Uid)) return; if (!plyEnt.TryGetComponent(out SharedHandsComponent? hands) || diff --git a/Content.Server/Interaction/InteractionSystem.cs b/Content.Server/Interaction/InteractionSystem.cs index 5b74ecba43..516d8e8f55 100644 --- a/Content.Server/Interaction/InteractionSystem.cs +++ b/Content.Server/Interaction/InteractionSystem.cs @@ -90,7 +90,7 @@ namespace Content.Server.Interaction userEntity = ((IPlayerSession?) session)?.AttachedEntity; - if (userEntity == null || !userEntity.IsValid()) + if (userEntity == null || !IoCManager.Resolve().EntityExists(userEntity.Uid)) { Logger.WarningS("system.interaction", $"Client sent interaction with no attached entity. Session={session}"); diff --git a/Content.Server/Storage/EntitySystems/StorageSystem.cs b/Content.Server/Storage/EntitySystems/StorageSystem.cs index 6ffe397bcd..408b63a9f9 100644 --- a/Content.Server/Storage/EntitySystems/StorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/StorageSystem.cs @@ -151,7 +151,7 @@ namespace Content.Server.Storage.EntitySystems var attachedEntity = session.AttachedEntity; // The component manages the set of sessions, so this invalid session should be removed soon. - if (attachedEntity == null || !attachedEntity.IsValid()) + if (attachedEntity == null || !IoCManager.Resolve().EntityExists(attachedEntity.Uid)) continue; if (storageMap != attachedEntity.Transform.MapID) diff --git a/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs b/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs index 176301087e..2accfda950 100644 --- a/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs +++ b/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs @@ -82,7 +82,7 @@ namespace Content.Shared.Movement.EntitySystems var ent = session?.AttachedEntity; - if (ent == null || !ent.IsValid()) + if (ent == null || !IoCManager.Resolve().EntityExists(ent.Uid)) return false; if (!ent.TryGetComponent(out T? comp))