Removes CannyFastMath usage from Atmos.

This commit is contained in:
Víctor Aguilera Puerto
2020-08-12 19:37:07 +02:00
parent cdc6ec3bfc
commit 1fc941b3b3
5 changed files with 8 additions and 13 deletions

View File

@@ -11,8 +11,6 @@ using Robust.Shared.IoC;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
using Math = CannyFastMath.Math;
using MathF = CannyFastMath.MathF;
namespace Content.Server.Atmos namespace Content.Server.Atmos
{ {

View File

@@ -1,4 +1,5 @@
#nullable enable #nullable enable
using System;
using Content.Server.GameObjects.Components.Atmos; using Content.Server.GameObjects.Components.Atmos;
using Robust.Shared.GameObjects.Components; using Robust.Shared.GameObjects.Components;
using Robust.Shared.Interfaces.Physics; using Robust.Shared.Interfaces.Physics;
@@ -8,8 +9,6 @@ using Robust.Shared.Map;
using Robust.Shared.Maths; using Robust.Shared.Maths;
using Robust.Shared.Physics; using Robust.Shared.Physics;
using Robust.Shared.Random; using Robust.Shared.Random;
using Logger = Robust.Shared.Log.Logger;
using MathF = CannyFastMath.MathF;
namespace Content.Server.Atmos namespace Content.Server.Atmos
{ {
@@ -52,13 +51,13 @@ namespace Content.Server.Atmos
if (maxForce > ThrowForce && throwTarget != GridCoordinates.InvalidGrid) if (maxForce > ThrowForce && throwTarget != GridCoordinates.InvalidGrid)
{ {
var moveForce = MathF.Min(maxForce * MathF.Clamp(moveProb, 0, 100) / 100f, 50f); var moveForce = MathF.Min(maxForce * Math.Clamp(moveProb, 0, 100) / 100f, 50f);
var pos = throwTarget.Position - transform.GridPosition.Position; var pos = throwTarget.Position - transform.GridPosition.Position;
LinearVelocity = pos * moveForce; LinearVelocity = pos * moveForce;
} }
else else
{ {
var moveForce = MathF.Min(maxForce * MathF.Clamp(moveProb, 0, 100) / 100f, 25f); var moveForce = MathF.Min(maxForce * Math.Clamp(moveProb, 0, 100) / 100f, 25f);
LinearVelocity = direction.ToVec() * moveForce; LinearVelocity = direction.ToVec() * moveForce;
} }

View File

@@ -1,5 +1,5 @@
#nullable enable #nullable enable
using CannyFastMath; using System;
using Content.Server.Interfaces; using Content.Server.Interfaces;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using JetBrains.Annotations; using JetBrains.Annotations;

View File

@@ -18,8 +18,6 @@ using Robust.Shared.Map;
using Robust.Shared.Maths; using Robust.Shared.Maths;
using Robust.Shared.Random; using Robust.Shared.Random;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
using Logger = Robust.Shared.Log.Logger;
using MathF = CannyFastMath.MathF;
namespace Content.Server.Atmos namespace Content.Server.Atmos
{ {
@@ -140,7 +138,7 @@ namespace Content.Server.Atmos
{ {
if(_soundCooldown == 0) if(_soundCooldown == 0)
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Effects/space_wind.ogg", EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Effects/space_wind.ogg",
GridIndices.ToGridCoordinates(_mapManager, GridIndex), AudioHelpers.WithVariation(0.125f).WithVolume(MathF.Clamp(PressureDifference / 10, 10, 100))); GridIndices.ToGridCoordinates(_mapManager, GridIndex), AudioHelpers.WithVariation(0.125f).WithVolume(Math.Clamp(PressureDifference / 10, 10, 100)));
} }
@@ -812,7 +810,7 @@ namespace Content.Server.Atmos
private void HandleDecompressionFloorRip(float sum) private void HandleDecompressionFloorRip(float sum)
{ {
if (sum > 20 && _robustRandom.Prob(MathF.Clamp(sum / 100, 0.005f, 0.5f))) if (sum > 20 && _robustRandom.Prob(Math.Clamp(sum / 100, 0.005f, 0.5f)))
_gridAtmosphereComponent.PryTile(GridIndices); _gridAtmosphereComponent.PryTile(GridIndices);
} }

View File

@@ -1,5 +1,5 @@
using System.Runtime.CompilerServices; using System;
using CannyFastMath; using System.Runtime.CompilerServices;
using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.EntitySystems; using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects; using Content.Server.Interfaces.GameObjects;