Update content vectors to numerics (#17759)

This commit is contained in:
metalgearsloth
2023-07-08 14:08:32 +10:00
committed by GitHub
parent 15772478c9
commit 68480af109
383 changed files with 978 additions and 575 deletions

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Shared.Weather;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
@@ -101,7 +102,7 @@ public sealed class WeatherSystem : SharedWeatherSystem
{
if (Math.Abs(x) == 1 && Math.Abs(y) == 1 ||
x == 0 && y == 0 ||
(new Vector2(x, y) + node.GridIndices - seed.GridIndices).Length > 3)
(new Vector2(x, y) + node.GridIndices - seed.GridIndices).Length() > 3)
{
continue;
}
@@ -114,7 +115,7 @@ public sealed class WeatherSystem : SharedWeatherSystem
}
nearestNode = new EntityCoordinates(entXform.GridUid.Value,
(Vector2) node.GridIndices + (grid.TileSize / 2f));
(Vector2) node.GridIndices + (grid.TileSizeHalfVector));
break;
}
@@ -125,11 +126,11 @@ public sealed class WeatherSystem : SharedWeatherSystem
var entPos = _transform.GetWorldPosition(entXform);
var sourceRelative = nearestNode.Value.ToMap(EntityManager).Position - entPos;
if (sourceRelative.LengthSquared > 1f)
if (sourceRelative.LengthSquared() > 1f)
{
occlusion = _physics.IntersectRayPenetration(entXform.MapID,
new CollisionRay(entPos, sourceRelative.Normalized, _audio.OcclusionCollisionMask),
sourceRelative.Length, stream.TrackingEntity);
new CollisionRay(entPos, sourceRelative.Normalized(), _audio.OcclusionCollisionMask),
sourceRelative.Length(), stream.TrackingEntity);
}
}
}