From: nikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com> Date: Fri, 22 Mar 2024 01:59:18 +0000 (+0200) Subject: Fix puller being improperly unset when pulling stops. (#26312) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=a6c018d755ee4f35fb8e3ab597fa90c7592fe920;p=space-station-14.git Fix puller being improperly unset when pulling stops. (#26312) Fix puller not being improperly unset on PullableComponent while being unpulled. When unpulled, the pullableComp has its puller field set to null after the message signifying the pulling has stopped has been sent. Since the component has a field to determine whether its owner is being pulled which is determined by the puller field, systems listening on the event would think that the owner of the component was still being pulled. --- diff --git a/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs b/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs index 33794ba169..b347c6da16 100644 --- a/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs +++ b/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs @@ -201,13 +201,18 @@ public sealed class PullingSystem : EntitySystem } } + var oldPuller = pullableComp.Puller; + pullableComp.PullJointId = null; + pullableComp.Puller = null; + Dirty(pullableUid, pullableComp); + // No more joints with puller -> force stop pull. - if (TryComp(pullableComp.Puller, out var pullerComp)) + if (TryComp(oldPuller, out var pullerComp)) { - var pullerUid = pullableComp.Puller.Value; + var pullerUid = oldPuller.Value; _alertsSystem.ClearAlert(pullerUid, AlertType.Pulling); pullerComp.Pulling = null; - Dirty(pullableComp.Puller.Value, pullerComp); + Dirty(oldPuller.Value, pullerComp); // Messaging var message = new PullStoppedMessage(pullerUid, pullableUid); @@ -218,9 +223,6 @@ public sealed class PullingSystem : EntitySystem RaiseLocalEvent(pullableUid, message); } - pullableComp.PullJointId = null; - pullableComp.Puller = null; - Dirty(pullableUid, pullableComp); _alertsSystem.ClearAlert(pullableUid, AlertType.Pulled); }