Files
tbd-station-14/Content.Client/GameObjects/Components/Fluids/SprayVisualizer.cs
Víctor Aguilera Puerto 69059eac80 Adds new different reaction types. (#2114)
* Adds new different reaction types.
- Adds touch, injection and ingestion reactions for entities.
- Adds tile reactions.
- Removes GasSprayerComponent in favor of SprayComponent.
- Gives fire extinguishers a safety.
- Gives spray puffs a sprite.
- Improved spray and fire extinguisher in general.
- Fire extinguisher now ACTUALLY puts out fires. Amazing, eh?
- Fire extinguisher sprays three 'clouds' at once.
- Spraying flammable chemicals at fire makes them worse. Whoops!
- Gives spray and fire extinguisher their classic sounds.
- Most chemicals now don't make puddles. Too bad!
- Space lube now makes a very slippery puddle. Honk.
- Spraying water (or using a fire extinguisher) on existing puddles makes them bigger.

* Fix solution tests

* food base now has solution container with noexamine caps
2020-09-21 17:51:07 +02:00

52 lines
1.4 KiB
C#

using Content.Shared.GameObjects.Components.Fluids;
using Robust.Client.GameObjects;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components.Fluids
{
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
{
Base
}
}