Made anchor visuals generic (#33810)
Added a generic anchor visuals enum
This commit is contained in:
@@ -44,11 +44,6 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
return;
|
||||
|
||||
portableNode.ConnectionsEnabled = args.Anchored;
|
||||
|
||||
if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
|
||||
{
|
||||
_appearance.SetData(uid, GasPortableVisuals.ConnectedState, args.Anchored, appearance);
|
||||
}
|
||||
}
|
||||
|
||||
public bool FindGasPortIn(EntityUid? gridId, EntityCoordinates coordinates, [NotNullWhen(true)] out GasPortComponent? port)
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Atmos.Piping.Unary.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Used in <see cref="GasPortableVisualizer"/> to determine which visuals to update.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public enum GasPortableVisuals
|
||||
{
|
||||
ConnectedState,
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ public sealed partial class AnchorableSystem : EntitySystem
|
||||
[Dependency] private readonly SharedToolSystem _tool = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
|
||||
private EntityQuery<PhysicsComponent> _physicsQuery;
|
||||
|
||||
@@ -47,6 +48,18 @@ public sealed partial class AnchorableSystem : EntitySystem
|
||||
SubscribeLocalEvent<AnchorableComponent, TryAnchorCompletedEvent>(OnAnchorComplete);
|
||||
SubscribeLocalEvent<AnchorableComponent, TryUnanchorCompletedEvent>(OnUnanchorComplete);
|
||||
SubscribeLocalEvent<AnchorableComponent, ExaminedEvent>(OnAnchoredExamine);
|
||||
SubscribeLocalEvent<AnchorableComponent, ComponentStartup>(OnAnchorStartup);
|
||||
SubscribeLocalEvent<AnchorableComponent, AnchorStateChangedEvent>(OnAnchorStateChange);
|
||||
}
|
||||
|
||||
private void OnAnchorStartup(EntityUid uid, AnchorableComponent comp, ComponentStartup args)
|
||||
{
|
||||
_appearance.SetData(uid, AnchorVisuals.Anchored, Transform(uid).Anchored);
|
||||
}
|
||||
|
||||
private void OnAnchorStateChange(EntityUid uid, AnchorableComponent comp, AnchorStateChangedEvent args)
|
||||
{
|
||||
_appearance.SetData(uid, AnchorVisuals.Anchored, args.Anchored);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -343,3 +356,9 @@ public sealed partial class AnchorableSystem : EntitySystem
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum AnchorVisuals : byte
|
||||
{
|
||||
Anchored
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
- type: Appearance
|
||||
- type: GenericVisualizer
|
||||
visuals:
|
||||
enum.GasPortableVisuals.ConnectedState:
|
||||
enum.AnchorVisuals.Anchored:
|
||||
connectedToPort:
|
||||
False: { state: can-connector, visible: false }
|
||||
True: { state: can-connector, visible: true }
|
||||
|
||||
Reference in New Issue
Block a user