diff --git a/Content.Client/GameObjects/Components/Weapons/FlashableComponent.cs b/Content.Client/GameObjects/Components/Weapons/FlashableComponent.cs index 05e6305a59..18047a8f85 100644 --- a/Content.Client/GameObjects/Components/Weapons/FlashableComponent.cs +++ b/Content.Client/GameObjects/Components/Weapons/FlashableComponent.cs @@ -141,7 +141,7 @@ namespace Content.Client.GameObjects.Components.Weapons const float xOffset = 0.0f; // Overkill but easy to adjust if you want to mess around with the design - var result = (float) Math.Clamp(slope * (float) Math.Pow(ratio - xOffset, exponent) + yOffset, 0.0, 1.0); + var result = (float) FloatMath.Clamp(slope * (float) Math.Pow(ratio - xOffset, exponent) + yOffset, 0.0, 1.0); DebugTools.Assert(!float.IsNaN(result)); return result; } diff --git a/Content.Client/Parallax/ParallaxGenerator.cs b/Content.Client/Parallax/ParallaxGenerator.cs index 9011cf411e..b9e532a8a2 100644 --- a/Content.Client/Parallax/ParallaxGenerator.cs +++ b/Content.Client/Parallax/ParallaxGenerator.cs @@ -12,9 +12,6 @@ using SixLabors.ImageSharp; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; using Color = Robust.Shared.Maths.Color; -using CannyFastMath; -using Math = CannyFastMath.Math; -using MathF = CannyFastMath.MathF; namespace Content.Client.Parallax { @@ -81,7 +78,7 @@ namespace Content.Client.Parallax private readonly NoiseGenerator.NoiseType NoiseType = NoiseGenerator.NoiseType.Fbm; private readonly uint Seed = 1234; private readonly float Persistence = 0.5f; - private readonly float Lacunarity = (float) (Math.TAU / 3); + private readonly float Lacunarity = (float) (Math.PI / 3); private readonly float Frequency = 1; private readonly uint Octaves = 3; private readonly float Threshold; diff --git a/Content.Client/State/LobbyState.cs b/Content.Client/State/LobbyState.cs index 7136d581d2..5f4b6853e0 100644 --- a/Content.Client/State/LobbyState.cs +++ b/Content.Client/State/LobbyState.cs @@ -20,9 +20,6 @@ using Robust.Shared.Localization; using Robust.Shared.Prototypes; using Robust.Shared.Timing; using Robust.Shared.ViewVariables; -using CannyFastMath; -using Math = CannyFastMath.Math; -using MathF = CannyFastMath.MathF; namespace Content.Client.State { diff --git a/Content.Client/UserInterface/CooldownGraphic.cs b/Content.Client/UserInterface/CooldownGraphic.cs index ae09ec8fb8..fb440af952 100644 --- a/Content.Client/UserInterface/CooldownGraphic.cs +++ b/Content.Client/UserInterface/CooldownGraphic.cs @@ -6,9 +6,6 @@ using System; using Robust.Client.Graphics.Shaders; using Robust.Shared.IoC; using Robust.Shared.Prototypes; -using CannyFastMath; -using Math = CannyFastMath.Math; -using MathF = CannyFastMath.MathF; namespace Robust.Client.UserInterface.Controls { @@ -45,7 +42,7 @@ namespace Robust.Client.UserInterface.Controls } else { - var alpha = MathF.Clamp(0.5f * lerp, 0f, 0.5f); + var alpha = FloatMath.Clamp(0.5f * lerp, 0f, 0.5f); color = new Color(1f, 1f, 1f, alpha); } diff --git a/Content.Server/AI/Utility/Considerations/Consideration.cs b/Content.Server/AI/Utility/Considerations/Consideration.cs index f2f0a9429d..20afc4dec1 100644 --- a/Content.Server/AI/Utility/Considerations/Consideration.cs +++ b/Content.Server/AI/Utility/Considerations/Consideration.cs @@ -2,6 +2,7 @@ using System; using Content.Server.AI.WorldState; using Content.Server.AI.WorldState.States.Utility; using JetBrains.Annotations; +using Robust.Shared.Maths; namespace Content.Server.AI.Utility.Considerations { @@ -16,7 +17,7 @@ namespace Content.Server.AI.Utility.Considerations var modificationFactor = 1.0f - 1.0f / considerationsCount; var makeUpValue = (1.0f - score) * modificationFactor; var adjustedScore = score + makeUpValue * score; - return Math.Clamp(adjustedScore, 0.0f, 1.0f); + return FloatMath.Clamp(adjustedScore, 0.0f, 1.0f); } [Pure] @@ -43,7 +44,7 @@ namespace Content.Server.AI.Utility.Considerations // ReSharper disable once CompareOfFloatsByEqualityOperator return x == 1.0f ? 0.0f : 1.0f; } - + public Func InverseBoolCurve(Blackboard context) { float Result() @@ -58,7 +59,7 @@ namespace Content.Server.AI.Utility.Considerations [Pure] private static float LogisticCurve(float x, float slope, float exponent, float yOffset, float xOffset) { - return Math.Clamp( + return FloatMath.Clamp( exponent * (1 / (1 + (float) Math.Pow(Math.Log(1000) * slope, -1 * x + xOffset))) + yOffset, 0.0f, 1.0f); } @@ -76,7 +77,7 @@ namespace Content.Server.AI.Utility.Considerations [Pure] private static float QuadraticCurve(float x, float slope, float exponent, float yOffset, float xOffset) { - return Math.Clamp(slope * (float) Math.Pow(x - xOffset, exponent) + yOffset, 0.0f, 1.0f); + return FloatMath.Clamp(slope * (float) Math.Pow(x - xOffset, exponent) + yOffset, 0.0f, 1.0f); } public Func QuadraticCurve(Blackboard context, float slope, float exponent, float yOffset, float xOffset) @@ -102,7 +103,7 @@ namespace Content.Server.AI.Utility.Considerations float Result() { var adjustedScore = GetAdjustedScore(context); - + switch (preset) { case Considerations.PresetCurve.Distance: diff --git a/Content.Server/Atmos/HighPressureMovementController.cs b/Content.Server/Atmos/HighPressureMovementController.cs index d3d8a93d48..60086206b9 100644 --- a/Content.Server/Atmos/HighPressureMovementController.cs +++ b/Content.Server/Atmos/HighPressureMovementController.cs @@ -51,13 +51,13 @@ namespace Content.Server.Atmos if (maxForce > ThrowForce && throwTarget != GridCoordinates.InvalidGrid) { - var moveForce = MathF.Min(maxForce * Math.Clamp(moveProb, 0, 100) / 100f, 50f); + var moveForce = MathF.Min(maxForce * FloatMath.Clamp(moveProb, 0, 100) / 100f, 50f); var pos = throwTarget.Position - transform.GridPosition.Position; LinearVelocity = pos * moveForce; } else { - var moveForce = MathF.Min(maxForce * Math.Clamp(moveProb, 0, 100) / 100f, 25f); + var moveForce = MathF.Min(maxForce * FloatMath.Clamp(moveProb, 0, 100) / 100f, 25f); LinearVelocity = direction.ToVec() * moveForce; } diff --git a/Content.Server/Atmos/TileAtmosphere.cs b/Content.Server/Atmos/TileAtmosphere.cs index f0c7cc458b..dfb3ad675f 100644 --- a/Content.Server/Atmos/TileAtmosphere.cs +++ b/Content.Server/Atmos/TileAtmosphere.cs @@ -138,7 +138,7 @@ namespace Content.Server.Atmos { if(_soundCooldown == 0) EntitySystem.Get().PlayAtCoords("/Audio/Effects/space_wind.ogg", - GridIndices.ToGridCoordinates(_mapManager, GridIndex), AudioHelpers.WithVariation(0.125f).WithVolume(Math.Clamp(PressureDifference / 10, 10, 100))); + GridIndices.ToGridCoordinates(_mapManager, GridIndex), AudioHelpers.WithVariation(0.125f).WithVolume(FloatMath.Clamp(PressureDifference / 10, 10, 100))); } @@ -810,7 +810,7 @@ namespace Content.Server.Atmos private void HandleDecompressionFloorRip(float sum) { - if (sum > 20 && _robustRandom.Prob(Math.Clamp(sum / 100, 0.005f, 0.5f))) + if (sum > 20 && _robustRandom.Prob(FloatMath.Clamp(sum / 100, 0.005f, 0.5f))) _gridAtmosphereComponent.PryTile(GridIndices); } diff --git a/Content.Server/Chemistry/ReactionEffects/ExplosionReactionEffect.cs b/Content.Server/Chemistry/ReactionEffects/ExplosionReactionEffect.cs index 1996e287a6..89f26f2413 100644 --- a/Content.Server/Chemistry/ReactionEffects/ExplosionReactionEffect.cs +++ b/Content.Server/Chemistry/ReactionEffects/ExplosionReactionEffect.cs @@ -4,9 +4,6 @@ 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 { diff --git a/Content.Server/GameObjects/Components/Mobs/HeatResistanceComponent.cs b/Content.Server/GameObjects/Components/Mobs/HeatResistanceComponent.cs index 760aea0caf..8d3283fe25 100644 --- a/Content.Server/GameObjects/Components/Mobs/HeatResistanceComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/HeatResistanceComponent.cs @@ -1,6 +1,6 @@ -using Content.Shared.GameObjects.Components.Inventory; +using System; +using Content.Shared.GameObjects.Components.Inventory; using Robust.Shared.GameObjects; -using Math = CannyFastMath.Math; namespace Content.Server.GameObjects { diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs index 8faffa150d..2a9a7f639a 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs @@ -15,10 +15,7 @@ using Robust.Shared.IoC; using Robust.Shared.Maths; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; -using CannyFastMath; using Content.Shared.Interfaces.GameObjects.Components; -using Math = CannyFastMath.Math; -using MathF = CannyFastMath.MathF; namespace Content.Server.GameObjects.Components.Weapon.Melee { diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerRangedBarrelComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerRangedBarrelComponent.cs index ce2349aea0..74e0cd5c4d 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerRangedBarrelComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerRangedBarrelComponent.cs @@ -180,7 +180,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels { var currentTime = _gameTiming.CurTime; var timeSinceLastFire = (currentTime - _lastFire).TotalSeconds; - var newTheta = Math.Clamp(_currentAngle.Theta + _angleIncrease - _angleDecay * timeSinceLastFire, _minAngle.Theta, _maxAngle.Theta); + var newTheta = FloatMath.Clamp(_currentAngle.Theta + _angleIncrease - _angleDecay * timeSinceLastFire, _minAngle.Theta, _maxAngle.Theta); _currentAngle = new Angle(newTheta); var random = (_robustRandom.NextDouble() - 0.5) * 2; diff --git a/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs index e3c3863a80..0bdd56c9cb 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs @@ -27,7 +27,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering public sealed class AiSteeringSystem : EntitySystem { // http://www.red3d.com/cwr/papers/1999/gdc99steer.html for a steering overview - + #pragma warning disable 649 [Dependency] private IMapManager _mapManager; [Dependency] private IEntityManager _entityManager; @@ -45,9 +45,9 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering /// How close we need to get to the center of each tile /// private const float TileTolerance = 0.8f; - + private Dictionary RunningAgents => _agentLists[_listIndex]; - + // We'll cycle the running list every tick as all we're doing is getting a vector2 for the // agent's steering. Should help a lot given this is the most expensive operator by far. // The AI will keep moving, it's just it'll keep moving in its existing direction. @@ -55,31 +55,31 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering private readonly List> _agentLists = new List>(AgentListCount); private const int AgentListCount = 2; private int _listIndex; - + // Cache nextGrid private readonly Dictionary _nextGrid = new Dictionary(); - + /// /// Current live paths for AI /// private readonly Dictionary> _paths = new Dictionary>(); - + /// /// Pathfinding request jobs we're waiting on /// - private readonly Dictionary> Job)> _pathfindingRequests = + private readonly Dictionary> Job)> _pathfindingRequests = new Dictionary>)>(); - + /// /// Keep track of how long we've been in 1 position and re-path if it's been too long /// private readonly Dictionary _stuckCounter = new Dictionary(); - + /// /// Get a fixed position for the target entity; if they move then re-path /// private readonly Dictionary _entityTargetPosition = new Dictionary(); - + // Anti-Stuck // Given the collision avoidance can lead to twitching need to store a reference position and check if we've been near this too long private readonly Dictionary _stuckPositions = new Dictionary(); @@ -88,7 +88,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering { base.Initialize(); _pathfindingSystem = Get(); - + for (var i = 0; i < AgentListCount; i++) { _agentLists.Add(new Dictionary()); @@ -111,14 +111,14 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering var agentList = _agentLists[i]; // Register shouldn't be called twice; if it is then someone dun fucked up DebugTools.Assert(!agentList.ContainsKey(entity)); - + if (agentList.Count < lowestListCount) { lowestListCount = agentList.Count; lowestListIndex = i; } } - + _agentLists[lowestListIndex].Add(entity, steeringRequest); } @@ -133,7 +133,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering { controller.VelocityDir = Vector2.Zero; } - + if (_pathfindingRequests.TryGetValue(entity, out var request)) { switch (request.Job.Status) @@ -157,7 +157,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering } _pathfindingRequests.Remove(entity); } - + if (_paths.ContainsKey(entity)) { _paths.Remove(entity); @@ -177,7 +177,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering { _entityTargetPosition.Remove(entity); } - + foreach (var agentList in _agentLists) { if (agentList.ContainsKey(entity)) @@ -214,7 +214,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering { var result = Steer(agent, steering); steering.Status = result; - + switch (result) { case SteeringStatus.Pending: @@ -255,7 +255,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering controller.VelocityDir = Vector2.Zero; return SteeringStatus.Pending; } - + // Validation // Check if we can even arrive -> Currently only samegrid movement supported if (entity.Transform.GridID != steeringRequest.TargetGrid.GridID) @@ -263,7 +263,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering controller.VelocityDir = Vector2.Zero; return SteeringStatus.NoPath; } - + // Check if we have arrived var targetDistance = (entity.Transform.MapPosition.Position - steeringRequest.TargetMap.Position).Length; if (targetDistance <= steeringRequest.ArrivalDistance) @@ -274,7 +274,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering controller.VelocityDir = Vector2.Zero; return SteeringStatus.Arrived; } - + // Handle pathfinding job // If we still have an existing path then keep following that until the new path arrives if (_pathfindingRequests.TryGetValue(entity, out var pathRequest) && pathRequest.Job.Status == JobStatus.Finished) @@ -297,7 +297,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering controller.VelocityDir = Vector2.Zero; return SteeringStatus.NoPath; } - + // If we're closer to next tile then we don't want to walk backwards to our tile's center UpdatePath(entity, path); @@ -319,7 +319,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering RequestPath(entity, steeringRequest); return SteeringStatus.Pending; } - + var ignoredCollision = new List(); // Check if the target entity has moved - If so then re-path // TODO: Patch the path from the target's position back towards us, stopping if it ever intersects the current path @@ -331,19 +331,19 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering controller.VelocityDir = Vector2.Zero; return SteeringStatus.NoPath; } - + // Check if target's moved too far if (_entityTargetPosition.TryGetValue(entity, out var targetGrid) && (entitySteer.TargetGrid.Position - targetGrid.Position).Length >= entitySteer.TargetMaxMove) { // We'll just repath and keep following the existing one until we get a new one RequestPath(entity, steeringRequest); } - + ignoredCollision.Add(entitySteer.Target); } HandleStuck(entity); - + // TODO: Probably need a dedicated queuing solver (doorway congestion FML) // Get the target grid (either next tile or target itself) and pass it in to the steering behaviors // If there's nowhere to go then just stop and wait @@ -353,14 +353,14 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering controller.VelocityDir = Vector2.Zero; return SteeringStatus.NoPath; } - + // Validate that we can even get to the next grid (could probably just check if we can use nextTile if we're not near the target grid) if (!_pathfindingSystem.CanTraverse(entity, nextGrid.Value)) { controller.VelocityDir = Vector2.Zero; return SteeringStatus.NoPath; } - + // Now we can /finally/ move var movementVector = Vector2.Zero; @@ -370,10 +370,10 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering movementVector += Seek(entity, nextGrid.Value); if (CollisionAvoidanceEnabled) { - movementVector += CollisionAvoidance(entity, movementVector, ignoredCollision); + movementVector += CollisionAvoidance(entity, movementVector, ignoredCollision); } // Group behaviors would also go here e.g. separation, cohesion, alignment - + // Move towards it DebugTools.Assert(movementVector != new Vector2(float.NaN, float.NaN)); controller.VelocityDir = movementVector.Normalized; @@ -391,7 +391,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering { return; } - + var cancelToken = new CancellationTokenSource(); var gridManager = _mapManager.GetGrid(entity.Transform.GridID); var startTile = gridManager.GetTileRef(entity.Transform.GridPosition); @@ -403,7 +403,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering } var access = AccessReader.FindAccessTags(entity); - + var job = _pathfindingSystem.RequestPath(new PathfindingArgs( entity.Uid, access, @@ -423,11 +423,11 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering private void UpdatePath(IEntity entity, Queue path) { _pathfindingRequests.Remove(entity); - + var entityTile = _mapManager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.GridPosition); var tile = path.Dequeue(); var closestDistance = PathfindingHelpers.OctileDistance(entityTile, tile); - + for (var i = 0; i < path.Count; i++) { tile = path.Peek(); @@ -441,7 +441,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering break; } } - + _paths[entity] = path; } @@ -458,20 +458,20 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering { _nextGrid.Remove(entity); } - + // If no tiles left just move towards the target (if we're close) if (!_paths.ContainsKey(entity) || _paths[entity].Count == 0) { if ((steeringRequest.TargetGrid.Position - entity.Transform.GridPosition.Position).Length <= 2.0f) { - return steeringRequest.TargetGrid; + return steeringRequest.TargetGrid; } // Too far so we need a re-path return null; } - - if (!_nextGrid.TryGetValue(entity, out var nextGrid) || + + if (!_nextGrid.TryGetValue(entity, out var nextGrid) || (nextGrid.Position - entity.Transform.GridPosition.Position).Length <= TileTolerance) { UpdateGridCache(entity); @@ -526,7 +526,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering { return; } - + // Okay now we're stuck _paths.Remove(entity); _stuckCounter[entity] = 0; @@ -580,7 +580,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering { return Vector2.Zero; } - + if (target.TryGetComponent(out IPhysicsComponent physicsComponent)) { var targetDistance = (targetPos.Position - entityPos.Position); @@ -603,7 +603,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering { return Vector2.Zero; } - + // We'll check tile-by-tile // Rewriting this frequently so not many comments as they'll go stale // I realise this is bad so please rewrite it ;-; @@ -636,7 +636,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering //Pathfinding updates are deferred so this may not be done yet. if (physicsEntity.Deleted) continue; - + // if we're moving in the same direction then ignore // So if 2 entities are moving towards each other and both detect a collision they'll both move in the same direction // i.e. towards the right @@ -650,7 +650,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering var additionalVector = (centerGrid.Position - entityGridCoords.Position); var distance = additionalVector.Length; // If we're too far no point, if we're close then cap it at the normalized vector - distance = Math.Clamp(2.5f - distance, 0.0f, 1.0f); + distance = FloatMath.Clamp(2.5f - distance, 0.0f, 1.0f); additionalVector = new Angle(90 * distance).RotateVec(additionalVector); avoidanceVector += additionalVector; // if we do need to avoid that means we'll have to lookahead for the next tile diff --git a/Content.Server/GameObjects/EntitySystems/PowerSolarSystem.cs b/Content.Server/GameObjects/EntitySystems/PowerSolarSystem.cs index 604e475d9c..433c7661f2 100644 --- a/Content.Server/GameObjects/EntitySystems/PowerSolarSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/PowerSolarSystem.cs @@ -12,9 +12,6 @@ using Robust.Shared.IoC; using Robust.Shared.Maths; using System; using System.Linq; -using CannyFastMath; -using Math = CannyFastMath.Math; -using MathF = CannyFastMath.MathF; namespace Content.Server.Interfaces.GameObjects.Components.Interaction { @@ -80,7 +77,7 @@ namespace Content.Server.Interfaces.GameObjects.Components.Interaction { EntityQuery = new TypeEntityQuery(typeof(SolarPanelComponent)); // Initialize the sun to something random - TowardsSun = Math.TAU * _robustRandom.NextDouble(); + TowardsSun = MathHelper.TwoPi * _robustRandom.NextDouble(); SunAngularVelocity = Angle.FromDegrees(0.1 + ((_robustRandom.NextDouble() - 0.5) * 0.05)); } diff --git a/Content.Server/GameTicking/GamePresets/PresetSuspicion.cs b/Content.Server/GameTicking/GamePresets/PresetSuspicion.cs index 17def7d31a..9d162705eb 100644 --- a/Content.Server/GameTicking/GamePresets/PresetSuspicion.cs +++ b/Content.Server/GameTicking/GamePresets/PresetSuspicion.cs @@ -16,7 +16,7 @@ using System.Linq; using Robust.Shared.Log; using System.Threading.Tasks; using Content.Shared.Preferences; - +using Robust.Shared.Maths; namespace Content.Server.GameTicking.GamePresets @@ -60,7 +60,7 @@ namespace Content.Server.GameTicking.GamePresets } } - var numTraitors = Math.Clamp(readyPlayers.Count % PlayersPerTraitor, + var numTraitors = FloatMath.Clamp(readyPlayers.Count % PlayersPerTraitor, MinTraitors, readyPlayers.Count); for (var i = 0; i < numTraitors; i++) diff --git a/Content.Server/Throw/ThrowHelper.cs b/Content.Server/Throw/ThrowHelper.cs index 17cadf3539..b0ebd1133b 100644 --- a/Content.Server/Throw/ThrowHelper.cs +++ b/Content.Server/Throw/ThrowHelper.cs @@ -1,4 +1,5 @@ -using Content.Server.GameObjects.Components; +using System; +using Content.Server.GameObjects.Components; using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Physics; using Robust.Shared.GameObjects.Components; @@ -12,7 +13,6 @@ using Robust.Shared.Maths; using Robust.Shared.Physics; using Robust.Shared.Random; using Robust.Shared.Interfaces.Physics; -using MathF = CannyFastMath.MathF; namespace Content.Server.Throw {