* Walls * Airlocks mostly ported * Disposal Unit * Tiles * Lighting * Catwalk * Windows * Some vending machine work * More Vending Machines * Rest of vending machine sprites ported * Fixes to vending machines * Tables (This took a lot of work) * Fixes low walls being required for window smoothing - Also replaces window damage visualization * Plasma Window * APC * SMES + Reorganized parts.yml * Furniture and Organization and Removed Shelf * Renamed seats.yml to chairs.yml * Dispensers * Lazy-fixed the glass airlocks * Don't need this no more * Tilez * blue circuit my fucking beloved * Switches lights to cev one * Conveyors and Switch * Reorients lights * !ALERT! MAP CHANGES !ALERT! Co-authored-by: Vera Aguilera Puerto <gradientvera@outlook.com>
60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
using System;
|
|
using Content.Shared.Rounding;
|
|
using Content.Shared.Window;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Log;
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Client.Window
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed class WindowVisualizer : AppearanceVisualizer
|
|
{
|
|
[DataField("crackRsi")]
|
|
public ResourcePath CrackRsi { get; } = new ("/Textures/Structures/Windows/cracks.rsi");
|
|
|
|
public override void InitializeEntity(IEntity entity)
|
|
{
|
|
if (!entity.TryGetComponent(out ISpriteComponent? sprite))
|
|
return;
|
|
|
|
sprite.LayerMapReserveBlank(WindowDamageLayers.Layer);
|
|
sprite.LayerSetVisible(WindowDamageLayers.Layer, false);
|
|
sprite.LayerSetRSI(WindowDamageLayers.Layer, CrackRsi);
|
|
}
|
|
|
|
public override void OnChangeData(AppearanceComponent component)
|
|
{
|
|
base.OnChangeData(component);
|
|
|
|
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
|
return;
|
|
|
|
if (component.TryGetData(WindowVisuals.Damage, out float fraction))
|
|
{
|
|
var level = Math.Min(ContentHelpers.RoundToLevels(fraction, 1, 5), 3);
|
|
|
|
if (level == 0)
|
|
{
|
|
sprite.LayerSetVisible(WindowDamageLayers.Layer, false);
|
|
return;
|
|
}
|
|
|
|
Logger.Info($"LEVEL: {level} DMG: {fraction}");
|
|
|
|
sprite.LayerSetVisible(WindowDamageLayers.Layer, true);
|
|
sprite.LayerSetState(WindowDamageLayers.Layer, $"{level}");
|
|
|
|
}
|
|
}
|
|
|
|
public enum WindowDamageLayers : byte
|
|
{
|
|
Layer,
|
|
}
|
|
}
|
|
}
|