Skip to content

Commit

Permalink
it works now
Browse files Browse the repository at this point in the history
  • Loading branch information
saga3152 committed Nov 5, 2024
1 parent 9ec5887 commit 2956504
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Content.Server/Fluids/EntitySystems/PuddleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ public sealed partial class PuddleSystem : SharedPuddleSystem
[ValidatePrototypeId<ReagentPrototype>]
private const string CopperBlood = "CopperBlood";

[ValidatePrototypeId<ReagentPrototype>]
private const string Water = "Water";

private static string[] _standoutReagents = [Blood, Slime, CopperBlood];
private static string[] _transparentReagents = [Water];
private static string[] _nonStandardReagents = (_standoutReagents = _transparentReagents);

public static readonly float PuddleVolume = 1000;

Expand Down Expand Up @@ -365,7 +370,7 @@ private void UpdateAppearance(EntityUid uid, PuddleComponent? puddleComponent =
// Kinda EH
// Could potentially do alpha per-solution but future problem.

color = solution.GetColorWithout(_prototypeManager, _standoutReagents);
color = solution.GetColorWithout(_prototypeManager, _nonStandardReagents);
color = color.WithAlpha(0.7f);

foreach (var standout in _standoutReagents)
Expand All @@ -378,6 +383,16 @@ private void UpdateAppearance(EntityUid uid, PuddleComponent? puddleComponent =
color = Color.InterpolateBetween(color,
_prototypeManager.Index<ReagentPrototype>(standout).SubstanceColor, interpolateValue);
}
foreach (var transparent in _transparentReagents)
{
var quantity = solution.GetTotalPrototypeQuantity(transparent);
if (quantity <= FixedPoint2.Zero)
continue;

var interpolateValue = quantity.Float() / solution.Volume.Float();
color = Color.InterpolateBetween(color,
_prototypeManager.Index<ReagentPrototype>(transparent).SubstanceColor.WithAlpha(0.15f), interpolateValue);
}
}

_appearance.SetData(uid, PuddleVisuals.CurrentVolume, volume.Float(), appearance);
Expand Down

0 comments on commit 2956504

Please sign in to comment.