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.CombatMode;
using Content.Shared.Weapons.Melee;
using Robust.Client.Graphics;
@@ -61,7 +62,7 @@ public sealed class MeleeArcOverlay : Overlay
if (diff.Equals(Vector2.Zero))
return;
diff = diff.Normalized * Math.Min(weapon.Range, diff.Length);
diff = diff.Normalized() * Math.Min(weapon.Range, diff.Length());
args.WorldHandle.DrawLine(playerPos.Position, playerPos.Position + diff, Color.Aqua);
if (weapon.Angle.Theta == 0)

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Client.Weapons.Melee.Components;
using Content.Shared.Weapons;
using Content.Shared.Weapons.Melee;
@@ -138,7 +139,7 @@ public sealed partial class MeleeWeaponSystem
sprite.NoRotation = true;
sprite.Rotation = localPos.ToWorldAngle();
var distance = Math.Clamp(localPos.Length / 2f, 0.2f, 1f);
var distance = Math.Clamp(localPos.Length() / 2f, 0.2f, 1f);
var xformQuery = GetEntityQuery<TransformComponent>();
var xform = xformQuery.GetComponent(animationUid);
@@ -274,7 +275,7 @@ public sealed partial class MeleeWeaponSystem
InterpolationMode = AnimationInterpolationMode.Linear,
KeyFrames =
{
new AnimationTrackProperty.KeyFrame(direction.Normalized * 0.15f, 0f),
new AnimationTrackProperty.KeyFrame(direction.Normalized() * 0.15f, 0f),
new AnimationTrackProperty.KeyFrame(Vector2.Zero, length)
}
}

View File

@@ -177,7 +177,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
var attackerPos = Transform(entity).MapPosition;
if (mousePos.MapId != attackerPos.MapId ||
(attackerPos.Position - mousePos.Position).Length > weapon.Range)
(attackerPos.Position - mousePos.Position).Length() > weapon.Range)
{
return;
}
@@ -276,7 +276,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
var userPos = TransformSystem.GetWorldPosition(userXform);
var direction = targetMap.Position - userPos;
var distance = Math.Min(component.Range, direction.Length);
var distance = MathF.Min(component.Range, direction.Length());
// This should really be improved. GetEntitiesInArc uses pos instead of bounding boxes.
// Server will validate it with InRangeUnobstructed.

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Shared.Weapons.Melee;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;

View File

@@ -41,7 +41,7 @@ public sealed class TetherGunOverlay : Overlay
var gunWorldPos = xformSystem.GetWorldPosition(gunXform, xformQuery);
var diff = worldPos - gunWorldPos;
var angle = diff.ToWorldAngle();
var length = diff.Length / 2f;
var length = diff.Length() / 2f;
var midPoint = gunWorldPos + diff / 2;
const float Width = 0.05f;

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Client.IoC;
using Content.Client.Items;
using Content.Client.Resources;
@@ -232,7 +233,7 @@ public sealed partial class GunSystem
}),
}
},
new Control() { MinSize = (5, 0) },
new Control() { MinSize = new Vector2(5, 0) },
(_ammoCount = new Label
{
StyleClasses = { StyleNano.StyleClassItemStatus },
@@ -267,7 +268,7 @@ public sealed partial class GunSystem
{
BackgroundColor = colorGone,
},
MinSize = (10, 15),
MinSize = new Vector2(10, 15),
});
}
@@ -281,7 +282,7 @@ public sealed partial class GunSystem
{
BackgroundColor = color,
},
MinSize = (10, 15),
MinSize = new Vector2(10, 15),
});
}
}
@@ -312,7 +313,7 @@ public sealed partial class GunSystem
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Right,
}),
new Control() { MinSize = (5,0) },
new Control() { MinSize = new Vector2(5,0) },
new Control
{
HorizontalExpand = true,
@@ -331,7 +332,7 @@ public sealed partial class GunSystem
})
}
},
new Control() { MinSize = (5,0) },
new Control() { MinSize = new Vector2(5,0) },
(_ammoCount = new Label
{
StyleClasses = {StyleNano.StyleClassItemStatus},
@@ -478,7 +479,7 @@ public sealed partial class GunSystem
box.AddChild(new TextureRect
{
Texture = texture,
TextureScale = (scale, scale),
TextureScale = new Vector2(scale, scale),
ModulateSelfOverride = Color.LimeGreen,
});
}

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Client.Items;
using Content.Client.Weapons.Ranged.Components;
using Content.Shared.Camera;
@@ -239,7 +240,7 @@ public sealed partial class GunSystem : SharedGunSystem
if (!Timing.IsFirstTimePredicted || user == null || recoil == Vector2.Zero || recoilScalar == 0)
return;
_recoil.KickCamera(user.Value, recoil.Normalized * 0.5f * recoilScalar);
_recoil.KickCamera(user.Value, recoil.Normalized() * 0.5f * recoilScalar);
}
protected override void Popup(string message, EntityUid? uid, EntityUid? user)