Made anchor visuals generic (#33810)

Added a generic anchor visuals enum
This commit is contained in:
TGRCDev
2024-12-11 05:50:20 -08:00
committed by GitHub
parent 7b681b66ae
commit 89522e7144
4 changed files with 20 additions and 19 deletions

View File

@@ -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
}