mirror of
https://github.com/wega-team/ss14-wega.git
synced 2026-06-09 10:06:49 +02:00
5168b5f3d4
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
29 lines
1.0 KiB
C#
29 lines
1.0 KiB
C#
using Content.Shared.Atmos.Piping.Unary.Components;
|
|
using Content.Shared.SprayPainter.Prototypes;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.Atmos.EntitySystems;
|
|
|
|
/// <summary>
|
|
/// Used to change the appearance of gas canisters.
|
|
/// </summary>
|
|
public sealed partial class GasCanisterAppearanceSystem : VisualizerSystem<GasCanisterComponent>
|
|
{
|
|
[Dependency] private IPrototypeManager _prototypeManager = default!;
|
|
|
|
protected override void OnAppearanceChange(EntityUid uid, GasCanisterComponent component, ref AppearanceChangeEvent args)
|
|
{
|
|
if (!AppearanceSystem.TryGetData<string>(uid, PaintableVisuals.Prototype, out var protoName, args.Component) || args.Sprite is not { } old)
|
|
return;
|
|
|
|
if (!_prototypeManager.HasIndex(protoName))
|
|
return;
|
|
|
|
// Create the given prototype and get its first layer.
|
|
var tempUid = Spawn(protoName);
|
|
SpriteSystem.LayerSetRsiState(uid, 0, SpriteSystem.LayerGetRsiState(tempUid, 0));
|
|
QueueDel(tempUid);
|
|
}
|
|
}
|