Partial lathe ECS, fix cursed lathe visualizer, a bit more audiovisual feedback for lathes (#7238)
* Prototype that's mostly borked rather than completely borked * ECS inserting mats * Partial ECS mostly done, needs cleanup and visualizer * Replace timers * Power visualizes at least * First ""working"" version * Clean up all lathes * Colors * Fix animation timing * Fixes greyscale, adds a bunch of colors * Give every (used) material a color * Made most lathes take long enough you can at least see there's some sort of animation * Insertion feedback popup * Sound for circuit printer and uniform printer * Fix queueing, optimize update * Remove mono crash * cleanup * Fix test failure * Techfab inserting sprite * Cleanup and commenting * Fix bug in CanProduce check * Fix UI resolves * Mirror review stuff
This commit is contained in:
43
Content.Client/Lathe/LatheSystem.cs
Normal file
43
Content.Client/Lathe/LatheSystem.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using Robust.Client.GameObjects;
|
||||
using Content.Shared.Lathe;
|
||||
using Content.Shared.Power;
|
||||
using Content.Client.Power;
|
||||
using Content.Client.Wires.Visualizers;
|
||||
using Content.Shared.Wires;
|
||||
|
||||
namespace Content.Client.Lathe
|
||||
{
|
||||
public sealed class LatheSystem : VisualizerSystem<LatheVisualsComponent>
|
||||
{
|
||||
protected override void OnAppearanceChange(EntityUid uid, LatheVisualsComponent component, ref AppearanceChangeEvent args)
|
||||
{
|
||||
if (TryComp(uid, out SpriteComponent? sprite))
|
||||
{
|
||||
if (args.Component.TryGetData(PowerDeviceVisuals.Powered, out bool powered))
|
||||
sprite.LayerSetVisible(PowerDeviceVisualLayers.Powered, powered);
|
||||
if (args.Component.TryGetData(SharedWiresComponent.WiresVisuals.MaintenancePanelState, out bool panel))
|
||||
sprite.LayerSetVisible(WiresVisualizer.WiresVisualLayers.MaintenancePanel, panel);
|
||||
// Lathe specific stuff
|
||||
if (args.Component.TryGetData(LatheVisuals.IsRunning, out bool isRunning))
|
||||
{
|
||||
var state = isRunning ? component.RunningState : component.IdleState;
|
||||
sprite.LayerSetAnimationTime(LatheVisualLayers.IsRunning, 0f);
|
||||
sprite.LayerSetState(LatheVisualLayers.IsRunning, state);
|
||||
}
|
||||
if (args.Component.TryGetData(LatheVisuals.IsInserting, out bool isInserting))
|
||||
{
|
||||
if (args.Component.TryGetData(LatheVisuals.InsertingColor, out Color color))
|
||||
sprite.LayerSetColor(LatheVisualLayers.IsInserting, color);
|
||||
|
||||
sprite.LayerSetAnimationTime(LatheVisualLayers.IsInserting, 0f);
|
||||
sprite.LayerSetVisible(LatheVisualLayers.IsInserting, isInserting);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public enum LatheVisualLayers : byte
|
||||
{
|
||||
IsRunning,
|
||||
IsInserting
|
||||
}
|
||||
Reference in New Issue
Block a user