diff --git a/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs b/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs index 142cf392e2..403b7d73fd 100644 --- a/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs +++ b/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs @@ -6,6 +6,8 @@ using Robust.Shared.GameObjects.Components; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Maths; +using Robust.Shared.Serialization; +using Robust.Shared.ViewVariables; namespace Content.Server.GameObjects.Components.Rotatable { @@ -14,9 +16,21 @@ namespace Content.Server.GameObjects.Components.Rotatable { public override string Name => "Rotatable"; + /// + /// If true, this entity can be rotated even while anchored. + /// + [ViewVariables(VVAccess.ReadWrite)] + public bool RotateWhileAnchored { get; private set; } + + public override void ExposeData(ObjectSerializer serializer) + { + base.ExposeData(serializer); + serializer.DataField(this, x => x.RotateWhileAnchored, "rotateWhileAnchored", false); + } + private void TryRotate(IEntity user, Angle angle) { - if (Owner.TryGetComponent(out IPhysicsComponent physics)) + if (!RotateWhileAnchored && Owner.TryGetComponent(out IPhysicsComponent physics)) { if (physics.Anchored) { @@ -33,7 +47,7 @@ namespace Content.Server.GameObjects.Components.Rotatable { protected override void GetData(IEntity user, RotatableComponent component, VerbData data) { - if (!ActionBlockerSystem.CanInteract(user)) + if (!ActionBlockerSystem.CanInteract(user) || (!component.RotateWhileAnchored && component.Owner.TryGetComponent(out IPhysicsComponent physics) && physics.Anchored)) { data.Visibility = VerbVisibility.Invisible; return; @@ -55,7 +69,7 @@ namespace Content.Server.GameObjects.Components.Rotatable { protected override void GetData(IEntity user, RotatableComponent component, VerbData data) { - if (!ActionBlockerSystem.CanInteract(user)) + if (!ActionBlockerSystem.CanInteract(user) || (!component.RotateWhileAnchored && component.Owner.TryGetComponent(out IPhysicsComponent physics) && physics.Anchored)) { data.Visibility = VerbVisibility.Invisible; return; diff --git a/Resources/Prototypes/Entities/Constructible/Furniture/seats.yml b/Resources/Prototypes/Entities/Constructible/Furniture/seats.yml index d66cf66bd4..5179d2cce2 100644 --- a/Resources/Prototypes/Entities/Constructible/Furniture/seats.yml +++ b/Resources/Prototypes/Entities/Constructible/Furniture/seats.yml @@ -83,6 +83,7 @@ parent: SeatBase components: - type: Rotatable + rotateWhileAnchored: true - type: Sprite state: officechair_white - type: Physics