Replace usages of customTypeSerializer PrototypeIdListSerializer with something that doesn't take 20 separate words to type out (#37959)
* Replace usages of customTypeSerializer PrototypeIdListSerializer with something that doesn't take 20 separate words to type out * Missed one * Missed another * Fix data field ids
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using Content.Shared.Chemistry.Components.SolutionManager;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using Content.Shared.Chemistry.Components.SolutionManager;
|
||||
|
||||
namespace Content.Shared.Chemistry.Components
|
||||
{
|
||||
@@ -583,6 +583,7 @@ namespace Content.Shared.Chemistry.Components
|
||||
/// <summary>
|
||||
/// Splits a solution without the specified reagent prototypes.
|
||||
/// </summary>
|
||||
[Obsolete("Use SplitSolutionWithout with params ProtoId<ReagentPrototype>")]
|
||||
public Solution SplitSolutionWithout(FixedPoint2 toTake, params string[] excludedPrototypes)
|
||||
{
|
||||
// First remove the blacklisted prototypes
|
||||
@@ -612,6 +613,38 @@ namespace Content.Shared.Chemistry.Components
|
||||
return sol;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Splits a solution without the specified reagent prototypes.
|
||||
/// </summary>
|
||||
public Solution SplitSolutionWithout(FixedPoint2 toTake, params ProtoId<ReagentPrototype>[] excludedPrototypes)
|
||||
{
|
||||
// First remove the blacklisted prototypes
|
||||
List<ReagentQuantity> excluded = new();
|
||||
foreach (var id in excludedPrototypes)
|
||||
{
|
||||
foreach (var tuple in Contents)
|
||||
{
|
||||
if (tuple.Reagent.Prototype != id)
|
||||
continue;
|
||||
|
||||
excluded.Add(tuple);
|
||||
RemoveReagent(tuple);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Then split the solution
|
||||
var sol = SplitSolution(toTake);
|
||||
|
||||
// Then re-add the excluded reagents to the original solution.
|
||||
foreach (var reagent in excluded)
|
||||
{
|
||||
AddReagent(reagent);
|
||||
}
|
||||
|
||||
return sol;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Splits a solution with only the specified reagent prototypes.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user