From 699e6de1fe56eba9bb162af274518726a32e445f Mon Sep 17 00:00:00 2001 From: Tayrtahn Date: Wed, 11 Jun 2025 17:39:25 -0400 Subject: [PATCH] Fix `StomachSystem` PVS error (#38268) Fix StomachSystem PVS error --- Content.Shared/Body/Systems/StomachSystem.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Content.Shared/Body/Systems/StomachSystem.cs b/Content.Shared/Body/Systems/StomachSystem.cs index 935dda6389..8b2df453a0 100644 --- a/Content.Shared/Body/Systems/StomachSystem.cs +++ b/Content.Shared/Body/Systems/StomachSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Body.Organ; using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Components.SolutionManager; using Content.Shared.Chemistry.EntitySystems; +using Robust.Shared.Containers; using Robust.Shared.Timing; using Robust.Shared.Utility; @@ -20,6 +21,7 @@ namespace Content.Shared.Body.Systems { SubscribeLocalEvent(OnMapInit); SubscribeLocalEvent(OnUnpaused); + SubscribeLocalEvent(OnEntRemoved); SubscribeLocalEvent(OnApplyMetabolicMultiplier); } @@ -33,6 +35,16 @@ namespace Content.Shared.Body.Systems ent.Comp.NextUpdate += args.PausedTime; } + private void OnEntRemoved(Entity ent, ref EntRemovedFromContainerMessage args) + { + // Make sure the removed entity was our contained solution + if (ent.Comp.Solution is not { } solution || args.Entity != solution.Owner) + return; + + // Cleared our cached reference to the solution entity + ent.Comp.Solution = null; + } + public override void Update(float frameTime) { var query = EntityQueryEnumerator(); -- 2.51.2