Fire extinguisher now applies an impulse to the user when used in space.

This commit is contained in:
Vera Aguilera Puerto
2021-05-04 13:37:23 +02:00
parent 4854062c15
commit 85f3871536
2 changed files with 9 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Player;
using Robust.Shared.Timing;
@@ -52,6 +53,8 @@ namespace Content.Server.GameObjects.Components.Fluids
private bool _hasSafety;
[DataField("safety")]
private bool _safety = true;
[DataField("impulse")]
private float _impulse = 0f;
/// <summary>
/// The amount of solution to be sprayer from this solution when using it
@@ -159,6 +162,11 @@ namespace Content.Server.GameObjects.Components.Fluids
vaporComponent.TryAddSolution(solution);
vaporComponent.Start(rotation.ToVec(), _sprayVelocity, target, _sprayAliveTime);
if (_impulse > 0f && eventArgs.User.TryGetComponent(out IPhysBody? body))
{
body.ApplyLinearImpulse(-direction * _impulse);
}
}
//Play sound