Injector UI shows TransferAmount change, Spilling liquid changes Injector mode (#26596)

* Injector UI shows TransferAmount change, spill changes mode

* Update Content.Shared/Fluids/SharedPuddleSystem.Spillable.cs

* Update Content.Shared/Fluids/SharedPuddleSystem.Spillable.cs

---------

Co-authored-by: Plykiya <plykiya@protonmail.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Plykiya
2024-03-30 22:37:33 -07:00
committed by GitHub
parent 7c7ff5abf6
commit d71062a64c
2 changed files with 10 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ public sealed class InjectorStatusControl : Control
private FixedPoint2 PrevVolume; private FixedPoint2 PrevVolume;
private FixedPoint2 PrevMaxVolume; private FixedPoint2 PrevMaxVolume;
private FixedPoint2 PrevTransferAmount;
private InjectorToggleMode PrevToggleState; private InjectorToggleMode PrevToggleState;
public InjectorStatusControl(Entity<InjectorComponent> parent, SharedSolutionContainerSystem solutionContainers) public InjectorStatusControl(Entity<InjectorComponent> parent, SharedSolutionContainerSystem solutionContainers)
@@ -37,11 +38,13 @@ public sealed class InjectorStatusControl : Control
// only updates the UI if any of the details are different than they previously were // only updates the UI if any of the details are different than they previously were
if (PrevVolume == solution.Volume if (PrevVolume == solution.Volume
&& PrevMaxVolume == solution.MaxVolume && PrevMaxVolume == solution.MaxVolume
&& PrevTransferAmount == _parent.Comp.TransferAmount
&& PrevToggleState == _parent.Comp.ToggleState) && PrevToggleState == _parent.Comp.ToggleState)
return; return;
PrevVolume = solution.Volume; PrevVolume = solution.Volume;
PrevMaxVolume = solution.MaxVolume; PrevMaxVolume = solution.MaxVolume;
PrevTransferAmount = _parent.Comp.TransferAmount;
PrevToggleState = _parent.Comp.ToggleState; PrevToggleState = _parent.Comp.ToggleState;
// Update current volume and injector state // Update current volume and injector state

View File

@@ -1,3 +1,4 @@
using Content.Shared.Chemistry.Components;
using Content.Shared.Database; using Content.Shared.Database;
using Content.Shared.DoAfter; using Content.Shared.DoAfter;
using Content.Shared.Examine; using Content.Shared.Examine;
@@ -62,6 +63,12 @@ public abstract partial class SharedPuddleSystem
{ {
var puddleSolution = _solutionContainerSystem.SplitSolution(soln.Value, solution.Volume); var puddleSolution = _solutionContainerSystem.SplitSolution(soln.Value, solution.Volume);
TrySpillAt(Transform(target).Coordinates, puddleSolution, out _); TrySpillAt(Transform(target).Coordinates, puddleSolution, out _);
if (TryComp<InjectorComponent>(entity, out var injectorComp))
{
injectorComp.ToggleState = InjectorToggleMode.Draw;
Dirty(entity, injectorComp);
}
}; };
} }
else else