fire extinguisher go brrrrrr (#20479)
This commit is contained in:
@@ -67,7 +67,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
|||||||
_physics.SetLinearDamping(physics, 0f);
|
_physics.SetLinearDamping(physics, 0f);
|
||||||
_physics.SetAngularDamping(physics, 0f);
|
_physics.SetAngularDamping(physics, 0f);
|
||||||
|
|
||||||
_throwing.TryThrow(vapor.Owner, dir, speed, user: user, pushbackRatio: ThrowingSystem.PushbackDefault * 10f);
|
_throwing.TryThrow(vapor.Owner, dir, speed, user: user);
|
||||||
|
|
||||||
var distance = (target.Position - vaporXform.WorldPosition).Length();
|
var distance = (target.Position - vaporXform.WorldPosition).Length();
|
||||||
var time = (distance / physics.LinearVelocity.Length());
|
var time = (distance / physics.LinearVelocity.Length());
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ using Content.Server.Fluids.EntitySystems;
|
|||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
||||||
|
|
||||||
namespace Content.Server.Fluids.Components;
|
namespace Content.Server.Fluids.Components;
|
||||||
|
|
||||||
@@ -12,25 +11,31 @@ public sealed partial class SprayComponent : Component
|
|||||||
{
|
{
|
||||||
public const string SolutionName = "spray";
|
public const string SolutionName = "spray";
|
||||||
|
|
||||||
[DataField("transferAmount")]
|
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||||
public FixedPoint2 TransferAmount = 10;
|
public FixedPoint2 TransferAmount = 10;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("sprayDistance")]
|
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||||
public float SprayDistance = 3.5f;
|
public float SprayDistance = 3.5f;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("sprayVelocity")]
|
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||||
public float SprayVelocity = 3.5f;
|
public float SprayVelocity = 3.5f;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("sprayedPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||||
public string SprayedPrototype = "Vapor";
|
public EntProtoId SprayedPrototype = "Vapor";
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("vaporAmount")]
|
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||||
public int VaporAmount = 1;
|
public int VaporAmount = 1;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("vaporSpread")]
|
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||||
public float VaporSpread = 90f;
|
public float VaporSpread = 90f;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("spraySound", required: true)]
|
/// <summary>
|
||||||
|
/// How much the player is pushed back for each spray.
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||||
|
public float PushbackAmount = 2f;
|
||||||
|
|
||||||
|
[ViewVariables(VVAccess.ReadWrite), DataField(required: true)]
|
||||||
[Access(typeof(SpraySystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
|
[Access(typeof(SpraySystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
|
||||||
public SoundSpecifier SpraySound { get; private set; } = default!;
|
public SoundSpecifier SpraySound { get; private set; } = default!;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ using Content.Server.Chemistry.EntitySystems;
|
|||||||
using Content.Server.Cooldown;
|
using Content.Server.Cooldown;
|
||||||
using Content.Server.Extinguisher;
|
using Content.Server.Extinguisher;
|
||||||
using Content.Server.Fluids.Components;
|
using Content.Server.Fluids.Components;
|
||||||
|
using Content.Server.Gravity;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Cooldown;
|
using Content.Shared.Cooldown;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Vapor;
|
using Content.Shared.Vapor;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
@@ -19,6 +21,8 @@ public sealed class SpraySystem : EntitySystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||||
|
[Dependency] private readonly GravitySystem _gravity = default!;
|
||||||
|
[Dependency] private readonly PhysicsSystem _physics = default!;
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
|
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
|
||||||
@@ -104,7 +108,8 @@ public sealed class SpraySystem : EntitySystem
|
|||||||
if (distance > component.SprayDistance)
|
if (distance > component.SprayDistance)
|
||||||
target = userMapPos.Offset(diffNorm * component.SprayDistance);
|
target = userMapPos.Offset(diffNorm * component.SprayDistance);
|
||||||
|
|
||||||
var newSolution = _solutionContainer.SplitSolution(uid, solution, component.TransferAmount);
|
var adjustedSolutionAmount = component.TransferAmount / component.VaporAmount;
|
||||||
|
var newSolution = _solutionContainer.SplitSolution(uid, solution, adjustedSolutionAmount);
|
||||||
|
|
||||||
if (newSolution.Volume <= FixedPoint2.Zero)
|
if (newSolution.Volume <= FixedPoint2.Zero)
|
||||||
break;
|
break;
|
||||||
@@ -132,6 +137,12 @@ public sealed class SpraySystem : EntitySystem
|
|||||||
cooldownTime = MathF.Max(time, cooldownTime);
|
cooldownTime = MathF.Max(time, cooldownTime);
|
||||||
|
|
||||||
_vapor.Start(vaporComponent, vaporXform, impulseDirection * diffLength, component.SprayVelocity, target, time, args.User);
|
_vapor.Start(vaporComponent, vaporXform, impulseDirection * diffLength, component.SprayVelocity, target, time, args.User);
|
||||||
|
|
||||||
|
if (TryComp<PhysicsComponent>(args.User, out var body))
|
||||||
|
{
|
||||||
|
if (_gravity.IsWeightless(args.User, body))
|
||||||
|
_physics.ApplyLinearImpulse(args.User, -impulseDirection.Normalized() * component.PushbackAmount, body: body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_audio.PlayPvs(component.SpraySound, uid, component.SpraySound.Params.WithVariation(0.125f));
|
_audio.PlayPvs(component.SpraySound, uid, component.SpraySound.Params.WithVariation(0.125f));
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
- type: ItemCooldown
|
- type: ItemCooldown
|
||||||
- type: Spray
|
- type: Spray
|
||||||
transferAmount: 10
|
transferAmount: 10
|
||||||
|
pushbackAmount: 60
|
||||||
spraySound:
|
spraySound:
|
||||||
path: /Audio/Effects/extinguish.ogg
|
path: /Audio/Effects/extinguish.ogg
|
||||||
sprayedPrototype: ExtinguisherSpray
|
sprayedPrototype: ExtinguisherSpray
|
||||||
|
|||||||
Reference in New Issue
Block a user