Universal weldable component (#7955)
* Weldable component for door * Content update * Examine message * Universal visualizer * Small fix * Entity storage * Content * Fixed test * Update Content.Shared/Storage/SharedStorageComponent.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Fixed loc string * Add public API to change welding time Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -160,7 +160,6 @@ namespace Content.Client.Doors
|
||||
var door = _entMan.GetComponent<DoorComponent>(component.Owner);
|
||||
var unlitVisible = true;
|
||||
var boltedVisible = false;
|
||||
var weldedVisible = false;
|
||||
var emergencyLightsVisible = false;
|
||||
|
||||
if (component.TryGetData(DoorVisuals.BaseRSI, out string baseRsi))
|
||||
@@ -210,7 +209,6 @@ namespace Content.Client.Doors
|
||||
animPlayer.Play(DenyAnimation, AnimationKey);
|
||||
break;
|
||||
case DoorState.Welded:
|
||||
weldedVisible = true;
|
||||
break;
|
||||
case DoorState.Emagging:
|
||||
animPlayer.Play(EmaggingAnimation, AnimationKey);
|
||||
@@ -236,7 +234,6 @@ namespace Content.Client.Doors
|
||||
if (!_simpleVisuals)
|
||||
{
|
||||
sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, unlitVisible && state != DoorState.Closed && state != DoorState.Welded);
|
||||
sprite.LayerSetVisible(DoorVisualLayers.BaseWelded, weldedVisible);
|
||||
sprite.LayerSetVisible(DoorVisualLayers.BaseBolted, unlitVisible && boltedVisible);
|
||||
if (_emergencyAccessLayer)
|
||||
{
|
||||
@@ -255,7 +252,6 @@ namespace Content.Client.Doors
|
||||
{
|
||||
Base,
|
||||
BaseUnlit,
|
||||
BaseWelded,
|
||||
BaseBolted,
|
||||
BaseEmergencyAccess,
|
||||
}
|
||||
|
||||
@@ -76,21 +76,12 @@ namespace Content.Client.Storage.Visualizers
|
||||
sprite.LayerSetState(StorageVisualLayers.Lock, locked ? "locked" : "unlocked");
|
||||
}
|
||||
}
|
||||
|
||||
if (component.TryGetData(StorageVisuals.CanWeld, out bool canWeld) && canWeld)
|
||||
{
|
||||
if (component.TryGetData(StorageVisuals.Welded, out bool weldedVal))
|
||||
{
|
||||
sprite.LayerSetVisible(StorageVisualLayers.Welded, weldedVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum StorageVisualLayers : byte
|
||||
{
|
||||
Door,
|
||||
Welded,
|
||||
Lock
|
||||
}
|
||||
}
|
||||
|
||||
9
Content.Client/Tools/Components/WeldableComponent.cs
Normal file
9
Content.Client/Tools/Components/WeldableComponent.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Content.Shared.Tools.Components;
|
||||
|
||||
namespace Content.Client.Tools.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed class WeldableComponent : SharedWeldableComponent
|
||||
{
|
||||
|
||||
}
|
||||
22
Content.Client/Tools/Visualizers/WeldableVisualizerSystem.cs
Normal file
22
Content.Client/Tools/Visualizers/WeldableVisualizerSystem.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Content.Client.Tools.Components;
|
||||
using Content.Shared.Tools.Components;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
namespace Content.Client.Tools.Visualizers;
|
||||
|
||||
public sealed class WeldableVisualizerSystem : VisualizerSystem<WeldableComponent>
|
||||
{
|
||||
protected override void OnAppearanceChange(EntityUid uid, WeldableComponent component, ref AppearanceChangeEvent args)
|
||||
{
|
||||
base.OnAppearanceChange(uid, component, ref args);
|
||||
|
||||
if (!TryComp(uid, out SpriteComponent? sprite))
|
||||
return;
|
||||
|
||||
args.Component.TryGetData(WeldableVisuals.IsWelded, out bool isWelded);
|
||||
if (sprite.LayerMapTryGet(WeldableLayers.BaseWelded, out var layer))
|
||||
{
|
||||
sprite.LayerSetVisible(layer, isWelded);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user