Added fireaxe cabinets (#4221)
* Added fireaxe cabinets * Now inserts and renamed ItemCabinetVisuals file * Added netsync * Cut out layers for future ItemCabinetVisualizer work and reorganized some RSIs * Update Resources/Textures/Constructible/Storage/Cabinets/extinguisher_cabinet.rsi/meta.json * Update Resources/Textures/Constructible/Storage/Cabinets/extinguisher_cabinet.rsi/meta.json Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Content.Shared.Cabinet;
|
||||
using Content.Shared.Cabinet;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
@@ -18,32 +18,38 @@ namespace Content.Client.Cabinet
|
||||
[DataField("closedState", required: true)]
|
||||
private string _closedState = default!;
|
||||
|
||||
[DataField("closedEmptyState", required: true)]
|
||||
private string _closedEmptyState = default!;
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
base.OnChangeData(component);
|
||||
|
||||
if (component.Owner.TryGetComponent<SpriteComponent>(out var sprite)
|
||||
&& component.TryGetData(ItemCabinetVisuals.IsOpen, out bool isOpen))
|
||||
&& component.TryGetData(ItemCabinetVisuals.IsOpen, out bool isOpen)
|
||||
&& component.TryGetData(ItemCabinetVisuals.ContainsItem, out bool contains))
|
||||
{
|
||||
if (isOpen)
|
||||
{
|
||||
if (component.TryGetData(ItemCabinetVisuals.ContainsItem, out bool contains))
|
||||
if (contains)
|
||||
{
|
||||
if (contains)
|
||||
{
|
||||
sprite.LayerSetState(0, _fullState);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite.LayerSetState(0, _emptyState);
|
||||
}
|
||||
|
||||
sprite.LayerSetState(0, _fullState);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite.LayerSetState(0, _emptyState);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (contains)
|
||||
{
|
||||
sprite.LayerSetState(0, _closedState);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite.LayerSetState(0, _closedEmptyState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user