Fix RotateWhilePulling not working (#29032)

This commit is contained in:
Leon Friedrich
2024-06-16 23:30:35 +12:00
committed by GitHub
parent ac979640bf
commit f121946b12
5 changed files with 29 additions and 36 deletions

View File

@@ -61,6 +61,7 @@ public sealed class PullingSystem : EntitySystem
SubscribeLocalEvent<PullableComponent, EntGotInsertedIntoContainerMessage>(OnPullableContainerInsert);
SubscribeLocalEvent<PullableComponent, ModifyUncuffDurationEvent>(OnModifyUncuffDuration);
SubscribeLocalEvent<PullerComponent, AfterAutoHandleStateEvent>(OnAfterState);
SubscribeLocalEvent<PullerComponent, EntGotInsertedIntoContainerMessage>(OnPullerContainerInsert);
SubscribeLocalEvent<PullerComponent, EntityUnpausedEvent>(OnPullerUnpaused);
SubscribeLocalEvent<PullerComponent, VirtualItemDeletedEvent>(OnVirtualItemDeleted);
@@ -72,6 +73,14 @@ public sealed class PullingSystem : EntitySystem
.Register<PullingSystem>();
}
private void OnAfterState(Entity<PullerComponent> ent, ref AfterAutoHandleStateEvent args)
{
if (ent.Comp.Pulling == null)
RemComp<ActivePullerComponent>(ent.Owner);
else
EnsureComp<ActivePullerComponent>(ent.Owner);
}
private void OnDropHandItems(EntityUid uid, PullerComponent pullerComp, DropHandItemsEvent args)
{
if (pullerComp.Pulling == null || pullerComp.NeedsHands)
@@ -228,6 +237,9 @@ public sealed class PullingSystem : EntitySystem
}
var oldPuller = pullableComp.Puller;
if (oldPuller != null)
RemComp<ActivePullerComponent>(oldPuller.Value);
pullableComp.PullJointId = null;
pullableComp.Puller = null;
Dirty(pullableUid, pullableComp);
@@ -410,6 +422,7 @@ public sealed class PullingSystem : EntitySystem
// Use net entity so it's consistent across client and server.
pullableComp.PullJointId = $"pull-joint-{GetNetEntity(pullableUid)}";
EnsureComp<ActivePullerComponent>(pullerUid);
pullerComp.Pulling = pullableUid;
pullableComp.Puller = pullerUid;