Un-Hardcode water evaporation & mopping behavior (#33399)
* Un-harcode slipperiness * Make it actually work * Prettyfy * Cleanup GetEvaporatingReagents * Fix mopping with space lube + wrong solutions in absorbance * Remove LINQ and rename parameters * Change evaporation speed to fixedpoint2 * Add evaporating speed functionality * Remove unused imports * Swap around reagent evaporation speed and puddle evaporation speed. --------- Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
This commit is contained in:
@@ -1,17 +1,52 @@
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
|
||||
namespace Content.Shared.Fluids;
|
||||
|
||||
public abstract partial class SharedPuddleSystem
|
||||
{
|
||||
[ValidatePrototypeId<ReagentPrototype>]
|
||||
private const string Water = "Water";
|
||||
public string[] GetEvaporatingReagents(Solution solution)
|
||||
{
|
||||
var evaporatingReagents = new List<string>();
|
||||
foreach (ReagentPrototype solProto in solution.GetReagentPrototypes(_prototypeManager).Keys)
|
||||
{
|
||||
if (solProto.EvaporationSpeed > FixedPoint2.Zero)
|
||||
evaporatingReagents.Add(solProto.ID);
|
||||
}
|
||||
return evaporatingReagents.ToArray();
|
||||
}
|
||||
|
||||
public static readonly string[] EvaporationReagents = [Water];
|
||||
public string[] GetAbsorbentReagents(Solution solution)
|
||||
{
|
||||
var absorbentReagents = new List<string>();
|
||||
foreach (ReagentPrototype solProto in solution.GetReagentPrototypes(_prototypeManager).Keys)
|
||||
{
|
||||
if (solProto.Absorbent)
|
||||
absorbentReagents.Add(solProto.ID);
|
||||
}
|
||||
return absorbentReagents.ToArray();
|
||||
}
|
||||
|
||||
public bool CanFullyEvaporate(Solution solution)
|
||||
{
|
||||
return solution.GetTotalPrototypeQuantity(EvaporationReagents) == solution.Volume;
|
||||
return solution.GetTotalPrototypeQuantity(GetEvaporatingReagents(solution)) == solution.Volume;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the evaporating speed of the reagents within a solution.
|
||||
/// The speed at which a solution evaporates is the sum of the speed of all evaporating reagents in it.
|
||||
/// </summary>
|
||||
public Dictionary<string, FixedPoint2> GetEvaporationSpeeds(Solution solution)
|
||||
{
|
||||
var evaporatingSpeeds = new Dictionary<string, FixedPoint2>();
|
||||
foreach (ReagentPrototype solProto in solution.GetReagentPrototypes(_prototypeManager).Keys)
|
||||
{
|
||||
if (solProto.EvaporationSpeed > FixedPoint2.Zero)
|
||||
{
|
||||
evaporatingSpeeds.Add(solProto.ID, solProto.EvaporationSpeed);
|
||||
}
|
||||
}
|
||||
return evaporatingSpeeds;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user