Skip to content

Commit

Permalink
Fix puller being improperly unset when pulling stops. (#26312)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nikthechampiongr authored and VMSolidus committed Jul 10, 2024
1 parent a8911da commit 1a32ca3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Content.Shared/Movement/Pulling/Systems/PullingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,18 @@ private void StopPulling(EntityUid pullableUid, PullableComponent pullableComp)
}
}

var oldPuller = pullableComp.Puller;
pullableComp.PullJointId = null;
pullableComp.Puller = null;
Dirty(pullableUid, pullableComp);

// No more joints with puller -> force stop pull.
if (TryComp<PullerComponent>(pullableComp.Puller, out var pullerComp))
if (TryComp<PullerComponent>(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);
Expand All @@ -218,9 +223,6 @@ private void StopPulling(EntityUid pullableUid, PullableComponent pullableComp)
RaiseLocalEvent(pullableUid, message);
}

pullableComp.PullJointId = null;
pullableComp.Puller = null;
Dirty(pullableUid, pullableComp);

_alertsSystem.ClearAlert(pullableUid, AlertType.Pulled);
}
Expand Down

0 comments on commit 1a32ca3

Please sign in to comment.