Фиксы педальных фич (#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 bool _hasUnreadAHelp;
|
||||||
private string? _aHelpSound;
|
private string? _aHelpSound;
|
||||||
|
|
||||||
private float defaultBwoinkVolume;
|
private float _defaultBwoinkVolume;
|
||||||
private float adminBwoinkVolume;
|
private float _adminBwoinkVolume;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -60,9 +60,8 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged<BwoinkSyst
|
|||||||
|
|
||||||
SubscribeNetworkEvent<BwoinkDiscordRelayUpdated>(DiscordRelayUpdated);
|
SubscribeNetworkEvent<BwoinkDiscordRelayUpdated>(DiscordRelayUpdated);
|
||||||
SubscribeNetworkEvent<BwoinkPlayerTypingUpdated>(PeopleTypingUpdated);
|
SubscribeNetworkEvent<BwoinkPlayerTypingUpdated>(PeopleTypingUpdated);
|
||||||
defaultBwoinkVolume = WhiteCVars.BwoinkVolume.DefaultValue;
|
_defaultBwoinkVolume = WhiteCVars.BwoinkVolume.DefaultValue;
|
||||||
_cfg.OnValueChanged(WhiteCVars.BwoinkVolume, volume => adminBwoinkVolume = volume);
|
_cfg.OnValueChanged(WhiteCVars.BwoinkVolume, volume => _adminBwoinkVolume = volume, true);
|
||||||
|
|
||||||
_adminManager.AdminStatusUpdated += OnAdminStatusUpdated;
|
_adminManager.AdminStatusUpdated += OnAdminStatusUpdated;
|
||||||
_config.OnValueChanged(CCVars.AHelpSound, v => _aHelpSound = v, true);
|
_config.OnValueChanged(CCVars.AHelpSound, v => _aHelpSound = v, true);
|
||||||
}
|
}
|
||||||
@@ -145,7 +144,7 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged<BwoinkSyst
|
|||||||
|
|
||||||
var isAdmin = _adminManager.IsActive();
|
var isAdmin = _adminManager.IsActive();
|
||||||
var notify = !isAdmin || !message.IsAdmin;
|
var notify = !isAdmin || !message.IsAdmin;
|
||||||
float bwoinkVolume = isAdmin ? adminBwoinkVolume : defaultBwoinkVolume;
|
var bwoinkVolume = isAdmin ? _adminBwoinkVolume : _defaultBwoinkVolume;
|
||||||
|
|
||||||
var audioParams = new AudioParams()
|
var audioParams = new AudioParams()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,11 @@ public sealed class InvisibilitySystem : SharedInvisibilitySystem
|
|||||||
if (!EntityManager.TryGetComponent(ev.Uid, out SpriteComponent? sprite))
|
if (!EntityManager.TryGetComponent(ev.Uid, out SpriteComponent? sprite))
|
||||||
return;
|
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);
|
sprite.Color = sprite.Color.WithAlpha(newAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -418,6 +418,10 @@ namespace Content.Server.Ghost
|
|||||||
var entityQuery = EntityQueryEnumerator<GhostComponent, VisibilityComponent>();
|
var entityQuery = EntityQueryEnumerator<GhostComponent, VisibilityComponent>();
|
||||||
while (entityQuery.MoveNext(out var uid, out _, out var vis))
|
while (entityQuery.MoveNext(out var uid, out _, out var vis))
|
||||||
{
|
{
|
||||||
|
// WD
|
||||||
|
if (EntityManager.TryGetComponent(vis.Owner, out InvisibilityComponent? invis) && invis.Invisible)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (visible)
|
if (visible)
|
||||||
{
|
{
|
||||||
_visibilitySystem.AddLayer(uid, vis, (int) VisibilityFlags.Normal, false);
|
_visibilitySystem.AddLayer(uid, vis, (int) VisibilityFlags.Normal, false);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Content.Shared.Mind;
|
|||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
using Content.Shared.Pointing;
|
using Content.Shared.Pointing;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
|
using Content.Shared.White.Administration;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
@@ -117,6 +118,11 @@ namespace Content.Server.Pointing.EntitySystems
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TryComp(pointed, out InvisibilityComponent? invisibility) && invisibility.Invisible) // WD
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (HasComp<PointingArrowComponent>(pointed))
|
if (HasComp<PointingArrowComponent>(pointed))
|
||||||
{
|
{
|
||||||
// this is a pointing arrow. no pointing here...
|
// this is a pointing arrow. no pointing here...
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Content.Server.Ghost.Components;
|
|
||||||
using Content.Shared.Eye;
|
using Content.Shared.Eye;
|
||||||
using Content.Shared.Follower;
|
using Content.Shared.Follower;
|
||||||
using Content.Shared.Ghost;
|
using Content.Shared.Ghost;
|
||||||
|
using Content.Shared.Follower.Components;
|
||||||
using Content.Shared.White.Administration;
|
using Content.Shared.White.Administration;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
|
||||||
@@ -46,7 +46,8 @@ public sealed class InvisibilitySystem : SharedInvisibilitySystem
|
|||||||
if (!EntityManager.TryGetComponent(uid, out VisibilityComponent? visibility))
|
if (!EntityManager.TryGetComponent(uid, out VisibilityComponent? visibility))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_followerSystem.StopAllFollowers(uid);
|
if (TryComp(uid, out FollowedComponent? followed))
|
||||||
|
_followerSystem.StopAllFollowers(uid, followed);
|
||||||
|
|
||||||
component.Invisible = !component.Invisible;
|
component.Invisible = !component.Invisible;
|
||||||
|
|
||||||
|
|||||||
@@ -25,5 +25,9 @@ public sealed class InvisibilityCommand : IConsoleCommand
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
entityManager.System<InvisibilitySystem>().ToggleInvisibility(uid.Value, invisibilityComponent);
|
entityManager.System<InvisibilitySystem>().ToggleInvisibility(uid.Value, invisibilityComponent);
|
||||||
|
|
||||||
|
shell.WriteLine(invisibilityComponent.Invisible
|
||||||
|
? "Теперь вы в режиме невидимости"
|
||||||
|
: "Теперь вы не в режиме невидимости");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,6 +122,14 @@ public sealed class FollowerSystem : EntitySystem
|
|||||||
StopAllFollowers(uid, component);
|
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>
|
/// <summary>
|
||||||
/// Makes an entity follow another entity, by parenting to it.
|
/// Makes an entity follow another entity, by parenting to it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -129,11 +137,15 @@ public sealed class FollowerSystem : EntitySystem
|
|||||||
/// <param name="entity">The entity to be followed</param>
|
/// <param name="entity">The entity to be followed</param>
|
||||||
public void StartFollowingEntity(EntityUid follower, EntityUid entity)
|
public void StartFollowingEntity(EntityUid follower, EntityUid entity)
|
||||||
{
|
{
|
||||||
// WD
|
if (IsFollowingInvisibleEntity(entity)) // WD
|
||||||
if (!EntityManager.HasComponent<InvisibilityComponent>(follower) &&
|
{
|
||||||
EntityManager.TryGetComponent(entity, out InvisibilityComponent? component) && component.Invisible)
|
if (!HasComp<InvisibilityComponent>(follower))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (TryComp(follower, out FollowedComponent? followed))
|
||||||
|
StopAllFollowers(follower, followed);
|
||||||
|
}
|
||||||
|
|
||||||
// No recursion for you
|
// No recursion for you
|
||||||
var targetXform = Transform(entity);
|
var targetXform = Transform(entity);
|
||||||
while (targetXform.ParentUid.IsValid())
|
while (targetXform.ParentUid.IsValid())
|
||||||
|
|||||||
@@ -8,8 +8,11 @@ namespace Content.Shared.White.Administration;
|
|||||||
[Access(typeof(SharedInvisibilitySystem))]
|
[Access(typeof(SharedInvisibilitySystem))]
|
||||||
public sealed class InvisibilityComponent : Component
|
public sealed class InvisibilityComponent : Component
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
public bool Invisible;
|
public bool Invisible;
|
||||||
|
|
||||||
|
public float? DefaultAlpha;
|
||||||
|
|
||||||
public readonly InstantAction ToggleInvisibilityAction = new()
|
public readonly InstantAction ToggleInvisibilityAction = new()
|
||||||
{
|
{
|
||||||
Icon = new SpriteSpecifier.Texture(new("White/Icons/transparent-ghost.png")),
|
Icon = new SpriteSpecifier.Texture(new("White/Icons/transparent-ghost.png")),
|
||||||
@@ -17,6 +20,7 @@ public sealed class InvisibilityComponent : Component
|
|||||||
Description = "Переключить невидимость вашего призрака.",
|
Description = "Переключить невидимость вашего призрака.",
|
||||||
ClientExclusive = true,
|
ClientExclusive = true,
|
||||||
CheckCanInteract = false,
|
CheckCanInteract = false,
|
||||||
|
Priority = -5,
|
||||||
Event = new ToggleInvisibilityActionEvent()
|
Event = new ToggleInvisibilityActionEvent()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,22 @@
|
|||||||
|
using Content.Shared.Examine;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Shared.White.Administration;
|
namespace Content.Shared.White.Administration;
|
||||||
|
|
||||||
public abstract class SharedInvisibilitySystem : EntitySystem
|
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]
|
[Serializable, NetSerializable]
|
||||||
|
|||||||
Reference in New Issue
Block a user