Фиксы педальных фич (#210)
* Aghost invisibility fixes * Fix naming and bwoink volume on load
This commit is contained in:
@@ -51,8 +51,8 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged<BwoinkSyst
|
||||
private bool _hasUnreadAHelp;
|
||||
private string? _aHelpSound;
|
||||
|
||||
private float defaultBwoinkVolume;
|
||||
private float adminBwoinkVolume;
|
||||
private float _defaultBwoinkVolume;
|
||||
private float _adminBwoinkVolume;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -60,9 +60,8 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged<BwoinkSyst
|
||||
|
||||
SubscribeNetworkEvent<BwoinkDiscordRelayUpdated>(DiscordRelayUpdated);
|
||||
SubscribeNetworkEvent<BwoinkPlayerTypingUpdated>(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<BwoinkSyst
|
||||
|
||||
var isAdmin = _adminManager.IsActive();
|
||||
var notify = !isAdmin || !message.IsAdmin;
|
||||
float bwoinkVolume = isAdmin ? adminBwoinkVolume : defaultBwoinkVolume;
|
||||
var bwoinkVolume = isAdmin ? _adminBwoinkVolume : _defaultBwoinkVolume;
|
||||
|
||||
var audioParams = new AudioParams()
|
||||
{
|
||||
|
||||
@@ -28,7 +28,11 @@ public sealed class InvisibilitySystem : SharedInvisibilitySystem
|
||||
if (!EntityManager.TryGetComponent(ev.Uid, out SpriteComponent? sprite))
|
||||
return;
|
||||
|
||||
var newAlpha = Math.Clamp(ev.Invisible ? sprite.Color.A / 3f : sprite.Color.A * 3f, 0f, 1f);
|
||||
var component = EntityManager.EnsureComponent<InvisibilityComponent>(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);
|
||||
}
|
||||
|
||||
|
||||
@@ -418,6 +418,10 @@ namespace Content.Server.Ghost
|
||||
var entityQuery = EntityQueryEnumerator<GhostComponent, VisibilityComponent>();
|
||||
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);
|
||||
|
||||
@@ -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<PointingArrowComponent>(pointed))
|
||||
{
|
||||
// this is a pointing arrow. no pointing here...
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -25,5 +25,9 @@ public sealed class InvisibilityCommand : IConsoleCommand
|
||||
return;
|
||||
|
||||
entityManager.System<InvisibilitySystem>().ToggleInvisibility(uid.Value, invisibilityComponent);
|
||||
|
||||
shell.WriteLine(invisibilityComponent.Invisible
|
||||
? "Теперь вы в режиме невидимости"
|
||||
: "Теперь вы не в режиме невидимости");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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<InvisibilityComponent, ExaminedEvent>(OnExamined);
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, InvisibilityComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (component.Invisible)
|
||||
args.PushMarkup("[color=lightsteelblue]Оно доступно лишь взору богов.[/color]");
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
Reference in New Issue
Block a user