decouple material insertion visualization from lathes (#13242)
This commit is contained in:
@@ -8,6 +8,8 @@ namespace Content.Client.Lathe;
|
||||
|
||||
public sealed class LatheSystem : SharedLatheSystem
|
||||
{
|
||||
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -20,32 +22,19 @@ public sealed class LatheSystem : SharedLatheSystem
|
||||
if (args.Sprite == null)
|
||||
return;
|
||||
|
||||
if (args.Component.TryGetData(PowerDeviceVisuals.Powered, out bool powered) &&
|
||||
if (_appearance.TryGetData(uid, PowerDeviceVisuals.Powered, out bool powered, args.Component) &&
|
||||
args.Sprite.LayerMapTryGet(PowerDeviceVisualLayers.Powered, out _))
|
||||
{
|
||||
args.Sprite.LayerSetVisible(PowerDeviceVisualLayers.Powered, powered);
|
||||
}
|
||||
|
||||
// Lathe specific stuff
|
||||
if (args.Component.TryGetData(LatheVisuals.IsRunning, out bool isRunning))
|
||||
if (_appearance.TryGetData(uid, LatheVisuals.IsRunning, out bool isRunning, args.Component))
|
||||
{
|
||||
var state = isRunning ? component.RunningState : component.IdleState;
|
||||
args.Sprite.LayerSetAnimationTime(LatheVisualLayers.IsRunning, 0f);
|
||||
args.Sprite.LayerSetState(LatheVisualLayers.IsRunning, state);
|
||||
}
|
||||
|
||||
if (args.Component.TryGetData(LatheVisuals.IsInserting, out bool isInserting)
|
||||
&& args.Sprite.LayerMapTryGet(LatheVisualLayers.IsInserting, out var isInsertingLayer))
|
||||
{
|
||||
if (args.Component.TryGetData(LatheVisuals.InsertingColor, out Color color)
|
||||
&& !component.IgnoreColor)
|
||||
{
|
||||
args.Sprite.LayerSetColor(isInsertingLayer, color);
|
||||
}
|
||||
|
||||
args.Sprite.LayerSetAnimationTime(isInsertingLayer, 0f);
|
||||
args.Sprite.LayerSetVisible(isInsertingLayer, isInserting);
|
||||
}
|
||||
}
|
||||
|
||||
///<remarks>
|
||||
@@ -60,6 +49,5 @@ public sealed class LatheSystem : SharedLatheSystem
|
||||
|
||||
public enum LatheVisualLayers : byte
|
||||
{
|
||||
IsRunning,
|
||||
IsInserting
|
||||
IsRunning
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user