mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* Directional visibility for wall-mounted entities (#43476) * Directional visibility for wall-mounted entities * Fix cache * Revert * InteractionIgnoreAnchoredInTileComponent + yml * Main system * Move it * Directional arrow * Add fade * retry * Split "Directional arrow" * fix * small thing * Split "InteractionIgnoreAnchoredInTileComponent" * correct description * I hate the online editor * retry * ... * Apply suggestions from code review Co-authored-by: Jessica M <jessica@jessicamaybe.com> * Additional comment * cleanup --------- Co-authored-by: Jessica M <jessica@jessicamaybe.com> Co-authored-by: AJCM-git <ajcm_mail@disroot.org> * 2 * Kinda useless * Fade CVar * Fix CVar runtime change * Clear _originalAlphas on dispose * Boring DI * retry * WallComponent --------- Co-authored-by: Jessica M <jessica@jessicamaybe.com> Co-authored-by: AJCM-git <ajcm_mail@disroot.org>
49 lines
1.6 KiB
C#
49 lines
1.6 KiB
C#
using Robust.Shared.ComponentTrees;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Physics;
|
|
|
|
namespace Content.Shared.Wall;
|
|
|
|
/// <summary>
|
|
/// Marks an entity as wall-mounted.
|
|
/// Allows interaction through other anchored entities on the same tile within the <see cref="Arc"/>.
|
|
/// Hides the sprite when viewed from outside that arc.
|
|
/// </summary>
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(raiseAfterAutoHandleState: true)]
|
|
public sealed partial class WallMountComponent : Component, IComponentTreeEntry<WallMountComponent>
|
|
{
|
|
/// <summary>
|
|
/// Range of angles where interaction through other anchored entities on the same tile is allowed.
|
|
/// Bigger is more permissive.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField]
|
|
public Angle Arc = new(MathF.PI);
|
|
|
|
/// <summary>
|
|
/// The direction the allowed angle range faces, relative to the entity's rotation.
|
|
/// Defaults to south.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField]
|
|
public Angle Direction = Angle.Zero;
|
|
|
|
/// <summary>
|
|
/// If true, the sprite is only visible from within the facing <see cref="Arc"/>.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField]
|
|
public bool DirectionalVisibility = true;
|
|
|
|
/// <inheritdoc/>
|
|
[ViewVariables]
|
|
public EntityUid? TreeUid { get; set; }
|
|
|
|
/// <inheritdoc/>
|
|
[ViewVariables]
|
|
public DynamicTree<ComponentTreeEntry<WallMountComponent>>? Tree { get; set; }
|
|
|
|
/// <inheritdoc/>
|
|
[ViewVariables]
|
|
public bool AddToTree => Arc < Math.Tau && DirectionalVisibility;
|
|
|
|
/// <inheritdoc/>
|
|
public bool TreeUpdateQueued { get; set; }
|
|
}
|