Фиксы педальных фич (#210)

* Aghost invisibility fixes

* Fix naming and bwoink volume on load
This commit is contained in:
Aviu00
2023-07-18 14:58:29 +03:00
committed by Aviu00
parent 3f8ff32206
commit 3acd057756
9 changed files with 60 additions and 13 deletions

View File

@@ -122,6 +122,14 @@ public sealed class FollowerSystem : EntitySystem
StopAllFollowers(uid, component);
}
private bool IsFollowingInvisibleEntity(EntityUid uid) // WD
{
if (TryComp(uid, out InvisibilityComponent? invisibility) && invisibility.Invisible)
return true;
return TryComp(uid, out FollowerComponent? follower) && IsFollowingInvisibleEntity(follower.Following);
}
/// <summary>
/// Makes an entity follow another entity, by parenting to it.
/// </summary>
@@ -129,10 +137,14 @@ public sealed class FollowerSystem : EntitySystem
/// <param name="entity">The entity to be followed</param>
public void StartFollowingEntity(EntityUid follower, EntityUid entity)
{
// WD
if (!EntityManager.HasComponent<InvisibilityComponent>(follower) &&
EntityManager.TryGetComponent(entity, out InvisibilityComponent? component) && component.Invisible)
return;
if (IsFollowingInvisibleEntity(entity)) // WD
{
if (!HasComp<InvisibilityComponent>(follower))
return;
if (TryComp(follower, out FollowedComponent? followed))
StopAllFollowers(follower, followed);
}
// No recursion for you
var targetXform = Transform(entity);