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

@@ -16,6 +16,7 @@ using Robust.Shared.Physics.Controllers;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using Content.Shared.Mobs.Systems;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
@@ -180,7 +181,7 @@ namespace Content.Shared.Movement.Systems
var parentRotation = GetParentGridAngle(mover, xformQuery);
var worldTotal = _relativeMovement ? parentRotation.RotateVec(total) : total;
DebugTools.Assert(MathHelper.CloseToPercent(total.Length, worldTotal.Length));
DebugTools.Assert(MathHelper.CloseToPercent(total.Length(), worldTotal.Length()));
var velocity = physicsComponent.LinearVelocity;
float friction;
@@ -289,7 +290,7 @@ namespace Content.Shared.Movement.Systems
private void Friction(float minimumFrictionSpeed, float frameTime, float friction, ref Vector2 velocity)
{
var speed = velocity.Length;
var speed = velocity.Length();
if (speed < minimumFrictionSpeed)
return;
@@ -310,8 +311,8 @@ namespace Content.Shared.Movement.Systems
private void Accelerate(ref Vector2 currentVelocity, in Vector2 velocity, float accel, float frameTime)
{
var wishDir = velocity != Vector2.Zero ? velocity.Normalized : Vector2.Zero;
var wishSpeed = velocity.Length;
var wishDir = velocity != Vector2.Zero ? velocity.Normalized() : Vector2.Zero;
var wishSpeed = velocity.Length();
var currentSpeed = Vector2.Dot(currentVelocity, wishDir);
var addSpeed = wishSpeed - currentSpeed;