diff --git a/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs index 9b5e5f476b..fb1d29b551 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs @@ -32,6 +32,7 @@ namespace Content.Server.GameObjects.Components private IEntityQuery entityQuery; private bool _locked; private bool _showContents; + private bool _noDoor; /// /// Determines if the storage is locked, meaning it cannot be opened. @@ -57,6 +58,17 @@ namespace Content.Server.GameObjects.Components } } + /// + /// Disables door control, and synchronizes the door with the lock. This is used for + /// attaching entities to the container without having a toggleable door. + /// + [ViewVariables(VVAccess.ReadWrite)] + public bool NoDoor + { + get => _noDoor; + set => _noDoor = value; + } + /// public override void Initialize() { @@ -65,6 +77,9 @@ namespace Content.Server.GameObjects.Components entityQuery = new IntersectingEntityQuery(Owner); Contents.ShowContents = _showContents; + + if (_noDoor && !_locked) + Open = true; } /// @@ -76,14 +91,18 @@ namespace Content.Server.GameObjects.Components serializer.DataField(ref IsCollidableWhenOpen, "IsCollidableWhenOpen", false); serializer.DataField(ref _locked, "locked", false); serializer.DataField(ref _showContents, "showContents", false); + serializer.DataField(ref _noDoor, "noDoor", false); } - [ViewVariables] + [ViewVariables(VVAccess.ReadWrite)] public bool Open { get; private set; } void IActivate.Activate(ActivateEventArgs eventArgs) { - ToggleOpen(); + if(_noDoor) + ToggleLock(); + else + ToggleOpen(); } private void ToggleOpen() @@ -102,6 +121,14 @@ namespace Content.Server.GameObjects.Components { _locked = !_locked; + if(_noDoor) + { + if(_locked) + CloseStorage(); + else + OpenStorage(); + } + if (Owner.TryGetComponent(out SoundComponent soundComponent)) soundComponent.Play(_locked ? "/Audio/machines/lockenable.ogg" : "/Audio/machines/lockreset.ogg"); } @@ -315,7 +342,7 @@ namespace Content.Server.GameObjects.Components /// protected override VerbVisibility GetVisibility(IEntity user, EntityStorageComponent component) { - return VerbVisibility.Visible; + return component.NoDoor ? VerbVisibility.Invisible : VerbVisibility.Visible; } /// diff --git a/Resources/Prototypes/Entities/buildings/shuttle.yml b/Resources/Prototypes/Entities/buildings/shuttle.yml new file mode 100644 index 0000000000..c879bfc02b --- /dev/null +++ b/Resources/Prototypes/Entities/buildings/shuttle.yml @@ -0,0 +1,25 @@ +- type: entity + name: Pilot Chair + description: The driver seat of a prestigious battle cruiser. + id: pilotseat_chair + components: + - type: Sprite + sprite: Buildings/furniture.rsi + state: chair + color: "#8e9799" + - type: Icon + sprite: Buildings/furniture.rsi + state: chair + + - type: Collidable + + - type: Clickable + - type: InteractionOutline + + - type: EntityStorage + showContents: true + noDoor: true + + - type: Damageable + - type: Destructible + thresholdvalue: 100 \ No newline at end of file