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
This commit is contained in:
Víctor Aguilera Puerto
2020-09-21 17:51:07 +02:00
committed by GitHub
parent 37d6ca556f
commit 69059eac80
51 changed files with 1006 additions and 471 deletions

View File

@@ -1,67 +0,0 @@
using System;
using Content.Shared.GameObjects.Components;
using JetBrains.Annotations;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Client.GameObjects.Components.Animations;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.Animations;
using Robust.Shared.Maths;
namespace Content.Client.GameObjects.Components.Atmos
{
[UsedImplicitly]
public class ExtinguisherVisualizer : AppearanceVisualizer
{
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
if (component.Deleted)
{
return;
}
if (component.TryGetData<double>(ExtinguisherVisuals.Rotation, out var degrees))
{
SetRotation(component, Angle.FromDegrees(degrees));
}
}
private void SetRotation(AppearanceComponent component, Angle rotation)
{
var sprite = component.Owner.GetComponent<ISpriteComponent>();
if (!sprite.Owner.TryGetComponent(out AnimationPlayerComponent animation))
{
sprite.Rotation = rotation;
return;
}
if (animation.HasRunningAnimation("rotate"))
{
animation.Stop("rotate");
}
animation.Play(new Animation
{
Length = TimeSpan.FromSeconds(0.125),
AnimationTracks =
{
new AnimationTrackComponentProperty
{
ComponentType = typeof(ISpriteComponent),
Property = nameof(ISpriteComponent.Rotation),
InterpolationMode = AnimationInterpolationMode.Linear,
KeyFrames =
{
new AnimationTrackProperty.KeyFrame(sprite.Rotation, 0),
new AnimationTrackProperty.KeyFrame(rotation, 0.125f)
}
}
}
}, "rotate");
}
}
}

View File

@@ -1,5 +1,5 @@
using System;
using Content.Shared.GameObjects.Atmos;
using Content.Shared.GameObjects.Components.Atmos;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;

View File

@@ -1,5 +1,4 @@
using Content.Shared.GameObjects.Atmos;
using JetBrains.Annotations;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.GameObjects.Components;
@@ -10,6 +9,7 @@ using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Utility;
using System;
using Content.Shared.GameObjects.Components.Atmos;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components.Atmos

View File

@@ -0,0 +1,101 @@
using System;
using Content.Shared.GameObjects.Components;
using JetBrains.Annotations;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Client.GameObjects.Components.Animations;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.Animations;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components.Atmos
{
[UsedImplicitly]
public class VaporVisualizer : AppearanceVisualizer
{
private const string AnimationKey = "flick_animation";
private Animation VaporFlick;
public override void LoadData(YamlMappingNode node)
{
base.LoadData(node);
var delay = 0.25f;
var state = "chempuff";
if (node.TryGetNode("animation_time", out var delayNode))
{
delay = delayNode.AsFloat();
}
if (node.TryGetNode("animation_state", out var stateNode))
{
state = stateNode.AsString();
}
VaporFlick = new Animation {Length = TimeSpan.FromSeconds(delay)};
{
var flick = new AnimationTrackSpriteFlick();
VaporFlick.AnimationTracks.Add(flick);
flick.LayerKey = VaporVisualLayers.Base;
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame(state, 0f));
}
}
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
if (component.Deleted)
{
return;
}
if (component.TryGetData<double>(VaporVisuals.Rotation, out var radians))
{
SetRotation(component, new Angle(radians));
}
if (component.TryGetData<Color>(VaporVisuals.Color, out var color))
{
SetColor(component, color);
}
if (component.TryGetData<bool>(VaporVisuals.State, out var state))
{
SetState(component, state);
}
}
private void SetState(AppearanceComponent component, bool state)
{
if (!state) return;
var animPlayer = component.Owner.GetComponent<AnimationPlayerComponent>();
if(!animPlayer.HasRunningAnimation(AnimationKey))
animPlayer.Play(VaporFlick, AnimationKey);
}
private void SetRotation(AppearanceComponent component, Angle rotation)
{
var sprite = component.Owner.GetComponent<ISpriteComponent>();
sprite.Rotation = rotation;
}
private void SetColor(AppearanceComponent component, Color color)
{
var sprite = component.Owner.GetComponent<ISpriteComponent>();
sprite.Color = color;
}
}
public enum VaporVisualLayers
{
Base
}
}

View File

@@ -1,5 +1,4 @@
using Content.Shared.GameObjects.Atmos;
using JetBrains.Annotations;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.GameObjects.Components;
@@ -10,6 +9,7 @@ using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Utility;
using System;
using Content.Shared.GameObjects.Components.Atmos;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components.Atmos