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.
This commit is contained in:
@@ -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.
|
// 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);
|
_alertsSystem.ClearAlert(pullerUid, AlertType.Pulling);
|
||||||
pullerComp.Pulling = null;
|
pullerComp.Pulling = null;
|
||||||
Dirty(pullableComp.Puller.Value, pullerComp);
|
Dirty(oldPuller.Value, pullerComp);
|
||||||
|
|
||||||
// Messaging
|
// Messaging
|
||||||
var message = new PullStoppedMessage(pullerUid, pullableUid);
|
var message = new PullStoppedMessage(pullerUid, pullableUid);
|
||||||
@@ -218,9 +223,6 @@ public sealed class PullingSystem : EntitySystem
|
|||||||
RaiseLocalEvent(pullableUid, message);
|
RaiseLocalEvent(pullableUid, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
pullableComp.PullJointId = null;
|
|
||||||
pullableComp.Puller = null;
|
|
||||||
Dirty(pullableUid, pullableComp);
|
|
||||||
|
|
||||||
_alertsSystem.ClearAlert(pullableUid, AlertType.Pulled);
|
_alertsSystem.ClearAlert(pullableUid, AlertType.Pulled);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user