use CannyFastMath in various places even where it might not be any different

also update a bunch of packages

clean up redundant YamlDotNet references
This commit is contained in:
Tyler Young
2020-06-13 01:28:28 -04:00
parent 916b9a67d8
commit de274de9e3
25 changed files with 71 additions and 66 deletions

View File

@@ -4,6 +4,9 @@ using Content.Server.GameObjects.Components.Chemistry;
using Content.Shared.Interfaces;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Serialization;
using CannyFastMath;
using Math = CannyFastMath.Math;
using MathF = CannyFastMath.MathF;
namespace Content.Server.Chemistry.ReactionEffects
{
@@ -35,9 +38,9 @@ namespace Content.Server.Chemistry.ReactionEffects
serializer.DataField(ref _maxScale, "maxScale", 1);
}
public void React(IEntity solutionEntity, decimal intensity)
public void React(IEntity solutionEntity, double intensity)
{
float floatIntensity = (float)intensity;
float floatIntensity = (float)intensity;
if (solutionEntity == null)
return;
if(!solutionEntity.TryGetComponent(out SolutionComponent solution))
@@ -46,7 +49,7 @@ namespace Content.Server.Chemistry.ReactionEffects
//Handle scaling
if (_scaled)
{
floatIntensity = Math.Min(floatIntensity, _maxScale);
floatIntensity = MathF.Min(floatIntensity, _maxScale);
}
else
{
@@ -54,10 +57,10 @@ namespace Content.Server.Chemistry.ReactionEffects
}
//Calculate intensities
int finalDevastationRange = (int)Math.Round(_devastationRange * floatIntensity);
int finalHeavyImpactRange = (int)Math.Round(_heavyImpactRange * floatIntensity);
int finalLightImpactRange = (int)Math.Round(_lightImpactRange * floatIntensity);
int finalFlashRange = (int)Math.Round(_flashRange * floatIntensity);
int finalDevastationRange = (int)MathF.Round(_devastationRange * floatIntensity);
int finalHeavyImpactRange = (int)MathF.Round(_heavyImpactRange * floatIntensity);
int finalLightImpactRange = (int)MathF.Round(_lightImpactRange * floatIntensity);
int finalFlashRange = (int)MathF.Round(_flashRange * floatIntensity);
ExplosionHelper.SpawnExplosion(solutionEntity.Transform.GridPosition, finalDevastationRange,
finalHeavyImpactRange, finalLightImpactRange, finalFlashRange);
}