Added the NoDoor flag to storage components, so that the open/closed state is synced with the lock/unlock.
Added the glorious Pilot Seat.
This commit is contained in:
@@ -32,6 +32,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
private IEntityQuery entityQuery;
|
private IEntityQuery entityQuery;
|
||||||
private bool _locked;
|
private bool _locked;
|
||||||
private bool _showContents;
|
private bool _showContents;
|
||||||
|
private bool _noDoor;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the storage is locked, meaning it cannot be opened.
|
/// Determines if the storage is locked, meaning it cannot be opened.
|
||||||
@@ -57,6 +58,17 @@ namespace Content.Server.GameObjects.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disables door control, and synchronizes the door with the lock. This is used for
|
||||||
|
/// attaching entities to the container without having a toggleable door.
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public bool NoDoor
|
||||||
|
{
|
||||||
|
get => _noDoor;
|
||||||
|
set => _noDoor = value;
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -65,6 +77,9 @@ namespace Content.Server.GameObjects.Components
|
|||||||
entityQuery = new IntersectingEntityQuery(Owner);
|
entityQuery = new IntersectingEntityQuery(Owner);
|
||||||
|
|
||||||
Contents.ShowContents = _showContents;
|
Contents.ShowContents = _showContents;
|
||||||
|
|
||||||
|
if (_noDoor && !_locked)
|
||||||
|
Open = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -76,13 +91,17 @@ namespace Content.Server.GameObjects.Components
|
|||||||
serializer.DataField(ref IsCollidableWhenOpen, "IsCollidableWhenOpen", false);
|
serializer.DataField(ref IsCollidableWhenOpen, "IsCollidableWhenOpen", false);
|
||||||
serializer.DataField(ref _locked, "locked", false);
|
serializer.DataField(ref _locked, "locked", false);
|
||||||
serializer.DataField(ref _showContents, "showContents", false);
|
serializer.DataField(ref _showContents, "showContents", false);
|
||||||
|
serializer.DataField(ref _noDoor, "noDoor", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool Open { get; private set; }
|
public bool Open { get; private set; }
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
if(_noDoor)
|
||||||
|
ToggleLock();
|
||||||
|
else
|
||||||
ToggleOpen();
|
ToggleOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +121,14 @@ namespace Content.Server.GameObjects.Components
|
|||||||
{
|
{
|
||||||
_locked = !_locked;
|
_locked = !_locked;
|
||||||
|
|
||||||
|
if(_noDoor)
|
||||||
|
{
|
||||||
|
if(_locked)
|
||||||
|
CloseStorage();
|
||||||
|
else
|
||||||
|
OpenStorage();
|
||||||
|
}
|
||||||
|
|
||||||
if (Owner.TryGetComponent(out SoundComponent soundComponent))
|
if (Owner.TryGetComponent(out SoundComponent soundComponent))
|
||||||
soundComponent.Play(_locked ? "/Audio/machines/lockenable.ogg" : "/Audio/machines/lockreset.ogg");
|
soundComponent.Play(_locked ? "/Audio/machines/lockenable.ogg" : "/Audio/machines/lockreset.ogg");
|
||||||
}
|
}
|
||||||
@@ -315,7 +342,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override VerbVisibility GetVisibility(IEntity user, EntityStorageComponent component)
|
protected override VerbVisibility GetVisibility(IEntity user, EntityStorageComponent component)
|
||||||
{
|
{
|
||||||
return VerbVisibility.Visible;
|
return component.NoDoor ? VerbVisibility.Invisible : VerbVisibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
25
Resources/Prototypes/Entities/buildings/shuttle.yml
Normal file
25
Resources/Prototypes/Entities/buildings/shuttle.yml
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user