Fix being able to set spray amounts in bottles and vapor sprites (#16795)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Content.Server.Fluids.EntitySystems;
|
using Content.Server.Fluids.EntitySystems;
|
||||||
|
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;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
@@ -11,6 +12,9 @@ public sealed class SprayComponent : Component
|
|||||||
{
|
{
|
||||||
public const string SolutionName = "spray";
|
public const string SolutionName = "spray";
|
||||||
|
|
||||||
|
[DataField("transferAmount")]
|
||||||
|
public FixedPoint2 TransferAmount = 10;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("sprayDistance")]
|
[ViewVariables(VVAccess.ReadWrite), DataField("sprayDistance")]
|
||||||
public float SprayDistance = 3.5f;
|
public float SprayDistance = 3.5f;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ 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.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Chemistry.Components;
|
|
||||||
using Content.Shared.Cooldown;
|
using Content.Shared.Cooldown;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
@@ -62,9 +61,6 @@ public sealed class SpraySystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TryComp<SolutionTransferComponent>(uid, out var transfer))
|
|
||||||
return;
|
|
||||||
|
|
||||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||||
var userXform = xformQuery.GetComponent(args.User);
|
var userXform = xformQuery.GetComponent(args.User);
|
||||||
|
|
||||||
@@ -89,7 +85,7 @@ public sealed class SpraySystem : EntitySystem
|
|||||||
var threeQuarters = diffNorm * 0.75f;
|
var threeQuarters = diffNorm * 0.75f;
|
||||||
var quarter = diffNorm * 0.25f;
|
var quarter = diffNorm * 0.25f;
|
||||||
|
|
||||||
var amount = Math.Max(Math.Min((solution.Volume / transfer.TransferAmount).Int(), component.VaporAmount), 1);
|
var amount = Math.Max(Math.Min((solution.Volume / component.TransferAmount).Int(), component.VaporAmount), 1);
|
||||||
var spread = component.VaporSpread / amount;
|
var spread = component.VaporSpread / amount;
|
||||||
// TODO: Just use usedelay homie.
|
// TODO: Just use usedelay homie.
|
||||||
var cooldownTime = 0f;
|
var cooldownTime = 0f;
|
||||||
@@ -107,7 +103,7 @@ 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, transfer.TransferAmount);
|
var newSolution = _solutionContainer.SplitSolution(uid, solution, component.TransferAmount);
|
||||||
|
|
||||||
if (newSolution.Volume <= FixedPoint2.Zero)
|
if (newSolution.Volume <= FixedPoint2.Zero)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
- type: SolutionTransfer
|
- type: SolutionTransfer
|
||||||
- type: ItemCooldown
|
- type: ItemCooldown
|
||||||
- type: Spray
|
- type: Spray
|
||||||
|
transferAmount: 10
|
||||||
spraySound:
|
spraySound:
|
||||||
path: /Audio/Effects/extinguish.ogg
|
path: /Audio/Effects/extinguish.ogg
|
||||||
sprayedPrototype: ExtinguisherSpray
|
sprayedPrototype: ExtinguisherSpray
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
canChangeTransferAmount: true
|
canChangeTransferAmount: true
|
||||||
- type: ItemCooldown
|
- type: ItemCooldown
|
||||||
- type: Spray
|
- type: Spray
|
||||||
|
transferAmount: 10
|
||||||
sprayVelocity: 2
|
sprayVelocity: 2
|
||||||
spraySound:
|
spraySound:
|
||||||
path: /Audio/Effects/spray2.ogg
|
path: /Audio/Effects/spray2.ogg
|
||||||
@@ -49,8 +50,10 @@
|
|||||||
spray:
|
spray:
|
||||||
maxVol: 250
|
maxVol: 250
|
||||||
- type: Spray
|
- type: Spray
|
||||||
|
transferAmount: 15
|
||||||
sprayedPrototype: BigVapor
|
sprayedPrototype: BigVapor
|
||||||
sprayVelocity: 5
|
sprayVelocity: 3
|
||||||
|
sprayDistance: 4.5
|
||||||
spraySound:
|
spraySound:
|
||||||
path: /Audio/Effects/spray2.ogg
|
path: /Audio/Effects/spray2.ogg
|
||||||
|
|
||||||
@@ -106,7 +109,7 @@
|
|||||||
- type: Sprite
|
- type: Sprite
|
||||||
netsync: false
|
netsync: false
|
||||||
sprite: Effects/chempuff.rsi
|
sprite: Effects/chempuff.rsi
|
||||||
rotation: 90
|
rotation: 180
|
||||||
layers:
|
layers:
|
||||||
- state: chempuff
|
- state: chempuff
|
||||||
map: ["enum.VaporVisualLayers.Base"]
|
map: ["enum.VaporVisualLayers.Base"]
|
||||||
@@ -133,7 +136,7 @@
|
|||||||
- type: Sprite
|
- type: Sprite
|
||||||
netsync: false
|
netsync: false
|
||||||
sprite: Effects/chempuff.rsi
|
sprite: Effects/chempuff.rsi
|
||||||
rotation: 90
|
rotation: 180
|
||||||
layers:
|
layers:
|
||||||
- state: chempuff
|
- state: chempuff
|
||||||
scale: 2, 2
|
scale: 2, 2
|
||||||
|
|||||||
Reference in New Issue
Block a user