Fix warnings and code cleanup/fixes (#13570)

This commit is contained in:
Visne
2023-01-19 03:56:45 +01:00
committed by GitHub
parent 3ca5a0224b
commit c6d3e4f3bd
265 changed files with 499 additions and 666 deletions

View File

@@ -45,57 +45,36 @@ namespace Content.Client.Fluids
return;
}
if (args.Component.TryGetData(PuddleVisuals.VolumeScale, out float volumeScale)
&& args.Component.TryGetData(PuddleVisuals.CurrentVolume, out FixedPoint2 currentVolume)
&& args.Component.TryGetData(PuddleVisuals.SolutionColor, out Color solutionColor)
&& args.Component.TryGetData(PuddleVisuals.IsEvaporatingVisual, out bool isEvaporating))
if (!args.Component.TryGetData(PuddleVisuals.VolumeScale, out float volumeScale)
|| !args.Component.TryGetData(PuddleVisuals.CurrentVolume, out FixedPoint2 currentVolume)
|| !args.Component.TryGetData(PuddleVisuals.SolutionColor, out Color solutionColor)
|| !args.Component.TryGetData(PuddleVisuals.IsEvaporatingVisual, out bool isEvaporating))
{
// volumeScale is our opacity based on level of fullness to overflow. The lower bound is hard-capped for visibility reasons.
var cappedScale = Math.Min(1.0f, volumeScale * 0.75f + 0.25f);
return;
}
Color newColor;
if (component.Recolor)
{
newColor = solutionColor.WithAlpha(cappedScale);
}
else
{
newColor = args.Sprite.Color.WithAlpha(cappedScale);
}
// volumeScale is our opacity based on level of fullness to overflow. The lower bound is hard-capped for visibility reasons.
var cappedScale = Math.Min(1.0f, volumeScale * 0.75f + 0.25f);
args.Sprite.LayerSetColor(0, newColor);
var newColor = component.Recolor ? solutionColor.WithAlpha(cappedScale) : args.Sprite.Color.WithAlpha(cappedScale);
if (component.CustomPuddleSprite) //Don't consider wet floor effects if we're using a custom sprite.
{
return;
}
args.Sprite.LayerSetColor(0, newColor);
bool wetFloorEffectNeeded;
// Don't consider wet floor effects if we're using a custom sprite.
if (component.CustomPuddleSprite)
return;
if (isEvaporating
&& currentVolume <= component.WetFloorEffectThreshold)
{
wetFloorEffectNeeded = true;
}
else
wetFloorEffectNeeded = false;
if (wetFloorEffectNeeded)
{
if (args.Sprite.LayerGetState(0) != "sparkles") // If we need the effect but don't already have it - start it
{
StartWetFloorEffect(args.Sprite, component.WetFloorEffectAlpha);
}
}
else
{
if (args.Sprite.LayerGetState(0) == "sparkles") // If we have the effect but don't need it - end it
EndWetFloorEffect(args.Sprite, component.OriginalRsi);
}
if (isEvaporating && currentVolume <= component.WetFloorEffectThreshold)
{
// If we need the effect but don't already have it - start it
if (args.Sprite.LayerGetState(0) != "sparkles")
StartWetFloorEffect(args.Sprite, component.WetFloorEffectAlpha);
}
else
{
return;
// If we have the effect but don't need it - end it
if (args.Sprite.LayerGetState(0) == "sparkles")
EndWetFloorEffect(args.Sprite, component.OriginalRsi);
}
}