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.Server.NPC.Components;
using Content.Server.NPC.Events;
using Content.Shared.CombatMode;
@@ -37,7 +38,7 @@ public sealed partial class NPCCombatSystem
var idealDistance = weapon.Range * 1.5f;
var obstacleDirection = pointB - args.WorldPosition;
var obstacleDistance = obstacleDirection.Length;
var obstacleDistance = obstacleDirection.Length();
if (obstacleDistance > idealDistance || obstacleDistance == 0f)
{
@@ -47,7 +48,7 @@ public sealed partial class NPCCombatSystem
args.Steering.CanSeek = false;
obstacleDirection = args.OffsetRotation.RotateVec(obstacleDirection);
var norm = obstacleDirection.Normalized;
var norm = obstacleDirection.Normalized();
var weight = (obstacleDistance <= args.AgentRadius
? 1f
@@ -163,7 +164,7 @@ public sealed partial class NPCCombatSystem
if (_random.Prob(component.MissChance) &&
physicsQuery.TryGetComponent(component.Target, out var targetPhysics) &&
targetPhysics.LinearVelocity.LengthSquared != 0f)
targetPhysics.LinearVelocity.LengthSquared() != 0f)
{
_melee.AttemptLightAttackMiss(uid, component.Weapon, weapon, targetXform.Coordinates.Offset(_random.NextVector2(0.5f)));
}