Fix for ghosts being unable to follow the AI when it uses a holopad (#36355)

* Initial commit

* Added to-do
This commit is contained in:
chromiumboy
2025-04-25 05:30:39 -05:00
committed by GitHub
parent 25f016e806
commit 65f50b55b6
3 changed files with 29 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ using Content.Shared.Hands;
using Content.Shared.Movement.Events;
using Content.Shared.Movement.Pulling.Events;
using Content.Shared.Polymorph;
using Content.Shared.Silicons.StationAi;
using Content.Shared.Tag;
using Content.Shared.Verbs;
using Robust.Shared.Containers;
@@ -50,6 +51,7 @@ public sealed class FollowerSystem : EntitySystem
SubscribeLocalEvent<FollowedComponent, EntityTerminatingEvent>(OnFollowedTerminating);
SubscribeLocalEvent<BeforeSerializationEvent>(OnBeforeSave);
SubscribeLocalEvent<FollowedComponent, PolymorphedEvent>(OnFollowedPolymorphed);
SubscribeLocalEvent<FollowedComponent, StationAiRemoteEntityReplacementEvent>(OnFollowedStationAiRemoteEntityReplaced);
}
private void OnFollowedAttempt(Entity<FollowedComponent> ent, ref ComponentGetStateAttemptEvent args)
@@ -169,6 +171,17 @@ public sealed class FollowerSystem : EntitySystem
}
}
// TODO: Slartibarfast mentioned that ideally this should be generalized and made part of SetRelay in SharedMoverController.Relay.cs.
// This would apply to polymorphed entities as well
private void OnFollowedStationAiRemoteEntityReplaced(Entity<FollowedComponent> entity, ref StationAiRemoteEntityReplacementEvent args)
{
if (args.NewRemoteEntity == null)
return;
foreach (var follower in entity.Comp.Following)
StartFollowingEntity(follower, args.NewRemoteEntity.Value);
}
/// <summary>
/// Makes an entity follow another entity, by parenting to it.
/// </summary>