* Engine namespace changes.
* Automated remove redundant using statements.
* Simplified Graphics namespace.
* Apparently the container system stores full type names in the map file.😞 This updates those names.
* API Changes to LocalizationManager.LoadCulture.
* Update submodule to v0.3.2
53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
using Content.Shared.GameObjects.Components.Fluids;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Shared.Utility;
|
|
using YamlDotNet.RepresentationModel;
|
|
|
|
namespace Content.Client.GameObjects.Components.Fluids
|
|
{
|
|
[UsedImplicitly]
|
|
public class SprayVisualizer : AppearanceVisualizer
|
|
{
|
|
private string _safetyOnState;
|
|
private string _safetyOffState;
|
|
|
|
public override void LoadData(YamlMappingNode node)
|
|
{
|
|
base.LoadData(node);
|
|
|
|
if (node.TryGetNode("safety_on_state", out var safetyOn))
|
|
{
|
|
_safetyOnState = safetyOn.AsString();
|
|
}
|
|
|
|
if (node.TryGetNode("safety_off_state", out var safetyOff))
|
|
{
|
|
_safetyOffState = safetyOff.AsString();
|
|
}
|
|
}
|
|
|
|
public override void OnChangeData(AppearanceComponent component)
|
|
{
|
|
base.OnChangeData(component);
|
|
|
|
if (component.TryGetData<bool>(SprayVisuals.Safety, out var safety))
|
|
{
|
|
SetSafety(component, safety);
|
|
}
|
|
}
|
|
|
|
private void SetSafety(AppearanceComponent component, bool safety)
|
|
{
|
|
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
|
|
|
sprite.LayerSetState(SprayVisualLayers.Base, safety ? _safetyOnState : _safetyOffState);
|
|
}
|
|
}
|
|
|
|
public enum SprayVisualLayers : byte
|
|
{
|
|
Base
|
|
}
|
|
}
|