Fix being able to set spray amounts in bottles and vapor sprites (#16795)

This commit is contained in:
Nemanja
2023-06-03 15:31:50 -04:00
committed by GitHub
parent 4cc988b668
commit ccc2648776
4 changed files with 13 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
using Content.Server.Fluids.EntitySystems;
using Content.Shared.FixedPoint;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
@@ -11,6 +12,9 @@ public sealed class SprayComponent : Component
{
public const string SolutionName = "spray";
[DataField("transferAmount")]
public FixedPoint2 TransferAmount = 10;
[ViewVariables(VVAccess.ReadWrite), DataField("sprayDistance")]
public float SprayDistance = 3.5f;

View File

@@ -4,7 +4,6 @@ using Content.Server.Cooldown;
using Content.Server.Extinguisher;
using Content.Server.Fluids.Components;
using Content.Server.Popups;
using Content.Shared.Chemistry.Components;
using Content.Shared.Cooldown;
using Content.Shared.FixedPoint;
using Content.Shared.Interaction;
@@ -62,9 +61,6 @@ public sealed class SpraySystem : EntitySystem
return;
}
if (!TryComp<SolutionTransferComponent>(uid, out var transfer))
return;
var xformQuery = GetEntityQuery<TransformComponent>();
var userXform = xformQuery.GetComponent(args.User);
@@ -89,7 +85,7 @@ public sealed class SpraySystem : EntitySystem
var threeQuarters = diffNorm * 0.75f;
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;
// TODO: Just use usedelay homie.
var cooldownTime = 0f;
@@ -107,7 +103,7 @@ public sealed class SpraySystem : EntitySystem
if (distance > 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)
break;

View File

@@ -27,6 +27,7 @@
- type: SolutionTransfer
- type: ItemCooldown
- type: Spray
transferAmount: 10
spraySound:
path: /Audio/Effects/extinguish.ogg
sprayedPrototype: ExtinguisherSpray

View File

@@ -27,6 +27,7 @@
canChangeTransferAmount: true
- type: ItemCooldown
- type: Spray
transferAmount: 10
sprayVelocity: 2
spraySound:
path: /Audio/Effects/spray2.ogg
@@ -49,8 +50,10 @@
spray:
maxVol: 250
- type: Spray
transferAmount: 15
sprayedPrototype: BigVapor
sprayVelocity: 5
sprayVelocity: 3
sprayDistance: 4.5
spraySound:
path: /Audio/Effects/spray2.ogg
@@ -106,7 +109,7 @@
- type: Sprite
netsync: false
sprite: Effects/chempuff.rsi
rotation: 90
rotation: 180
layers:
- state: chempuff
map: ["enum.VaporVisualLayers.Base"]
@@ -133,7 +136,7 @@
- type: Sprite
netsync: false
sprite: Effects/chempuff.rsi
rotation: 90
rotation: 180
layers:
- state: chempuff
scale: 2, 2