Fix: obsolete warnings in SharedAbsorbentSystem (#40885)
* fix: formating warnings * split GetAbsorbentReagents into string and protoid * fix: changed SplitSolutionWhitout [obsolete] to use new method * fix: missing using directive after merge * Replaced methods with ProtoId variant
This commit is contained in:
@@ -302,7 +302,7 @@ namespace Content.Shared.Chemistry.Components
|
|||||||
/// If you only want the volume of a single reagent, use <see cref="GetReagentQuantity"/>
|
/// If you only want the volume of a single reagent, use <see cref="GetReagentQuantity"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Pure]
|
[Pure]
|
||||||
public FixedPoint2 GetTotalPrototypeQuantity(params string[] prototypes)
|
public FixedPoint2 GetTotalPrototypeQuantity(params ProtoId<ReagentPrototype>[] prototypes)
|
||||||
{
|
{
|
||||||
var total = FixedPoint2.Zero;
|
var total = FixedPoint2.Zero;
|
||||||
foreach (var (reagent, quantity) in Contents)
|
foreach (var (reagent, quantity) in Contents)
|
||||||
@@ -314,7 +314,7 @@ namespace Content.Shared.Chemistry.Components
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FixedPoint2 GetTotalPrototypeQuantity(string id)
|
public FixedPoint2 GetTotalPrototypeQuantity(ProtoId<ReagentPrototype> id)
|
||||||
{
|
{
|
||||||
var total = FixedPoint2.Zero;
|
var total = FixedPoint2.Zero;
|
||||||
foreach (var (reagent, quantity) in Contents)
|
foreach (var (reagent, quantity) in Contents)
|
||||||
@@ -645,7 +645,7 @@ namespace Content.Shared.Chemistry.Components
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Splits a solution with only the specified reagent prototypes.
|
/// Splits a solution with only the specified reagent prototypes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Solution SplitSolutionWithOnly(FixedPoint2 toTake, params string[] includedPrototypes)
|
public Solution SplitSolutionWithOnly(FixedPoint2 toTake, params ProtoId<ReagentPrototype>[] includedPrototypes)
|
||||||
{
|
{
|
||||||
// First remove the non-included prototypes
|
// First remove the non-included prototypes
|
||||||
List<ReagentQuantity> excluded = new();
|
List<ReagentQuantity> excluded = new();
|
||||||
@@ -844,7 +844,7 @@ namespace Content.Shared.Chemistry.Components
|
|||||||
ValidateSolution();
|
ValidateSolution();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color GetColorWithout(IPrototypeManager? protoMan, params string[] without)
|
public Color GetColorWithout(IPrototypeManager? protoMan, params ProtoId<ReagentPrototype>[] without)
|
||||||
{
|
{
|
||||||
if (Volume == FixedPoint2.Zero)
|
if (Volume == FixedPoint2.Zero)
|
||||||
{
|
{
|
||||||
@@ -887,7 +887,7 @@ namespace Content.Shared.Chemistry.Components
|
|||||||
return GetColorWithout(protoMan);
|
return GetColorWithout(protoMan);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color GetColorWithOnly(IPrototypeManager? protoMan, params string[] included)
|
public Color GetColorWithOnly(IPrototypeManager? protoMan, params ProtoId<ReagentPrototype>[] included)
|
||||||
{
|
{
|
||||||
if (Volume == FixedPoint2.Zero)
|
if (Volume == FixedPoint2.Zero)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -858,7 +858,7 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem
|
|||||||
args.PushMarkup(Loc.GetString(entity.Comp.LocPhysicalQuality,
|
args.PushMarkup(Loc.GetString(entity.Comp.LocPhysicalQuality,
|
||||||
("color", colorHex),
|
("color", colorHex),
|
||||||
("desc", primary.LocalizedPhysicalDescription),
|
("desc", primary.LocalizedPhysicalDescription),
|
||||||
("chemCount", solution.Contents.Count) ));
|
("chemCount", solution.Contents.Count)));
|
||||||
|
|
||||||
// Push the recognizable reagents
|
// Push the recognizable reagents
|
||||||
|
|
||||||
@@ -1048,7 +1048,7 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem
|
|||||||
public bool EnsureSolution(
|
public bool EnsureSolution(
|
||||||
Entity<MetaDataComponent?> entity,
|
Entity<MetaDataComponent?> entity,
|
||||||
string name,
|
string name,
|
||||||
[NotNullWhen(true)]out Solution? solution,
|
[NotNullWhen(true)] out Solution? solution,
|
||||||
FixedPoint2 maxVol = default)
|
FixedPoint2 maxVol = default)
|
||||||
{
|
{
|
||||||
return EnsureSolution(entity, name, maxVol, null, out _, out solution);
|
return EnsureSolution(entity, name, maxVol, null, out _, out solution);
|
||||||
@@ -1058,7 +1058,7 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem
|
|||||||
Entity<MetaDataComponent?> entity,
|
Entity<MetaDataComponent?> entity,
|
||||||
string name,
|
string name,
|
||||||
out bool existed,
|
out bool existed,
|
||||||
[NotNullWhen(true)]out Solution? solution,
|
[NotNullWhen(true)] out Solution? solution,
|
||||||
FixedPoint2 maxVol = default)
|
FixedPoint2 maxVol = default)
|
||||||
{
|
{
|
||||||
return EnsureSolution(entity, name, maxVol, null, out existed, out solution);
|
return EnsureSolution(entity, name, maxVol, null, out existed, out solution);
|
||||||
@@ -1240,13 +1240,13 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dissolvedSol.RemoveReagent(reagent,amtChange);
|
dissolvedSol.RemoveReagent(reagent, amtChange);
|
||||||
}
|
}
|
||||||
UpdateChemicals(dissolvedSolution);
|
UpdateChemicals(dissolvedSolution);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FixedPoint2 GetReagentQuantityFromConcentration(Entity<SolutionComponent> dissolvedSolution,
|
public FixedPoint2 GetReagentQuantityFromConcentration(Entity<SolutionComponent> dissolvedSolution,
|
||||||
FixedPoint2 volume,float concentration)
|
FixedPoint2 volume, float concentration)
|
||||||
{
|
{
|
||||||
var dissolvedSol = dissolvedSolution.Comp.Solution;
|
var dissolvedSol = dissolvedSolution.Comp.Solution;
|
||||||
if (volume == 0
|
if (volume == 0
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ namespace Content.Shared.Chemistry.Reagent
|
|||||||
if (effect.EntityEffectGuidebookText(prototype, entSys) is not { } description)
|
if (effect.EntityEffectGuidebookText(prototype, entSys) is not { } description)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var quantity = metabolism == null ? 0f : (double) (effect.MinScale * metabolism);
|
var quantity = metabolism == null ? 0f : (double)(effect.MinScale * metabolism);
|
||||||
|
|
||||||
return Loc.GetString(
|
return Loc.GetString(
|
||||||
"guidebook-reagent-effect-description",
|
"guidebook-reagent-effect-description",
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Shared.Chemistry.Components;
|
using Content.Shared.Chemistry.Components;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using Content.Shared.Fluids.Components;
|
using Content.Shared.Fluids.Components;
|
||||||
|
using Content.Shared.Chemistry.Reagent;
|
||||||
|
|
||||||
namespace Content.Shared.Fluids;
|
namespace Content.Shared.Fluids;
|
||||||
|
|
||||||
@@ -78,9 +80,9 @@ public abstract partial class SharedPuddleSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public string[] GetEvaporatingReagents(Solution solution)
|
public ProtoId<ReagentPrototype>[] GetEvaporatingReagents(Solution solution)
|
||||||
{
|
{
|
||||||
List<string> evaporatingReagents = [];
|
List<ProtoId<ReagentPrototype>> evaporatingReagents = [];
|
||||||
foreach (var solProto in solution.GetReagentPrototypes(_prototypeManager).Keys)
|
foreach (var solProto in solution.GetReagentPrototypes(_prototypeManager).Keys)
|
||||||
{
|
{
|
||||||
if (solProto.EvaporationSpeed > FixedPoint2.Zero)
|
if (solProto.EvaporationSpeed > FixedPoint2.Zero)
|
||||||
@@ -89,10 +91,10 @@ public abstract partial class SharedPuddleSystem
|
|||||||
return evaporatingReagents.ToArray();
|
return evaporatingReagents.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string[] GetAbsorbentReagents(Solution solution)
|
public ProtoId<ReagentPrototype>[] GetAbsorbentReagents(Solution solution)
|
||||||
{
|
{
|
||||||
List<string> absorbentReagents = [];
|
var absorbentReagents = new List<ProtoId<ReagentPrototype>>();
|
||||||
foreach (var solProto in solution.GetReagentPrototypes(_prototypeManager).Keys)
|
foreach (ReagentPrototype solProto in solution.GetReagentPrototypes(_prototypeManager).Keys)
|
||||||
{
|
{
|
||||||
if (solProto.Absorbent)
|
if (solProto.Absorbent)
|
||||||
absorbentReagents.Add(solProto.ID);
|
absorbentReagents.Add(solProto.ID);
|
||||||
@@ -109,9 +111,9 @@ public abstract partial class SharedPuddleSystem
|
|||||||
/// Gets a mapping of evaporating speed of the reagents within a solution.
|
/// Gets a mapping of evaporating speed of the reagents within a solution.
|
||||||
/// The speed at which a solution evaporates is the average of the speed of all evaporating reagents in it.
|
/// The speed at which a solution evaporates is the average of the speed of all evaporating reagents in it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, FixedPoint2> GetEvaporationSpeeds(Solution solution)
|
public Dictionary<ProtoId<ReagentPrototype>, FixedPoint2> GetEvaporationSpeeds(Solution solution)
|
||||||
{
|
{
|
||||||
Dictionary<string, FixedPoint2> evaporatingSpeeds = [];
|
Dictionary<ProtoId<ReagentPrototype>, FixedPoint2> evaporatingSpeeds = [];
|
||||||
foreach (var solProto in solution.GetReagentPrototypes(_prototypeManager).Keys)
|
foreach (var solProto in solution.GetReagentPrototypes(_prototypeManager).Keys)
|
||||||
{
|
{
|
||||||
if (solProto.EvaporationSpeed > FixedPoint2.Zero)
|
if (solProto.EvaporationSpeed > FixedPoint2.Zero)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public abstract partial class SharedPuddleSystem : EntitySystem
|
|||||||
[Dependency] private readonly StepTriggerSystem _stepTrigger = default!;
|
[Dependency] private readonly StepTriggerSystem _stepTrigger = default!;
|
||||||
[Dependency] private readonly TileFrictionController _tile = default!;
|
[Dependency] private readonly TileFrictionController _tile = default!;
|
||||||
|
|
||||||
private string[] _standoutReagents = [];
|
private ProtoId<ReagentPrototype>[] _standoutReagents = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The lowest threshold to be considered for puddle sprite states as well as slipperiness of a puddle.
|
/// The lowest threshold to be considered for puddle sprite states as well as slipperiness of a puddle.
|
||||||
|
|||||||
Reference in New Issue
Block a user