Rollerbed / foldable strap fixes. (#16106)
This commit is contained in:
@@ -23,11 +23,11 @@ public sealed class RotationVisualizerSystem : VisualizerSystem<RotationVisualsC
|
||||
{
|
||||
base.OnAppearanceChange(uid, component, ref args);
|
||||
|
||||
if (!AppearanceSystem.TryGetData<RotationState>(uid, RotationVisuals.RotationState, out var state, args.Component) ||
|
||||
args.Sprite == null)
|
||||
{
|
||||
if (args.Sprite == null)
|
||||
return;
|
||||
}
|
||||
|
||||
// If not defined, defaults to standing.
|
||||
AppearanceSystem.TryGetData<RotationState>(uid, RotationVisuals.RotationState, out var state, args.Component);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace Content.Client.Storage
|
||||
/// Client version of item storage containers, contains a UI which displays stored entities and their size
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(SharedStorageComponent))]
|
||||
public sealed class ClientStorageComponent : SharedStorageComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the folded state of the given <see cref="FoldableComponent"/>
|
||||
/// </summary>
|
||||
/// <param name="uid"></param>
|
||||
/// <param name="component"></param>
|
||||
/// <param name="folded">If true, the component will become folded, else unfolded</param>
|
||||
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<AlternativeVerb> args)
|
||||
|
||||
@@ -14,7 +14,7 @@ public sealed class StrapComponent : Component
|
||||
/// <summary>
|
||||
/// The entities that are currently buckled
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[ViewVariables] // TODO serialization
|
||||
public readonly HashSet<EntityUid> BuckledEntities = new();
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -169,6 +169,7 @@ public abstract partial class SharedBuckleSystem
|
||||
/// <param name="strapComp"> strap component of the thing we are strapping to </param>
|
||||
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);
|
||||
|
||||
@@ -14,6 +14,7 @@ public abstract partial class SharedBuckleSystem
|
||||
{
|
||||
private void InitializeStrap()
|
||||
{
|
||||
SubscribeLocalEvent<StrapComponent, ComponentStartup>(OnStrapStartup);
|
||||
SubscribeLocalEvent<StrapComponent, ComponentShutdown>(OnStrapShutdown);
|
||||
SubscribeLocalEvent<StrapComponent, ComponentRemove>((_, c, _) => StrapRemoveAll(c));
|
||||
|
||||
@@ -34,6 +35,11 @@ public abstract partial class SharedBuckleSystem
|
||||
SubscribeLocalEvent<StrapComponent, MoveEvent>(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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace Content.Shared.Rotation
|
||||
public enum RotationState
|
||||
{
|
||||
/// <summary>
|
||||
/// Standing up
|
||||
/// Standing up. This is the default value.
|
||||
/// </summary>
|
||||
Vertical,
|
||||
Vertical = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Laying down
|
||||
|
||||
Reference in New Issue
Block a user