Indicator fixes (#357)
* - fix: Fix hud showing stealth entities. * - fix: Fix aghost SSD indicator. * - tweak: Make ninja more stealthy.
This commit is contained in:
@@ -7,6 +7,7 @@ using Robust.Client.GameObjects;
|
|||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Enums;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using Content.Client.StatusIcon;
|
||||||
using Content.Shared.StatusIcon.Components;
|
using Content.Shared.StatusIcon.Components;
|
||||||
using Content.Client.UserInterface.Systems;
|
using Content.Client.UserInterface.Systems;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
@@ -24,6 +25,7 @@ public sealed class EntityHealthBarOverlay : Overlay
|
|||||||
private readonly MobStateSystem _mobStateSystem;
|
private readonly MobStateSystem _mobStateSystem;
|
||||||
private readonly MobThresholdSystem _mobThresholdSystem;
|
private readonly MobThresholdSystem _mobThresholdSystem;
|
||||||
private readonly ProgressColorSystem _progressColor;
|
private readonly ProgressColorSystem _progressColor;
|
||||||
|
private readonly StatusIconSystem _statusIcon;
|
||||||
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
|
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
|
||||||
public HashSet<string> DamageContainers = new();
|
public HashSet<string> DamageContainers = new();
|
||||||
|
|
||||||
@@ -34,6 +36,7 @@ public sealed class EntityHealthBarOverlay : Overlay
|
|||||||
_mobStateSystem = _entManager.System<MobStateSystem>();
|
_mobStateSystem = _entManager.System<MobStateSystem>();
|
||||||
_mobThresholdSystem = _entManager.System<MobThresholdSystem>();
|
_mobThresholdSystem = _entManager.System<MobThresholdSystem>();
|
||||||
_progressColor = _entManager.System<ProgressColorSystem>();
|
_progressColor = _entManager.System<ProgressColorSystem>();
|
||||||
|
_statusIcon = entManager.System<StatusIconSystem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Draw(in OverlayDrawArgs args)
|
protected override void Draw(in OverlayDrawArgs args)
|
||||||
@@ -70,6 +73,9 @@ public sealed class EntityHealthBarOverlay : Overlay
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_statusIcon.IsVisible(uid))
|
||||||
|
continue;
|
||||||
|
|
||||||
// we use the status icon component bounds if specified otherwise use sprite
|
// we use the status icon component bounds if specified otherwise use sprite
|
||||||
var bounds = _entManager.GetComponentOrNull<StatusIconComponent>(uid)?.Bounds ?? spriteComponent.Bounds;
|
var bounds = _entManager.GetComponentOrNull<StatusIconComponent>(uid)?.Bounds ?? spriteComponent.Bounds;
|
||||||
var worldPos = _transform.GetWorldPosition(xform, xformQuery);
|
var worldPos = _transform.GetWorldPosition(xform, xformQuery);
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
|
using Content.Shared.Ghost;
|
||||||
|
using Content.Shared.Mind;
|
||||||
using Content.Shared.Mind.Components;
|
using Content.Shared.Mind.Components;
|
||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
using Content.Shared.NPC;
|
using Content.Shared.NPC;
|
||||||
@@ -34,9 +36,18 @@ public sealed class SSDIndicatorSystem : EntitySystem
|
|||||||
!_mobState.IsDead(uid) &&
|
!_mobState.IsDead(uid) &&
|
||||||
!HasComp<ActiveNPCComponent>(uid) &&
|
!HasComp<ActiveNPCComponent>(uid) &&
|
||||||
TryComp<MindContainerComponent>(uid, out var mindContainer) &&
|
TryComp<MindContainerComponent>(uid, out var mindContainer) &&
|
||||||
mindContainer.ShowExamineInfo)
|
mindContainer.ShowExamineInfo &&
|
||||||
|
!IsAghosted(mindContainer)) // WD EDIT
|
||||||
{
|
{
|
||||||
args.StatusIcons.Add(_prototype.Index<StatusIconPrototype>(component.Icon));
|
args.StatusIcons.Add(_prototype.Index<StatusIconPrototype>(component.Icon));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool IsAghosted(MindContainerComponent mindContainer) // WD
|
||||||
|
{
|
||||||
|
if (!TryComp(mindContainer.Mind, out MindComponent? mindComp))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return TryComp(mindComp.VisitingEntity, out GhostComponent? ghost) && ghost.CanGhostInteract;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ public sealed class StatusIconOverlay : Overlay
|
|||||||
if (icons.Count == 0)
|
if (icons.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!_statusIcon.IsVisible(uid))
|
||||||
|
continue;
|
||||||
|
|
||||||
var worldMatrix = Matrix3.CreateTranslation(worldPos);
|
var worldMatrix = Matrix3.CreateTranslation(worldPos);
|
||||||
Matrix3.Multiply(scaleMatrix, worldMatrix, out var scaledWorld);
|
Matrix3.Multiply(scaleMatrix, worldMatrix, out var scaledWorld);
|
||||||
Matrix3.Multiply(rotationMatrix, scaledWorld, out var matty);
|
Matrix3.Multiply(rotationMatrix, scaledWorld, out var matty);
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
|
using Content.Shared.Ghost;
|
||||||
using Content.Shared.StatusIcon;
|
using Content.Shared.StatusIcon;
|
||||||
using Content.Shared.StatusIcon.Components;
|
using Content.Shared.StatusIcon.Components;
|
||||||
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
|
using Robust.Client.Player;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
|
|
||||||
namespace Content.Client.StatusIcon;
|
namespace Content.Client.StatusIcon;
|
||||||
@@ -13,6 +16,10 @@ public sealed class StatusIconSystem : SharedStatusIconSystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IConfigurationManager _configuration = default!;
|
[Dependency] private readonly IConfigurationManager _configuration = default!;
|
||||||
[Dependency] private readonly IOverlayManager _overlay = default!;
|
[Dependency] private readonly IOverlayManager _overlay = default!;
|
||||||
|
[Dependency] private readonly IPlayerManager _playerMan = default!;
|
||||||
|
|
||||||
|
private EntityQuery<GhostComponent> _ghostQuery;
|
||||||
|
private EntityQuery<SpriteComponent> _spriteQuery;
|
||||||
|
|
||||||
private bool _globalEnabled;
|
private bool _globalEnabled;
|
||||||
private bool _localEnabled;
|
private bool _localEnabled;
|
||||||
@@ -20,6 +27,9 @@ public sealed class StatusIconSystem : SharedStatusIconSystem
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
_ghostQuery = GetEntityQuery<GhostComponent>();
|
||||||
|
_spriteQuery = GetEntityQuery<SpriteComponent>();
|
||||||
|
|
||||||
Subs.CVar(_configuration, CCVars.LocalStatusIconsEnabled, OnLocalStatusIconChanged, true);
|
Subs.CVar(_configuration, CCVars.LocalStatusIconsEnabled, OnLocalStatusIconChanged, true);
|
||||||
Subs.CVar(_configuration, CCVars.GlobalStatusIconsEnabled, OnGlobalStatusIconChanged, true);
|
Subs.CVar(_configuration, CCVars.GlobalStatusIconsEnabled, OnGlobalStatusIconChanged, true);
|
||||||
}
|
}
|
||||||
@@ -59,5 +69,29 @@ public sealed class StatusIconSystem : SharedStatusIconSystem
|
|||||||
RaiseLocalEvent(uid, ref ev);
|
RaiseLocalEvent(uid, ref ev);
|
||||||
return ev.StatusIcons;
|
return ev.StatusIcons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For overlay to check if an entity can be seen.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsVisible(EntityUid uid)
|
||||||
|
{
|
||||||
|
// ghosties can always see them
|
||||||
|
var viewer = _playerMan.LocalSession?.AttachedEntity;
|
||||||
|
if (_ghostQuery.HasComponent(viewer))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (_spriteQuery.TryGetComponent(uid, out var sprite) && !sprite.Visible)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var ev = new StatusIconVisibleEvent(true);
|
||||||
|
RaiseLocalEvent(uid, ref ev);
|
||||||
|
return ev.Visible;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised on an entity to check if it should draw hud icons.
|
||||||
|
/// Used to check invisibility etc inside the screen bounds.
|
||||||
|
/// </summary>
|
||||||
|
[ByRefEvent]
|
||||||
|
public record struct StatusIconVisibleEvent(bool Visible);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Client.Interactable.Components;
|
using Content.Client.Interactable.Components;
|
||||||
|
using Content.Client.StatusIcon;
|
||||||
using Content.Shared.Stealth;
|
using Content.Shared.Stealth;
|
||||||
using Content.Shared.Stealth.Components;
|
using Content.Shared.Stealth.Components;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
@@ -18,9 +19,12 @@ public sealed class StealthSystem : SharedStealthSystem
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_shader = _protoMan.Index<ShaderPrototype>("Stealth").InstanceUnique();
|
_shader = _protoMan.Index<ShaderPrototype>("Stealth").InstanceUnique();
|
||||||
|
|
||||||
SubscribeLocalEvent<StealthComponent, ComponentShutdown>(OnShutdown);
|
SubscribeLocalEvent<StealthComponent, ComponentShutdown>(OnShutdown);
|
||||||
SubscribeLocalEvent<StealthComponent, ComponentStartup>(OnStartup);
|
SubscribeLocalEvent<StealthComponent, ComponentStartup>(OnStartup);
|
||||||
SubscribeLocalEvent<StealthComponent, BeforePostShaderRenderEvent>(OnShaderRender);
|
SubscribeLocalEvent<StealthComponent, BeforePostShaderRenderEvent>(OnShaderRender);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<StealthComponent, StatusIconVisibleEvent>(OnStatusIconVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetEnabled(EntityUid uid, bool value, StealthComponent? component = null)
|
public override void SetEnabled(EntityUid uid, bool value, StealthComponent? component = null)
|
||||||
@@ -92,5 +96,12 @@ public sealed class StealthSystem : SharedStealthSystem
|
|||||||
visibility = MathF.Max(0, visibility);
|
visibility = MathF.Max(0, visibility);
|
||||||
args.Sprite.Color = new Color(visibility, visibility, 1, 1);
|
args.Sprite.Color = new Color(visibility, visibility, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnStatusIconVisible(EntityUid uid, StealthComponent comp, ref StatusIconVisibleEvent args)
|
||||||
|
{
|
||||||
|
// no sechud seing invisible ninjas
|
||||||
|
if (comp.Enabled)
|
||||||
|
args.Visible = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using Content.Client.StatusIcon;
|
||||||
using Content.Client.Storage.Components;
|
using Content.Client.Storage.Components;
|
||||||
using Content.Shared.Destructible;
|
using Content.Shared.Destructible;
|
||||||
using Content.Shared.Foldable;
|
using Content.Shared.Foldable;
|
||||||
@@ -29,6 +30,8 @@ public sealed class EntityStorageSystem : SharedEntityStorageSystem
|
|||||||
|
|
||||||
SubscribeLocalEvent<EntityStorageComponent, ComponentGetState>(OnGetState);
|
SubscribeLocalEvent<EntityStorageComponent, ComponentGetState>(OnGetState);
|
||||||
SubscribeLocalEvent<EntityStorageComponent, ComponentHandleState>(OnHandleState);
|
SubscribeLocalEvent<EntityStorageComponent, ComponentHandleState>(OnHandleState);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<InsideEntityStorageComponent, StatusIconVisibleEvent>(OnStatusIconVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool ResolveStorage(EntityUid uid, [NotNullWhen(true)] ref SharedEntityStorageComponent? component)
|
public override bool ResolveStorage(EntityUid uid, [NotNullWhen(true)] ref SharedEntityStorageComponent? component)
|
||||||
@@ -40,4 +43,9 @@ public sealed class EntityStorageSystem : SharedEntityStorageSystem
|
|||||||
component = storage;
|
component = storage;
|
||||||
return component != null;
|
return component != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnStatusIconVisible(EntityUid uid, InsideEntityStorageComponent comp, ref StatusIconVisibleEvent args)
|
||||||
|
{
|
||||||
|
args.Visible = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ public sealed class AGhost : LocalizedCommands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_entities.Dirty(mindId, mind); // WD
|
||||||
|
|
||||||
if (mind.VisitingEntity != default && _entities.TryGetComponent<GhostComponent>(mind.VisitingEntity, out var oldGhostComponent))
|
if (mind.VisitingEntity != default && _entities.TryGetComponent<GhostComponent>(mind.VisitingEntity, out var oldGhostComponent))
|
||||||
{
|
{
|
||||||
mindSystem.UnVisit(mindId, mind);
|
mindSystem.UnVisit(mindId, mind);
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
- type: ContainerContainer
|
- type: ContainerContainer
|
||||||
containers:
|
containers:
|
||||||
toggleable-clothing: !type:ContainerSlot {}
|
toggleable-clothing: !type:ContainerSlot {}
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: ClothingOuterBaseLarge
|
parent: ClothingOuterBaseLarge
|
||||||
id: ClothingOuterSuitSpaceNinja
|
id: ClothingOuterSuitSpaceNinja
|
||||||
@@ -125,7 +125,7 @@
|
|||||||
- type: Clothing
|
- type: Clothing
|
||||||
sprite: Clothing/OuterClothing/Suits/spaceninja.rsi
|
sprite: Clothing/OuterClothing/Suits/spaceninja.rsi
|
||||||
- type: StealthClothing
|
- type: StealthClothing
|
||||||
visibility: 1.1
|
visibility: 0.5
|
||||||
toggleAction: ActionTogglePhaseCloak
|
toggleAction: ActionTogglePhaseCloak
|
||||||
- type: PressureProtection
|
- type: PressureProtection
|
||||||
highPressureMultiplier: 0.6
|
highPressureMultiplier: 0.6
|
||||||
|
|||||||
Reference in New Issue
Block a user