Allow drag-and-drop insertion of reagents into the ChemMaster (#19796)
* Add DumpableSolutionComponent Separates out the component from "DrainComponent" that allows one to drag a bucket/any reagent container onto a drain/sink/toilet to empty it and allows other reagent containers to reuse the code effortlessly. * Give the ChemMaster 4000 the DumpableSolution Component Allows drag and dropping solutions into the ChemMaster much like you used to be able to do exclusively with drains. This also allows dumping jugs into them.
This commit is contained in:
@@ -24,20 +24,26 @@ public sealed partial class PuddleSystem
|
||||
return;
|
||||
}
|
||||
|
||||
TryComp<DrainableSolutionComponent>(args.Target, out var drainable);
|
||||
|
||||
_solutionContainerSystem.TryGetDrainableSolution(args.Target, out var drainableSolution, drainable);
|
||||
|
||||
// Dump reagents into drain
|
||||
if (TryComp<DrainComponent>(args.Target, out var drain) && drainable != null)
|
||||
// Dump reagents into DumpableSolution
|
||||
if (TryComp<DumpableSolutionComponent>(args.Target, out var dump))
|
||||
{
|
||||
if (drainableSolution == null || solution == null)
|
||||
_solutionContainerSystem.TryGetDumpableSolution(args.Target, out var dumpableSolution, dump);
|
||||
if (dumpableSolution == null || solution == null)
|
||||
return;
|
||||
|
||||
var split = _solutionContainerSystem.SplitSolution(uid, solution, drainableSolution.AvailableVolume);
|
||||
bool success = true;
|
||||
if (dump.Unlimited)
|
||||
{
|
||||
var split = _solutionContainerSystem.SplitSolution(uid, solution, solution.Volume);
|
||||
dumpableSolution.AddSolution(split, _prototypeManager);
|
||||
}
|
||||
else
|
||||
{
|
||||
var split = _solutionContainerSystem.SplitSolution(uid, solution, dumpableSolution.AvailableVolume);
|
||||
success = _solutionContainerSystem.TryAddSolution(args.Target, dumpableSolution, split);
|
||||
}
|
||||
|
||||
// TODO: Drane refactor
|
||||
if (_solutionContainerSystem.TryAddSolution(args.Target, drainableSolution, split))
|
||||
if (success)
|
||||
{
|
||||
_audio.PlayPvs(AbsorbentComponent.DefaultTransferSound, args.Target);
|
||||
}
|
||||
@@ -49,6 +55,10 @@ public sealed partial class PuddleSystem
|
||||
return;
|
||||
}
|
||||
|
||||
TryComp<DrainableSolutionComponent>(args.Target, out var drainable);
|
||||
|
||||
_solutionContainerSystem.TryGetDrainableSolution(args.Target, out var drainableSolution, drainable);
|
||||
|
||||
// Take reagents from target
|
||||
if (drainable != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user