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:
@@ -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))),
|
||||
|
||||
Reference in New Issue
Block a user