Fix followers getting sent to nullspace when target is polymorphed (#33878)

* Add an event for polymorph actions

* Subscribe FollowerSystem to the event

* Add check that unfollow target is actually current target.

* Make followers try to follow on state update; Dirty follower on follow.
This commit is contained in:
Tayrtahn
2025-02-11 16:34:24 -05:00
committed by GitHub
parent fa020ceef3
commit 46b19291ea
4 changed files with 38 additions and 2 deletions

View File

@@ -267,6 +267,10 @@ public sealed partial class PolymorphSystem : EntitySystem
if (PausedMap != null)
_transform.SetParent(uid, targetTransformComp, PausedMap.Value);
// Raise an event to inform anything that wants to know about the entity swap
var ev = new PolymorphedEvent(uid, child, false);
RaiseLocalEvent(uid, ref ev);
return child;
}
@@ -339,6 +343,10 @@ public sealed partial class PolymorphSystem : EntitySystem
// if an item polymorph was picked up, put it back down after reverting
_transform.AttachToGridOrMap(parent, parentXform);
// Raise an event to inform anything that wants to know about the entity swap
var ev = new PolymorphedEvent(uid, parent, true);
RaiseLocalEvent(uid, ref ev);
_popup.PopupEntity(Loc.GetString("polymorph-revert-popup-generic",
("parent", Identity.Entity(uid, EntityManager)),
("child", Identity.Entity(parent, EntityManager))),