diff --git a/Content.Client/Rotation/RotationVisualizerSystem.cs b/Content.Client/Rotation/RotationVisualizerSystem.cs index 892a93eb51..106bd79711 100644 --- a/Content.Client/Rotation/RotationVisualizerSystem.cs +++ b/Content.Client/Rotation/RotationVisualizerSystem.cs @@ -23,11 +23,11 @@ public sealed class RotationVisualizerSystem : VisualizerSystem(uid, RotationVisuals.RotationState, out var state, args.Component) || - args.Sprite == null) - { + if (args.Sprite == null) return; - } + + // If not defined, defaults to standing. + AppearanceSystem.TryGetData(uid, RotationVisuals.RotationState, out var state, args.Component); switch (state) { diff --git a/Content.Client/Storage/ClientStorageComponent.cs b/Content.Client/Storage/ClientStorageComponent.cs index 122d2e9900..dfd0f26c1a 100644 --- a/Content.Client/Storage/ClientStorageComponent.cs +++ b/Content.Client/Storage/ClientStorageComponent.cs @@ -8,6 +8,7 @@ namespace Content.Client.Storage /// Client version of item storage containers, contains a UI which displays stored entities and their size /// [RegisterComponent] + [ComponentReference(typeof(SharedStorageComponent))] public sealed class ClientStorageComponent : SharedStorageComponent { [Dependency] private readonly IEntityManager _entityManager = default!; diff --git a/Content.Server/Foldable/FoldableSystem.cs b/Content.Server/Foldable/FoldableSystem.cs index e21ac65727..7b5b2577dd 100644 --- a/Content.Server/Foldable/FoldableSystem.cs +++ b/Content.Server/Foldable/FoldableSystem.cs @@ -13,7 +13,6 @@ namespace Content.Server.Foldable [UsedImplicitly] public sealed class FoldableSystem : SharedFoldableSystem { - [Dependency] private readonly SharedBuckleSystem _buckle = default!; [Dependency] private readonly SharedContainerSystem _container = default!; public override void Initialize() @@ -65,20 +64,6 @@ namespace Content.Server.Foldable return true; } - /// - /// Set the folded state of the given - /// - /// - /// - /// If true, the component will become folded, else unfolded - public override void SetFolded(EntityUid uid, FoldableComponent component, bool folded) - { - base.SetFolded(uid, component, folded); - - // You can't buckle an entity to a folded object - _buckle.StrapSetEnabled(uid, !component.IsFolded); - } - #region Verb private void AddFoldVerb(EntityUid uid, FoldableComponent component, GetVerbsEvent args) diff --git a/Content.Shared/Buckle/Components/StrapComponent.cs b/Content.Shared/Buckle/Components/StrapComponent.cs index 5d19cb5883..8d2515de6d 100644 --- a/Content.Shared/Buckle/Components/StrapComponent.cs +++ b/Content.Shared/Buckle/Components/StrapComponent.cs @@ -14,7 +14,7 @@ public sealed class StrapComponent : Component /// /// The entities that are currently buckled /// - [ViewVariables] + [ViewVariables] // TODO serialization public readonly HashSet BuckledEntities = new(); /// diff --git a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs index cd50ee0991..8a2af7996a 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs @@ -169,6 +169,7 @@ public abstract partial class SharedBuckleSystem /// strap component of the thing we are strapping to private void UpdateBuckleStatus(EntityUid uid, BuckleComponent buckleComp, StrapComponent? strapComp = null) { + AppearanceSystem.SetData(uid, StrapVisuals.State, buckleComp.Buckled); if (buckleComp.BuckledTo != null) { if (!Resolve(buckleComp.BuckledTo.Value, ref strapComp)) @@ -471,8 +472,6 @@ public abstract partial class SharedBuckleSystem { _standingSystem.Down(buckleUid); } - // Sync StrapComponent data - AppearanceSystem.SetData(strapUid, StrapVisuals.State, false); if (strapComp.BuckledEntities.Remove(buckleUid)) { strapComp.OccupiedSize -= buckleComp.Size; @@ -480,6 +479,7 @@ public abstract partial class SharedBuckleSystem Dirty(strapComp); } + AppearanceSystem.SetData(strapUid, StrapVisuals.State, strapComp.BuckledEntities.Count != 0); _audioSystem.PlayPredicted(strapComp.UnbuckleSound, strapUid, buckleUid); var ev = new BuckleChangeEvent(strapUid, buckleUid, false); diff --git a/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs b/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs index a87f9fea14..44670fd18f 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs @@ -14,6 +14,7 @@ public abstract partial class SharedBuckleSystem { private void InitializeStrap() { + SubscribeLocalEvent(OnStrapStartup); SubscribeLocalEvent(OnStrapShutdown); SubscribeLocalEvent((_, c, _) => StrapRemoveAll(c)); @@ -34,6 +35,11 @@ public abstract partial class SharedBuckleSystem SubscribeLocalEvent(OnStrapMoveEvent); } + private void OnStrapStartup(EntityUid uid, StrapComponent component, ComponentStartup args) + { + AppearanceSystem.SetData(uid, StrapVisuals.State, component.BuckledEntities.Count != 0); + } + private void OnStrapShutdown(EntityUid uid, StrapComponent component, ComponentShutdown args) { if (LifeStage(uid) > EntityLifeStage.MapInitialized) diff --git a/Content.Shared/Foldable/SharedFoldableSystem.cs b/Content.Shared/Foldable/SharedFoldableSystem.cs index da94da686d..2b2b6423d0 100644 --- a/Content.Shared/Foldable/SharedFoldableSystem.cs +++ b/Content.Shared/Foldable/SharedFoldableSystem.cs @@ -1,3 +1,4 @@ +using Content.Shared.Buckle; using Content.Shared.Storage.Components; using JetBrains.Annotations; using Robust.Shared.Containers; @@ -10,6 +11,7 @@ namespace Content.Shared.Foldable; public abstract class SharedFoldableSystem : EntitySystem { [Dependency] protected readonly SharedAppearanceSystem Appearance = default!; + [Dependency] private readonly SharedBuckleSystem _buckle = default!; public override void Initialize() { @@ -65,6 +67,7 @@ public abstract class SharedFoldableSystem : EntitySystem component.IsFolded = folded; Dirty(component); Appearance.SetData(uid, FoldedVisuals.State, folded); + _buckle.StrapSetEnabled(uid, !component.IsFolded); } private void OnInsertEvent(EntityUid uid, FoldableComponent component, ContainerGettingInsertedAttemptEvent args) diff --git a/Content.Shared/Rotation/SharedRotationComponent.cs b/Content.Shared/Rotation/SharedRotationComponent.cs index 99ffd6dd84..ce1fd374b3 100644 --- a/Content.Shared/Rotation/SharedRotationComponent.cs +++ b/Content.Shared/Rotation/SharedRotationComponent.cs @@ -12,9 +12,9 @@ namespace Content.Shared.Rotation public enum RotationState { /// - /// Standing up + /// Standing up. This is the default value. /// - Vertical, + Vertical = 0, /// /// Laying down