Update content vectors to numerics (#17759)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Numerics;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Weapons.Melee.Events;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.CombatMode;
|
||||
@@ -681,7 +682,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
|
||||
var userPos = TransformSystem.GetWorldPosition(userXform);
|
||||
var direction = targetMap.Position - userPos;
|
||||
var distance = Math.Min(component.Range, direction.Length);
|
||||
var distance = Math.Min(component.Range, direction.Length());
|
||||
|
||||
var damage = GetDamage(meleeUid, user, component) * GetModifier(meleeUid, user, component, false);
|
||||
var entities = ev.Entities;
|
||||
@@ -939,7 +940,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
var invMatrix = TransformSystem.GetInvWorldMatrix(userXform);
|
||||
var localPos = invMatrix.Transform(coordinates.Position);
|
||||
|
||||
if (localPos.LengthSquared <= 0f)
|
||||
if (localPos.LengthSquared() <= 0f)
|
||||
return;
|
||||
|
||||
localPos = userXform.LocalRotation.RotateVec(localPos);
|
||||
@@ -948,8 +949,8 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
const float bufferLength = 0.2f;
|
||||
var visualLength = length - bufferLength;
|
||||
|
||||
if (localPos.Length > visualLength)
|
||||
localPos = localPos.Normalized * visualLength;
|
||||
if (localPos.Length() > visualLength)
|
||||
localPos = localPos.Normalized() * visualLength;
|
||||
|
||||
DoLunge(user, angle, localPos, animation);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared.CombatMode;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Hands.Components;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared.Weapons.Reflect;
|
||||
|
||||
namespace Content.Shared.Weapons.Ranged.Events;
|
||||
|
||||
@@ -410,7 +410,7 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
{
|
||||
var fromMap = fromCoordinates.ToMapPos(EntityManager, TransformSystem);
|
||||
var toMap = toCoordinates.ToMapPos(EntityManager, TransformSystem);
|
||||
var shotDirection = (toMap - fromMap).Normalized;
|
||||
var shotDirection = (toMap - fromMap).Normalized();
|
||||
|
||||
const float impulseStrength = 25.0f;
|
||||
var impulseVector = shotDirection * impulseStrength;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Numerics;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Database;
|
||||
|
||||
Reference in New Issue
Block a user