2021-06-09 22:19:39 +02:00
|
|
|
|
using Content.Shared.Wall;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
|
using Robust.Client.GameObjects;
|
2021-11-22 23:22:59 -08:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-12-05 18:09:01 +01:00
|
|
|
|
using Robust.Shared.IoC;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Client.Wall
|
2020-10-08 17:41:23 +02:00
|
|
|
|
{
|
|
|
|
|
|
[UsedImplicitly]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class ReinforcedWallVisualizer : AppearanceVisualizer
|
2020-10-08 17:41:23 +02:00
|
|
|
|
{
|
|
|
|
|
|
public override void OnChangeData(AppearanceComponent component)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.OnChangeData(component);
|
|
|
|
|
|
|
|
|
|
|
|
if (component.TryGetData(ReinforcedWallVisuals.DeconstructionStage, out int stage))
|
|
|
|
|
|
{
|
|
|
|
|
|
SetDeconstructionStage(component, stage);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetDeconstructionStage(AppearanceComponent component, int stage)
|
|
|
|
|
|
{
|
|
|
|
|
|
var entity = component.Owner;
|
|
|
|
|
|
|
2021-12-05 18:09:01 +01:00
|
|
|
|
var entities = IoCManager.Resolve<IEntityManager>();
|
|
|
|
|
|
if (!entities.TryGetComponent(entity, out ISpriteComponent? sprite)) return;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
|
|
|
|
|
|
if (stage < 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
sprite.LayerSetVisible(ReinforcedWallVisualLayers.Deconstruction, false);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sprite.LayerSetVisible(ReinforcedWallVisualLayers.Deconstruction, true);
|
|
|
|
|
|
sprite.LayerSetState(ReinforcedWallVisualLayers.Deconstruction, $"reinf_construct-{stage}");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-12-04 11:57:33 +01:00
|
|
|
|
public enum ReinforcedWallVisualLayers : byte
|
2020-10-08 17:41:23 +02:00
|
|
|
|
{
|
|
|
|
|
|
Deconstruction,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|