_physics.SetLinearDamping(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 time = (distance / physics.LinearVelocity.Length());
using Content.Shared.FixedPoint;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
-using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Fluids.Components;
{
public const string SolutionName = "spray";
- [DataField("transferAmount")]
+ [ViewVariables(VVAccess.ReadWrite), DataField]
public FixedPoint2 TransferAmount = 10;
- [ViewVariables(VVAccess.ReadWrite), DataField("sprayDistance")]
+ [ViewVariables(VVAccess.ReadWrite), DataField]
public float SprayDistance = 3.5f;
- [ViewVariables(VVAccess.ReadWrite), DataField("sprayVelocity")]
+ [ViewVariables(VVAccess.ReadWrite), DataField]
public float SprayVelocity = 3.5f;
- [ViewVariables(VVAccess.ReadWrite), DataField("sprayedPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
- public string SprayedPrototype = "Vapor";
+ [ViewVariables(VVAccess.ReadWrite), DataField]
+ public EntProtoId SprayedPrototype = "Vapor";
- [ViewVariables(VVAccess.ReadWrite), DataField("vaporAmount")]
+ [ViewVariables(VVAccess.ReadWrite), DataField]
public int VaporAmount = 1;
- [ViewVariables(VVAccess.ReadWrite), DataField("vaporSpread")]
+ [ViewVariables(VVAccess.ReadWrite), DataField]
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
public SoundSpecifier SpraySound { get; private set; } = default!;
}
using Content.Server.Cooldown;
using Content.Server.Extinguisher;
using Content.Server.Fluids.Components;
+using Content.Server.Gravity;
using Content.Server.Popups;
using Content.Shared.Cooldown;
using Content.Shared.FixedPoint;
using Content.Shared.Interaction;
using Content.Shared.Vapor;
using Robust.Server.GameObjects;
+using Robust.Shared.Physics.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
{
[Dependency] private readonly IGameTiming _gameTiming = 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 SharedAudioSystem _audio = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
if (distance > 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)
break;
cooldownTime = MathF.Max(time, cooldownTime);
_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));
- type: ItemCooldown
- type: Spray
transferAmount: 10
+ pushbackAmount: 60
spraySound:
path: /Audio/Effects/extinguish.ogg
sprayedPrototype: ExtinguisherSpray