diff --git a/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs b/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs index ccd8086729..aa03d4158d 100644 --- a/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs +++ b/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs @@ -51,8 +51,8 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged(DiscordRelayUpdated); SubscribeNetworkEvent(PeopleTypingUpdated); - defaultBwoinkVolume = WhiteCVars.BwoinkVolume.DefaultValue; - _cfg.OnValueChanged(WhiteCVars.BwoinkVolume, volume => adminBwoinkVolume = volume); - + _defaultBwoinkVolume = WhiteCVars.BwoinkVolume.DefaultValue; + _cfg.OnValueChanged(WhiteCVars.BwoinkVolume, volume => _adminBwoinkVolume = volume, true); _adminManager.AdminStatusUpdated += OnAdminStatusUpdated; _config.OnValueChanged(CCVars.AHelpSound, v => _aHelpSound = v, true); } @@ -145,7 +144,7 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged(ev.Uid); + component.Invisible = ev.Invisible; + component.DefaultAlpha ??= sprite.Color.A; + + var newAlpha = ev.Invisible ? component.DefaultAlpha.Value / 3f : component.DefaultAlpha.Value; sprite.Color = sprite.Color.WithAlpha(newAlpha); } diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index e00a7f038d..05bad5cc11 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -418,6 +418,10 @@ namespace Content.Server.Ghost var entityQuery = EntityQueryEnumerator(); while (entityQuery.MoveNext(out var uid, out _, out var vis)) { + // WD + if (EntityManager.TryGetComponent(vis.Owner, out InvisibilityComponent? invis) && invis.Invisible) + continue; + if (visible) { _visibilitySystem.AddLayer(uid, vis, (int) VisibilityFlags.Normal, false); diff --git a/Content.Server/Pointing/EntitySystems/PointingSystem.cs b/Content.Server/Pointing/EntitySystems/PointingSystem.cs index 6fcdfcf994..56f5fb5d91 100644 --- a/Content.Server/Pointing/EntitySystems/PointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/PointingSystem.cs @@ -13,6 +13,7 @@ using Content.Shared.Mind; using Content.Shared.Mobs.Systems; using Content.Shared.Pointing; using Content.Shared.Popups; +using Content.Shared.White.Administration; using JetBrains.Annotations; using Robust.Server.GameObjects; using Robust.Server.Player; @@ -117,6 +118,11 @@ namespace Content.Server.Pointing.EntitySystems return false; } + if (TryComp(pointed, out InvisibilityComponent? invisibility) && invisibility.Invisible) // WD + { + return false; + } + if (HasComp(pointed)) { // this is a pointing arrow. no pointing here... diff --git a/Content.Server/White/Administration/InvisibilitySystem.cs b/Content.Server/White/Administration/InvisibilitySystem.cs index bca02a2b03..26c69b5559 100644 --- a/Content.Server/White/Administration/InvisibilitySystem.cs +++ b/Content.Server/White/Administration/InvisibilitySystem.cs @@ -1,7 +1,7 @@ -using Content.Server.Ghost.Components; using Content.Shared.Eye; using Content.Shared.Follower; using Content.Shared.Ghost; +using Content.Shared.Follower.Components; using Content.Shared.White.Administration; using Robust.Server.GameObjects; @@ -46,7 +46,8 @@ public sealed class InvisibilitySystem : SharedInvisibilitySystem if (!EntityManager.TryGetComponent(uid, out VisibilityComponent? visibility)) return; - _followerSystem.StopAllFollowers(uid); + if (TryComp(uid, out FollowedComponent? followed)) + _followerSystem.StopAllFollowers(uid, followed); component.Invisible = !component.Invisible; diff --git a/Content.Server/White/Commands/InvisibilityCommand.cs b/Content.Server/White/Commands/InvisibilityCommand.cs index 79aa9cc4ba..c91382d4a4 100644 --- a/Content.Server/White/Commands/InvisibilityCommand.cs +++ b/Content.Server/White/Commands/InvisibilityCommand.cs @@ -25,5 +25,9 @@ public sealed class InvisibilityCommand : IConsoleCommand return; entityManager.System().ToggleInvisibility(uid.Value, invisibilityComponent); + + shell.WriteLine(invisibilityComponent.Invisible + ? "Теперь вы в режиме невидимости" + : "Теперь вы не в режиме невидимости"); } } diff --git a/Content.Shared/Follower/FollowerSystem.cs b/Content.Shared/Follower/FollowerSystem.cs index d6d1aa7ac0..8e1739f57a 100644 --- a/Content.Shared/Follower/FollowerSystem.cs +++ b/Content.Shared/Follower/FollowerSystem.cs @@ -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); + } + /// /// Makes an entity follow another entity, by parenting to it. /// @@ -129,10 +137,14 @@ public sealed class FollowerSystem : EntitySystem /// The entity to be followed public void StartFollowingEntity(EntityUid follower, EntityUid entity) { - // WD - if (!EntityManager.HasComponent(follower) && - EntityManager.TryGetComponent(entity, out InvisibilityComponent? component) && component.Invisible) - return; + if (IsFollowingInvisibleEntity(entity)) // WD + { + if (!HasComp(follower)) + return; + + if (TryComp(follower, out FollowedComponent? followed)) + StopAllFollowers(follower, followed); + } // No recursion for you var targetXform = Transform(entity); diff --git a/Content.Shared/White/Administration/InvisibilityComponent.cs b/Content.Shared/White/Administration/InvisibilityComponent.cs index 2a1126fe60..cd70362106 100644 --- a/Content.Shared/White/Administration/InvisibilityComponent.cs +++ b/Content.Shared/White/Administration/InvisibilityComponent.cs @@ -8,8 +8,11 @@ namespace Content.Shared.White.Administration; [Access(typeof(SharedInvisibilitySystem))] public sealed class InvisibilityComponent : Component { + [ViewVariables] public bool Invisible; + public float? DefaultAlpha; + public readonly InstantAction ToggleInvisibilityAction = new() { Icon = new SpriteSpecifier.Texture(new("White/Icons/transparent-ghost.png")), @@ -17,6 +20,7 @@ public sealed class InvisibilityComponent : Component Description = "Переключить невидимость вашего призрака.", ClientExclusive = true, CheckCanInteract = false, + Priority = -5, Event = new ToggleInvisibilityActionEvent() }; } diff --git a/Content.Shared/White/Administration/SharedInvisibilitySystem.cs b/Content.Shared/White/Administration/SharedInvisibilitySystem.cs index 661920b992..944da241f3 100644 --- a/Content.Shared/White/Administration/SharedInvisibilitySystem.cs +++ b/Content.Shared/White/Administration/SharedInvisibilitySystem.cs @@ -1,9 +1,22 @@ +using Content.Shared.Examine; using Robust.Shared.Serialization; namespace Content.Shared.White.Administration; public abstract class SharedInvisibilitySystem : EntitySystem { + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnExamined); + } + + private void OnExamined(EntityUid uid, InvisibilityComponent component, ExaminedEvent args) + { + if (component.Invisible) + args.PushMarkup("[color=lightsteelblue]Оно доступно лишь взору богов.[/color]"); + } } [Serializable, NetSerializable]