diff --git a/Content.Client/Administration/AdminNameOverlay.cs b/Content.Client/Administration/AdminNameOverlay.cs index 6f191222cfb..8afee7f3669 100644 --- a/Content.Client/Administration/AdminNameOverlay.cs +++ b/Content.Client/Administration/AdminNameOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Administration.Systems; using Robust.Client.Graphics; using Robust.Client.ResourceManagement; diff --git a/Content.Client/Administration/Systems/KillSignSystem.cs b/Content.Client/Administration/Systems/KillSignSystem.cs index 59ee2e1714b..fb327236ca9 100644 --- a/Content.Client/Administration/Systems/KillSignSystem.cs +++ b/Content.Client/Administration/Systems/KillSignSystem.cs @@ -1,4 +1,5 @@ -using Content.Client.Administration.Components; +using System.Numerics; +using Content.Client.Administration.Components; using Robust.Client.GameObjects; using Robust.Shared.Utility; diff --git a/Content.Client/Administration/UI/AdminMenuWindow.xaml.cs b/Content.Client/Administration/UI/AdminMenuWindow.xaml.cs index 3340c778304..d4dfcc2042e 100644 --- a/Content.Client/Administration/UI/AdminMenuWindow.xaml.cs +++ b/Content.Client/Administration/UI/AdminMenuWindow.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.XAML; @@ -11,7 +12,7 @@ public sealed partial class AdminMenuWindow : DefaultWindow public AdminMenuWindow() { - MinSize = (500, 250); + MinSize = new Vector2(500, 250); Title = Loc.GetString("admin-menu-title"); RobustXamlLoader.Load(this); MasterTabContainer.SetTabTitle(0, Loc.GetString("admin-menu-admin-tab")); diff --git a/Content.Client/Administration/UI/BanList/BanListControl.xaml.cs b/Content.Client/Administration/UI/BanList/BanListControl.xaml.cs index 5846179fb52..f7fe7709c84 100644 --- a/Content.Client/Administration/UI/BanList/BanListControl.xaml.cs +++ b/Content.Client/Administration/UI/BanList/BanListControl.xaml.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.Administration.UI.CustomControls; using Content.Shared.Administration.BanList; using Robust.Client.AutoGenerated; @@ -57,7 +58,7 @@ private bool LineIdsClicked(BanListLine line) _popup = new BanListIdsPopup(id, ip, hwid, guid); - var box = UIBox2.FromDimensions(UserInterfaceManager.MousePositionScaled.Position, (1, 1)); + var box = UIBox2.FromDimensions(UserInterfaceManager.MousePositionScaled.Position, new Vector2(1, 1)); _popup.Open(box); return true; diff --git a/Content.Client/Administration/UI/CustomControls/VSeparator.cs b/Content.Client/Administration/UI/CustomControls/VSeparator.cs index 3f4dbc18bcc..0ab8a88c7bd 100644 --- a/Content.Client/Administration/UI/CustomControls/VSeparator.cs +++ b/Content.Client/Administration/UI/CustomControls/VSeparator.cs @@ -1,4 +1,5 @@ -using Robust.Client.Graphics; +using System.Numerics; +using Robust.Client.Graphics; using Robust.Client.UserInterface.Controls; using Robust.Shared.Maths; @@ -10,7 +11,7 @@ public sealed class VSeparator : PanelContainer public VSeparator(Color color) { - MinSize = (2, 5); + MinSize = new Vector2(2, 5); AddChild(new PanelContainer { diff --git a/Content.Client/Administration/UI/Notes/AdminNotesControl.xaml.cs b/Content.Client/Administration/UI/Notes/AdminNotesControl.xaml.cs index dacc042e623..49a74342c4c 100644 --- a/Content.Client/Administration/UI/Notes/AdminNotesControl.xaml.cs +++ b/Content.Client/Administration/UI/Notes/AdminNotesControl.xaml.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Shared.Administration.Notes; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface; @@ -67,7 +68,7 @@ private bool NoteClicked(AdminNotesLine line) }; _popup.OnDeletePressed += noteId => OnNoteDeleted?.Invoke(noteId); - var box = UIBox2.FromDimensions(UserInterfaceManager.MousePositionScaled.Position, (1, 1)); + var box = UIBox2.FromDimensions(UserInterfaceManager.MousePositionScaled.Position, Vector2.One); _popup.Open(box); return true; diff --git a/Content.Client/Administration/UI/PermissionsEui.cs b/Content.Client/Administration/UI/PermissionsEui.cs index 97842261f09..4cddf8887ee 100644 --- a/Content.Client/Administration/UI/PermissionsEui.cs +++ b/Content.Client/Administration/UI/PermissionsEui.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Numerics; using Content.Client.Administration.Managers; using Content.Client.Eui; using Content.Client.Stylesheets; @@ -339,7 +340,7 @@ public Menu(PermissionsEui ui) Contents.AddChild(tab); } - protected override Vector2 ContentsMinimumSize => (600, 400); + protected override Vector2 ContentsMinimumSize => new Vector2(600, 400); } private sealed class EditAdminWindow : DefaultWindow @@ -356,7 +357,7 @@ private sealed class EditAdminWindow : DefaultWindow public EditAdminWindow(PermissionsEui ui, PermissionsEuiState.AdminData? data) { - MinSize = (600, 400); + MinSize = new Vector2(600, 400); SourceData = data; Control nameControl; @@ -534,7 +535,7 @@ private sealed class EditAdminRankWindow : DefaultWindow public EditAdminRankWindow(PermissionsEui ui, KeyValuePair? data) { Title = Loc.GetString("permissions-eui-edit-admin-rank-window-title"); - MinSize = (600, 400); + MinSize = new Vector2(600, 400); SourceId = data?.Key; NameEdit = new LineEdit diff --git a/Content.Client/Administration/UI/SetOutfit/SetOutfitMenu.xaml.cs b/Content.Client/Administration/UI/SetOutfit/SetOutfitMenu.xaml.cs index d06fcc3726a..473d706badc 100644 --- a/Content.Client/Administration/UI/SetOutfit/SetOutfitMenu.xaml.cs +++ b/Content.Client/Administration/UI/SetOutfit/SetOutfitMenu.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Roles; using Robust.Client.AutoGenerated; using Robust.Client.Console; @@ -22,7 +23,7 @@ public sealed partial class SetOutfitMenu : DefaultWindow public SetOutfitMenu() { - MinSize = SetSize = (250, 320); + MinSize = SetSize = new Vector2(250, 320); IoCManager.InjectDependencies(this); RobustXamlLoader.Load(this); diff --git a/Content.Client/Administration/UI/SpawnExplosion/ExplosionDebugOverlay.cs b/Content.Client/Administration/UI/SpawnExplosion/ExplosionDebugOverlay.cs index 33273ebbeb8..e175f396615 100644 --- a/Content.Client/Administration/UI/SpawnExplosion/ExplosionDebugOverlay.cs +++ b/Content.Client/Administration/UI/SpawnExplosion/ExplosionDebugOverlay.cs @@ -4,6 +4,7 @@ using Robust.Shared.Enums; using Robust.Shared.Map; using System.Linq; +using System.Numerics; namespace Content.Client.Administration.UI.SpawnExplosion; @@ -94,7 +95,7 @@ private void DrawText( foreach (var tile in tiles) { - var centre = ((Vector2) tile + 0.5f) * tileSize; + var centre = (tile + Vector2Helpers.Half) * tileSize; // is the center of this tile visible to the user? if (!gridBounds.Contains(centre)) @@ -105,9 +106,9 @@ private void DrawText( var screenCenter = _eyeManager.WorldToScreen(worldCenter); if (Intensity[i] > 9) - screenCenter += (-12, -8); + screenCenter += new Vector2(-12, -8); else - screenCenter += (-8, -8); + screenCenter += new Vector2(-8, -8); handle.DrawString(_font, screenCenter, Intensity[i].ToString("F2")); } @@ -116,8 +117,8 @@ private void DrawText( if (tileSets.ContainsKey(0)) { var epicenter = tileSets[0].First(); - var worldCenter = transform.Transform(((Vector2) epicenter + 0.5f) * tileSize); - var screenCenter = _eyeManager.WorldToScreen(worldCenter) + (-24, -24); + var worldCenter = transform.Transform((epicenter + Vector2Helpers.Half) * tileSize); + var screenCenter = _eyeManager.WorldToScreen(worldCenter) + new Vector2(-24, -24); var text = $"{Intensity[0]:F2}\nΣ={TotalIntensity:F1}\nΔ={Slope:F1}"; handle.DrawString(_font, screenCenter, text); } @@ -168,7 +169,7 @@ private void DrawTiles( foreach (var tile in tiles) { - var centre = ((Vector2) tile + 0.5f) * tileSize; + var centre = (tile + Vector2Helpers.Half) * tileSize; // is the center of this tile visible to the user? if (!gridBounds.Contains(centre)) diff --git a/Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs b/Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs index 6399c1e03c4..04219fe39b0 100644 --- a/Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs +++ b/Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Explosion; using JetBrains.Annotations; using Robust.Client.AutoGenerated; @@ -120,7 +121,7 @@ private void UpdatePreview() return; } - MapCoordinates coords = new((MapX.Value, MapY.Value), _mapData[MapOptions.SelectedId]); + MapCoordinates coords = new(new Vector2(MapX.Value, MapY.Value), _mapData[MapOptions.SelectedId]); var explosionType = _explosionTypes[ExplosionOption.SelectedId]; _eui.RequestPreviewData(coords, explosionType, Intensity.Value, Slope.Value, MaxIntensity.Value); } diff --git a/Content.Client/Administration/UI/Tabs/AdminbusTab/LoadBlueprintsWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AdminbusTab/LoadBlueprintsWindow.xaml.cs index c91eac6620f..374093c5769 100644 --- a/Content.Client/Administration/UI/Tabs/AdminbusTab/LoadBlueprintsWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AdminbusTab/LoadBlueprintsWindow.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using JetBrains.Annotations; using Robust.Client.AutoGenerated; using Robust.Client.Console; diff --git a/Content.Client/Animations/ReusableAnimations.cs b/Content.Client/Animations/ReusableAnimations.cs index 38dfd6629cb..b061cfd05f7 100644 --- a/Content.Client/Animations/ReusableAnimations.cs +++ b/Content.Client/Animations/ReusableAnimations.cs @@ -1,4 +1,5 @@ using System; +using System.Numerics; using Robust.Client.Animations; using Robust.Client.GameObjects; using Robust.Shared.Animations; diff --git a/Content.Client/Anomaly/AnomalySystem.cs b/Content.Client/Anomaly/AnomalySystem.cs index 4ed73e7fa35..c93f0ce9490 100644 --- a/Content.Client/Anomaly/AnomalySystem.cs +++ b/Content.Client/Anomaly/AnomalySystem.cs @@ -1,4 +1,5 @@ -using Content.Client.Gravity; +using System.Numerics; +using Content.Client.Gravity; using Content.Shared.Anomaly; using Content.Shared.Anomaly.Components; using Robust.Client.GameObjects; diff --git a/Content.Client/Arcade/BlockGameMenu.cs b/Content.Client/Arcade/BlockGameMenu.cs index 17f150c756a..abb587ce7f9 100644 --- a/Content.Client/Arcade/BlockGameMenu.cs +++ b/Content.Client/Arcade/BlockGameMenu.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Numerics; using System.Text; using Content.Client.Arcade.UI; using Content.Client.Resources; @@ -61,7 +62,7 @@ public BlockGameMenu(BlockGameBoundUserInterface owner) Title = Loc.GetString("blockgame-menu-title"); _owner = owner; - MinSize = SetSize = (410, 490); + MinSize = SetSize = new Vector2(410, 490); var resourceCache = IoCManager.Resolve(); var backgroundTexture = resourceCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png"); diff --git a/Content.Client/Arcade/SpaceVillainArcadeMenu.cs b/Content.Client/Arcade/SpaceVillainArcadeMenu.cs index 4f07593b0e1..e5542a5848e 100644 --- a/Content.Client/Arcade/SpaceVillainArcadeMenu.cs +++ b/Content.Client/Arcade/SpaceVillainArcadeMenu.cs @@ -1,9 +1,8 @@ -using Content.Client.Arcade.UI; +using System.Numerics; +using Content.Client.Arcade.UI; using Content.Shared.Arcade; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; -using Robust.Shared.Localization; -using Vector2 = Robust.Shared.Maths.Vector2; namespace Content.Client.Arcade { @@ -20,7 +19,7 @@ public sealed class SpaceVillainArcadeMenu : DefaultWindow private readonly Button[] _gameButtons = new Button[3]; //used to disable/enable all game buttons public SpaceVillainArcadeMenu(SpaceVillainArcadeBoundUserInterface owner) { - MinSize = SetSize = (300, 225); + MinSize = SetSize = new Vector2(300, 225); Title = Loc.GetString("spacevillain-menu-title"); Owner = owner; diff --git a/Content.Client/Atmos/Overlays/AtmosDebugOverlay.cs b/Content.Client/Atmos/Overlays/AtmosDebugOverlay.cs index e02a8d69d85..6d1752a8c92 100644 --- a/Content.Client/Atmos/Overlays/AtmosDebugOverlay.cs +++ b/Content.Client/Atmos/Overlays/AtmosDebugOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Atmos.EntitySystems; using Content.Shared.Atmos; using Content.Shared.Atmos.EntitySystems; diff --git a/Content.Client/Atmos/Overlays/GasTileOverlay.cs b/Content.Client/Atmos/Overlays/GasTileOverlay.cs index d4e4e57d028..d3e6dbc8dec 100644 --- a/Content.Client/Atmos/Overlays/GasTileOverlay.cs +++ b/Content.Client/Atmos/Overlays/GasTileOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Atmos.Components; using Content.Client.Atmos.EntitySystems; using Content.Shared.Atmos; diff --git a/Content.Client/Atmos/UI/GasAnalyzerWindow.xaml.cs b/Content.Client/Atmos/UI/GasAnalyzerWindow.xaml.cs index fa012760855..7f6edfede8d 100644 --- a/Content.Client/Atmos/UI/GasAnalyzerWindow.xaml.cs +++ b/Content.Client/Atmos/UI/GasAnalyzerWindow.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.UserInterface.Controls; using Content.Shared.Atmos; using Content.Shared.Temperature; diff --git a/Content.Client/Audio/AmbientSoundSystem.cs b/Content.Client/Audio/AmbientSoundSystem.cs index 8b5cf4ad061..210b92d8156 100644 --- a/Content.Client/Audio/AmbientSoundSystem.cs +++ b/Content.Client/Audio/AmbientSoundSystem.cs @@ -11,6 +11,7 @@ using Robust.Shared.Timing; using Robust.Shared.Utility; using System.Linq; +using System.Numerics; using Robust.Client.GameObjects; namespace Content.Client.Audio; @@ -36,6 +37,8 @@ protected override void QueueUpdate(EntityUid uid, AmbientSoundComponent ambienc private int _maxAmbientCount; private bool _overlayEnabled; private float _maxAmbientRange; + private Vector2 MaxAmbientVector => new(_maxAmbientRange, _maxAmbientRange); + private float _cooldown; private TimeSpan _targetTime = TimeSpan.Zero; private float _ambienceVolume = 0.0f; @@ -210,7 +213,7 @@ private static bool Callback( ? xform.LocalPosition - state.Player.LocalPosition : xform.WorldPosition - state.MapPos; - var range = delta.Length; + var range = delta.Length(); if (range >= ambientComp.Range) return true; @@ -250,7 +253,7 @@ private void ProcessNearbyAmbience(TransformComponent playerXform) ? xform.LocalPosition - playerXform.LocalPosition : xform.WorldPosition - mapPos.Position; - if (distance.LengthSquared < comp.Range * comp.Range) + if (distance.LengthSquared() < comp.Range * comp.Range) continue; } @@ -266,7 +269,7 @@ private void ProcessNearbyAmbience(TransformComponent playerXform) var pos = mapPos.Position; var state = new QueryState(pos, playerXform, query); - var worldAabb = new Box2(pos - _maxAmbientRange, pos + _maxAmbientRange); + var worldAabb = new Box2(pos - MaxAmbientVector, pos + MaxAmbientVector); _treeSys.QueryAabb(ref state, Callback, mapPos.MapId, worldAabb); // Add in range ambiences diff --git a/Content.Client/Audio/AmbientSoundTreeSystem.cs b/Content.Client/Audio/AmbientSoundTreeSystem.cs index 6e2fd58d727..7a9439c9df1 100644 --- a/Content.Client/Audio/AmbientSoundTreeSystem.cs +++ b/Content.Client/Audio/AmbientSoundTreeSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Audio; using Robust.Shared.ComponentTrees; using Robust.Shared.Physics; @@ -13,7 +14,7 @@ public sealed class AmbientSoundTreeSystem : ComponentTreeSystem true; protected override Box2 ExtractAabb(in ComponentTreeEntry entry, Vector2 pos, Angle rot) - => new Box2(pos - entry.Component.Range, pos + entry.Component.Range); + => new Box2(pos - entry.Component.RangeVector, pos + entry.Component.RangeVector); protected override Box2 ExtractAabb(in ComponentTreeEntry entry) { diff --git a/Content.Client/Botany/PotencyVisualsSystem.cs b/Content.Client/Botany/PotencyVisualsSystem.cs index eac97764231..cd64a17f32d 100644 --- a/Content.Client/Botany/PotencyVisualsSystem.cs +++ b/Content.Client/Botany/PotencyVisualsSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Botany; using Content.Client.Botany.Components; using Robust.Client.GameObjects; diff --git a/Content.Client/Bql/BqlResultsWindow.xaml.cs b/Content.Client/Bql/BqlResultsWindow.xaml.cs index 7adceb5d773..4a9fde855a7 100644 --- a/Content.Client/Bql/BqlResultsWindow.xaml.cs +++ b/Content.Client/Bql/BqlResultsWindow.xaml.cs @@ -1,4 +1,5 @@ -using Robust.Client.AutoGenerated; +using System.Numerics; +using Robust.Client.AutoGenerated; using Robust.Client.Console; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; @@ -20,7 +21,7 @@ public BqlResultsWindow(IClientConsoleHost console, ILocalizationManager loc) RobustXamlLoader.Load(this); } - protected override Vector2 ContentsMinimumSize => (500, 700); + protected override Vector2 ContentsMinimumSize => new(500, 700); public void Update((string name, EntityUid entity)[] entities) { diff --git a/Content.Client/Camera/CameraRecoilSystem.cs b/Content.Client/Camera/CameraRecoilSystem.cs index cb17caa3579..a5dc7e6ecd9 100644 --- a/Content.Client/Camera/CameraRecoilSystem.cs +++ b/Content.Client/Camera/CameraRecoilSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Camera; namespace Content.Client.Camera; @@ -17,15 +18,16 @@ private void OnCameraKick(CameraKickEvent ev) public override void KickCamera(EntityUid uid, Vector2 recoil, CameraRecoilComponent? component = null) { - if (!Resolve(uid, ref component, false)) return; + if (!Resolve(uid, ref component, false)) + return; // Use really bad math to "dampen" kicks when we're already kicked. - var existing = component.CurrentKick.Length; + var existing = component.CurrentKick.Length(); var dampen = existing / KickMagnitudeMax; component.CurrentKick += recoil * (1 - dampen); - if (component.CurrentKick.Length > KickMagnitudeMax) - component.CurrentKick = component.CurrentKick.Normalized * KickMagnitudeMax; + if (component.CurrentKick.Length() > KickMagnitudeMax) + component.CurrentKick = component.CurrentKick.Normalized() * KickMagnitudeMax; component.LastKickTime = 0; } diff --git a/Content.Client/CardboardBox/CardboardBoxSystem.cs b/Content.Client/CardboardBox/CardboardBoxSystem.cs index 1b67c8be75a..a4a273eacad 100644 --- a/Content.Client/CardboardBox/CardboardBoxSystem.cs +++ b/Content.Client/CardboardBox/CardboardBoxSystem.cs @@ -1,4 +1,5 @@ -using Content.Shared.CardboardBox; +using System.Numerics; +using Content.Shared.CardboardBox; using Content.Shared.CardboardBox.Components; using Content.Shared.Examine; using Content.Shared.Movement.Components; diff --git a/Content.Client/Changelog/ChangelogWindow.xaml.cs b/Content.Client/Changelog/ChangelogWindow.xaml.cs index 88981268af6..a552dc9d1fb 100644 --- a/Content.Client/Changelog/ChangelogWindow.xaml.cs +++ b/Content.Client/Changelog/ChangelogWindow.xaml.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.Resources; using Content.Client.Stylesheets; using Content.Client.UserInterface.Systems.EscapeMenu; @@ -108,7 +109,7 @@ private async void PopulateChangelog() { Texture = upArrow, ModulateSelfOverride = Color.FromHex("#888"), - TextureScale = (0.5f, 0.5f), + TextureScale = new Vector2(0.5f, 0.5f), Margin = new Thickness(4, 3), VerticalAlignment = VAlignment.Bottom }, @@ -122,7 +123,7 @@ private async void PopulateChangelog() { Texture = upArrow, ModulateSelfOverride = Color.FromHex("#888"), - TextureScale = (0.5f, 0.5f), + TextureScale = new Vector2(0.5f, 0.5f), Margin = new Thickness(4, 3), VerticalAlignment = VAlignment.Bottom } @@ -184,7 +185,7 @@ private TextureRect GetIcon(ChangelogLineType type) { Texture = _resourceCache.GetTexture(new ResPath($"/Textures/Interface/Changelog/{file}")), VerticalAlignment = VAlignment.Top, - TextureScale = (0.5f, 0.5f), + TextureScale = new Vector2(0.5f, 0.5f), Margin = new Thickness(2, 4, 6, 2), ModulateSelfOverride = Color.FromHex(color) }; diff --git a/Content.Client/Chat/UI/SpeechBubble.cs b/Content.Client/Chat/UI/SpeechBubble.cs index a74395c2a11..b6b336f1dc9 100644 --- a/Content.Client/Chat/UI/SpeechBubble.cs +++ b/Content.Client/Chat/UI/SpeechBubble.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Chat.Managers; using Robust.Client.Graphics; using Robust.Client.UserInterface; @@ -80,7 +81,7 @@ public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, ForceRunStyleUpdate(); - bubble.Measure(Vector2.Infinity); + bubble.Measure(Vector2Helpers.Infinity); ContentSize = bubble.DesiredSize; _verticalOffsetAchieved = -ContentSize.Y; } @@ -130,7 +131,7 @@ protected override void FrameUpdate(FrameEventArgs args) var worldPos = xform.WorldPosition + offset; var lowerCenter = _eyeManager.WorldToScreen(worldPos) / UIScale; - var screenPos = lowerCenter - (ContentSize.X / 2, ContentSize.Y + _verticalOffsetAchieved); + var screenPos = lowerCenter - new Vector2(ContentSize.X / 2, ContentSize.Y + _verticalOffsetAchieved); // Round to nearest 0.5 screenPos = (screenPos * 2).Rounded() / 2; LayoutContainer.SetPosition(this, screenPos); diff --git a/Content.Client/Chemistry/UI/ChemMasterWindow.xaml.cs b/Content.Client/Chemistry/UI/ChemMasterWindow.xaml.cs index d0913e5cdbe..bcfc6fdc010 100644 --- a/Content.Client/Chemistry/UI/ChemMasterWindow.xaml.cs +++ b/Content.Client/Chemistry/UI/ChemMasterWindow.xaml.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.Stylesheets; using Content.Client.UserInterface.Controls; using Content.Shared.Chemistry; @@ -59,7 +60,7 @@ public ChemMasterWindow() { Access = AccessLevel.Public, StyleClasses = { styleBase }, - MaxSize = (42, 28), + MaxSize = new Vector2(42, 28), Group = pillTypeGroup }; @@ -68,7 +69,7 @@ public ChemMasterWindow() TextureRect pillTypeTexture = new TextureRect { Texture = specifier.Frame0(), - TextureScale = (1.75f, 1.75f), + TextureScale = new Vector2(1.75f, 1.75f), Stretch = TextureRect.StretchMode.KeepCentered, }; diff --git a/Content.Client/Chemistry/Visualizers/FoamVisualsComponent.cs b/Content.Client/Chemistry/Visualizers/FoamVisualsComponent.cs index 6dad697c725..ac71bbb6096 100644 --- a/Content.Client/Chemistry/Visualizers/FoamVisualsComponent.cs +++ b/Content.Client/Chemistry/Visualizers/FoamVisualsComponent.cs @@ -1,4 +1,5 @@ using Robust.Client.Animations; +using Robust.Client.Graphics; namespace Content.Client.Chemistry.Visualizers; @@ -22,7 +23,7 @@ public sealed class FoamVisualsComponent : Component /// /// The state of the entities base sprite RSI that is displayed when the foam dissolves. - /// Cannot use because it does not have and I am not making an engine PR at this time. + /// Cannot use because it does not have and I am not making an engine PR at this time. /// [DataField("animationState")] public string State = "foam-dissolve"; diff --git a/Content.Client/Clickable/ClickableComponent.cs b/Content.Client/Clickable/ClickableComponent.cs index 3a1f9be44f7..a1cbc9a5181 100644 --- a/Content.Client/Clickable/ClickableComponent.cs +++ b/Content.Client/Clickable/ClickableComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Client.Utility; @@ -62,7 +63,7 @@ public bool CheckClick(SpriteComponent sprite, TransformComponent transform, Ent if (layer.Texture != null) { // Convert to image coordinates - var imagePos = (Vector2i) (localPos * EyeManager.PixelsPerMeter * (1, -1) + layer.Texture.Size / 2f); + var imagePos = (Vector2i) (localPos * EyeManager.PixelsPerMeter * new Vector2(1, -1) + layer.Texture.Size / 2f); if (_clickMapManager.IsOccluding(layer.Texture, imagePos)) return true; @@ -80,7 +81,7 @@ public bool CheckClick(SpriteComponent sprite, TransformComponent transform, Ent var layerLocal = inverseMatrix.Transform(localPos); // Convert to image coordinates - var layerImagePos = (Vector2i) (layerLocal * EyeManager.PixelsPerMeter * (1, -1) + rsiState.Size / 2f); + var layerImagePos = (Vector2i) (layerLocal * EyeManager.PixelsPerMeter * new Vector2(1, -1) + rsiState.Size / 2f); // Next, to get the right click map we need the "direction" of this layer that is actually being used to draw the sprite on the screen. // This **can** differ from the dir defined before, but can also just be the same. diff --git a/Content.Client/Cloning/UI/AcceptCloningWindow.cs b/Content.Client/Cloning/UI/AcceptCloningWindow.cs index decca6cf5c3..01824ad4827 100644 --- a/Content.Client/Cloning/UI/AcceptCloningWindow.cs +++ b/Content.Client/Cloning/UI/AcceptCloningWindow.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; @@ -43,7 +44,7 @@ public AcceptCloningWindow() (new Control() { - MinSize = (20, 0) + MinSize = new Vector2(20, 0) }), (DenyButton = new Button diff --git a/Content.Client/Clothing/UI/ChameleonMenu.xaml.cs b/Content.Client/Clothing/UI/ChameleonMenu.xaml.cs index fc0e7bbb80f..131ee3b1e90 100644 --- a/Content.Client/Clothing/UI/ChameleonMenu.xaml.cs +++ b/Content.Client/Clothing/UI/ChameleonMenu.xaml.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.Clothing.Systems; using Content.Client.Stylesheets; using Robust.Client.AutoGenerated; diff --git a/Content.Client/CombatMode/CombatModeIndicatorsOverlay.cs b/Content.Client/CombatMode/CombatModeIndicatorsOverlay.cs index d3cdd22f627..fc3de45dc95 100644 --- a/Content.Client/CombatMode/CombatModeIndicatorsOverlay.cs +++ b/Content.Client/CombatMode/CombatModeIndicatorsOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Hands.Systems; using Content.Shared.Weapons.Ranged.Components; using Robust.Client.GameObjects; @@ -77,7 +78,7 @@ protected override void Draw(in OverlayDrawArgs args) private void DrawSight(Texture sight, DrawingHandleScreen screen, Vector2 centerPos, float scale) { var sightSize = sight.Size * scale; - var expandedSize = sightSize + 7f; + var expandedSize = sightSize + new Vector2(7f, 7f); screen.DrawTextureRect(sight, UIBox2.FromDimensions(centerPos - sightSize * 0.5f, sightSize), StrokeColor); diff --git a/Content.Client/Commands/ZoomCommand.cs b/Content.Client/Commands/ZoomCommand.cs index bdcfdaa6fa0..83a04a241bb 100644 --- a/Content.Client/Commands/ZoomCommand.cs +++ b/Content.Client/Commands/ZoomCommand.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Movement.Systems; using Content.Shared.Movement.Components; using Content.Shared.Movement.Systems; diff --git a/Content.Client/Configurable/UI/ConfigurationMenu.cs b/Content.Client/Configurable/UI/ConfigurationMenu.cs index 483482dad11..cc24af28692 100644 --- a/Content.Client/Configurable/UI/ConfigurationMenu.cs +++ b/Content.Client/Configurable/UI/ConfigurationMenu.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Numerics; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; @@ -21,7 +22,7 @@ public sealed class ConfigurationMenu : DefaultWindow public ConfigurationMenu(ConfigurationBoundUserInterface owner) { - MinSize = SetSize = (300, 250); + MinSize = SetSize = new Vector2(300, 250); Owner = owner; _inputs = new List<(string name, LineEdit input)>(); diff --git a/Content.Client/Construction/UI/ConstructionMenu.xaml.cs b/Content.Client/Construction/UI/ConstructionMenu.xaml.cs index 125d9210cf9..2187a5266e6 100644 --- a/Content.Client/Construction/UI/ConstructionMenu.xaml.cs +++ b/Content.Client/Construction/UI/ConstructionMenu.xaml.cs @@ -1,4 +1,5 @@ using System; +using System.Numerics; using Robust.Client.AutoGenerated; using Robust.Client.Graphics; using Robust.Client.UserInterface.Controls; @@ -71,7 +72,7 @@ public bool EraseButtonPressed public ConstructionMenu() { - SetSize = MinSize = (720, 320); + SetSize = MinSize = new Vector2(720, 320); IoCManager.InjectDependencies(this); RobustXamlLoader.Load(this); diff --git a/Content.Client/ContextMenu/UI/ContextMenuPopup.xaml.cs b/Content.Client/ContextMenu/UI/ContextMenuPopup.xaml.cs index a50e2c8ee44..dd5642ae45d 100644 --- a/Content.Client/ContextMenu/UI/ContextMenuPopup.xaml.cs +++ b/Content.Client/ContextMenu/UI/ContextMenuPopup.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.AutoGenerated; using Robust.Client.Graphics; using Robust.Client.UserInterface.Controls; diff --git a/Content.Client/ContextMenu/UI/ContextMenuUIController.cs b/Content.Client/ContextMenu/UI/ContextMenuUIController.cs index b6737b9768c..61e505b007a 100644 --- a/Content.Client/ContextMenu/UI/ContextMenuUIController.cs +++ b/Content.Client/ContextMenu/UI/ContextMenuUIController.cs @@ -1,3 +1,4 @@ +using System.Numerics; using System.Threading; using Content.Client.CombatMode; using Content.Client.Gameplay; @@ -171,8 +172,8 @@ public void OpenSubMenu(ContextMenuElement element) // open pop-up adjacent to the parent element. We want the sub-menu elements to align with this element // which depends on the panel container style margins. var altPos = element.GlobalPosition; - var pos = altPos + (element.Width + 2 * ContextMenuElement.ElementMargin, -2 * ContextMenuElement.ElementMargin); - element.SubMenu.Open(UIBox2.FromDimensions(pos, (1, 1)), altPos); + var pos = altPos + new Vector2(element.Width + 2 * ContextMenuElement.ElementMargin, -2 * ContextMenuElement.ElementMargin); + element.SubMenu.Open(UIBox2.FromDimensions(pos, new Vector2(1, 1)), altPos); // draw on top of other menus element.SubMenu.SetPositionLast(); diff --git a/Content.Client/ContextMenu/UI/EntityMenuUIController.cs b/Content.Client/ContextMenu/UI/EntityMenuUIController.cs index 0752f630ec5..6ca8d95db7d 100644 --- a/Content.Client/ContextMenu/UI/EntityMenuUIController.cs +++ b/Content.Client/ContextMenu/UI/EntityMenuUIController.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.CombatMode; using Content.Client.Examine; using Content.Client.Gameplay; @@ -94,7 +95,7 @@ public void OpenRootMenu(List entities) Elements.Clear(); AddToUI(orderedStates); - var box = UIBox2.FromDimensions(_userInterfaceManager.MousePositionScaled.Position, (1, 1)); + var box = UIBox2.FromDimensions(_userInterfaceManager.MousePositionScaled.Position, new Vector2(1, 1)); _context.RootMenu.Open(box); } diff --git a/Content.Client/Credits/CreditsWindow.xaml.cs b/Content.Client/Credits/CreditsWindow.xaml.cs index 1b2a63f4081..666ff2aa48b 100644 --- a/Content.Client/Credits/CreditsWindow.xaml.cs +++ b/Content.Client/Credits/CreditsWindow.xaml.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Numerics; using Content.Client.Stylesheets; using Content.Shared.CCVar; using Robust.Client.AutoGenerated; @@ -86,7 +87,7 @@ private void PopulatePatrons(BoxContainer patronsContainer) { if (!first) { - patronsContainer.AddChild(new Control {MinSize = (0, 10)}); + patronsContainer.AddChild(new Control {MinSize = new Vector2(0, 10)}); } first = false; @@ -133,7 +134,7 @@ void AddSection(string title, string path, bool markup = false) { if (!first) { - ss14ContributorsContainer.AddChild(new Control {MinSize = (0, 10)}); + ss14ContributorsContainer.AddChild(new Control {MinSize = new Vector2(0, 10)}); } first = false; diff --git a/Content.Client/CrewManifest/CrewManifestUi.xaml.cs b/Content.Client/CrewManifest/CrewManifestUi.xaml.cs index 2f6f5f9268e..151d21312ac 100644 --- a/Content.Client/CrewManifest/CrewManifestUi.xaml.cs +++ b/Content.Client/CrewManifest/CrewManifestUi.xaml.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Shared.CCVar; using Content.Shared.CrewManifest; using Content.Shared.Roles; @@ -146,7 +147,7 @@ public CrewManifestSection(string sectionTitle, List entries, { var icon = new TextureRect() { - TextureScale = (2, 2), + TextureScale = new Vector2(2, 2), Stretch = TextureRect.StretchMode.KeepCentered }; diff --git a/Content.Client/Decals/DecalPlacementSystem.cs b/Content.Client/Decals/DecalPlacementSystem.cs index 09f97183385..bc05c39c3de 100644 --- a/Content.Client/Decals/DecalPlacementSystem.cs +++ b/Content.Client/Decals/DecalPlacementSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Actions; using Content.Client.Decals.Overlays; using Content.Shared.Actions; diff --git a/Content.Client/Decals/Overlays/DecalPlacementOverlay.cs b/Content.Client/Decals/Overlays/DecalPlacementOverlay.cs index 1c65cca045c..016a71bfc84 100644 --- a/Content.Client/Decals/Overlays/DecalPlacementOverlay.cs +++ b/Content.Client/Decals/Overlays/DecalPlacementOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Client.Input; @@ -54,7 +55,7 @@ protected override void Draw(in OverlayDrawArgs args) if (snap) { - localPos = (Vector2) localPos.Floored() + grid.TileSize / 2f; + localPos = (Vector2) localPos.Floored() + grid.TileSizeHalfVector; } // Nothing uses snap cardinals so probably don't need preview? diff --git a/Content.Client/DoAfter/DoAfterOverlay.cs b/Content.Client/DoAfter/DoAfterOverlay.cs index d6d4cb88cbb..bc3902cc535 100644 --- a/Content.Client/DoAfter/DoAfterOverlay.cs +++ b/Content.Client/DoAfter/DoAfterOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.DoAfter; using Robust.Client.GameObjects; using Robust.Client.Graphics; diff --git a/Content.Client/DragDrop/DragDropHelper.cs b/Content.Client/DragDrop/DragDropHelper.cs index c5d0ccffc0b..d8286ee7054 100644 --- a/Content.Client/DragDrop/DragDropHelper.cs +++ b/Content.Client/DragDrop/DragDropHelper.cs @@ -121,7 +121,7 @@ public void Update(float frameTime) case DragState.MouseDown: { var screenPos = _inputManager.MouseScreenPosition; - if ((_mouseDownScreenPos.Position - screenPos.Position).Length > Deadzone) + if ((_mouseDownScreenPos.Position - screenPos.Position).Length() > Deadzone) { StartDragging(); } diff --git a/Content.Client/DragDrop/DragDropSystem.cs b/Content.Client/DragDrop/DragDropSystem.cs index 5be800260dd..c7a6718e76c 100644 --- a/Content.Client/DragDrop/DragDropSystem.cs +++ b/Content.Client/DragDrop/DragDropSystem.cs @@ -21,6 +21,7 @@ using Robust.Shared.Prototypes; using Robust.Shared.Utility; using System.Linq; +using System.Numerics; using DrawDepth = Content.Shared.DrawDepth.DrawDepth; namespace Content.Client.DragDrop; @@ -405,7 +406,9 @@ private void HighlightTargets() // find possible targets on screen even if not reachable // TODO: Duplicated in SpriteSystem and TargetOutlineSystem. Should probably be cached somewhere for a frame? var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition); - var bounds = new Box2(mousePos.Position - 1.5f, mousePos.Position + 1.5f); + var expansion = new Vector2(1.5f, 1.5f); + + var bounds = new Box2(mousePos.Position - expansion, mousePos.Position + expansion); var pvsEntities = _lookup.GetEntitiesIntersecting(mousePos.MapId, bounds); var spriteQuery = GetEntityQuery(); @@ -510,7 +513,7 @@ public override void Update(float frameTime) case DragState.MouseDown: { var screenPos = _inputManager.MouseScreenPosition; - if ((_mouseDownScreenPos!.Value.Position - screenPos.Position).Length > _deadzone) + if ((_mouseDownScreenPos!.Value.Position - screenPos.Position).Length() > _deadzone) { StartDrag(); } diff --git a/Content.Client/Examine/ExamineSystem.cs b/Content.Client/Examine/ExamineSystem.cs index cd09ff5fd10..f1ca7d37076 100644 --- a/Content.Client/Examine/ExamineSystem.cs +++ b/Content.Client/Examine/ExamineSystem.cs @@ -14,6 +14,7 @@ using Robust.Shared.Map; using Robust.Shared.Utility; using System.Linq; +using System.Numerics; using System.Threading; using Content.Shared.Eye.Blinding.Components; using Robust.Client; @@ -209,7 +210,7 @@ public void OpenTooltip(EntityUid player, EntityUid target, bool centeredOnCurso hBox.AddChild(new SpriteView { Sprite = sprite, OverrideDirection = Direction.South, - SetSize = (32, 32), + SetSize = new Vector2(32, 32), Margin = new Thickness(2, 0, 2, 0), }); } @@ -231,8 +232,8 @@ public void OpenTooltip(EntityUid player, EntityUid target, bool centeredOnCurso }); } - panel.Measure(Vector2.Infinity); - var size = Vector2.ComponentMax((minWidth, 0), panel.DesiredSize); + panel.Measure(Vector2Helpers.Infinity); + var size = Vector2.Max(new Vector2(minWidth, 0), panel.DesiredSize); _examineTooltipOpen.Open(UIBox2.FromDimensions(_popupPos.Position, size)); } diff --git a/Content.Client/Explosion/ExplosionOverlay.cs b/Content.Client/Explosion/ExplosionOverlay.cs index 41dceb94bd2..17df782887d 100644 --- a/Content.Client/Explosion/ExplosionOverlay.cs +++ b/Content.Client/Explosion/ExplosionOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Explosion; using JetBrains.Annotations; using Robust.Client.Graphics; @@ -102,13 +103,13 @@ private void DrawTiles( foreach (var tile in tiles) { - var centre = ((Vector2) tile + 0.5f) * tileSize; + var centre = (tile + Vector2Helpers.Half) * tileSize; if (!gridBounds.Contains(centre)) continue; var texture = _robustRandom.Pick(frames); - drawHandle.DrawTextureRect(texture, Box2.CenteredAround(centre, (tileSize, tileSize)), textures.FireColor); + drawHandle.DrawTextureRect(texture, Box2.CenteredAround(centre, new Vector2(tileSize, tileSize)), textures.FireColor); } } } diff --git a/Content.Client/Flash/FlashOverlay.cs b/Content.Client/Flash/FlashOverlay.cs index 129baf0ca8f..f7e7fa3d4d9 100644 --- a/Content.Client/Flash/FlashOverlay.cs +++ b/Content.Client/Flash/FlashOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Viewport; using Robust.Client.GameObjects; using Robust.Client.Graphics; @@ -64,7 +65,7 @@ protected override void Draw(in OverlayDrawArgs args) screenSpaceHandle.UseShader(_shader); _shader.SetParameter("percentComplete", percentComplete); - var screenSize = UIBox2.FromDimensions((0, 0), _displayManager.ScreenSize); + var screenSize = UIBox2.FromDimensions(new Vector2(0, 0), _displayManager.ScreenSize); if (_screenshotTexture != null) { diff --git a/Content.Client/Fluids/PuddleOverlay.cs b/Content.Client/Fluids/PuddleOverlay.cs index 5cee2ba3a33..f2f5ca1b9ad 100644 --- a/Content.Client/Fluids/PuddleOverlay.cs +++ b/Content.Client/Fluids/PuddleOverlay.cs @@ -1,4 +1,5 @@ -using Content.Shared.FixedPoint; +using System.Numerics; +using Content.Shared.FixedPoint; using Robust.Client.Graphics; using Robust.Client.ResourceManagement; using Robust.Shared.Enums; @@ -61,7 +62,7 @@ private void DrawWorld(in OverlayDrawArgs args) foreach (var debugOverlayData in _debugOverlaySystem.GetData(mapGrid.Owner)) { - var centre = ((Vector2) debugOverlayData.Pos + 0.5f) * mapGrid.TileSize; + var centre = (debugOverlayData.Pos + Vector2Helpers.Half) * mapGrid.TileSize; // is the center of this tile visible if (!gridBounds.Contains(centre)) @@ -93,7 +94,7 @@ private void DrawScreen(in OverlayDrawArgs args) foreach (var debugOverlayData in _debugOverlaySystem.GetData(mapGrid.Owner)) { - var centre = ((Vector2) debugOverlayData.Pos + 0.5f) * mapGrid.TileSize; + var centre = (debugOverlayData.Pos + Vector2Helpers.Half) * mapGrid.TileSize; // // is the center of this tile visible if (!gridBounds.Contains(centre)) diff --git a/Content.Client/Gameplay/GameplayStateBase.cs b/Content.Client/Gameplay/GameplayStateBase.cs index b4bd6f9b726..f0594fe379e 100644 --- a/Content.Client/Gameplay/GameplayStateBase.cs +++ b/Content.Client/Gameplay/GameplayStateBase.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Numerics; using Content.Client.Clickable; using Content.Client.ContextMenu.UI; using Robust.Client.ComponentTrees; @@ -90,7 +91,7 @@ public IEnumerable GetClickableEntities(MapCoordinates coordinates) { // Find all the entities intersecting our click var spriteTree = _entityManager.EntitySysManager.GetEntitySystem(); - var entities = spriteTree.QueryAabb(coordinates.MapId, Box2.CenteredAround(coordinates.Position, (1, 1)), true); + var entities = spriteTree.QueryAabb(coordinates.MapId, Box2.CenteredAround(coordinates.Position, new Vector2(1, 1))); // Check the entities against whether or not we can click them var foundEntities = new List<(EntityUid, int, uint, float)>(entities.Count); diff --git a/Content.Client/Ghost/UI/ReturnToBodyMenu.cs b/Content.Client/Ghost/UI/ReturnToBodyMenu.cs index 94b5303f0d2..69f04993c9b 100644 --- a/Content.Client/Ghost/UI/ReturnToBodyMenu.cs +++ b/Content.Client/Ghost/UI/ReturnToBodyMenu.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; @@ -41,7 +42,7 @@ public ReturnToBodyMenu() (new Control() { - MinSize = (20, 0) + MinSize = new Vector2(20, 0) }), (DenyButton = new Button diff --git a/Content.Client/Gravity/FloatingVisualizerSystem.cs b/Content.Client/Gravity/FloatingVisualizerSystem.cs index 9a18670b2fc..f489237d107 100644 --- a/Content.Client/Gravity/FloatingVisualizerSystem.cs +++ b/Content.Client/Gravity/FloatingVisualizerSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Gravity; using Robust.Client.GameObjects; using Robust.Client.Animations; diff --git a/Content.Client/Gravity/GravitySystem.Shake.cs b/Content.Client/Gravity/GravitySystem.Shake.cs index 60307b619b6..fee072051ab 100644 --- a/Content.Client/Gravity/GravitySystem.Shake.cs +++ b/Content.Client/Gravity/GravitySystem.Shake.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Camera; using Content.Shared.Gravity; using Robust.Client.Player; diff --git a/Content.Client/Guidebook/Controls/GuideEntityEmbed.xaml.cs b/Content.Client/Guidebook/Controls/GuideEntityEmbed.xaml.cs index fc885b36553..ed838587bba 100644 --- a/Content.Client/Guidebook/Controls/GuideEntityEmbed.xaml.cs +++ b/Content.Client/Guidebook/Controls/GuideEntityEmbed.xaml.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using System.Numerics; using Content.Client.ContextMenu.UI; using Content.Client.Examine; using Content.Client.Guidebook.Richtext; @@ -159,7 +160,7 @@ public bool TryParseTag(Dictionary args, [NotNullWhen(true)] out } else { - Scale = (2, 2); + Scale = new Vector2(2, 2); } if (args.TryGetValue("Interactive", out var interactive)) diff --git a/Content.Client/Hands/ShowHandItemOverlay.cs b/Content.Client/Hands/ShowHandItemOverlay.cs index 81a59cc475b..aa9ccbf4be6 100644 --- a/Content.Client/Hands/ShowHandItemOverlay.cs +++ b/Content.Client/Hands/ShowHandItemOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Hands.Systems; using Content.Shared.CCVar; using Robust.Client.GameObjects; @@ -63,10 +64,11 @@ protected override void Draw(in OverlayDrawArgs args) var screen = args.ScreenHandle; var offset = _cfg.GetCVar(CCVars.HudHeldItemOffset); + var offsetVec = new Vector2(offset, offset); if (IconOverride != null) { - screen.DrawTexture(IconOverride, mousePos.Position - IconOverride.Size / 2 + offset, Color.White.WithAlpha(0.75f)); + screen.DrawTexture(IconOverride, mousePos.Position - IconOverride.Size / 2 + offsetVec, Color.White.WithAlpha(0.75f)); return; } @@ -84,7 +86,7 @@ protected override void Draw(in OverlayDrawArgs args) screen.DrawEntity(handEntity.Value, halfSize, new Vector2(1f, 1f) * uiScale, Angle.Zero, Angle.Zero, Direction.South, sprite); }, Color.Transparent); - screen.DrawTexture(_renderBackbuffer.Texture, mousePos.Position - halfSize + offset, Color.White.WithAlpha(0.75f)); + screen.DrawTexture(_renderBackbuffer.Texture, mousePos.Position - halfSize + offsetVec, Color.White.WithAlpha(0.75f)); } } } diff --git a/Content.Client/Hands/Systems/HandsSystem.cs b/Content.Client/Hands/Systems/HandsSystem.cs index ba4bbb728bd..0d56d4617bd 100644 --- a/Content.Client/Hands/Systems/HandsSystem.cs +++ b/Content.Client/Hands/Systems/HandsSystem.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using System.Numerics; using Content.Client.Animations; using Content.Client.Examine; using Content.Client.Strip; diff --git a/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs b/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs index dacf7ff01c3..243b65960b2 100644 --- a/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs +++ b/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using System.Text; using Content.Shared.Damage; using Content.Shared.Damage.Prototypes; @@ -64,12 +65,12 @@ public void Populate(HealthAnalyzerScannedUserMessage msg) text.AppendLine(); } Diagnostics.Text = text.ToString(); - SetSize = (250, 600); + SetSize = new Vector2(250, 600); } else { Diagnostics.Text = Loc.GetString("health-analyzer-window-no-patient-data-text"); - SetSize = (250, 100); + SetSize = new Vector2(250, 100); } } } diff --git a/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs b/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs index 9598a97cf22..9f0c94acce0 100644 --- a/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs +++ b/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.IoC; using Content.Client.Resources; using Content.Shared.Damage; diff --git a/Content.Client/IconSmoothing/IconSmoothSystem.Edge.cs b/Content.Client/IconSmoothing/IconSmoothSystem.Edge.cs index 6de31e8f0a3..65ee0ae4309 100644 --- a/Content.Client/IconSmoothing/IconSmoothSystem.Edge.cs +++ b/Content.Client/IconSmoothing/IconSmoothSystem.Edge.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.IconSmoothing; using Robust.Client.GameObjects; diff --git a/Content.Client/IconSmoothing/IconSmoothSystem.cs b/Content.Client/IconSmoothing/IconSmoothSystem.cs index f3cb0048875..5b931b7232f 100644 --- a/Content.Client/IconSmoothing/IconSmoothSystem.cs +++ b/Content.Client/IconSmoothing/IconSmoothSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.IconSmoothing; using JetBrains.Annotations; using Robust.Client.GameObjects; diff --git a/Content.Client/Info/RulesAndInfoWindow.cs b/Content.Client/Info/RulesAndInfoWindow.cs index 118a93114a3..2905857b393 100644 --- a/Content.Client/Info/RulesAndInfoWindow.cs +++ b/Content.Client/Info/RulesAndInfoWindow.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.UserInterface.Systems.EscapeMenu; using Robust.Client.ResourceManagement; using Robust.Client.UserInterface; @@ -35,7 +36,7 @@ public RulesAndInfoWindow() Contents.AddChild(rootContainer); - SetSize = (650, 650); + SetSize = new Vector2(650, 650); } private void PopulateTutorial(Info tutorialList) diff --git a/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs b/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs index 669d05622e6..d0901315ae0 100644 --- a/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs +++ b/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Numerics; using System.Threading.Tasks; using Content.Client.Interactable; using Content.Shared.ActionBlocker; @@ -59,7 +60,7 @@ public InstrumentMenu(InstrumentBoundUserInterface owner) PlaybackSlider.OnValueChanged += PlaybackSliderSeek; PlaybackSlider.OnKeyBindUp += PlaybackSliderKeyUp; - MinSize = SetSize = (400, 150); + MinSize = SetSize = new Vector2(400, 150); } private void InstrumentOnMidiPlaybackEnded() diff --git a/Content.Client/Inventory/StrippableBoundUserInterface.cs b/Content.Client/Inventory/StrippableBoundUserInterface.cs index efca4b0a975..8e8d7b1875e 100644 --- a/Content.Client/Inventory/StrippableBoundUserInterface.cs +++ b/Content.Client/Inventory/StrippableBoundUserInterface.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.Examine; using Content.Client.Strip; using Content.Client.Stylesheets; @@ -139,14 +140,14 @@ public void UpdateMenu() // TODO fix layout container measuring (its broken atm). // _strippingMenu.InvalidateMeasure(); - // _strippingMenu.Contents.Measure(Vector2.Infinity); + // _strippingMenu.Contents.Measure(Vector2Helpers.Infinity); // TODO allow windows to resize based on content's desired size // for now: shit-code // this breaks for drones (too many hands, lots of empty vertical space), and looks shit for monkeys and the like. // but the window is realizable, so eh. - _strippingMenu.SetSize = (220, snare?.IsEnsnared == true ? 550 : 530); + _strippingMenu.SetSize = new Vector2(220, snare?.IsEnsnared == true ? 550 : 530); } private void AddHandButton(Hand hand) diff --git a/Content.Client/Jittering/JitteringSystem.cs b/Content.Client/Jittering/JitteringSystem.cs index 6f03a76b16d..032eb3e18f2 100644 --- a/Content.Client/Jittering/JitteringSystem.cs +++ b/Content.Client/Jittering/JitteringSystem.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Immutable; +using System.Numerics; using Content.Shared.Jittering; using Robust.Client.Animations; using Robust.Client.GameObjects; diff --git a/Content.Client/LateJoin/LateJoinGui.cs b/Content.Client/LateJoin/LateJoinGui.cs index 0d9d72480a0..f569edaddfd 100644 --- a/Content.Client/LateJoin/LateJoinGui.cs +++ b/Content.Client/LateJoin/LateJoinGui.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.CrewManifest; using Content.Client.GameTicking.Managers; using Content.Client.UserInterface.Controls; @@ -38,7 +39,7 @@ public sealed class LateJoinGui : DefaultWindow public LateJoinGui() { - MinSize = SetSize = (360, 560); + MinSize = SetSize = new Vector2(360, 560); IoCManager.InjectDependencies(this); _sprites = _entitySystem.GetEntitySystem(); _crewManifest = _entitySystem.GetEntitySystem(); @@ -228,7 +229,7 @@ private void RebuildUI() var icon = new TextureRect { - TextureScale = (2, 2), + TextureScale = new Vector2(2, 2), Stretch = TextureRect.StretchMode.KeepCentered }; @@ -261,7 +262,7 @@ private void RebuildUI() jobSelector.AddChild(new TextureRect { - TextureScale = (0.4f, 0.4f), + TextureScale = new Vector2(0.4f, 0.4f), Stretch = TextureRect.StretchMode.KeepCentered, Texture = _sprites.Frame0(new SpriteSpecifier.Texture(new ("/Textures/Interface/Nano/lock.svg.192dpi.png"))), HorizontalExpand = true, diff --git a/Content.Client/Light/Components/HandheldLightComponent.cs b/Content.Client/Light/Components/HandheldLightComponent.cs index e777f14a638..f140f831247 100644 --- a/Content.Client/Light/Components/HandheldLightComponent.cs +++ b/Content.Client/Light/Components/HandheldLightComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Light; using Content.Shared.Light.Component; using Robust.Client.Graphics; @@ -42,7 +43,7 @@ public HandheldLightStatus(HandheldLightComponent parent) for (var i = 0; i < _sections.Length; i++) { - var panel = new PanelContainer {MinSize = (20, 20)}; + var panel = new PanelContainer {MinSize = new Vector2(20, 20)}; wrapper.AddChild(panel); _sections[i] = panel; } diff --git a/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs b/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs index ce3e5563849..bd51c6010fd 100644 --- a/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs +++ b/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.Humanoid; using Content.Client.Inventory; using Content.Client.Preferences; @@ -96,7 +97,7 @@ private SpriteView MakeSpriteView(EntityUid entity, Direction direction) { Sprite = _entityManager.GetComponent(entity), OverrideDirection = direction, - Scale = (2, 2) + Scale = new Vector2(2, 2) }; } diff --git a/Content.Client/MachineLinking/UI/SignalPortSelectorMenu.xaml.cs b/Content.Client/MachineLinking/UI/SignalPortSelectorMenu.xaml.cs index ee498019c56..a2a0f2f5f93 100644 --- a/Content.Client/MachineLinking/UI/SignalPortSelectorMenu.xaml.cs +++ b/Content.Client/MachineLinking/UI/SignalPortSelectorMenu.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.MachineLinking; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface; @@ -88,7 +89,7 @@ protected override void Draw(DrawingHandleScreen handle) var rightChild = RightButton.GetChild(right); var y1 = leftChild.PixelPosition.Y + leftChild.PixelHeight / 2 + leftOffset; var y2 = rightChild.PixelPosition.Y + rightChild.PixelHeight / 2 + rightOffset; - handle.DrawLine((0, y1), (PixelWidth, y2), Color.Cyan); + handle.DrawLine(new Vector2(0, y1), new Vector2(PixelWidth, y2), Color.Cyan); } } } diff --git a/Content.Client/Maps/GridDraggingSystem.cs b/Content.Client/Maps/GridDraggingSystem.cs index 957ccca9191..6bfd5d3e97e 100644 --- a/Content.Client/Maps/GridDraggingSystem.cs +++ b/Content.Client/Maps/GridDraggingSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Maps; using Robust.Client.GameObjects; using Robust.Client.Graphics; @@ -69,7 +70,7 @@ private void StopDragging() RaiseNetworkEvent(new GridDragVelocityRequest() { Grid = _dragging.Value, - LinearVelocity = distance.LengthSquared > 0f ? (distance / (float) tickTime.TotalSeconds) * 0.25f : Vector2.Zero, + LinearVelocity = distance.LengthSquared() > 0f ? (distance / (float) tickTime.TotalSeconds) * 0.25f : Vector2.Zero, }); } diff --git a/Content.Client/Medical/CrewMonitoring/CrewMonitoringWindow.xaml.cs b/Content.Client/Medical/CrewMonitoring/CrewMonitoringWindow.xaml.cs index 7da9a23dc43..40da258a4be 100644 --- a/Content.Client/Medical/CrewMonitoring/CrewMonitoringWindow.xaml.cs +++ b/Content.Client/Medical/CrewMonitoring/CrewMonitoringWindow.xaml.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.Stylesheets; using Content.Client.UserInterface.Controls; using Content.Shared.Medical.SuitSensor; @@ -151,7 +152,7 @@ private BoxContainer GetPositionBox(SuitSensorStatus sensor, Vector2 monitorCoor { var dirIcon = new DirectionIcon() { - SetSize = (IconSize, IconSize), + SetSize = new Vector2(IconSize, IconSize), Margin = new(0, 0, 4, 0) }; box.AddChild(dirIcon); @@ -164,7 +165,7 @@ private BoxContainer GetPositionBox(SuitSensorStatus sensor, Vector2 monitorCoor var displayPos = local.Floored(); var dirIcon = new DirectionIcon(snap, precision) { - SetSize = (IconSize, IconSize), + SetSize = new Vector2(IconSize, IconSize), Margin = new(0, 0, 4, 0) }; box.AddChild(dirIcon); diff --git a/Content.Client/Medical/Cryogenics/CryoPodSystem.cs b/Content.Client/Medical/Cryogenics/CryoPodSystem.cs index bb6c1f0fae9..a9f3c76b48f 100644 --- a/Content.Client/Medical/Cryogenics/CryoPodSystem.cs +++ b/Content.Client/Medical/Cryogenics/CryoPodSystem.cs @@ -1,4 +1,5 @@ -using Content.Shared.Emag.Systems; +using System.Numerics; +using Content.Shared.Emag.Systems; using Content.Shared.Medical.Cryogenics; using Content.Shared.Verbs; using Robust.Client.GameObjects; diff --git a/Content.Client/Movement/Systems/ContentEyeSystem.cs b/Content.Client/Movement/Systems/ContentEyeSystem.cs index c6de5984081..5c65f3f1246 100644 --- a/Content.Client/Movement/Systems/ContentEyeSystem.cs +++ b/Content.Client/Movement/Systems/ContentEyeSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Movement.Components; using Content.Shared.Movement.Systems; using Robust.Client.GameObjects; diff --git a/Content.Client/Movement/Systems/JetpackSystem.cs b/Content.Client/Movement/Systems/JetpackSystem.cs index 000687c25ae..1c8e859e34f 100644 --- a/Content.Client/Movement/Systems/JetpackSystem.cs +++ b/Content.Client/Movement/Systems/JetpackSystem.cs @@ -61,7 +61,7 @@ private void CreateParticles(EntityUid uid) // Don't show particles unless the user is moving. if (Container.TryGetContainingContainer(uid, out var container) && TryComp(container.Owner, out var body) && - body.LinearVelocity.LengthSquared < 1f) + body.LinearVelocity.LengthSquared() < 1f) return; var uidXform = Transform(uid); diff --git a/Content.Client/NPC/HTN/HTNOverlay.cs b/Content.Client/NPC/HTN/HTNOverlay.cs index 0d1a4f8c8a9..ad173f3b29c 100644 --- a/Content.Client/NPC/HTN/HTNOverlay.cs +++ b/Content.Client/NPC/HTN/HTNOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.Graphics; using Robust.Client.ResourceManagement; using Robust.Shared.Enums; diff --git a/Content.Client/NPC/NPCSteeringComponent.cs b/Content.Client/NPC/NPCSteeringComponent.cs index 3ae227fd77b..f7776ef5c85 100644 --- a/Content.Client/NPC/NPCSteeringComponent.cs +++ b/Content.Client/NPC/NPCSteeringComponent.cs @@ -1,3 +1,5 @@ +using System.Numerics; + namespace Content.Client.NPC; [RegisterComponent] diff --git a/Content.Client/NPC/NPCSteeringSystem.cs b/Content.Client/NPC/NPCSteeringSystem.cs index 8bfdcea8417..c647c026c1e 100644 --- a/Content.Client/NPC/NPCSteeringSystem.cs +++ b/Content.Client/NPC/NPCSteeringSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Physics.Controllers; using Content.Shared.Movement.Components; using Content.Shared.NPC; diff --git a/Content.Client/NPC/PathfindingSystem.cs b/Content.Client/NPC/PathfindingSystem.cs index 88b4d93adb4..9cd82fcb3b1 100644 --- a/Content.Client/NPC/PathfindingSystem.cs +++ b/Content.Client/NPC/PathfindingSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using System.Text; using Content.Shared.NPC; using Robust.Client.Graphics; @@ -173,7 +174,7 @@ private void DrawScreen(OverlayDrawArgs args, DrawingHandleScreen screenHandle) { var mousePos = _inputManager.MouseScreenPosition; var mouseWorldPos = _eyeManager.ScreenToMap(mousePos); - var aabb = new Box2(mouseWorldPos.Position - SharedPathfindingSystem.ChunkSize, mouseWorldPos.Position + SharedPathfindingSystem.ChunkSize); + var aabb = new Box2(mouseWorldPos.Position - SharedPathfindingSystem.ChunkSizeVec, mouseWorldPos.Position + SharedPathfindingSystem.ChunkSizeVec); var xformQuery = _entManager.GetEntityQuery(); if ((_system.Modes & PathfindingDebugMode.Crumb) != 0x0 && @@ -207,7 +208,7 @@ private void DrawScreen(OverlayDrawArgs args, DrawingHandleScreen screenHandle) foreach (var crumb in chunk.Value) { var crumbMapPos = worldMatrix.Transform(_system.GetCoordinate(chunk.Key, crumb.Coordinates)); - var distance = (crumbMapPos - mouseWorldPos.Position).Length; + var distance = (crumbMapPos - mouseWorldPos.Position).Length(); if (distance < nearestDistance) { @@ -334,7 +335,9 @@ private void DrawWorld(OverlayDrawArgs args, DrawingHandleWorld worldHandle) { if (!_system.Breadcrumbs.TryGetValue(grid.Owner, out var crumbs) || !xformQuery.TryGetComponent(grid.Owner, out var gridXform)) + { continue; + } var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(); worldHandle.SetTransform(worldMatrix); @@ -357,6 +360,7 @@ private void DrawWorld(OverlayDrawArgs args, DrawingHandleWorld worldHandle) } const float edge = 1f / SharedPathfindingSystem.SubStep / 4f; + var edgeVec = new Vector2(edge, edge); var masked = crumb.Data.CollisionMask != 0 || crumb.Data.CollisionLayer != 0; Color color; @@ -375,7 +379,7 @@ private void DrawWorld(OverlayDrawArgs args, DrawingHandleWorld worldHandle) } var coordinate = _system.GetCoordinate(chunk.Key, crumb.Coordinates); - worldHandle.DrawRect(new Box2(coordinate - edge, coordinate + edge), color.WithAlpha(0.25f)); + worldHandle.DrawRect(new Box2(coordinate - edgeVec, coordinate + edgeVec), color.WithAlpha(0.25f)); } } } diff --git a/Content.Client/NetworkConfigurator/NetworkConfiguratorDeviceList.xaml.cs b/Content.Client/NetworkConfigurator/NetworkConfiguratorDeviceList.xaml.cs index 6891faf3661..8cfa97dc6c2 100644 --- a/Content.Client/NetworkConfigurator/NetworkConfiguratorDeviceList.xaml.cs +++ b/Content.Client/NetworkConfigurator/NetworkConfiguratorDeviceList.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.Controls; diff --git a/Content.Client/NetworkConfigurator/NetworkConfiguratorLinkMenu.xaml.cs b/Content.Client/NetworkConfigurator/NetworkConfiguratorLinkMenu.xaml.cs index a867a608fb6..20f1fb8d7cd 100644 --- a/Content.Client/NetworkConfigurator/NetworkConfiguratorLinkMenu.xaml.cs +++ b/Content.Client/NetworkConfigurator/NetworkConfiguratorLinkMenu.xaml.cs @@ -1,4 +1,5 @@ -using Content.Client.UserInterface.Controls; +using System.Numerics; +using Content.Client.UserInterface.Controls; using Content.Shared.DeviceLinking; using Content.Shared.DeviceNetwork; using Robust.Client.AutoGenerated; @@ -6,7 +7,6 @@ using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.XAML; -using Vector2 = Robust.Shared.Maths.Vector2; namespace Content.Client.NetworkConfigurator; @@ -187,7 +187,7 @@ protected override void Draw(DrawingHandleScreen handle) if (left == right) { - handle.DrawLine((0, y1), (PixelWidth, y2), Color.Cyan); + handle.DrawLine(new Vector2(0, y1), new Vector2(PixelWidth, y2), Color.Cyan); continue; } diff --git a/Content.Client/NodeContainer/NodeVisualizationOverlay.cs b/Content.Client/NodeContainer/NodeVisualizationOverlay.cs index 2086995c03d..820ba14b01b 100644 --- a/Content.Client/NodeContainer/NodeVisualizationOverlay.cs +++ b/Content.Client/NodeContainer/NodeVisualizationOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using System.Text; using Content.Client.Resources; using Robust.Client.Graphics; @@ -89,7 +90,7 @@ private void DrawScreen(in OverlayDrawArgs args) sb.Append($"grid pos: {gridTile}\n"); sb.Append(group.DebugData); - args.ScreenHandle.DrawString(_font, mousePos + (20, -20), sb.ToString()); + args.ScreenHandle.DrawString(_font, mousePos + new Vector2(20, -20), sb.ToString()); } private void DrawWorld(in OverlayDrawArgs overlayDrawArgs) @@ -105,7 +106,7 @@ private void DrawWorld(in OverlayDrawArgs overlayDrawArgs) _hovered = default; - var cursorBox = Box2.CenteredAround(_mouseWorldPos, (nodeSize, nodeSize)); + var cursorBox = Box2.CenteredAround(_mouseWorldPos, new Vector2(nodeSize, nodeSize)); // Group visible nodes by grid tiles. var worldAABB = overlayDrawArgs.WorldAABB; @@ -145,14 +146,14 @@ private void DrawWorld(in OverlayDrawArgs overlayDrawArgs) var lCursorBox = invMatrix.TransformBox(cursorBox); foreach (var (pos, list) in gridDict) { - var centerPos = (Vector2) pos + grid.TileSize / 2f; + var centerPos = (Vector2) pos + grid.TileSizeHalfVector; list.Sort(NodeDisplayComparer.Instance); var offset = -(list.Count - 1) * nodeOffset / 2; foreach (var (group, node) in list) { - var nodePos = centerPos + (offset, offset); + var nodePos = centerPos + new Vector2(offset, offset); if (lCursorBox.Contains(nodePos)) _hovered = (group.NetId, node.NetId); @@ -166,7 +167,7 @@ private void DrawWorld(in OverlayDrawArgs overlayDrawArgs) foreach (var nodeRenderData in _nodeIndex.Values) { var pos = nodeRenderData.NodePos; - var bounds = Box2.CenteredAround(pos, (nodeSize, nodeSize)); + var bounds = Box2.CenteredAround(pos, new Vector2(nodeSize, nodeSize)); var groupData = nodeRenderData.GroupData; var color = groupData.Color; diff --git a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs index cbd462ea4ff..d1e4c3bbcdd 100644 --- a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs +++ b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Stylesheets; using Content.Shared.Input; using Robust.Client.AutoGenerated; @@ -60,7 +61,7 @@ void AddHeader(string headerContents) { if (!first) { - KeybindsContainer.AddChild(new Control {MinSize = (0, 8)}); + KeybindsContainer.AddChild(new Control {MinSize = new Vector2(0, 8)}); } first = false; @@ -414,11 +415,11 @@ public KeyControl(KeyRebindTab parent, BoundKeyFunction function) Orientation = LayoutOrientation.Horizontal, Children = { - new Control {MinSize = (5, 0)}, + new Control {MinSize = new Vector2(5, 0)}, name, BindButton1, BindButton2, - new Control {MinSize = (10, 0)}, + new Control {MinSize = new Vector2(10, 0)}, ResetButton } }; @@ -458,7 +459,7 @@ public BindButton(KeyRebindTab tab, KeyControl keyControl, string styleClass) Button.OnKeyBindDown += ButtonOnOnKeyBindDown; - MinSize = (200, 0); + MinSize = new Vector2(200, 0); } protected override void EnteredTree() diff --git a/Content.Client/Orbit/OrbitVisualsSystem.cs b/Content.Client/Orbit/OrbitVisualsSystem.cs index 86565979181..74dcdc7d2f5 100644 --- a/Content.Client/Orbit/OrbitVisualsSystem.cs +++ b/Content.Client/Orbit/OrbitVisualsSystem.cs @@ -1,4 +1,5 @@ -using Content.Shared.Follower; +using System.Numerics; +using Content.Shared.Follower; using Content.Shared.Follower.Components; using Robust.Client.Animations; using Robust.Client.GameObjects; diff --git a/Content.Client/Outline/TargetOutlineSystem.cs b/Content.Client/Outline/TargetOutlineSystem.cs index 18838d25727..44171b754ed 100644 --- a/Content.Client/Outline/TargetOutlineSystem.cs +++ b/Content.Client/Outline/TargetOutlineSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Interaction; using Content.Shared.Whitelist; using Robust.Client.GameObjects; @@ -58,7 +59,9 @@ public sealed class TargetOutlineSystem : EntitySystem /// /// The size of the box around the mouse to use when looking for valid targets. /// - public float LookupSize = 2; + public float LookupSize = 1; + + private Vector2 LookupVector => new(LookupSize, LookupSize); private const string ShaderTargetValid = "SelectionOutlineInrange"; private const string ShaderTargetInvalid = "SelectionOutline"; @@ -116,7 +119,7 @@ private void HighlightTargets() // find possible targets on screen // TODO: Duplicated in SpriteSystem and DragDropSystem. Should probably be cached somewhere for a frame? var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition).Position; - var bounds = new Box2(mousePos - LookupSize / 2f, mousePos + LookupSize / 2f); + var bounds = new Box2(mousePos - LookupVector, mousePos + LookupVector); var pvsEntities = _lookup.GetEntitiesIntersecting(_eyeManager.CurrentMap, bounds, LookupFlags.Approximate | LookupFlags.Static); var spriteQuery = GetEntityQuery(); @@ -159,7 +162,7 @@ private void HighlightTargets() { var origin = Transform(player).WorldPosition; var target = Transform(entity).WorldPosition; - valid = (origin - target).LengthSquared <= Range; + valid = (origin - target).LengthSquared() <= Range; } if (sprite.PostShader != null && diff --git a/Content.Client/PDA/PdaNavigationButton.xaml.cs b/Content.Client/PDA/PdaNavigationButton.xaml.cs index 3e44829411f..2ad72a29f07 100644 --- a/Content.Client/PDA/PdaNavigationButton.xaml.cs +++ b/Content.Client/PDA/PdaNavigationButton.xaml.cs @@ -1,4 +1,5 @@ -using Robust.Client.AutoGenerated; +using System.Numerics; +using Robust.Client.AutoGenerated; using Robust.Client.Graphics; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.XAML; diff --git a/Content.Client/PDA/PdaWindow.xaml.cs b/Content.Client/PDA/PdaWindow.xaml.cs index cc4d622751c..1c8a24cdb41 100644 --- a/Content.Client/PDA/PdaWindow.xaml.cs +++ b/Content.Client/PDA/PdaWindow.xaml.cs @@ -1,4 +1,5 @@ -using Robust.Client.AutoGenerated; +using System.Numerics; +using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.XAML; diff --git a/Content.Client/PDA/Ringer/RingtoneMenu.xaml.cs b/Content.Client/PDA/Ringer/RingtoneMenu.xaml.cs index 1363fa66d16..198c34b0953 100644 --- a/Content.Client/PDA/Ringer/RingtoneMenu.xaml.cs +++ b/Content.Client/PDA/Ringer/RingtoneMenu.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.XAML; diff --git a/Content.Client/Paper/UI/PaperVisualsComponent.cs b/Content.Client/Paper/UI/PaperVisualsComponent.cs index fb6126b77e3..4eda1395e86 100644 --- a/Content.Client/Paper/UI/PaperVisualsComponent.cs +++ b/Content.Client/Paper/UI/PaperVisualsComponent.cs @@ -1,3 +1,5 @@ +using System.Numerics; + namespace Content.Client.Paper; [RegisterComponent] diff --git a/Content.Client/Paper/UI/PaperWindow.xaml.cs b/Content.Client/Paper/UI/PaperWindow.xaml.cs index 5e070f94dcf..5c20dd02928 100644 --- a/Content.Client/Paper/UI/PaperWindow.xaml.cs +++ b/Content.Client/Paper/UI/PaperWindow.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Paper; using Robust.Client.AutoGenerated; using Robust.Client.Graphics; diff --git a/Content.Client/Parallax/Data/ParallaxLayerConfig.cs b/Content.Client/Parallax/Data/ParallaxLayerConfig.cs index 9d9db148f81..556a0a3a4a4 100644 --- a/Content.Client/Parallax/Data/ParallaxLayerConfig.cs +++ b/Content.Client/Parallax/Data/ParallaxLayerConfig.cs @@ -1,7 +1,4 @@ -using System; -using Robust.Client.Graphics; -using Content.Client.Parallax.Data; -using Robust.Shared.Serialization.Manager.Attributes; +using System.Numerics; namespace Content.Client.Parallax.Data; diff --git a/Content.Client/Parallax/Managers/IParallaxManager.cs b/Content.Client/Parallax/Managers/IParallaxManager.cs index 23b42bede20..258e671cd93 100644 --- a/Content.Client/Parallax/Managers/IParallaxManager.cs +++ b/Content.Client/Parallax/Managers/IParallaxManager.cs @@ -1,3 +1,4 @@ +using System.Numerics; using System.Threading.Tasks; using Robust.Shared.Maths; diff --git a/Content.Client/Parallax/Managers/ParallaxManager.cs b/Content.Client/Parallax/Managers/ParallaxManager.cs index 9236578b2ec..83e7febe27c 100644 --- a/Content.Client/Parallax/Managers/ParallaxManager.cs +++ b/Content.Client/Parallax/Managers/ParallaxManager.cs @@ -1,4 +1,5 @@ using System.Collections.Concurrent; +using System.Numerics; using System.Threading; using System.Threading.Tasks; using Content.Client.Parallax.Data; diff --git a/Content.Client/Parallax/ParallaxControl.cs b/Content.Client/Parallax/ParallaxControl.cs index afd9a7423ec..8f56857214a 100644 --- a/Content.Client/Parallax/ParallaxControl.cs +++ b/Content.Client/Parallax/ParallaxControl.cs @@ -1,4 +1,5 @@ -using Content.Client.Parallax.Managers; +using System.Numerics; +using Content.Client.Parallax.Managers; using Robust.Client.Graphics; using Robust.Client.UserInterface; using Robust.Shared.Random; @@ -22,7 +23,7 @@ public ParallaxControl() { IoCManager.InjectDependencies(this); - Offset = (_random.Next(0, 1000), _random.Next(0, 1000)); + Offset = new Vector2(_random.Next(0, 1000), _random.Next(0, 1000)); RectClipContent = true; _parallaxManager.LoadParallaxByName("FastSpace"); } @@ -54,7 +55,7 @@ protected override void Draw(DrawingHandleScreen handle) { for (var y = -scaledOffset.Y; y < ourSize.Y; y += texSize.Y) { - handle.DrawTextureRect(tex, UIBox2.FromDimensions((x, y), texSize)); + handle.DrawTextureRect(tex, UIBox2.FromDimensions(new Vector2(x, y), texSize)); } } } diff --git a/Content.Client/Parallax/ParallaxOverlay.cs b/Content.Client/Parallax/ParallaxOverlay.cs index 59fc8fce513..38748c42223 100644 --- a/Content.Client/Parallax/ParallaxOverlay.cs +++ b/Content.Client/Parallax/ParallaxOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Parallax.Managers; using Content.Shared.CCVar; using Content.Shared.Parallax.Biomes; @@ -101,7 +102,7 @@ protected override void Draw(in OverlayDrawArgs args) { for (var y = flooredBL.Y; y < args.WorldAABB.Top; y += size.Y) { - worldHandle.DrawTextureRect(tex, Box2.FromDimensions((x, y), size)); + worldHandle.DrawTextureRect(tex, Box2.FromDimensions(new Vector2(x, y), size)); } } } diff --git a/Content.Client/ParticleAccelerator/UI/ParticleAcceleratorControlMenu.cs b/Content.Client/ParticleAccelerator/UI/ParticleAcceleratorControlMenu.cs index 0df9363cb86..bd91306c7ea 100644 --- a/Content.Client/ParticleAccelerator/UI/ParticleAcceleratorControlMenu.cs +++ b/Content.Client/ParticleAccelerator/UI/ParticleAcceleratorControlMenu.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Resources; using Content.Client.Stylesheets; using Content.Client.UserInterface.Controls; @@ -51,7 +52,7 @@ public sealed class ParticleAcceleratorControlMenu : BaseWindow public ParticleAcceleratorControlMenu(ParticleAcceleratorBoundUserInterface owner) { - SetSize = (400, 320); + SetSize = new Vector2(400, 320); _greyScaleShader = IoCManager.Resolve().Index("Greyscale").Instance(); _owner = owner; @@ -159,11 +160,11 @@ public ParticleAcceleratorControlMenu(ParticleAcceleratorBoundUserInterface owne new PanelContainer { PanelOverride = new StyleBoxFlat {BackgroundColor = StyleNano.NanoGold}, - MinSize = (0, 2), + MinSize = new Vector2(0, 2), }, new Control { - MinSize = (0, 4) + MinSize = new Vector2(0, 4) }, new BoxContainer @@ -210,7 +211,7 @@ public ParticleAcceleratorControlMenu(ParticleAcceleratorBoundUserInterface owne }, new Control { - MinSize = (0, 10), + MinSize = new Vector2(0, 10), }, _drawLabel, new Control @@ -237,7 +238,7 @@ public ParticleAcceleratorControlMenu(ParticleAcceleratorBoundUserInterface owne new BoxContainer { Orientation = LayoutOrientation.Vertical, - MinSize = (186, 0), + MinSize = new Vector2(186, 0), Children = { (_statusLabel = new Label @@ -246,7 +247,7 @@ public ParticleAcceleratorControlMenu(ParticleAcceleratorBoundUserInterface owne }), new Control { - MinSize = (0, 20) + MinSize = new Vector2(0, 20) }, new PanelContainer { diff --git a/Content.Client/Physics/JointVisualsOverlay.cs b/Content.Client/Physics/JointVisualsOverlay.cs index 5362a848d54..09c02746e2e 100644 --- a/Content.Client/Physics/JointVisualsOverlay.cs +++ b/Content.Client/Physics/JointVisualsOverlay.cs @@ -61,7 +61,7 @@ protected override void Draw(in OverlayDrawArgs args) var posA = coordsA.ToMapPos(_entManager, xformSystem); var posB = coordsB.ToMapPos(_entManager, xformSystem); var diff = (posB - posA); - var length = diff.Length; + var length = diff.Length(); var midPoint = diff / 2f + posA; var angle = (posB - posA).ToWorldAngle(); diff --git a/Content.Client/Pinpointer/NavMapSystem.cs b/Content.Client/Pinpointer/NavMapSystem.cs index 23b7fc8365a..6556aeaf99c 100644 --- a/Content.Client/Pinpointer/NavMapSystem.cs +++ b/Content.Client/Pinpointer/NavMapSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Pinpointer; using Robust.Client.Graphics; using Robust.Shared.Enums; diff --git a/Content.Client/Pinpointer/UI/NavMapControl.cs b/Content.Client/Pinpointer/UI/NavMapControl.cs index 2e63ef0ecee..bd61587e8bd 100644 --- a/Content.Client/Pinpointer/UI/NavMapControl.cs +++ b/Content.Client/Pinpointer/UI/NavMapControl.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Stylesheets; using Content.Client.UserInterface.Controls; using Content.Shared.Pinpointer; @@ -10,7 +11,6 @@ using Robust.Shared.Physics; using Robust.Shared.Physics.Collision.Shapes; using Robust.Shared.Physics.Components; -using Vector2 = Robust.Shared.Maths.Vector2; namespace Content.Client.Pinpointer.UI; @@ -87,7 +87,7 @@ public NavMapControl() : base(8f, 128f, 48f) }; AddChild(topContainer); - topPanel.Measure(Vector2.Infinity); + topPanel.Measure(Vector2Helpers.Infinity); _recenter.OnPressed += args => { @@ -153,7 +153,7 @@ protected override void Draw(DrawingHandleScreen handle) var frameTime = Timing.FrameTime; var diff = _offset * (float) frameTime.TotalSeconds; - if (_offset.LengthSquared < _recenterMinimum) + if (_offset.LengthSquared() < _recenterMinimum) { _offset = Vector2.Zero; _recentering = false; @@ -337,6 +337,6 @@ protected override void Draw(DrawingHandleScreen handle) private Vector2 Scale(Vector2 position) { - return position * MinimapScale + MidPoint; + return position * MinimapScale + MidpointVector; } } diff --git a/Content.Client/Pinpointer/UI/StationMapWindow.xaml.cs b/Content.Client/Pinpointer/UI/StationMapWindow.xaml.cs index 205987ca35e..1fa12fa9e7c 100644 --- a/Content.Client/Pinpointer/UI/StationMapWindow.xaml.cs +++ b/Content.Client/Pinpointer/UI/StationMapWindow.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.UserInterface.Controls; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.XAML; diff --git a/Content.Client/Placement/Modes/WallmountLight.cs b/Content.Client/Placement/Modes/WallmountLight.cs index 3b9a93f360d..fb364a7bba8 100644 --- a/Content.Client/Placement/Modes/WallmountLight.cs +++ b/Content.Client/Placement/Modes/WallmountLight.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.Placement; using Robust.Shared.Map; using Robust.Shared.Maths; diff --git a/Content.Client/Pointing/Components/PointingArrowComponent.cs b/Content.Client/Pointing/Components/PointingArrowComponent.cs index 26a47b19253..223f48a48fa 100644 --- a/Content.Client/Pointing/Components/PointingArrowComponent.cs +++ b/Content.Client/Pointing/Components/PointingArrowComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Pointing.Components; namespace Content.Client.Pointing.Components; @@ -16,7 +17,7 @@ public sealed class PointingArrowComponent : SharedPointingArrowComponent /// [ViewVariables(VVAccess.ReadWrite)] [DataField("offset")] - public readonly Vector2 Offset = (0, 0.25f); + public readonly Vector2 Offset = new(0, 0.25f); public readonly string AnimationKey = "pointingarrow"; } diff --git a/Content.Client/Popups/PopupOverlay.cs b/Content.Client/Popups/PopupOverlay.cs index 85485ada568..17af5ca38f4 100644 --- a/Content.Client/Popups/PopupOverlay.cs +++ b/Content.Client/Popups/PopupOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Examine; using Content.Shared.CCVar; using Content.Shared.Examine; @@ -88,7 +89,7 @@ private void DrawWorld(DrawingHandleScreen worldHandle, OverlayDrawArgs args, fl if (mapPos.MapId != args.MapId) continue; - var distance = (mapPos.Position - args.WorldBounds.Center).Length; + var distance = (mapPos.Position - args.WorldBounds.Center).Length(); // Should handle fade here too wyci. if (!args.WorldAABB.Contains(mapPos.Position) || !ExamineSystemShared.InRangeUnOccluded(viewPos, mapPos, distance, diff --git a/Content.Client/Power/PowerMonitoringWindow.xaml.cs b/Content.Client/Power/PowerMonitoringWindow.xaml.cs index 76e5840bba4..9e519b6ec76 100644 --- a/Content.Client/Power/PowerMonitoringWindow.xaml.cs +++ b/Content.Client/Power/PowerMonitoringWindow.xaml.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using System.Numerics; using Content.Client.Computer; using Content.Client.IoC; using Content.Shared.Power; @@ -28,7 +29,7 @@ public sealed partial class PowerMonitoringWindow : DefaultWindow, IComputerWind public PowerMonitoringWindow() { RobustXamlLoader.Load(this); - SetSize = MinSize = (300, 450); + SetSize = MinSize = new Vector2(300, 450); IoCManager.InjectDependencies(this); MasterTabContainer.SetTabTitle(0, Loc.GetString("power-monitoring-window-tab-sources")); MasterTabContainer.SetTabTitle(1, Loc.GetString("power-monitoring-window-tab-loads")); diff --git a/Content.Client/Power/SolarControlWindow.xaml.cs b/Content.Client/Power/SolarControlWindow.xaml.cs index f9d535e099d..4b5053a6ab8 100644 --- a/Content.Client/Power/SolarControlWindow.xaml.cs +++ b/Content.Client/Power/SolarControlWindow.xaml.cs @@ -1,4 +1,5 @@ using System; +using System.Numerics; using Content.Client.Computer; using Content.Shared.Solar; using JetBrains.Annotations; @@ -104,7 +105,7 @@ public sealed class SolarControlNotARadar : Control public SolarControlNotARadar() { - MinSize = (SizeFull, SizeFull); + MinSize = new Vector2(SizeFull, SizeFull); } public void UpdateState(SolarControlConsoleBoundInterfaceState ls) @@ -125,36 +126,36 @@ protected override void Draw(DrawingHandleScreen handle) var gridLinesEquatorial = 8; // Draw base - handle.DrawCircle((point, point), RadiusCircle + 1, fakeAA); - handle.DrawCircle((point, point), RadiusCircle, Color.Black); + handle.DrawCircle(new Vector2(point, point), RadiusCircle + 1, fakeAA); + handle.DrawCircle(new Vector2(point, point), RadiusCircle, Color.Black); // Draw grid lines for (var i = 0; i < gridLinesEquatorial; i++) { - handle.DrawCircle((point, point), (RadiusCircle / gridLinesEquatorial) * i, gridLines, false); + handle.DrawCircle(new Vector2(point, point), (RadiusCircle / gridLinesEquatorial) * i, gridLines, false); } for (var i = 0; i < gridLinesRadial; i++) { Angle angle = (Math.PI / gridLinesRadial) * i; var aExtent = angle.ToVec() * RadiusCircle; - handle.DrawLine((point, point) - aExtent, (point, point) + aExtent, gridLines); + handle.DrawLine(new Vector2(point, point) - aExtent, new Vector2(point, point) + aExtent, gridLines); } // The rotations need to be adjusted because Y is inverted in Robust (like BYOND) - Vector2 rotMul = (1, -1); + var rotMul = new Vector2(1, -1); // Hotfix corrections I don't understand - Angle rotOfs = new Angle(Math.PI * -0.5); + var rotOfs = new Angle(Math.PI * -0.5); - Angle predictedPanelRotation = PredictedPanelRotation; + var predictedPanelRotation = PredictedPanelRotation; var extent = (predictedPanelRotation + rotOfs).ToVec() * rotMul * RadiusCircle; - Vector2 extentOrtho = (extent.Y, -extent.X); - handle.DrawLine((point, point) - extentOrtho, (point, point) + extentOrtho, Color.White); - handle.DrawLine((point, point) + (extent / panelExtentCutback), (point, point) + extent - (extent / panelExtentCutback), Color.DarkGray); + var extentOrtho = new Vector2(extent.Y, -extent.X); + handle.DrawLine(new Vector2(point, point) - extentOrtho, new Vector2(point, point) + extentOrtho, Color.White); + handle.DrawLine(new Vector2(point, point) + (extent / panelExtentCutback), new Vector2(point, point) + extent - (extent / panelExtentCutback), Color.DarkGray); var sunExtent = (_lastState.TowardsSun + rotOfs).ToVec() * rotMul * RadiusCircle; - handle.DrawLine((point, point) + sunExtent, (point, point), Color.Yellow); + handle.DrawLine(new Vector2(point, point) + sunExtent, new Vector2(point, point), Color.Yellow); } } diff --git a/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs b/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs index d5230228e9a..f3c3241b7e9 100644 --- a/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs +++ b/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.Humanoid; using Content.Client.Info; using Content.Client.Lobby.UI; @@ -186,7 +187,7 @@ public CharacterPickerButton( var view = new SpriteView { Sprite = entityManager.GetComponent(_previewDummy), - Scale = (2, 2), + Scale = new Vector2(2, 2), OverrideDirection = Direction.South }; diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs index bd7e431ae4d..34c526e10ff 100644 --- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs +++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.Humanoid; using Content.Client.Lobby.UI; using Content.Client.Message; @@ -486,7 +487,7 @@ public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IProt _previewSprite = new SpriteView { Sprite = sprite, - Scale = (6, 6), + Scale = new Vector2(6, 6), OverrideDirection = Direction.South, VerticalAlignment = VAlignment.Center, SizeFlagsStretchRatio = 1 @@ -496,7 +497,7 @@ public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IProt _previewSpriteSide = new SpriteView { Sprite = sprite, - Scale = (6, 6), + Scale = new Vector2(6, 6), OverrideDirection = Direction.East, VerticalAlignment = VAlignment.Center, SizeFlagsStretchRatio = 1 @@ -725,7 +726,7 @@ private void RebuildSpriteView() _previewSprite = new SpriteView { Sprite = sprite, - Scale = (6, 6), + Scale = new Vector2(6, 6), OverrideDirection = Direction.South, VerticalAlignment = VAlignment.Center, SizeFlagsStretchRatio = 1 @@ -742,7 +743,7 @@ private void RebuildSpriteView() _previewSpriteSide = new SpriteView { Sprite = sprite, - Scale = (6, 6), + Scale = new Vector2(6, 6), OverrideDirection = Direction.East, VerticalAlignment = VAlignment.Center, SizeFlagsStretchRatio = 1 @@ -1217,7 +1218,7 @@ public JobPrioritySelector(JobPrototype job) var icon = new TextureRect { - TextureScale = (2, 2), + TextureScale = new Vector2(2, 2), Stretch = TextureRect.StretchMode.KeepCentered }; @@ -1252,7 +1253,7 @@ public JobPrioritySelector(JobPrototype job) { Margin = new Thickness(5f,0,5f,0), Text = job.LocalizedName, - MinSize = (180, 0), + MinSize = new Vector2(180, 0), MouseFilter = MouseFilterMode.Stop }; diff --git a/Content.Client/Radiation/Overlays/RadiationDebugOverlay.cs b/Content.Client/Radiation/Overlays/RadiationDebugOverlay.cs index 1a7419517b5..96fbb5dca82 100644 --- a/Content.Client/Radiation/Overlays/RadiationDebugOverlay.cs +++ b/Content.Client/Radiation/Overlays/RadiationDebugOverlay.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.Radiation.Systems; using Robust.Client.Graphics; using Robust.Client.ResourceManagement; diff --git a/Content.Client/Radiation/Overlays/RadiationPulseOverlay.cs b/Content.Client/Radiation/Overlays/RadiationPulseOverlay.cs index 6e0e83c2a0c..a07d4f6a74d 100644 --- a/Content.Client/Radiation/Overlays/RadiationPulseOverlay.cs +++ b/Content.Client/Radiation/Overlays/RadiationPulseOverlay.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Shared.Radiation.Components; using Robust.Client.Graphics; using Robust.Shared.Enums; diff --git a/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs b/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs index 4a88f48add2..04fd35da11b 100644 --- a/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs +++ b/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs @@ -134,9 +134,7 @@ private bool TryFindFallbackSpawn(out EntityCoordinates coords) return true; } - var uid = EntityQuery() - .OrderByDescending(x => x.LocalAABB.Size.LengthSquared) - .FirstOrDefault()?.Owner; + var uid = EntityQuery().MaxBy(x => x.LocalAABB.Size.LengthSquared())?.Owner; coords = new EntityCoordinates(uid ?? default, default); return uid != null; } diff --git a/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Spectate.cs b/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Spectate.cs index 7230179bada..b7c8b5448b1 100644 --- a/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Spectate.cs +++ b/Content.Client/Replay/Spectator/ReplaySpectatorSystem.Spectate.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Replay.UI; using Content.Shared.Verbs; using Robust.Shared.Console; diff --git a/Content.Client/Research/UI/ResearchConsoleMenu.xaml.cs b/Content.Client/Research/UI/ResearchConsoleMenu.xaml.cs index d40cf3cfdfe..6335db83de5 100644 --- a/Content.Client/Research/UI/ResearchConsoleMenu.xaml.cs +++ b/Content.Client/Research/UI/ResearchConsoleMenu.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.UserInterface.Controls; using Content.Shared.Access.Components; using Content.Shared.Access.Systems; @@ -149,7 +150,7 @@ public void UpdateInformationPanel(ResearchConsoleBoundInterfaceState state) // i'm building the small-ass control here to spare me some mild annoyance in making a new file var texture = new TextureRect { - TextureScale = ( 2, 2 ), + TextureScale = new Vector2( 2, 2 ), VerticalAlignment = VAlignment.Center }; var label = new RichTextLabel(); diff --git a/Content.Client/RoundEnd/RoundEndSummaryWindow.cs b/Content.Client/RoundEnd/RoundEndSummaryWindow.cs index 8f83689e805..9288195d7b2 100644 --- a/Content.Client/RoundEnd/RoundEndSummaryWindow.cs +++ b/Content.Client/RoundEnd/RoundEndSummaryWindow.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.Message; using Content.Shared.GameTicking; using Robust.Client.GameObjects; @@ -19,7 +20,7 @@ public RoundEndSummaryWindow(string gm, string roundEnd, TimeSpan roundTimeSpan, { _entityManager = entityManager; - MinSize = SetSize = (520, 580); + MinSize = SetSize = new Vector2(520, 580); Title = Loc.GetString("round-end-summary-window-title"); @@ -131,7 +132,7 @@ private BoxContainer MakePlayerManifestoTab(RoundEndMessageEvent.RoundEndPlayerI Sprite = sprite, OverrideDirection = Direction.South, VerticalAlignment = VAlignment.Center, - SetSize = (32, 32), + SetSize = new Vector2(32, 32), VerticalExpand = true, }); } diff --git a/Content.Client/Shuttles/UI/DockingControl.cs b/Content.Client/Shuttles/UI/DockingControl.cs index 44d205a8b7c..93c72921bb7 100644 --- a/Content.Client/Shuttles/UI/DockingControl.cs +++ b/Content.Client/Shuttles/UI/DockingControl.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.UserInterface.Controls; using Content.Shared.Shuttles.BUIStates; using Robust.Client.Graphics; @@ -19,9 +20,14 @@ public class DockingControl : Control private float _range = 8f; private float _rangeSquared = 0f; + + private Vector2 RangeVector => new Vector2(_range, _range); + private const float GridLinesDistance = 32f; private int MidPoint => SizeFull / 2; + private Vector2 MidPointVector => new Vector2(MidPoint, MidPoint); + private int SizeFull => (int) (MapGridControl.UIDisplayRadius * 2 * UIScale); private int ScaledMinimapRadius => (int) (MapGridControl.UIDisplayRadius * UIScale); private float MinimapScale => _range != 0 ? ScaledMinimapRadius / _range : 0f; @@ -42,7 +48,7 @@ public DockingControl() _entManager = IoCManager.Resolve(); _mapManager = IoCManager.Resolve(); _rangeSquared = _range * _range; - MinSize = (SizeFull, SizeFull); + MinSize = new Vector2(SizeFull, SizeFull); } protected override void Draw(DrawingHandleScreen handle) @@ -51,8 +57,8 @@ protected override void Draw(DrawingHandleScreen handle) var fakeAA = new Color(0.08f, 0.08f, 0.08f); - handle.DrawCircle((MidPoint, MidPoint), ScaledMinimapRadius + 1, fakeAA); - handle.DrawCircle((MidPoint, MidPoint), ScaledMinimapRadius, Color.Black); + handle.DrawCircle(new Vector2(MidPoint, MidPoint), ScaledMinimapRadius + 1, fakeAA); + handle.DrawCircle(new Vector2(MidPoint, MidPoint), ScaledMinimapRadius, Color.Black); var gridLines = new Color(0.08f, 0.08f, 0.08f); var gridLinesRadial = 8; @@ -60,14 +66,14 @@ protected override void Draw(DrawingHandleScreen handle) for (var i = 1; i < gridLinesEquatorial + 1; i++) { - handle.DrawCircle((MidPoint, MidPoint), GridLinesDistance * MinimapScale * i, gridLines, false); + handle.DrawCircle(new Vector2(MidPoint, MidPoint), GridLinesDistance * MinimapScale * i, gridLines, false); } for (var i = 0; i < gridLinesRadial; i++) { Angle angle = (Math.PI / gridLinesRadial) * i; var aExtent = angle.ToVec() * ScaledMinimapRadius; - handle.DrawLine((MidPoint, MidPoint) - aExtent, (MidPoint, MidPoint) + aExtent, gridLines); + handle.DrawLine(new Vector2(MidPoint, MidPoint) - aExtent, new Vector2(MidPoint, MidPoint) + aExtent, gridLines); } if (Coordinates == null || @@ -89,8 +95,8 @@ protected override void Draw(DrawingHandleScreen handle) var start = matrix.Transform(poly.Vertices[i]); var end = matrix.Transform(poly.Vertices[(i + 1) % poly.VertexCount]); - var startOut = start.LengthSquared > _rangeSquared; - var endOut = end.LengthSquared > _rangeSquared; + var startOut = start.LengthSquared() > _rangeSquared; + var endOut = end.LengthSquared() > _rangeSquared; // We need to draw to the radar border so we'll cap the range, // but if none of the verts are in range then just leave it. @@ -104,13 +110,17 @@ protected override void Draw(DrawingHandleScreen handle) if (startOut) { // It's called Jobseeker now. - if (!MathHelper.TryGetIntersecting(start, end, _range, out var newStart)) continue; + if (!MathHelper.TryGetIntersecting(start, end, _range, out var newStart)) + continue; + start = newStart.Value; } // otherwise vice versa else if (endOut) { - if (!MathHelper.TryGetIntersecting(end, start, _range, out var newEnd)) continue; + if (!MathHelper.TryGetIntersecting(end, start, _range, out var newEnd)) + continue; + end = newEnd.Value; } @@ -138,7 +148,7 @@ protected override void Draw(DrawingHandleScreen handle) var xformQuery = _entManager.GetEntityQuery(); foreach (var grid in _mapManager.FindGridsIntersecting(gridXform.MapID, - new Box2(worldPos - _range, worldPos + _range))) + new Box2(worldPos - RangeVector, worldPos + RangeVector))) { if (grid.Owner == GridEntity) continue; @@ -164,8 +174,8 @@ protected override void Draw(DrawingHandleScreen handle) var start = matty.Transform(startPos); var end = matty.Transform(endPos); - var startOut = start.LengthSquared > _rangeSquared; - var endOut = end.LengthSquared > _rangeSquared; + var startOut = start.LengthSquared() > _rangeSquared; + var endOut = end.LengthSquared() > _rangeSquared; // We need to draw to the radar border so we'll cap the range, // but if none of the verts are in range then just leave it. @@ -200,7 +210,8 @@ protected override void Draw(DrawingHandleScreen handle) { var position = matty.Transform(dock.Coordinates.Position); - if (position.Length > _range - 0.8f) continue; + if (position.Length() > _range - 0.8f) + continue; var otherDockRotation = Matrix3.CreateRotation(dock.Angle); @@ -251,6 +262,6 @@ protected override void Draw(DrawingHandleScreen handle) private Vector2 ScalePosition(Vector2 value) { - return value * MinimapScale + MidPoint; + return value * MinimapScale + MidPointVector; } } diff --git a/Content.Client/Shuttles/UI/RadarControl.cs b/Content.Client/Shuttles/UI/RadarControl.cs index 19cdd7d9b91..46aa3233ab8 100644 --- a/Content.Client/Shuttles/UI/RadarControl.cs +++ b/Content.Client/Shuttles/UI/RadarControl.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.UserInterface.Controls; using Content.Shared.Shuttles.BUIStates; using Content.Shared.Shuttles.Components; @@ -134,8 +135,8 @@ protected override void Draw(DrawingHandleScreen handle) var fakeAA = new Color(0.08f, 0.08f, 0.08f); - handle.DrawCircle((MidPoint, MidPoint), ScaledMinimapRadius + 1, fakeAA); - handle.DrawCircle((MidPoint, MidPoint), ScaledMinimapRadius, Color.Black); + handle.DrawCircle(new Vector2(MidPoint, MidPoint), ScaledMinimapRadius + 1, fakeAA); + handle.DrawCircle(new Vector2(MidPoint, MidPoint), ScaledMinimapRadius, Color.Black); // No data if (_coordinates == null || _rotation == null) @@ -150,14 +151,14 @@ protected override void Draw(DrawingHandleScreen handle) for (var i = 1; i < gridLinesEquatorial + 1; i++) { - handle.DrawCircle((MidPoint, MidPoint), GridLinesDistance * MinimapScale * i, gridLines, false); + handle.DrawCircle(new Vector2(MidPoint, MidPoint), GridLinesDistance * MinimapScale * i, gridLines, false); } for (var i = 0; i < gridLinesRadial; i++) { Angle angle = (Math.PI / gridLinesRadial) * i; var aExtent = angle.ToVec() * ScaledMinimapRadius; - handle.DrawLine((MidPoint, MidPoint) - aExtent, (MidPoint, MidPoint) + aExtent, gridLines); + handle.DrawLine(new Vector2(MidPoint, MidPoint) - aExtent, new Vector2(MidPoint, MidPoint) + aExtent, gridLines); } var metaQuery = _entManager.GetEntityQuery(); @@ -202,7 +203,7 @@ protected override void Draw(DrawingHandleScreen handle) // Draw other grids... differently foreach (var grid in _mapManager.FindGridsIntersecting(mapPosition.MapId, - new Box2(mapPosition.Position - MaxRadarRange, mapPosition.Position + MaxRadarRange))) + new Box2(mapPosition.Position - MaxRadarRangeVector, mapPosition.Position + MaxRadarRangeVector))) { if (grid.Owner == ourGridId || !fixturesQuery.TryGetComponent(grid.Owner, out var fixturesComp)) continue; @@ -330,7 +331,8 @@ private void DrawDocks(DrawingHandleScreen handle, EntityUid uid, Matrix3 matrix var position = state.Coordinates.Position; var uiPosition = matrix.Transform(position); - if (uiPosition.Length > WorldRange - DockScale) continue; + if (uiPosition.Length() > WorldRange - DockScale) + continue; var color = HighlightedDock == ent ? state.HighlightedColor : state.Color; @@ -408,7 +410,7 @@ private void DrawGrid(DrawingHandleScreen handle, Matrix3 matrix, MapGridCompone var adjustedStart = matrix.Transform(start); var adjustedEnd = matrix.Transform(end); - if (adjustedStart.Length > ActualRadarRange || adjustedEnd.Length > ActualRadarRange) + if (adjustedStart.Length() > ActualRadarRange || adjustedEnd.Length() > ActualRadarRange) continue; start = ScalePosition(new Vector2(adjustedStart.X, -adjustedStart.Y)); @@ -424,11 +426,11 @@ private void DrawGrid(DrawingHandleScreen handle, Matrix3 matrix, MapGridCompone private Vector2 ScalePosition(Vector2 value) { - return value * MinimapScale + MidPoint; + return value * MinimapScale + MidpointVector; } private Vector2 InverseScalePosition(Vector2 value) { - return (value - MidPoint) / MinimapScale; + return (value - MidpointVector) / MinimapScale; } } diff --git a/Content.Client/Singularity/SingularityOverlay.cs b/Content.Client/Singularity/SingularityOverlay.cs index 3dae489c327..cda6c1ab262 100644 --- a/Content.Client/Singularity/SingularityOverlay.cs +++ b/Content.Client/Singularity/SingularityOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Singularity.Components; using Robust.Client.Graphics; using Robust.Shared.Enums; @@ -30,9 +31,9 @@ public SingularityOverlay() _shader.SetParameter("maxDistance", MaxDistance * EyeManager.PixelsPerMeter); } - private Vector2[] _positions = new Vector2[MaxCount]; - private float[] _intensities = new float[MaxCount]; - private float[] _falloffPowers = new float[MaxCount]; + private readonly Vector2[] _positions = new Vector2[MaxCount]; + private readonly float[] _intensities = new float[MaxCount]; + private readonly float[] _falloffPowers = new float[MaxCount]; private int _count = 0; protected override bool BeforeDraw(in OverlayDrawArgs args) @@ -49,7 +50,7 @@ protected override bool BeforeDraw(in OverlayDrawArgs args) var mapPos = xform.WorldPosition; // is the distortion in range? - if ((mapPos - args.WorldAABB.ClosestPoint(mapPos)).LengthSquared > MaxDistance * MaxDistance) + if ((mapPos - args.WorldAABB.ClosestPoint(mapPos)).LengthSquared() > MaxDistance * MaxDistance) continue; // To be clear, this needs to use "inside-viewport" pixels. diff --git a/Content.Client/StatusIcon/StatusIconOverlay.cs b/Content.Client/StatusIcon/StatusIconOverlay.cs index ea255dde99a..d1b556a5c72 100644 --- a/Content.Client/StatusIcon/StatusIconOverlay.cs +++ b/Content.Client/StatusIcon/StatusIconOverlay.cs @@ -1,4 +1,5 @@ -using Content.Shared.StatusIcon.Components; +using System.Numerics; +using Content.Shared.StatusIcon.Components; using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Shared.Enums; diff --git a/Content.Client/Storage/UI/StorageWindow.cs b/Content.Client/Storage/UI/StorageWindow.cs index 55ac04679fb..83ad6a8e806 100644 --- a/Content.Client/Storage/UI/StorageWindow.cs +++ b/Content.Client/Storage/UI/StorageWindow.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Client.UserInterface.Controls; @@ -30,7 +31,7 @@ public sealed class StorageWindow : DefaultWindow public StorageWindow(IEntityManager entityManager) { _entityManager = entityManager; - SetSize = (240, 320); + SetSize = new Vector2(240, 320); Title = Loc.GetString("comp-storage-window-title"); RectClipContent = true; diff --git a/Content.Client/Stylesheets/StyleBase.cs b/Content.Client/Stylesheets/StyleBase.cs index 0a7cac910d2..5068f97e36f 100644 --- a/Content.Client/Stylesheets/StyleBase.cs +++ b/Content.Client/Stylesheets/StyleBase.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Resources; using Robust.Client.Graphics; using Robust.Client.ResourceManagement; @@ -77,7 +78,7 @@ protected StyleBase(IResourceCache resCache) BaseButtonOpenRight = new StyleBoxTexture(BaseButton) { - Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((0, 0), (14, 24))), + Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions(new Vector2(0, 0), new Vector2(14, 24))), }; BaseButtonOpenRight.SetPatchMargin(StyleBox.Margin.Right, 0); BaseButtonOpenRight.SetContentMarginOverride(StyleBox.Margin.Right, 8); @@ -85,7 +86,7 @@ protected StyleBase(IResourceCache resCache) BaseButtonOpenLeft = new StyleBoxTexture(BaseButton) { - Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((10, 0), (14, 24))), + Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions(new Vector2(10, 0), new Vector2(14, 24))), }; BaseButtonOpenLeft.SetPatchMargin(StyleBox.Margin.Left, 0); BaseButtonOpenLeft.SetContentMarginOverride(StyleBox.Margin.Left, 8); @@ -93,7 +94,7 @@ protected StyleBase(IResourceCache resCache) BaseButtonOpenBoth = new StyleBoxTexture(BaseButton) { - Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((10, 0), (3, 24))), + Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions(new Vector2(10, 0), new Vector2(3, 24))), }; BaseButtonOpenBoth.SetPatchMargin(StyleBox.Margin.Horizontal, 0); BaseButtonOpenBoth.SetContentMarginOverride(StyleBox.Margin.Horizontal, 8); @@ -102,7 +103,7 @@ protected StyleBase(IResourceCache resCache) BaseButtonSquare = new StyleBoxTexture(BaseButton) { - Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((10, 0), (3, 24))), + Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions(new Vector2(10, 0), new Vector2(3, 24))), }; BaseButtonSquare.SetPatchMargin(StyleBox.Margin.Horizontal, 0); BaseButtonSquare.SetContentMarginOverride(StyleBox.Margin.Horizontal, 8); diff --git a/Content.Client/Stylesheets/StyleNano.cs b/Content.Client/Stylesheets/StyleNano.cs index 351b6cf548a..5dcbc9b3aef 100644 --- a/Content.Client/Stylesheets/StyleNano.cs +++ b/Content.Client/Stylesheets/StyleNano.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.ContextMenu.UI; using Content.Client.Examine; using Content.Client.PDA; @@ -294,19 +295,19 @@ public StyleNano(IResourceCache resCache) : base(resCache) var topButtonOpenRight = new StyleBoxTexture(topButtonBase) { - Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((0, 0), (14, 24))), + Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions(new Vector2(0, 0), new Vector2(14, 24))), }; topButtonOpenRight.SetPatchMargin(StyleBox.Margin.Right, 0); var topButtonOpenLeft = new StyleBoxTexture(topButtonBase) { - Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((10, 0), (14, 24))), + Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions(new Vector2(10, 0), new Vector2(14, 24))), }; topButtonOpenLeft.SetPatchMargin(StyleBox.Margin.Left, 0); var topButtonSquare = new StyleBoxTexture(topButtonBase) { - Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((10, 0), (3, 24))), + Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions(new Vector2(10, 0), new Vector2(3, 24))), }; topButtonSquare.SetPatchMargin(StyleBox.Margin.Horizontal, 0); diff --git a/Content.Client/Tabletop/TabletopSystem.cs b/Content.Client/Tabletop/TabletopSystem.cs index 64e89b63021..1f146a17982 100644 --- a/Content.Client/Tabletop/TabletopSystem.cs +++ b/Content.Client/Tabletop/TabletopSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Tabletop.UI; using Content.Client.Viewport; using Content.Shared.Tabletop; diff --git a/Content.Client/TextScreen/TextScreenSystem.cs b/Content.Client/TextScreen/TextScreenSystem.cs index 20eb9025797..040e5b7d314 100644 --- a/Content.Client/TextScreen/TextScreenSystem.cs +++ b/Content.Client/TextScreen/TextScreenSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.TextScreen; using Robust.Client.GameObjects; using Robust.Shared.Timing; diff --git a/Content.Client/TextScreen/TextScreenVisualsComponent.cs b/Content.Client/TextScreen/TextScreenVisualsComponent.cs index b49f874829e..4a5338cba9c 100644 --- a/Content.Client/TextScreen/TextScreenVisualsComponent.cs +++ b/Content.Client/TextScreen/TextScreenVisualsComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.TextScreen; using Robust.Client.Graphics; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; diff --git a/Content.Client/Traits/ParacusiaSystem.cs b/Content.Client/Traits/ParacusiaSystem.cs index c55c12315ad..d05820c7ca4 100644 --- a/Content.Client/Traits/ParacusiaSystem.cs +++ b/Content.Client/Traits/ParacusiaSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Traits.Assorted; using Content.Client.Camera; using Robust.Shared.Random; diff --git a/Content.Client/UserInterface/Controls/DirectionIcon.cs b/Content.Client/UserInterface/Controls/DirectionIcon.cs index cdc567be3d0..c1c17bdbcb0 100644 --- a/Content.Client/UserInterface/Controls/DirectionIcon.cs +++ b/Content.Client/UserInterface/Controls/DirectionIcon.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.Graphics; using Robust.Client.UserInterface.Controls; diff --git a/Content.Client/UserInterface/Controls/FancyTree/FancyTree.xaml.cs b/Content.Client/UserInterface/Controls/FancyTree/FancyTree.xaml.cs index 658465f2454..64e482f37ec 100644 --- a/Content.Client/UserInterface/Controls/FancyTree/FancyTree.xaml.cs +++ b/Content.Client/UserInterface/Controls/FancyTree/FancyTree.xaml.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using System.Numerics; using Content.Client.Resources; using Robust.Client.AutoGenerated; using Robust.Client.Graphics; @@ -128,7 +129,7 @@ public TreeItem AddItem(TreeItem? parent = null) }; Items.Add(item); - item.Icon.SetSize = (Indentation, Indentation); + item.Icon.SetSize = new Vector2(Indentation, Indentation); item.Button.OnPressed += (_) => OnPressed(item); if (parent == null) diff --git a/Content.Client/UserInterface/Controls/FancyWindow.xaml.cs b/Content.Client/UserInterface/Controls/FancyWindow.xaml.cs index ec1d7a89c80..8cdfe57dba2 100644 --- a/Content.Client/UserInterface/Controls/FancyWindow.xaml.cs +++ b/Content.Client/UserInterface/Controls/FancyWindow.xaml.cs @@ -1,4 +1,5 @@ -using Robust.Client.AutoGenerated; +using System.Numerics; +using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.XAML; diff --git a/Content.Client/UserInterface/Controls/ListContainer.cs b/Content.Client/UserInterface/Controls/ListContainer.cs index e471cb7fe8f..eefeb19d40d 100644 --- a/Content.Client/UserInterface/Controls/ListContainer.cs +++ b/Content.Client/UserInterface/Controls/ListContainer.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using JetBrains.Annotations; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; @@ -76,7 +77,7 @@ public void PopulateList(IReadOnlyList data) { ListContainerButton control = new(data[0]); GenerateItem?.Invoke(data[0], control); - control.Measure(Vector2.Infinity); + control.Measure(Vector2Helpers.Infinity); _itemHeight = control.DesiredSize.Y; control.Dispose(); } @@ -312,7 +313,7 @@ protected override Vector2 MeasureOverride(Vector2 availableSize) child.Measure(constraint); if (child == _vScrollBar) continue; - childSize = Vector2.ComponentMax(childSize, child.DesiredSize); + childSize = Vector2.Max(childSize, child.DesiredSize); } if (_itemHeight == 0 && childSize.Y != 0) diff --git a/Content.Client/UserInterface/Controls/MainViewport.cs b/Content.Client/UserInterface/Controls/MainViewport.cs index 05c6ed74115..e334f615724 100644 --- a/Content.Client/UserInterface/Controls/MainViewport.cs +++ b/Content.Client/UserInterface/Controls/MainViewport.cs @@ -1,4 +1,5 @@ -using Content.Client.Viewport; +using System.Numerics; +using Content.Client.Viewport; using Content.Shared.CCVar; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; diff --git a/Content.Client/UserInterface/Controls/MapGridControl.cs b/Content.Client/UserInterface/Controls/MapGridControl.cs index d44424912e6..d56790431fa 100644 --- a/Content.Client/UserInterface/Controls/MapGridControl.cs +++ b/Content.Client/UserInterface/Controls/MapGridControl.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.Graphics; using Robust.Client.UserInterface; using Robust.Shared.Timing; @@ -33,6 +34,10 @@ public abstract class MapGridControl : Control /// public float MaxRadarRange { get; private set; } = 256f * 10f; + public Vector2 MaxRadarRangeVector => new Vector2(MaxRadarRange, MaxRadarRange); + + protected Vector2 MidpointVector => new Vector2(MidPoint, MidPoint); + protected int MidPoint => SizeFull / 2; protected int SizeFull => (int) ((UIDisplayRadius + MinimapMargin) * 2 * UIScale); protected int ScaledMinimapRadius => (int) (UIDisplayRadius * UIScale); @@ -43,7 +48,7 @@ public abstract class MapGridControl : Control public MapGridControl(float minRange, float maxRange, float range) { IoCManager.InjectDependencies(this); - SetSize = (SizeFull, SizeFull); + SetSize = new Vector2(SizeFull, SizeFull); RectClipContent = true; MouseFilter = MouseFilterMode.Stop; ActualRadarRange = WorldRange; diff --git a/Content.Client/UserInterface/Controls/MenuButton.cs b/Content.Client/UserInterface/Controls/MenuButton.cs index 028412eae7c..51a52604a4b 100644 --- a/Content.Client/UserInterface/Controls/MenuButton.cs +++ b/Content.Client/UserInterface/Controls/MenuButton.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using System.Numerics; using Robust.Client.Graphics; using Robust.Client.Input; using Robust.Client.UserInterface.Controls; @@ -50,7 +51,7 @@ public MenuButton() TooltipDelay = CustomTooltipDelay; _buttonIcon = new TextureRect() { - TextureScale = (0.5f, 0.5f), + TextureScale = new Vector2(0.5f, 0.5f), HorizontalAlignment = HAlignment.Center, VerticalAlignment = VAlignment.Center, VerticalExpand = true, diff --git a/Content.Client/UserInterface/Controls/ProgressTextureRect.cs b/Content.Client/UserInterface/Controls/ProgressTextureRect.cs index d6930b47385..3f422e371f7 100644 --- a/Content.Client/UserInterface/Controls/ProgressTextureRect.cs +++ b/Content.Client/UserInterface/Controls/ProgressTextureRect.cs @@ -1,4 +1,5 @@ -using Content.Client.DoAfter; +using System.Numerics; +using Content.Client.DoAfter; using Robust.Client.Graphics; using Robust.Client.UserInterface.Controls; diff --git a/Content.Client/UserInterface/Controls/RecordedSplitContainer.cs b/Content.Client/UserInterface/Controls/RecordedSplitContainer.cs index 21b883dd31d..b255ac15a30 100644 --- a/Content.Client/UserInterface/Controls/RecordedSplitContainer.cs +++ b/Content.Client/UserInterface/Controls/RecordedSplitContainer.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Shared.Input; diff --git a/Content.Client/UserInterface/Controls/SlotControl.cs b/Content.Client/UserInterface/Controls/SlotControl.cs index 527802c26db..193a9908d08 100644 --- a/Content.Client/UserInterface/Controls/SlotControl.cs +++ b/Content.Client/UserInterface/Controls/SlotControl.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Cooldown; using Content.Client.UserInterface.Systems.Inventory.Controls; using Robust.Client.ResourceManagement; @@ -107,16 +108,16 @@ public SlotControl() { IoCManager.InjectDependencies(this); Name = "SlotButton_null"; - MinSize = (DefaultButtonSize, DefaultButtonSize); + MinSize = new Vector2(DefaultButtonSize, DefaultButtonSize); AddChild(ButtonRect = new TextureRect { - TextureScale = (2, 2), + TextureScale = new Vector2(2, 2), MouseFilter = MouseFilterMode.Stop }); AddChild(HighlightRect = new TextureRect { Visible = false, - TextureScale = (2, 2), + TextureScale = new Vector2(2, 2), MouseFilter = MouseFilterMode.Ignore }); @@ -125,21 +126,21 @@ public SlotControl() AddChild(SpriteView = new SpriteView { - Scale = (2, 2), - SetSize = (DefaultButtonSize, DefaultButtonSize), + Scale = new Vector2(2, 2), + SetSize = new Vector2(DefaultButtonSize, DefaultButtonSize), OverrideDirection = Direction.South }); AddChild(HoverSpriteView = new SpriteView { - Scale = (2, 2), - SetSize = (DefaultButtonSize, DefaultButtonSize), + Scale = new Vector2(2, 2), + SetSize = new Vector2(DefaultButtonSize, DefaultButtonSize), OverrideDirection = Direction.South }); AddChild(StorageButton = new TextureButton { - Scale = (0.75f, 0.75f), + Scale = new Vector2(0.75f, 0.75f), HorizontalAlignment = HAlignment.Right, VerticalAlignment = VAlignment.Bottom, Visible = false, @@ -174,7 +175,7 @@ public SlotControl() AddChild(BlockedRect = new TextureRect { - TextureScale = (2, 2), + TextureScale = new Vector2(2, 2), MouseFilter = MouseFilterMode.Stop, Visible = false }); diff --git a/Content.Client/UserInterface/Controls/SplitBar.xaml.cs b/Content.Client/UserInterface/Controls/SplitBar.xaml.cs index b60cedf1853..a7b11970e2d 100644 --- a/Content.Client/UserInterface/Controls/SplitBar.xaml.cs +++ b/Content.Client/UserInterface/Controls/SplitBar.xaml.cs @@ -1,4 +1,5 @@ -using Robust.Client.AutoGenerated; +using System.Numerics; +using Robust.Client.AutoGenerated; using Robust.Client.Graphics; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.XAML; diff --git a/Content.Client/UserInterface/Controls/StripeBack.cs b/Content.Client/UserInterface/Controls/StripeBack.cs index 8d1df84bc8d..3e7f017db1d 100644 --- a/Content.Client/UserInterface/Controls/StripeBack.cs +++ b/Content.Client/UserInterface/Controls/StripeBack.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.Graphics; using Robust.Client.UserInterface.Controls; @@ -62,10 +63,10 @@ protected override Vector2 MeasureOverride(Vector2 availableSize) foreach (var child in Children) { child.Measure(availableSize); - size = Vector2.ComponentMax(size, child.DesiredSize); + size = Vector2.Max(size, child.DesiredSize); } - return size + (0, padSizeTotal); + return size + new Vector2(0, padSizeTotal); } protected override Vector2 ArrangeOverride(Vector2 finalSize) diff --git a/Content.Client/UserInterface/Screens/DefaultGameScreen.xaml.cs b/Content.Client/UserInterface/Screens/DefaultGameScreen.xaml.cs index acaefeafa7a..c35d831035e 100644 --- a/Content.Client/UserInterface/Screens/DefaultGameScreen.xaml.cs +++ b/Content.Client/UserInterface/Screens/DefaultGameScreen.xaml.cs @@ -1,4 +1,5 @@ -using Content.Client.UserInterface.Systems.Chat.Widgets; +using System.Numerics; +using Content.Client.UserInterface.Systems.Chat.Widgets; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.XAML; diff --git a/Content.Client/UserInterface/Screens/InGameScreen.cs b/Content.Client/UserInterface/Screens/InGameScreen.cs index 7220bf0635f..cb6dbaeb52f 100644 --- a/Content.Client/UserInterface/Screens/InGameScreen.cs +++ b/Content.Client/UserInterface/Screens/InGameScreen.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.UserInterface.Systems.Chat.Widgets; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; diff --git a/Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml.cs b/Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml.cs index 7ee01516ff4..9aef78fd856 100644 --- a/Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml.cs +++ b/Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.UserInterface.Systems.Chat.Widgets; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.Controls; diff --git a/Content.Client/UserInterface/Systems/Actions/ActionUIController.cs b/Content.Client/UserInterface/Systems/Actions/ActionUIController.cs index d89b8340336..51e5ffcb227 100644 --- a/Content.Client/UserInterface/Systems/Actions/ActionUIController.cs +++ b/Content.Client/UserInterface/Systems/Actions/ActionUIController.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using System.Runtime.InteropServices; using Content.Client.Actions; using Content.Client.Construction; @@ -71,10 +72,10 @@ public ActionUIController() _menuDragHelper = new DragDropHelper(OnMenuBeginDrag, OnMenuContinueDrag, OnMenuEndDrag); _dragShadow = new TextureRect { - MinSize = (64, 64), + MinSize = new Vector2(64, 64), Stretch = StretchMode.Scale, Visible = false, - SetSize = (64, 64), + SetSize = new Vector2(64, 64), MouseFilter = MouseFilterMode.Ignore }; @@ -738,13 +739,13 @@ private bool OnMenuBeginDrag() } } - LayoutContainer.SetPosition(_dragShadow, UIManager.MousePositionScaled.Position - (32, 32)); + LayoutContainer.SetPosition(_dragShadow, UIManager.MousePositionScaled.Position - new Vector2(32, 32)); return true; } private bool OnMenuContinueDrag(float frameTime) { - LayoutContainer.SetPosition(_dragShadow, UIManager.MousePositionScaled.Position - (32, 32)); + LayoutContainer.SetPosition(_dragShadow, UIManager.MousePositionScaled.Position - new Vector2(32, 32)); _dragShadow.Visible = true; return true; } diff --git a/Content.Client/UserInterface/Systems/Actions/Controls/ActionButton.cs b/Content.Client/UserInterface/Systems/Actions/Controls/ActionButton.cs index d55e495faa1..4030326420f 100644 --- a/Content.Client/UserInterface/Systems/Actions/Controls/ActionButton.cs +++ b/Content.Client/UserInterface/Systems/Actions/Controls/ActionButton.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Actions.UI; using Content.Client.Cooldown; using Content.Client.Stylesheets; @@ -65,7 +66,7 @@ public ActionButton() HighlightRect = new PanelContainer { StyleClasses = {StyleNano.StyleClassHandSlotHighlight}, - MinSize = (32, 32), + MinSize = new Vector2(32, 32), Visible = false }; _bigActionIcon = new TextureRect @@ -94,8 +95,8 @@ public ActionButton() Name = "Big Sprite", HorizontalExpand = true, VerticalExpand = true, - Scale = (2, 2), - SetSize = (64, 64), + Scale = new Vector2(2, 2), + SetSize = new Vector2(64, 64), Visible = false, OverrideDirection = Direction.South, }; @@ -113,11 +114,11 @@ public ActionButton() Orientation = LayoutOrientation.Horizontal, HorizontalExpand = true, VerticalExpand = true, - MinSize = (64, 64) + MinSize = new Vector2(64, 64) }; paddingBoxItemIcon.AddChild(new Control() { - MinSize = (32, 32), + MinSize = new Vector2(32, 32), }); paddingBoxItemIcon.AddChild(new Control { diff --git a/Content.Client/UserInterface/Systems/Alerts/Controls/AlertControl.cs b/Content.Client/UserInterface/Systems/Alerts/Controls/AlertControl.cs index 5c5466537bc..702558785ac 100644 --- a/Content.Client/UserInterface/Systems/Alerts/Controls/AlertControl.cs +++ b/Content.Client/UserInterface/Systems/Alerts/Controls/AlertControl.cs @@ -1,4 +1,5 @@ -using Content.Client.Actions.UI; +using System.Numerics; +using Content.Client.Actions.UI; using Content.Client.Cooldown; using Content.Shared.Alert; using Robust.Client.UserInterface; @@ -54,7 +55,7 @@ public AlertControl(AlertPrototype alert, short? severity) var specifier = alert.GetIcon(_severity); _icon = new AnimatedTextureRect { - DisplayRect = {TextureScale = (2, 2)} + DisplayRect = {TextureScale = new Vector2(2, 2)} }; _icon.SetFromSpriteSpecifier(specifier); diff --git a/Content.Client/UserInterface/Systems/Atmos/GasTank/GasTankWindow.cs b/Content.Client/UserInterface/Systems/Atmos/GasTank/GasTankWindow.cs index db3cc02e53e..7797a096de3 100644 --- a/Content.Client/UserInterface/Systems/Atmos/GasTank/GasTankWindow.cs +++ b/Content.Client/UserInterface/Systems/Atmos/GasTank/GasTankWindow.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Message; using Content.Client.Resources; using Content.Client.Stylesheets; @@ -75,7 +76,7 @@ public GasTankWindow(GasTankBoundUserInterface owner) { Orientation = LayoutOrientation.Vertical }), - new Control {MinSize = (0, 110)} + new Control {MinSize = new Vector2(0, 110)} } }; @@ -125,13 +126,13 @@ public GasTankWindow(GasTankBoundUserInterface owner) _topContainer.AddChild(topRow); _topContainer.AddChild(new PanelContainer { - MinSize = (0, 2), + MinSize = new Vector2(0, 2), PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")} }); _topContainer.AddChild(middle); _topContainer.AddChild(new PanelContainer { - MinSize = (0, 2), + MinSize = new Vector2(0, 2), PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")} }); @@ -141,7 +142,7 @@ public GasTankWindow(GasTankBoundUserInterface owner) //internals _lblInternals = new RichTextLabel - {MinSize = (200, 0), VerticalAlignment = VAlignment.Center}; + {MinSize = new Vector2(200, 0), VerticalAlignment = VAlignment.Center}; _btnInternals = new Button {Text = Loc.GetString("gas-tank-window-internals-toggle-button") }; _contentContainer.AddChild( diff --git a/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs b/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs index ee2f082a1c2..cf05fd6115a 100644 --- a/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs +++ b/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; +using System.Numerics; using Content.Client.Administration.Managers; using Content.Client.Administration.Systems; using Content.Client.Administration.UI.Bwoink; @@ -465,7 +466,7 @@ private void EnsureInit(bool relayActive) TitleClass="windowTitleAlert", HeaderClass="windowHeaderAlert", Title=Loc.GetString("bwoink-user-title"), - MinSize=(500, 200), + MinSize = new Vector2(500, 200), }; _window.OnClose += () => { OnClose?.Invoke(); }; _window.OnOpen += () => { OnOpen?.Invoke(); }; diff --git a/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs b/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs index be22414f3db..50431a7c575 100644 --- a/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs +++ b/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs @@ -1,5 +1,6 @@ using System.Globalization; using System.Linq; +using System.Numerics; using Content.Client.Administration.Managers; using Content.Client.Chat; using Content.Client.Chat.Managers; diff --git a/Content.Client/UserInterface/Systems/Chat/Controls/ChannelFilterButton.cs b/Content.Client/UserInterface/Systems/Chat/Controls/ChannelFilterButton.cs index 43f189211ff..d19f167587f 100644 --- a/Content.Client/UserInterface/Systems/Chat/Controls/ChannelFilterButton.cs +++ b/Content.Client/UserInterface/Systems/Chat/Controls/ChannelFilterButton.cs @@ -1,4 +1,5 @@ -using Content.Client.Resources; +using System.Numerics; +using Content.Client.Resources; using Robust.Client.ResourceManagement; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; @@ -55,8 +56,8 @@ private void OnFilterButtonToggled(ButtonToggledEventArgs args) { var globalPos = GlobalPosition; var (minX, minY) = ChatFilterPopup.MinSize; - var box = UIBox2.FromDimensions(globalPos - (FilterDropdownOffset, 0), - (Math.Max(minX, ChatFilterPopup.MinWidth), minY)); + var box = UIBox2.FromDimensions(globalPos - new Vector2(FilterDropdownOffset, 0), + new Vector2(Math.Max(minX, ChatFilterPopup.MinWidth), minY)); ChatFilterPopup.Open(box); } else diff --git a/Content.Client/UserInterface/Systems/Chat/Controls/ChannelSelectorButton.cs b/Content.Client/UserInterface/Systems/Chat/Controls/ChannelSelectorButton.cs index e594b04d9a0..96a7594ff6f 100644 --- a/Content.Client/UserInterface/Systems/Chat/Controls/ChannelSelectorButton.cs +++ b/Content.Client/UserInterface/Systems/Chat/Controls/ChannelSelectorButton.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Chat; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; @@ -97,7 +98,7 @@ private void OnSelectorButtonToggled(ButtonToggledEventArgs args) { var globalLeft = GlobalPosition.X; var globalBot = GlobalPosition.Y + Height; - var box = UIBox2.FromDimensions((globalLeft, globalBot), (SizeBox.Width, SelectorDropdownOffset)); + var box = UIBox2.FromDimensions(new Vector2(globalLeft, globalBot), new Vector2(SizeBox.Width, SelectorDropdownOffset)); _channelSelectorPopup.Open(box); } else diff --git a/Content.Client/UserInterface/Systems/Chat/Widgets/ResizableChatBox.cs b/Content.Client/UserInterface/Systems/Chat/Widgets/ResizableChatBox.cs index 492ebcc9da9..781544883e6 100644 --- a/Content.Client/UserInterface/Systems/Chat/Widgets/ResizableChatBox.cs +++ b/Content.Client/UserInterface/Systems/Chat/Widgets/ResizableChatBox.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Client.Graphics; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; diff --git a/Content.Client/UserInterface/Systems/Ghost/Controls/GhostTargetWindow.xaml.cs b/Content.Client/UserInterface/Systems/Ghost/Controls/GhostTargetWindow.xaml.cs index 9133ea05d22..314e77fb0af 100644 --- a/Content.Client/UserInterface/Systems/Ghost/Controls/GhostTargetWindow.xaml.cs +++ b/Content.Client/UserInterface/Systems/Ghost/Controls/GhostTargetWindow.xaml.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Shared.Ghost; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.Controls; @@ -54,7 +55,7 @@ private void AddButtons() HorizontalAlignment = HAlignment.Center, VerticalAlignment = VAlignment.Center, SizeFlagsStretchRatio = 1, - MinSize = (340, 20), + MinSize = new Vector2(340, 20), ClipText = true, }; diff --git a/Content.Client/UserInterface/Systems/Ghost/Controls/Roles/MakeGhostRoleWindow.xaml.cs b/Content.Client/UserInterface/Systems/Ghost/Controls/Roles/MakeGhostRoleWindow.xaml.cs index 4dbdd91af84..6ce3d7da6b9 100644 --- a/Content.Client/UserInterface/Systems/Ghost/Controls/Roles/MakeGhostRoleWindow.xaml.cs +++ b/Content.Client/UserInterface/Systems/Ghost/Controls/Roles/MakeGhostRoleWindow.xaml.cs @@ -1,4 +1,5 @@ -using Robust.Client.AutoGenerated; +using System.Numerics; +using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.XAML; using static Robust.Client.UserInterface.Controls.BaseButton; @@ -14,14 +15,14 @@ public MakeGhostRoleWindow() { RobustXamlLoader.Load(this); - MakeSentientLabel.MinSize = (150, 0); - RoleEntityLabel.MinSize = (150, 0); - RoleNameLabel.MinSize = (150, 0); - RoleName.MinSize = (300, 0); - RoleDescriptionLabel.MinSize = (150, 0); - RoleDescription.MinSize = (300, 0); - RoleRulesLabel.MinSize = (150, 0); - RoleRules.MinSize = (300, 0); + MakeSentientLabel.MinSize = new Vector2(150, 0); + RoleEntityLabel.MinSize = new Vector2(150, 0); + RoleNameLabel.MinSize = new Vector2(150, 0); + RoleName.MinSize = new Vector2(300, 0); + RoleDescriptionLabel.MinSize = new Vector2(150, 0); + RoleDescription.MinSize = new Vector2(300, 0); + RoleRulesLabel.MinSize = new Vector2(150, 0); + RoleRules.MinSize = new Vector2(300, 0); MakeButton.OnPressed += OnPressed; } diff --git a/Content.Client/UserInterface/Systems/Inventory/Controls/InventoryDisplay.cs b/Content.Client/UserInterface/Systems/Inventory/Controls/InventoryDisplay.cs index 0110463f4ff..0d49a5b53c9 100644 --- a/Content.Client/UserInterface/Systems/Inventory/Controls/InventoryDisplay.cs +++ b/Content.Client/UserInterface/Systems/Inventory/Controls/InventoryDisplay.cs @@ -1,4 +1,5 @@ -using Content.Client.UserInterface.Controls; +using System.Numerics; +using Content.Client.UserInterface.Controls; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; diff --git a/Content.Client/VendingMachines/UI/VendingMachineMenu.xaml.cs b/Content.Client/VendingMachines/UI/VendingMachineMenu.xaml.cs index 1dead838ce9..d0d21e4a6ed 100644 --- a/Content.Client/VendingMachines/UI/VendingMachineMenu.xaml.cs +++ b/Content.Client/VendingMachines/UI/VendingMachineMenu.xaml.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.VendingMachines; using Robust.Client.AutoGenerated; using Robust.Client.GameObjects; @@ -18,7 +19,7 @@ public sealed partial class VendingMachineMenu : DefaultWindow public VendingMachineMenu() { - MinSize = SetSize = (250, 150); + MinSize = SetSize = new Vector2(250, 150); RobustXamlLoader.Load(this); IoCManager.InjectDependencies(this); @@ -81,7 +82,7 @@ public void Populate(List inventory) private void SetSizeAfterUpdate(int longestEntryLength) { - SetSize = (Math.Clamp((longestEntryLength + 2) * 12, 250, 300), + SetSize = new Vector2(Math.Clamp((longestEntryLength + 2) * 12, 250, 300), Math.Clamp(VendingContents.Count * 50, 150, 350)); } } diff --git a/Content.Client/Verbs/UI/VerbMenuElement.cs b/Content.Client/Verbs/UI/VerbMenuElement.cs index e5361a1ea6e..3f47fb55753 100644 --- a/Content.Client/Verbs/UI/VerbMenuElement.cs +++ b/Content.Client/Verbs/UI/VerbMenuElement.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.ContextMenu.UI; using Content.Shared.Verbs; using Robust.Client.GameObjects; @@ -48,7 +49,7 @@ public VerbMenuElement(Verb verb) : base(verb.Text) var spriteView = new SpriteView() { OverrideDirection = Direction.South, - SetSize = (ElementHeight, ElementHeight), + SetSize = new Vector2(ElementHeight, ElementHeight), Sprite = entManager.GetComponentOrNull(verb.IconEntity.Value) }; diff --git a/Content.Client/Verbs/UI/VerbMenuUIController.cs b/Content.Client/Verbs/UI/VerbMenuUIController.cs index 62d986c658b..6ede75f33b0 100644 --- a/Content.Client/Verbs/UI/VerbMenuUIController.cs +++ b/Content.Client/Verbs/UI/VerbMenuUIController.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.CombatMode; using Content.Client.ContextMenu.UI; using Content.Client.Gameplay; @@ -93,7 +94,7 @@ public void OpenVerbMenu(EntityUid target, bool force = false, ContextMenuPopup? // Show the menu at mouse pos menu.SetPositionLast(); - var box = UIBox2.FromDimensions(_userInterfaceManager.MousePositionScaled.Position, (1, 1)); + var box = UIBox2.FromDimensions(_userInterfaceManager.MousePositionScaled.Position, new Vector2(1, 1)); menu.Open(box); } diff --git a/Content.Client/Viewport/ScalingViewport.cs b/Content.Client/Viewport/ScalingViewport.cs index 64a8957b5ce..69b5d515673 100644 --- a/Content.Client/Viewport/ScalingViewport.cs +++ b/Content.Client/Viewport/ScalingViewport.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Numerics; using Robust.Client.Graphics; using Robust.Client.Input; using Robust.Client.UserInterface; @@ -225,7 +226,7 @@ private void RegenerateViewport() Filter = StretchMode == ScalingViewportStretchMode.Bilinear, }); - _viewport.RenderScale = (renderScale, renderScale); + _viewport.RenderScale = new Vector2(renderScale, renderScale); _viewport.Eye = _eye; } diff --git a/Content.Client/Voting/UI/VoteCallMenu.xaml.cs b/Content.Client/Voting/UI/VoteCallMenu.xaml.cs index e62baba7e2a..0eede4c4804 100644 --- a/Content.Client/Voting/UI/VoteCallMenu.xaml.cs +++ b/Content.Client/Voting/UI/VoteCallMenu.xaml.cs @@ -1,4 +1,5 @@ using System; +using System.Numerics; using Content.Client.Stylesheets; using Content.Shared.Administration; using Content.Shared.Voting; diff --git a/Content.Client/Weapons/Melee/MeleeArcOverlay.cs b/Content.Client/Weapons/Melee/MeleeArcOverlay.cs index 99ef6ca41de..dcbbb3219ba 100644 --- a/Content.Client/Weapons/Melee/MeleeArcOverlay.cs +++ b/Content.Client/Weapons/Melee/MeleeArcOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.CombatMode; using Content.Shared.Weapons.Melee; using Robust.Client.Graphics; @@ -61,7 +62,7 @@ protected override void Draw(in OverlayDrawArgs args) 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) diff --git a/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs b/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs index 486c1df3aff..f841c9bff56 100644 --- a/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs +++ b/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs @@ -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 override void DoLunge(EntityUid user, Angle angle, Vector2 localPos, stri 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(); var xform = xformQuery.GetComponent(animationUid); @@ -274,7 +275,7 @@ private Animation GetLungeAnimation(Vector2 direction) 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) } } diff --git a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs index 2f7f09ae986..8f49d569948 100644 --- a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs +++ b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs @@ -177,7 +177,7 @@ public override void Update(float frameTime) 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 @@ private void ClientHeavyAttack(EntityUid user, EntityCoordinates coordinates, En 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. diff --git a/Content.Client/Weapons/Melee/MeleeWindupOverlay.cs b/Content.Client/Weapons/Melee/MeleeWindupOverlay.cs index 9f5193a3caa..55e66d6c9d0 100644 --- a/Content.Client/Weapons/Melee/MeleeWindupOverlay.cs +++ b/Content.Client/Weapons/Melee/MeleeWindupOverlay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Weapons.Melee; using Robust.Client.GameObjects; using Robust.Client.Graphics; diff --git a/Content.Client/Weapons/Misc/TetherGunOverlay.cs b/Content.Client/Weapons/Misc/TetherGunOverlay.cs index 142d9da8232..57657829033 100644 --- a/Content.Client/Weapons/Misc/TetherGunOverlay.cs +++ b/Content.Client/Weapons/Misc/TetherGunOverlay.cs @@ -41,7 +41,7 @@ protected override void Draw(in OverlayDrawArgs args) 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; diff --git a/Content.Client/Weapons/Ranged/Systems/GunSystem.AmmoCounter.cs b/Content.Client/Weapons/Ranged/Systems/GunSystem.AmmoCounter.cs index f9914df4701..288c730c416 100644 --- a/Content.Client/Weapons/Ranged/Systems/GunSystem.AmmoCounter.cs +++ b/Content.Client/Weapons/Ranged/Systems/GunSystem.AmmoCounter.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.IoC; using Content.Client.Items; using Content.Client.Resources; @@ -232,7 +233,7 @@ public BoxesStatusControl() }), } }, - new Control() { MinSize = (5, 0) }, + new Control() { MinSize = new Vector2(5, 0) }, (_ammoCount = new Label { StyleClasses = { StyleNano.StyleClassItemStatus }, @@ -267,7 +268,7 @@ private static void FillBulletRow(Control container, int count, int capacity) { BackgroundColor = colorGone, }, - MinSize = (10, 15), + MinSize = new Vector2(10, 15), }); } @@ -281,7 +282,7 @@ private static void FillBulletRow(Control container, int count, int capacity) { BackgroundColor = color, }, - MinSize = (10, 15), + MinSize = new Vector2(10, 15), }); } } @@ -312,7 +313,7 @@ public ChamberMagazineStatusControl() 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 ChamberMagazineStatusControl() }) } }, - new Control() { MinSize = (5,0) }, + new Control() { MinSize = new Vector2(5,0) }, (_ammoCount = new Label { StyleClasses = {StyleNano.StyleClassItemStatus}, @@ -478,7 +479,7 @@ private void FillBulletRow(int currentIndex, bool?[] bullets, Control container, box.AddChild(new TextureRect { Texture = texture, - TextureScale = (scale, scale), + TextureScale = new Vector2(scale, scale), ModulateSelfOverride = Color.LimeGreen, }); } diff --git a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs index de539eb5ba2..d06f8b16585 100644 --- a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs @@ -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 @@ private void Recoil(EntityUid? user, Vector2 recoil, float recoilScalar) 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) diff --git a/Content.Client/Weather/WeatherOverlay.cs b/Content.Client/Weather/WeatherOverlay.cs index 1c5fe4230a6..6d386addb33 100644 --- a/Content.Client/Weather/WeatherOverlay.cs +++ b/Content.Client/Weather/WeatherOverlay.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Client.Parallax; using Content.Shared.Weather; using OpenToolkit.Graphics.ES11; @@ -201,7 +202,7 @@ private void DrawWorld(in OverlayDrawArgs args, WeatherPrototype weatherProto, f { for (var y = flooredBL.Y; y < args.WorldAABB.Top; y += size.Y) { - var box = Box2.FromDimensions((x, y), size); + var box = Box2.FromDimensions(new Vector2(x, y), size); worldHandle.DrawTextureRect(sprite, box, (weatherProto.Color ?? Color.White).WithAlpha(alpha)); } } diff --git a/Content.Client/Weather/WeatherSystem.cs b/Content.Client/Weather/WeatherSystem.cs index 54e53e12936..43ad41ceaad 100644 --- a/Content.Client/Weather/WeatherSystem.cs +++ b/Content.Client/Weather/WeatherSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Weather; using Robust.Client.GameObjects; using Robust.Client.Graphics; @@ -101,7 +102,7 @@ protected override void Run(EntityUid uid, WeatherData weather, WeatherPrototype { 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 @@ protected override void Run(EntityUid uid, WeatherData weather, WeatherPrototype } nearestNode = new EntityCoordinates(entXform.GridUid.Value, - (Vector2) node.GridIndices + (grid.TileSize / 2f)); + (Vector2) node.GridIndices + (grid.TileSizeHalfVector)); break; } @@ -125,11 +126,11 @@ protected override void Run(EntityUid uid, WeatherData weather, WeatherPrototype 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); } } } diff --git a/Content.Client/Wires/UI/WiresMenu.cs b/Content.Client/Wires/UI/WiresMenu.cs index bfbb2ebd223..7bccc208616 100644 --- a/Content.Client/Wires/UI/WiresMenu.cs +++ b/Content.Client/Wires/UI/WiresMenu.cs @@ -1,4 +1,5 @@ using System; +using System.Numerics; using Content.Client.Examine; using Content.Client.Resources; using Content.Client.Stylesheets; @@ -74,7 +75,7 @@ public WiresMenu(WiresBoundUserInterface owner) { new PanelContainer { - MinSize = (2, 0), + MinSize = new Vector2(2, 0), PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")} }, new PanelContainer @@ -86,7 +87,7 @@ public WiresMenu(WiresBoundUserInterface owner) }, new PanelContainer { - MinSize = (2, 0), + MinSize = new Vector2(2, 0), PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")} }, } @@ -103,9 +104,9 @@ public WiresMenu(WiresBoundUserInterface owner) VerticalAlignment = VAlignment.Bottom }; - wrappingHBox.AddChild(new Control {MinSize = (20, 0)}); + wrappingHBox.AddChild(new Control {MinSize = new Vector2(20, 0)}); wrappingHBox.AddChild(_wiresHBox); - wrappingHBox.AddChild(new Control {MinSize = (20, 0)}); + wrappingHBox.AddChild(new Control {MinSize = new Vector2(20, 0)}); bottomWrap.AddChild(bottomPanel); @@ -142,7 +143,7 @@ public WiresMenu(WiresBoundUserInterface owner) { Orientation = LayoutOrientation.Vertical }), - new Control {MinSize = (0, 110)} + new Control {MinSize = new Vector2(0, 110)} } }; @@ -195,7 +196,7 @@ public WiresMenu(WiresBoundUserInterface owner) var popup = new HelpPopup(); UserInterfaceManager.ModalRoot.AddChild(popup); - popup.Open(UIBox2.FromDimensions(a.Event.PointerLocation.Position, (400, 200))); + popup.Open(UIBox2.FromDimensions(a.Event.PointerLocation.Position, new Vector2(400, 200))); }; var middle = new PanelContainer @@ -222,17 +223,17 @@ public WiresMenu(WiresBoundUserInterface owner) _topContainer.AddChild(topRow); _topContainer.AddChild(new PanelContainer { - MinSize = (0, 2), + MinSize = new Vector2(0, 2), PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")} }); _topContainer.AddChild(middle); _topContainer.AddChild(new PanelContainer { - MinSize = (0, 2), + MinSize = new Vector2(0, 2), PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")} }); CloseButton.OnPressed += _ => Close(); - SetSize = (320, 200); + SetSize = new Vector2(320, 200); } @@ -265,7 +266,6 @@ public void Populate(WiresBoundUserInterfaceState state) }; } - _statusContainer.RemoveAllChildren(); foreach (var status in state.Statuses) @@ -342,7 +342,7 @@ public WireControl(WireColor color, WireLetter letter, bool isCut, bool flip, bo }; layout.AddChild(contact1); - LayoutContainer.SetPosition(contact1, (0, 0)); + LayoutContainer.SetPosition(contact1, new Vector2(0, 0)); var contact2 = new TextureRect { @@ -351,15 +351,15 @@ public WireControl(WireColor color, WireLetter letter, bool isCut, bool flip, bo }; layout.AddChild(contact2); - LayoutContainer.SetPosition(contact2, (0, 60)); + LayoutContainer.SetPosition(contact2, new Vector2(0, 60)); var wire = new WireRender(color, isCut, flip, mirror, type, _resourceCache); layout.AddChild(wire); - LayoutContainer.SetPosition(wire, (2, 16)); + LayoutContainer.SetPosition(wire, new Vector2(2, 16)); ToolTip = color.Name(); - MinSize = (20, 102); + MinSize = new Vector2(20, 102); } protected override void KeyBindDown(GUIBoundKeyEventArgs args) @@ -424,7 +424,7 @@ public WireRender(WireColor color, bool isCut, bool flip, bool mirror, int type, _mirror = mirror; _type = type; - SetSize = (16, 50); + SetSize = new Vector2(16, 50); } protected override void Draw(DrawingHandleScreen handle) @@ -516,7 +516,7 @@ public StatusLight(StatusLightData data, IResourceCache resourceCache) var lightContainer = new Control { - SetSize = (20, 20), + SetSize = new Vector2(20, 20), Children = { new TextureRect @@ -583,7 +583,7 @@ public StatusLight(StatusLightData data, IResourceCache resourceCache) VerticalAlignment = VAlignment.Center, }); hBox.AddChild(lightContainer); - hBox.AddChild(new Control {MinSize = (6, 0)}); + hBox.AddChild(new Control {MinSize = new Vector2(6, 0)}); AddChild(hBox); } } diff --git a/Content.IntegrationTests/DummyParallaxManager.cs b/Content.IntegrationTests/DummyParallaxManager.cs index 2daa682673f..6379d5cd891 100644 --- a/Content.IntegrationTests/DummyParallaxManager.cs +++ b/Content.IntegrationTests/DummyParallaxManager.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Parallax.Managers; using Content.Client.Parallax; using Robust.Shared.Maths; diff --git a/Content.IntegrationTests/Tests/Body/LegTest.cs b/Content.IntegrationTests/Tests/Body/LegTest.cs index cd5fa23da0c..5932c4211ad 100644 --- a/Content.IntegrationTests/Tests/Body/LegTest.cs +++ b/Content.IntegrationTests/Tests/Body/LegTest.cs @@ -1,4 +1,5 @@ -using Content.Server.Body.Systems; +using System.Numerics; +using Content.Server.Body.Systems; using Content.Shared.Body.Components; using Content.Shared.Body.Part; using Content.Shared.Rotation; diff --git a/Content.IntegrationTests/Tests/Body/LungTest.cs b/Content.IntegrationTests/Tests/Body/LungTest.cs index 637740d64d4..e6122456618 100644 --- a/Content.IntegrationTests/Tests/Body/LungTest.cs +++ b/Content.IntegrationTests/Tests/Body/LungTest.cs @@ -11,6 +11,7 @@ using Robust.Shared.Map.Components; using Robust.Shared.Maths; using System.Linq; +using System.Numerics; namespace Content.IntegrationTests.Tests.Body { diff --git a/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs b/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs index 2421e065608..ebf175b81c4 100644 --- a/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs +++ b/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Body.Systems; using Content.Shared.Buckle; using Content.Shared.ActionBlocker; @@ -181,7 +182,7 @@ await server.WaitAssertion(() => // Move away from the chair var xformQuery = entityManager.GetEntityQuery(); var oldWorldPosition = xformSystem.GetWorldPosition(chair, xformQuery); - xformSystem.SetWorldPosition(human, oldWorldPosition + (1000, 1000), xformQuery); + xformSystem.SetWorldPosition(human, oldWorldPosition + new Vector2(1000, 1000), xformQuery); // Out of range #pragma warning disable NUnit2045 // Interdependent asserts. @@ -192,7 +193,7 @@ await server.WaitAssertion(() => // Move near the chair oldWorldPosition = xformSystem.GetWorldPosition(chair, xformQuery); - xformSystem.SetWorldPosition(human, oldWorldPosition + (0.5f, 0), xformQuery); + xformSystem.SetWorldPosition(human, oldWorldPosition + new Vector2(0.5f, 0), xformQuery); // In range #pragma warning disable NUnit2045 // Interdependent asserts. @@ -219,7 +220,7 @@ await server.WaitAssertion(() => // Move away from the chair oldWorldPosition = xformSystem.GetWorldPosition(chair, xformQuery); - xformSystem.SetWorldPosition(human, oldWorldPosition + (1, 0), xformQuery); + xformSystem.SetWorldPosition(human, oldWorldPosition + new Vector2(1, 0), xformQuery); }); await server.WaitRunTicks(1); @@ -378,7 +379,7 @@ await server.WaitAssertion(() => // Move the buckled entity away var xformQuery = entityManager.GetEntityQuery(); var oldWorldPosition = xformSystem.GetWorldPosition(chair, xformQuery); - xformSystem.SetWorldPosition(human, oldWorldPosition + (100, 0), xformQuery); + xformSystem.SetWorldPosition(human, oldWorldPosition + new Vector2(100, 0), xformQuery); }); await PoolManager.WaitUntil(server, () => !buckle.Buckled, 10); diff --git a/Content.IntegrationTests/Tests/CargoTest.cs b/Content.IntegrationTests/Tests/CargoTest.cs index 86810453ca3..88c96bb04b8 100644 --- a/Content.IntegrationTests/Tests/CargoTest.cs +++ b/Content.IntegrationTests/Tests/CargoTest.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Cargo.Components; using Content.Server.Cargo.Systems; using Content.Shared.Cargo.Prototypes; diff --git a/Content.IntegrationTests/Tests/ClickableTest.cs b/Content.IntegrationTests/Tests/ClickableTest.cs index 2a88a181d9c..fd19114c2c2 100644 --- a/Content.IntegrationTests/Tests/ClickableTest.cs +++ b/Content.IntegrationTests/Tests/ClickableTest.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Client.Clickable; using Robust.Client.GameObjects; using Robust.Client.Graphics; @@ -70,7 +71,7 @@ await server.WaitPost(() => await client.WaitPost(() => { var sprite = spriteQuery.GetComponent(entity); - sprite.Scale = (scale, scale); + sprite.Scale = new Vector2(scale, scale); // these tests currently all assume player eye is 0 eyeManager.CurrentEye.Rotation = 0; @@ -78,7 +79,7 @@ await client.WaitPost(() => var pos = clientEntManager.System().GetWorldPosition(entity); var clickable = clientEntManager.GetComponent(entity); - hit = clickable.CheckClick(sprite, xformQuery.GetComponent(entity), xformQuery, (clickPosX, clickPosY) + pos, eye, out _, out _, out _); + hit = clickable.CheckClick(sprite, xformQuery.GetComponent(entity), xformQuery, new Vector2(clickPosX, clickPosY) + pos, eye, out _, out _, out _); }); await server.WaitPost(() => diff --git a/Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs b/Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs index f23e2932488..6d68bfd4f31 100644 --- a/Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs +++ b/Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Construction.Components; using Content.Shared.Construction.Prototypes; using Robust.Shared.GameObjects; diff --git a/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs b/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs index 089950aa192..5596cb2e6de 100644 --- a/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs +++ b/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Storage.EntitySystems; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; diff --git a/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs b/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs index 7c53522b5e7..4ac8111a50c 100644 --- a/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs +++ b/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.DeviceNetwork; using Content.Server.DeviceNetwork.Components; using Content.Server.DeviceNetwork.Systems; @@ -156,7 +157,7 @@ await server.WaitAssertion(() => Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty)); }); - device2 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", new MapCoordinates(new Robust.Shared.Maths.Vector2(0, 50), testMap.MapId)); + device2 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", new MapCoordinates(new Vector2(0, 50), testMap.MapId)); Assert.That(entityManager.TryGetComponent(device2, out networkComponent2), Is.True); Assert.Multiple(() => diff --git a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs index 948252e5cc4..e90ed8ff4a1 100644 --- a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs +++ b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs @@ -1,5 +1,6 @@ #nullable enable annotations using System.Linq; +using System.Numerics; using Content.Server.Disposal.Tube.Components; using Content.Server.Disposal.Unit.Components; using Content.Server.Disposal.Unit.EntitySystems; @@ -210,7 +211,7 @@ await server.WaitAssertion(() => // Move the disposal trunk away var xform = entityManager.GetComponent(disposalTrunk); var worldPos = xformSystem.GetWorldPosition(disposalTrunk); - xformSystem.SetWorldPosition(xform, worldPos + (1, 0)); + xformSystem.SetWorldPosition(xform, worldPos + new Vector2(1, 0)); // Fail to flush with a mob and an item Flush(disposalUnit, unitComponent, false, disposalSystem, human, wrench); @@ -221,7 +222,7 @@ await server.WaitAssertion(() => // Move the disposal trunk back var xform = entityManager.GetComponent(disposalTrunk); var worldPos = xformSystem.GetWorldPosition(disposalTrunk); - xformSystem.SetWorldPosition(xform, worldPos - (1, 0)); + xformSystem.SetWorldPosition(xform, worldPos - new Vector2(1, 0)); // Fail to flush with a mob and an item, no power Flush(disposalUnit, unitComponent, false, disposalSystem, human, wrench); diff --git a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs index b856169d99c..15a0e800b10 100644 --- a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs +++ b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Doors.Systems; using Content.Shared.Doors.Components; using Robust.Shared.GameObjects; @@ -139,10 +140,10 @@ await server.WaitAssertion(() => { var mapId = mapManager.CreateMap(); - var humanCoordinates = new MapCoordinates((physicsDummyStartingX, 0), mapId); + var humanCoordinates = new MapCoordinates(new Vector2(physicsDummyStartingX, 0), mapId); physicsDummy = entityManager.SpawnEntity("PhysicsDummy", humanCoordinates); - airlock = entityManager.SpawnEntity("AirlockDummy", new MapCoordinates((0, 0), mapId)); + airlock = entityManager.SpawnEntity("AirlockDummy", new MapCoordinates(new Vector2(0, 0), mapId)); Assert.Multiple(() => { diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs index 10ddc528db1..f8334514613 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs @@ -1,4 +1,5 @@ #nullable enable +using System.Numerics; using Content.Server.Cuffs; using Content.Shared.Body.Components; using Content.Shared.Cuffs.Components; diff --git a/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs b/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs index ff1466fbfaa..d2bf1ab92b2 100644 --- a/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs +++ b/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs @@ -1,4 +1,5 @@ #nullable enable annotations +using System.Numerics; using Content.Server.Interaction; using Content.Shared.Hands.Components; using Content.Shared.Hands.EntitySystems; @@ -142,10 +143,10 @@ await server.WaitAssertion(() => user = sEntities.SpawnEntity(null, coords); user.EnsureComponent(); handSys.AddHand(user, "hand", HandLocation.Left); - target = sEntities.SpawnEntity(null, new MapCoordinates((1.9f, 0), mapId)); + target = sEntities.SpawnEntity(null, new MapCoordinates(new Vector2(1.9f, 0), mapId)); item = sEntities.SpawnEntity(null, coords); item.EnsureComponent(); - wall = sEntities.SpawnEntity("DummyDebugWall", new MapCoordinates((1, 0), sEntities.GetComponent(user).MapID)); + wall = sEntities.SpawnEntity("DummyDebugWall", new MapCoordinates(new Vector2(1, 0), sEntities.GetComponent(user).MapID)); }); await server.WaitRunTicks(1); @@ -212,7 +213,7 @@ await server.WaitAssertion(() => user = sEntities.SpawnEntity(null, coords); user.EnsureComponent(); handSys.AddHand(user, "hand", HandLocation.Left); - target = sEntities.SpawnEntity(null, new MapCoordinates((InteractionSystem.InteractionRange - 0.1f, 0), mapId)); + target = sEntities.SpawnEntity(null, new MapCoordinates(new Vector2(SharedInteractionSystem.InteractionRange - 0.1f, 0), mapId)); item = sEntities.SpawnEntity(null, coords); item.EnsureComponent(); }); @@ -282,7 +283,7 @@ await server.WaitAssertion(() => user = sEntities.SpawnEntity(null, coords); user.EnsureComponent(); handSys.AddHand(user, "hand", HandLocation.Left); - target = sEntities.SpawnEntity(null, new MapCoordinates((SharedInteractionSystem.InteractionRange + 0.01f, 0), mapId)); + target = sEntities.SpawnEntity(null, new MapCoordinates(new Vector2(SharedInteractionSystem.InteractionRange + 0.01f, 0), mapId)); item = sEntities.SpawnEntity(null, coords); item.EnsureComponent(); }); diff --git a/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs b/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs index f7b77f454e2..ed6766fa700 100644 --- a/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs +++ b/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Interaction; using Robust.Shared.Containers; using Robust.Shared.GameObjects; @@ -16,7 +17,7 @@ public sealed class InRangeUnobstructed private const float InteractionRangeDivided15 = InteractionRange / 1.5f; - private readonly (float, float) _interactionRangeDivided15X = (InteractionRangeDivided15, 0f); + private static readonly Vector2 InteractionRangeDivided15X = new(InteractionRangeDivided15, 0f); private const float InteractionRangeDivided15Times3 = InteractionRangeDivided15 * 3; @@ -67,7 +68,7 @@ await server.WaitAssertion(() => }); // Move them slightly apart - xformSys.SetLocalPosition(origin, xform.LocalPosition + _interactionRangeDivided15X, xform); + xformSys.SetLocalPosition(origin, xform.LocalPosition + InteractionRangeDivided15X, xform); Assert.Multiple(() => { diff --git a/Content.IntegrationTests/Tests/Interaction/InteractionTest.Helpers.cs b/Content.IntegrationTests/Tests/Interaction/InteractionTest.Helpers.cs index 7fccab140df..cd19803772d 100644 --- a/Content.IntegrationTests/Tests/Interaction/InteractionTest.Helpers.cs +++ b/Content.IntegrationTests/Tests/Interaction/InteractionTest.Helpers.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; +using System.Numerics; using System.Reflection; using Content.Client.Construction; using Content.Server.Atmos; @@ -532,7 +533,7 @@ protected async Task> DoEntityLookup(LookupFlags flags = Look await Server.WaitPost(() => { // Get all entities left behind by deconstruction - entities = lookup.GetEntitiesIntersecting(MapId, Box2.CentredAroundZero((10, 10)), flags); + entities = lookup.GetEntitiesIntersecting(MapId, Box2.CentredAroundZero(new Vector2(10, 10)), flags); var xformQuery = SEntMan.GetEntityQuery(); diff --git a/Content.IntegrationTests/Tests/Interaction/InteractionTest.cs b/Content.IntegrationTests/Tests/Interaction/InteractionTest.cs index d18fa415ef9..f3c2a835ca0 100644 --- a/Content.IntegrationTests/Tests/Interaction/InteractionTest.cs +++ b/Content.IntegrationTests/Tests/Interaction/InteractionTest.cs @@ -1,5 +1,6 @@ #nullable enable using System.Linq; +using System.Numerics; using Content.Client.Construction; using Content.Client.Examine; using Content.Server.Body.Systems; @@ -171,8 +172,8 @@ public virtual async Task Setup() // Setup map. MapData = await PoolManager.CreateTestMap(PairTracker); - PlayerCoords = MapData.GridCoords.Offset((0.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan); - TargetCoords = MapData.GridCoords.Offset((1.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan); + PlayerCoords = MapData.GridCoords.Offset(new Vector2(0.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan); + TargetCoords = MapData.GridCoords.Offset(new Vector2(1.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan); await SetTile(Plating, grid: MapData.MapGrid); // Get player data diff --git a/Content.IntegrationTests/Tests/Interaction/MovementTest.cs b/Content.IntegrationTests/Tests/Interaction/MovementTest.cs index 3fb37b0081c..178439d8e29 100644 --- a/Content.IntegrationTests/Tests/Interaction/MovementTest.cs +++ b/Content.IntegrationTests/Tests/Interaction/MovementTest.cs @@ -1,4 +1,5 @@ #nullable enable +using System.Numerics; using Robust.Shared.GameObjects; namespace Content.IntegrationTests.Tests.Interaction; @@ -28,14 +29,14 @@ public override async Task Setup() await base.Setup(); for (var i = -Tiles; i <= Tiles; i++) { - await SetTile(Plating, PlayerCoords.Offset((i, 0)), MapData.MapGrid); + await SetTile(Plating, PlayerCoords.Offset(new Vector2(i, 0)), MapData.MapGrid); } AssertGridCount(1); if (AddWalls) { - await SpawnEntity("WallSolid", PlayerCoords.Offset((-Tiles, 0))); - await SpawnEntity("WallSolid", PlayerCoords.Offset((Tiles, 0))); + await SpawnEntity("WallSolid", PlayerCoords.Offset(new Vector2(-Tiles, 0))); + await SpawnEntity("WallSolid", PlayerCoords.Offset(new Vector2(Tiles, 0))); } await AddGravity(); diff --git a/Content.IntegrationTests/Tests/Networking/AutoPredictReconcileTest.cs b/Content.IntegrationTests/Tests/Networking/AutoPredictReconcileTest.cs index a9b76138760..b3e7efa9747 100644 --- a/Content.IntegrationTests/Tests/Networking/AutoPredictReconcileTest.cs +++ b/Content.IntegrationTests/Tests/Networking/AutoPredictReconcileTest.cs @@ -1,6 +1,7 @@ #nullable enable using System.Collections.Generic; using System.Linq; +using System.Numerics; using Robust.Client.GameStates; using Robust.Client.Timing; using Robust.Server.Player; @@ -65,7 +66,7 @@ await server.WaitPost(() => // Spawn dummy component entity. var map = sMapManager.CreateMap(); var player = sPlayerManager.ServerSessions.Single(); - serverEnt = sEntityManager.SpawnEntity(null, new MapCoordinates((0, 0), map)); + serverEnt = sEntityManager.SpawnEntity(null, new MapCoordinates(new Vector2(0, 0), map)); serverComponent = sEntityManager.AddComponent(serverEnt); // Make client "join game" so they receive game state updates. diff --git a/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs b/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs index eecaef69955..e0c4c607fa7 100644 --- a/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs +++ b/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs @@ -1,6 +1,7 @@ #nullable enable using System.Collections.Generic; using System.Linq; +using System.Numerics; using Robust.Client.GameStates; using Robust.Client.Timing; using Robust.Server.Player; @@ -66,7 +67,7 @@ await server.WaitPost(() => // Spawn dummy component entity. var map = sMapManager.CreateMap(); var player = sPlayerManager.ServerSessions.Single(); - serverEnt = sEntityManager.SpawnEntity(null, new MapCoordinates((0, 0), map)); + serverEnt = sEntityManager.SpawnEntity(null, new MapCoordinates(new Vector2(0, 0), map)); serverComponent = sEntityManager.AddComponent(serverEnt); // Make client "join game" so they receive game state updates. diff --git a/Content.IntegrationTests/Tests/Networking/SystemPredictReconcileTest.cs b/Content.IntegrationTests/Tests/Networking/SystemPredictReconcileTest.cs index 19f7f10c2e4..2447540dc9e 100644 --- a/Content.IntegrationTests/Tests/Networking/SystemPredictReconcileTest.cs +++ b/Content.IntegrationTests/Tests/Networking/SystemPredictReconcileTest.cs @@ -1,6 +1,7 @@ #nullable enable using System.Collections.Generic; using System.Linq; +using System.Numerics; using Robust.Client.GameStates; using Robust.Client.Timing; using Robust.Server.Player; @@ -65,7 +66,7 @@ await server.WaitPost(() => // Spawn dummy component entity. var map = sMapManager.CreateMap(); var player = sPlayerManager.ServerSessions.Single(); - serverEnt = sEntityManager.SpawnEntity(null, new MapCoordinates((0, 0), map)); + serverEnt = sEntityManager.SpawnEntity(null, new MapCoordinates(new Vector2(0, 0), map)); serverComponent = sEntityManager.AddComponent(serverEnt); // Make client "join game" so they receive game state updates. diff --git a/Content.IntegrationTests/Tests/SaveLoadMapTest.cs b/Content.IntegrationTests/Tests/SaveLoadMapTest.cs index e6af36e36a7..84702aec666 100644 --- a/Content.IntegrationTests/Tests/SaveLoadMapTest.cs +++ b/Content.IntegrationTests/Tests/SaveLoadMapTest.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.CCVar; using Robust.Server.GameObjects; using Robust.Shared.Configuration; diff --git a/Content.IntegrationTests/Tests/Shuttle/DockTest.cs b/Content.IntegrationTests/Tests/Shuttle/DockTest.cs index 7ee4aa5271d..4931134275f 100644 --- a/Content.IntegrationTests/Tests/Shuttle/DockTest.cs +++ b/Content.IntegrationTests/Tests/Shuttle/DockTest.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Numerics; using Content.Server.Shuttles.Systems; using Content.Tests; using Robust.Shared.GameObjects; diff --git a/Content.IntegrationTests/Tests/ShuttleTest.cs b/Content.IntegrationTests/Tests/ShuttleTest.cs index 08dc30bb33f..640334522fb 100644 --- a/Content.IntegrationTests/Tests/ShuttleTest.cs +++ b/Content.IntegrationTests/Tests/ShuttleTest.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Shuttles.Components; using Robust.Shared.GameObjects; using Robust.Shared.Map; @@ -34,7 +35,7 @@ await server.WaitAssertion(() => Assert.Multiple(() => { Assert.That(entManager.HasComponent(gridEnt)); - Assert.That(entManager.TryGetComponent(gridEnt, out gridPhys)); + Assert.That(entManager.TryGetComponent(gridEnt, out gridPhys)); }); Assert.Multiple(() => { diff --git a/Content.MapRenderer/MapViewerData.cs b/Content.MapRenderer/MapViewerData.cs index 7c61373af95..b7b720e0044 100644 --- a/Content.MapRenderer/MapViewerData.cs +++ b/Content.MapRenderer/MapViewerData.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Numerics; using Robust.Shared.Maths; using SixLabors.ImageSharp.PixelFormats; diff --git a/Content.MapRenderer/Painters/GridPainter.cs b/Content.MapRenderer/Painters/GridPainter.cs index 519b991da13..6b9dd128cc6 100644 --- a/Content.MapRenderer/Painters/GridPainter.cs +++ b/Content.MapRenderer/Painters/GridPainter.cs @@ -2,6 +2,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; +using System.Numerics; using System.Runtime.InteropServices; using Content.Shared.Decals; using Robust.Client.GameObjects; diff --git a/Content.MapRenderer/RenderedGridImage.cs b/Content.MapRenderer/RenderedGridImage.cs index 8d08e8f3c13..759aee2e2fe 100644 --- a/Content.MapRenderer/RenderedGridImage.cs +++ b/Content.MapRenderer/RenderedGridImage.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +using System.Numerics; +using Robust.Shared.GameObjects; using Robust.Shared.Maths; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; diff --git a/Content.Server/Administration/Commands/ExplosionCommand.cs b/Content.Server/Administration/Commands/ExplosionCommand.cs index 9a509f7fa32..d48b69a5ad2 100644 --- a/Content.Server/Administration/Commands/ExplosionCommand.cs +++ b/Content.Server/Administration/Commands/ExplosionCommand.cs @@ -8,6 +8,7 @@ using Robust.Shared.Map; using Robust.Shared.Prototypes; using System.Linq; +using System.Numerics; namespace Content.Server.Administration.Commands; @@ -90,7 +91,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args) shell.WriteError($"Failed to parse map ID: {args[5]}"); return; } - coords = new MapCoordinates((x, y), new(parsed)); + coords = new MapCoordinates(new Vector2(x, y), new(parsed)); } else { @@ -103,7 +104,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args) } if (args.Length > 4) - coords = new MapCoordinates((x, y), xform.MapID); + coords = new MapCoordinates(new Vector2(x, y), xform.MapID); else coords = xform.MapPosition; } diff --git a/Content.Server/Administration/Commands/LoadGameMapCommand.cs b/Content.Server/Administration/Commands/LoadGameMapCommand.cs index ead73abb142..ea31c1ecb17 100644 --- a/Content.Server/Administration/Commands/LoadGameMapCommand.cs +++ b/Content.Server/Administration/Commands/LoadGameMapCommand.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.GameTicking; using Content.Server.Maps; using Content.Shared.Administration; diff --git a/Content.Server/Administration/Commands/WarpCommand.cs b/Content.Server/Administration/Commands/WarpCommand.cs index 13945f5ab97..282bb61cc01 100644 --- a/Content.Server/Administration/Commands/WarpCommand.cs +++ b/Content.Server/Administration/Commands/WarpCommand.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Ghost.Components; using Content.Server.Warps; using Content.Shared.Administration; diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.Tools.cs b/Content.Server/Administration/Systems/AdminVerbSystem.Tools.cs index 5e62c8ca387..ced46189b61 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.Tools.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.Tools.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; +using System.Numerics; using Content.Server.Administration.Commands; using Content.Server.Administration.Components; using Content.Server.Atmos; diff --git a/Content.Server/Administration/Systems/BufferingSystem.cs b/Content.Server/Administration/Systems/BufferingSystem.cs index 00a0a929fe5..a8d1f88d725 100644 --- a/Content.Server/Administration/Systems/BufferingSystem.cs +++ b/Content.Server/Administration/Systems/BufferingSystem.cs @@ -1,4 +1,5 @@ -using Content.Server.Administration.Components; +using System.Numerics; +using Content.Server.Administration.Components; using Content.Shared.Administration; using Robust.Shared.Map; using Robust.Shared.Random; diff --git a/Content.Server/Anomaly/Effects/BluespaceAnomalySystem.cs b/Content.Server/Anomaly/Effects/BluespaceAnomalySystem.cs index 41e96fb4c82..cd7adbd3e47 100644 --- a/Content.Server/Anomaly/Effects/BluespaceAnomalySystem.cs +++ b/Content.Server/Anomaly/Effects/BluespaceAnomalySystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Anomaly.Components; using Content.Shared.Anomaly.Components; using Content.Shared.Mobs.Components; @@ -49,7 +50,7 @@ private void OnSupercritical(EntityUid uid, BluespaceAnomalyComponent component, var xform = Transform(uid); var mapPos = _xform.GetWorldPosition(xform); var radius = component.SupercriticalTeleportRadius; - var gridBounds = new Box2(mapPos - (radius, radius), mapPos + (radius, radius)); + var gridBounds = new Box2(mapPos - new Vector2(radius, radius), mapPos + new Vector2(radius, radius)); foreach (var comp in _lookup.GetComponentsInRange(xform.Coordinates, component.MaxShuffleRadius)) { var ent = comp.Owner; diff --git a/Content.Server/Anomaly/Effects/EntityAnomalySystem.cs b/Content.Server/Anomaly/Effects/EntityAnomalySystem.cs index 46caa39ba79..445774b7a31 100644 --- a/Content.Server/Anomaly/Effects/EntityAnomalySystem.cs +++ b/Content.Server/Anomaly/Effects/EntityAnomalySystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Maps; using Content.Shared.Anomaly.Components; using Content.Shared.Anomaly.Effects.Components; @@ -54,7 +55,7 @@ private void SpawnMonstersOnOpenTiles(EntitySpawnAnomalyComponent component, Tra var localpos = xform.Coordinates.Position; var tilerefs = grid.GetLocalTilesIntersecting( - new Box2(localpos + (-radius, -radius), localpos + (radius, radius))).ToArray(); + new Box2(localpos + new Vector2(-radius, -radius), localpos + new Vector2(radius, radius))).ToArray(); if (tilerefs.Length == 0) return; diff --git a/Content.Server/Anomaly/Effects/GasProducerAnomalySystem.cs b/Content.Server/Anomaly/Effects/GasProducerAnomalySystem.cs index 7dad392fbc5..6c5057edab0 100644 --- a/Content.Server/Anomaly/Effects/GasProducerAnomalySystem.cs +++ b/Content.Server/Anomaly/Effects/GasProducerAnomalySystem.cs @@ -6,6 +6,7 @@ using Robust.Shared.Map; using Robust.Shared.Random; using System.Linq; +using System.Numerics; namespace Content.Server.Anomaly.Effects; @@ -50,7 +51,7 @@ public override void Update(float frameTime) } } - private void ReleaseGas(EntityUid uid, Gas gas, float mols, float radius, int count, float temp) + private void ReleaseGas(EntityUid uid, Gas gas, float mols, float radius, int count, float temp) { var xform = Transform(uid); @@ -59,19 +60,19 @@ private void ReleaseGas(EntityUid uid, Gas gas, float mols, float radius, int co var localpos = xform.Coordinates.Position; var tilerefs = grid.GetLocalTilesIntersecting( - new Box2(localpos + (-radius, -radius), localpos + (radius, radius))).ToArray(); + new Box2(localpos + new Vector2(-radius, -radius), localpos + new Vector2(radius, radius))).ToArray(); if (tilerefs.Length == 0) return; var mixture = _atmosphere.GetTileMixture(xform.GridUid, xform.MapUid, _xform.GetGridOrMapTilePosition(uid, xform), true); - if (mixture != null) + if (mixture != null) { mixture.AdjustMoles(gas, mols); mixture.Temperature += temp; } - - if (count == 0) + + if (count == 0) return; _random.Shuffle(tilerefs); diff --git a/Content.Server/Anomaly/Effects/ProjectileAnomalySystem.cs b/Content.Server/Anomaly/Effects/ProjectileAnomalySystem.cs index d0081c6e46f..8483c86dbbf 100644 --- a/Content.Server/Anomaly/Effects/ProjectileAnomalySystem.cs +++ b/Content.Server/Anomaly/Effects/ProjectileAnomalySystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Anomaly.Components; using Content.Server.Weapons.Ranged.Systems; using Content.Shared.Anomaly.Components; diff --git a/Content.Server/Anomaly/Effects/TileAnomalySystem.cs b/Content.Server/Anomaly/Effects/TileAnomalySystem.cs index e70204be742..69644045d2e 100644 --- a/Content.Server/Anomaly/Effects/TileAnomalySystem.cs +++ b/Content.Server/Anomaly/Effects/TileAnomalySystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Maps; using Content.Shared.Anomaly.Components; using Content.Shared.Anomaly.Effects.Components; @@ -34,7 +35,7 @@ private void OnSeverityChanged(EntityUid uid, TileSpawnAnomalyComponent componen var fleshTile = (ContentTileDefinition) _tiledef[component.FloorTileId]; var localpos = xform.Coordinates.Position; var tilerefs = grid.GetLocalTilesIntersecting( - new Box2(localpos + (-radius, -radius), localpos + (radius, radius))); + new Box2(localpos + new Vector2(-radius, -radius), localpos + new Vector2(radius, radius))); foreach (var tileref in tilerefs) { if (!_random.Prob(0.33f)) diff --git a/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs b/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs index 84db1bfb9c0..7d00634e4a8 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Atmos.Components; using Content.Shared.Atmos; using Content.Shared.Atmos.EntitySystems; diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index 9f72d2372e3..d5f810c67c0 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -233,7 +233,7 @@ public void ExperiencePressureDifference( // TODO: Technically these directions won't be correct but uhh I'm just here for optimisations buddy not to fix my old bugs. if (throwTarget != EntityCoordinates.Invalid) { - var pos = ((throwTarget.ToMap(EntityManager).Position - xform.WorldPosition).Normalized + dirVec).Normalized; + var pos = ((throwTarget.ToMap(EntityManager).Position - xform.WorldPosition).Normalized() + dirVec).Normalized(); _physics.ApplyLinearImpulse(uid, pos * moveForce, body: physics); } else diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs index c588b13d0ca..46aa73eccdc 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs @@ -10,6 +10,7 @@ using Robust.Shared.Random; using Robust.Shared.Utility; using System.Linq; +using System.Numerics; namespace Content.Server.Atmos.EntitySystems { @@ -523,13 +524,13 @@ private void ExplosivelyDepressurize(MapGridComponent mapGrid, GridAtmosphereCom if (GridImpulse && tileCount > 0) { - var direction = ((Vector2)_depressurizeTiles[tileCount - 1].GridIndices - tile.GridIndices).Normalized; + var direction = ((Vector2)_depressurizeTiles[tileCount - 1].GridIndices - tile.GridIndices).Normalized(); var gridPhysics = Comp(mapGrid.Owner); // TODO ATMOS: Come up with better values for these. _physics.ApplyLinearImpulse(mapGrid.Owner, direction * totalMolesRemoved * gridPhysics.Mass, body: gridPhysics); - _physics.ApplyAngularImpulse(mapGrid.Owner, Vector2.Cross(tile.GridIndices - gridPhysics.LocalCenter, direction) * totalMolesRemoved, body: gridPhysics); + _physics.ApplyAngularImpulse(mapGrid.Owner, Vector2Helpers.Cross(tile.GridIndices - gridPhysics.LocalCenter, direction) * totalMolesRemoved, body: gridPhysics); } if(tileCount > 10 && (totalMolesRemoved / tileCount) > 10) diff --git a/Content.Server/Beam/BeamSystem.cs b/Content.Server/Beam/BeamSystem.cs index 3fbb8f23773..f53f3361b4b 100644 --- a/Content.Server/Beam/BeamSystem.cs +++ b/Content.Server/Beam/BeamSystem.cs @@ -1,4 +1,5 @@ -using Content.Server.Beam.Components; +using System.Numerics; +using Content.Server.Beam.Components; using Content.Shared.Beam; using Content.Shared.Beam.Components; using Content.Shared.Physics; @@ -74,10 +75,10 @@ private void CreateBeam(string prototype, var beamSpawnPos = beamStartPos; var ent = Spawn(prototype, beamSpawnPos); var shape = new EdgeShape(distanceCorrection, new Vector2(0,0)); - var distanceLength = distanceCorrection.Length; if (!TryComp(ent, out var physics) || !TryComp(ent, out var beam)) return; + FixturesComponent? manager = null; _fixture.TryCreateFixture( ent, @@ -93,6 +94,8 @@ private void CreateBeam(string prototype, _physics.SetCanCollide(ent, true, manager: manager, body: physics); _broadphase.RegenerateContacts(ent, physics, manager); + var distanceLength = distanceCorrection.Length(); + var beamVisualizerEvent = new BeamVisualizerEvent(ent, distanceLength, userAngle, bodyState, shader); RaiseNetworkEvent(beamVisualizerEvent); @@ -104,7 +107,7 @@ private void CreateBeam(string prototype, var controllerEnt = Spawn("VirtualBeamEntityController", beamSpawnPos); beam.VirtualBeamController = controllerEnt; - _audio.PlayPvs(beam.Sound, beam.Owner); + _audio.PlayPvs(beam.Sound, ent); var beamControllerCreatedEvent = new BeamControllerCreatedEvent(ent, controllerEnt); RaiseLocalEvent(controllerEnt, beamControllerCreatedEvent); @@ -113,7 +116,7 @@ private void CreateBeam(string prototype, //Create the rest of the beam, sprites handled through the BeamVisualizerEvent for (var i = 0; i < distanceLength-1; i++) { - beamSpawnPos = beamSpawnPos.Offset(calculatedDistance.Normalized); + beamSpawnPos = beamSpawnPos.Offset(calculatedDistance.Normalized()); var newEnt = Spawn(prototype, beamSpawnPos); var ev = new BeamVisualizerEvent(newEnt, distanceLength, userAngle, bodyState, shader); @@ -150,10 +153,10 @@ public void TryCreateBeam(EntityUid user, EntityUid target, string bodyPrototype return; //Where the start of the beam will spawn - var beamStartPos = userMapPos.Offset(calculatedDistance.Normalized); + var beamStartPos = userMapPos.Offset(calculatedDistance.Normalized()); //Don't divide by zero - if (calculatedDistance.Length == 0) + if (calculatedDistance.Length() == 0) return; if (controller != null && TryComp(controller, out var controllerBeamComp)) @@ -162,7 +165,7 @@ public void TryCreateBeam(EntityUid user, EntityUid target, string bodyPrototype controllerBeamComp.HitTargets.Add(target); } - var distanceCorrection = calculatedDistance - calculatedDistance.Normalized; + var distanceCorrection = calculatedDistance - calculatedDistance.Normalized(); CreateBeam(bodyPrototype, userAngle, calculatedDistance, beamStartPos, distanceCorrection, controller, bodyState, shader); diff --git a/Content.Server/Camera/CameraRecoilSystem.cs b/Content.Server/Camera/CameraRecoilSystem.cs index d8e6e22bd15..0022ce3214f 100644 --- a/Content.Server/Camera/CameraRecoilSystem.cs +++ b/Content.Server/Camera/CameraRecoilSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Camera; using Robust.Shared.Player; diff --git a/Content.Server/Chemistry/EntitySystems/VaporSystem.cs b/Content.Server/Chemistry/EntitySystems/VaporSystem.cs index bd4fd29e58e..92ba44b2c6f 100644 --- a/Content.Server/Chemistry/EntitySystems/VaporSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/VaporSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Chemistry.Components; using Content.Server.Chemistry.Components.SolutionManager; using Content.Shared.Chemistry.Components; @@ -68,8 +69,8 @@ public void Start(VaporComponent vapor, TransformComponent vaporXform, Vector2 d _throwing.TryThrow(vapor.Owner, dir, speed, user: user, pushbackRatio: ThrowingSystem.PushbackDefault * 10f); - var distance = (target.Position - vaporXform.WorldPosition).Length; - var time = (distance / physics.LinearVelocity.Length); + var distance = (target.Position - vaporXform.WorldPosition).Length(); + var time = (distance / physics.LinearVelocity.Length()); despawn.Lifetime = MathF.Min(aliveTime, time); } } diff --git a/Content.Server/Chemistry/TileReactions/CleanDecalsReaction.cs b/Content.Server/Chemistry/TileReactions/CleanDecalsReaction.cs index 0ae41d31a48..b5e10258ca5 100644 --- a/Content.Server/Chemistry/TileReactions/CleanDecalsReaction.cs +++ b/Content.Server/Chemistry/TileReactions/CleanDecalsReaction.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Decals; using Content.Shared.Chemistry.Reaction; using Content.Shared.Chemistry.Reagent; diff --git a/Content.Server/Chemistry/TileReactions/CreateEntityTileReaction.cs b/Content.Server/Chemistry/TileReactions/CreateEntityTileReaction.cs index 66bbc7c0dc7..e59d669868c 100644 --- a/Content.Server/Chemistry/TileReactions/CreateEntityTileReaction.cs +++ b/Content.Server/Chemistry/TileReactions/CreateEntityTileReaction.cs @@ -1,4 +1,5 @@ -using Content.Shared.Chemistry.Reaction; +using System.Numerics; +using Content.Shared.Chemistry.Reaction; using Content.Shared.Chemistry.Reagent; using Content.Shared.FixedPoint; using Content.Shared.Maps; diff --git a/Content.Server/Climbing/ClimbSystem.cs b/Content.Server/Climbing/ClimbSystem.cs index 727c640698e..72802831e28 100644 --- a/Content.Server/Climbing/ClimbSystem.cs +++ b/Content.Server/Climbing/ClimbSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Body.Systems; using Content.Server.Climbing.Components; using Content.Server.Interaction; @@ -384,21 +385,22 @@ public void MoveEntityToward(EntityUid uid, EntityUid target, PhysicsComponent? var from = Transform(uid).WorldPosition; var to = Transform(target).WorldPosition; - var (x, y) = (to - from).Normalized; + var (x, y) = (to - from).Normalized(); if (MathF.Abs(x) < 0.6f) // user climbed mostly vertically so lets make it a clean straight line to = new Vector2(from.X, to.Y); else if (MathF.Abs(y) < 0.6f) // user climbed mostly horizontally so lets make it a clean straight line to = new Vector2(to.X, from.Y); - var velocity = (to - from).Length; + var velocity = (to - from).Length(); - if (velocity <= 0.0f) return; + if (velocity <= 0.0f) + return; // Since there are bodies with different masses: // mass * 10 seems enough to move entity // instead of launching cats like rockets against the walls with constant impulse value. - _physics.ApplyLinearImpulse(uid, (to - from).Normalized * velocity * physics.Mass * 10, body: physics); + _physics.ApplyLinearImpulse(uid, (to - from).Normalized() * velocity * physics.Mass * 10, body: physics); _physics.SetBodyType(uid, BodyType.Dynamic, body: physics); climbing.OwnerIsTransitioning = true; _actionBlockerSystem.UpdateCanMove(uid); diff --git a/Content.Server/Crayon/CrayonSystem.cs b/Content.Server/Crayon/CrayonSystem.cs index 3cd43f16545..e326bbb0c0b 100644 --- a/Content.Server/Crayon/CrayonSystem.cs +++ b/Content.Server/Crayon/CrayonSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Administration.Logs; using Content.Server.Decals; using Content.Server.Nutrition.EntitySystems; diff --git a/Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs b/Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs index a1cc9604318..99ef99e04ce 100644 --- a/Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs +++ b/Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs @@ -28,12 +28,14 @@ public override void Initialize() private void HandleCollide(EntityUid uid, DamageOnHighSpeedImpactComponent component, ref StartCollideEvent args) { - if (!EntityManager.HasComponent(uid)) return; + if (!EntityManager.HasComponent(uid)) + return; var otherBody = args.OtherEntity; - var speed = args.OurBody.LinearVelocity.Length; + var speed = args.OurBody.LinearVelocity.Length(); - if (speed < component.MinimumSpeed) return; + if (speed < component.MinimumSpeed) + return; SoundSystem.Play(component.SoundHit.GetSound(), Filter.Pvs(otherBody), otherBody, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f)); diff --git a/Content.Server/Decals/Commands/AddDecalCommand.cs b/Content.Server/Decals/Commands/AddDecalCommand.cs index dc2c179a3ed..be57d917866 100644 --- a/Content.Server/Decals/Commands/AddDecalCommand.cs +++ b/Content.Server/Decals/Commands/AddDecalCommand.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Administration; using Content.Shared.Administration; using Content.Shared.Decals; diff --git a/Content.Server/Decals/Commands/EditDecalCommand.cs b/Content.Server/Decals/Commands/EditDecalCommand.cs index cc1be6d2a23..a300d218500 100644 --- a/Content.Server/Decals/Commands/EditDecalCommand.cs +++ b/Content.Server/Decals/Commands/EditDecalCommand.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Administration; using Content.Shared.Administration; using Robust.Shared.Console; @@ -61,7 +62,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args) return; } - if (!decalSystem.SetDecalPosition(gridId, uid, new(gridId, (x, y)))) + if (!decalSystem.SetDecalPosition(gridId, uid, new(gridId, new Vector2(x, y)))) { shell.WriteError("Failed changing decalposition."); } diff --git a/Content.Server/Decals/DecalSystem.cs b/Content.Server/Decals/DecalSystem.cs index f9a143a290d..a251c1ab944 100644 --- a/Content.Server/Decals/DecalSystem.cs +++ b/Content.Server/Decals/DecalSystem.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; +using System.Numerics; using System.Threading.Tasks; using Content.Server.Administration.Managers; using Content.Shared.Administration; @@ -32,6 +33,8 @@ public sealed class DecalSystem : SharedDecalSystem private readonly Dictionary> _dirtyChunks = new(); private readonly Dictionary>> _previousSentChunks = new(); + private static readonly Vector2 _boundsMinExpansion = new(0.01f, 0.01f); + private static readonly Vector2 _boundsMaxExpansion = new(1.01f, 1.01f); // If this ever gets parallelised then you'll want to increase the pooled count. private ObjectPool> _chunkIndexPool = @@ -100,7 +103,7 @@ private void OnGridSplit(ref PostGridSplitEvent ev) if (!oldChunkCollection.TryGetValue(chunkIndices, out var oldChunk)) continue; - var bounds = new Box2(tilePos - 0.01f, tilePos + 1.01f); + var bounds = new Box2(tilePos - _boundsMinExpansion, tilePos + _boundsMaxExpansion); var toRemove = new RemQueue(); foreach (var (oldDecalId, decal) in oldChunk.Decals) @@ -283,7 +286,7 @@ public bool RemoveDecal(EntityUid gridId, uint decalId, DecalGridComponent? comp foreach (var (uid, decal) in chunk.Decals) { - if ((position - decal.Coordinates-new Vector2(0.5f, 0.5f)).Length > distance) + if ((position - decal.Coordinates - new Vector2(0.5f, 0.5f)).Length() > distance) continue; if (validDelegate == null || validDelegate(decal)) diff --git a/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs index 62e8cf6aaba..243ad44c0bc 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Forensics; using Content.Server.Stack; using Content.Shared.Prototypes; diff --git a/Content.Server/DeviceNetwork/Systems/DeviceNetworkSystem.cs b/Content.Server/DeviceNetwork/Systems/DeviceNetworkSystem.cs index d67ae1a0863..75204d48855 100644 --- a/Content.Server/DeviceNetwork/Systems/DeviceNetworkSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/DeviceNetworkSystem.cs @@ -5,6 +5,7 @@ using Robust.Shared.Random; using System.Buffers; using System.Diagnostics.CodeAnalysis; +using System.Numerics; using Content.Shared.Examine; namespace Content.Server.DeviceNetwork.Systems diff --git a/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs b/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs index 8c26e712a4a..cbf591624d7 100644 --- a/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs @@ -21,8 +21,8 @@ private void OnBeforePacketSent(EntityUid uid, WirelessNetworkComponent componen var xform = Transform(uid); if (xform.MapID != args.SenderTransform.MapID - || !TryComp(args.Sender, out var sendingComponent) - || (ownPosition - xform.WorldPosition).Length > sendingComponent.Range) + || !TryComp(args.Sender, out var sendingComponent) + || (ownPosition - xform.WorldPosition).Length() > sendingComponent.Range) { args.Cancel(); } diff --git a/Content.Server/Dragon/DragonSystem.cs b/Content.Server/Dragon/DragonSystem.cs index befdc50ca49..4c84f9b09c4 100644 --- a/Content.Server/Dragon/DragonSystem.cs +++ b/Content.Server/Dragon/DragonSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Body.Systems; using Content.Server.Popups; using Content.Shared.Actions; diff --git a/Content.Server/Explosion/EntitySystems/ClusterGrenadeSystem.cs b/Content.Server/Explosion/EntitySystems/ClusterGrenadeSystem.cs index d14da2a619c..e05056a68c1 100644 --- a/Content.Server/Explosion/EntitySystems/ClusterGrenadeSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ClusterGrenadeSystem.cs @@ -82,7 +82,7 @@ private void OnClugUse(EntityUid uid, ClusterGrenadeComponent component, UseInHa thrownCount++; // TODO: Suss out throw strength - _throwingSystem.TryThrow(grenade, angle.ToVec().Normalized * component.ThrowDistance); + _throwingSystem.TryThrow(grenade, angle.ToVec().Normalized() * component.ThrowDistance); grenade.SpawnTimer(delay, () => { diff --git a/Content.Server/Explosion/EntitySystems/ExplosionGridTileFlood.cs b/Content.Server/Explosion/EntitySystems/ExplosionGridTileFlood.cs index d5f9557bd02..8d2a699de27 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionGridTileFlood.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionGridTileFlood.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Atmos; using Robust.Shared.Map; using Robust.Shared.Map.Components; @@ -75,7 +76,7 @@ public ExplosionGridTileFlood( _matrix.R1C2 = size / 2; _matrix *= transform.WorldMatrix * Matrix3.Invert(spaceMatrix); var relativeAngle = transform.WorldRotation - spaceAngle; - _offset = relativeAngle.RotateVec((size / 4, size / 4)); + _offset = relativeAngle.RotateVec(new Vector2(size / 4, size / 4)); } public override void InitTile(Vector2i initialTile) diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs index bd3626d4ecc..79985d233b7 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Atmos; using Robust.Shared.Map; using Robust.Shared.Map.Components; @@ -100,7 +101,7 @@ private void OnGridRemoved(GridRemovalEvent ev) var matrix = offsetMatrix * gridWorldMatrix * targetMatrix; var angle = gridWorldRotation - targetAngle; - var (x, y) = angle.RotateVec((tileSize / 4f, tileSize / 4f)); + var (x, y) = angle.RotateVec(new Vector2(tileSize / 4f, tileSize / 4f)); foreach (var (tile, dir) in edges) { @@ -166,9 +167,9 @@ private void OnGridRemoved(GridRemovalEvent ev) data.UnblockedDirections = AtmosDirection.Invalid; // all directions are blocked automatically. if ((dir & NeighborFlag.Cardinal) == 0) - data.BlockingGridEdges.Add(new(default, null, ((Vector2) tile + 0.5f) * tileSize, 0, tileSize)); + data.BlockingGridEdges.Add(new(default, null, (tile + Vector2Helpers.Half) * tileSize, 0, tileSize)); else - data.BlockingGridEdges.Add(new(tile, referenceGrid.Value, ((Vector2) tile + 0.5f) * tileSize, 0, tileSize)); + data.BlockingGridEdges.Add(new(tile, referenceGrid.Value, (tile + Vector2Helpers.Half) * tileSize, 0, tileSize)); } } @@ -189,7 +190,7 @@ public void GetUnblockedDirections(Dictionary transf if (data.UnblockedDirections == AtmosDirection.Invalid) continue; // already all blocked. - var tileCenter = ((Vector2) tile + 0.5f) * tileSize; + var tileCenter = (tile + new Vector2(0.5f, 0.5f)) * tileSize; foreach (var edge in data.BlockingGridEdges) { // if a blocking edge contains the center of the tile, block all directions @@ -200,19 +201,19 @@ public void GetUnblockedDirections(Dictionary transf } // check north - if (edge.Box.Contains(tileCenter + (0, tileSize / 2f))) + if (edge.Box.Contains(tileCenter + new Vector2(0, tileSize / 2f))) data.UnblockedDirections &= ~AtmosDirection.North; // check south - if (edge.Box.Contains(tileCenter + (0, -tileSize / 2f))) + if (edge.Box.Contains(tileCenter + new Vector2(0, -tileSize / 2f))) data.UnblockedDirections &= ~AtmosDirection.South; // check east - if (edge.Box.Contains(tileCenter + (tileSize / 2f, 0))) + if (edge.Box.Contains(tileCenter + new Vector2(tileSize / 2f, 0))) data.UnblockedDirections &= ~AtmosDirection.East; // check west - if (edge.Box.Contains(tileCenter + (-tileSize / 2f, 0))) + if (edge.Box.Contains(tileCenter + new Vector2(-tileSize / 2f, 0))) data.UnblockedDirections &= ~AtmosDirection.West; } } @@ -382,7 +383,7 @@ public GridEdgeData(Vector2i tile, EntityUid? grid, Vector2 center, Angle angle, { Tile = tile; Grid = grid; - Box = new(Box2.CenteredAround(center, (size, size)), angle, center); + Box = new(Box2.CenteredAround(center, new Vector2(size, size)), angle, center); } } } diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs index e8d25d81905..cb83916420b 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Explosion.Components; using Content.Server.Mind.Components; using Content.Shared.CCVar; @@ -305,7 +306,7 @@ internal void ExplodeSpace(BroadphaseComponent lookup, EntityQuery tagQuery, EntityQuery projectileQuery) { - var gridBox = Box2.FromDimensions(tile * DefaultTileSize, (DefaultTileSize, DefaultTileSize)); + var gridBox = Box2.FromDimensions(tile * DefaultTileSize, new Vector2(DefaultTileSize, DefaultTileSize)); var worldBox = spaceMatrix.TransformBox(gridBox); var list = new List(); var state = (list, processed, invSpaceMatrix, lookup.Owner, xformQuery, gridBox); diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.TileFill.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.TileFill.cs index 1537d8ac00c..fc16c9daa4a 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.TileFill.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.TileFill.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Shared.Administration; using Content.Shared.Explosion; using Robust.Shared.Map; @@ -272,7 +273,7 @@ public sealed partial class ExplosionSystem : EntitySystem // First attempt to find a grid that is relatively close to the explosion's center. Instead of looking in a // diameter x diameter sized box, use a smaller box with radius sized sides: - var box = Box2.CenteredAround(epicenter.Position, (radius, radius)); + var box = Box2.CenteredAround(epicenter.Position, new Vector2(radius, radius)); foreach (var grid in _mapManager.FindGridsIntersecting(epicenter.MapId, box)) { @@ -293,7 +294,7 @@ public sealed partial class ExplosionSystem : EntitySystem // and using that for the grid look-up, we will just arbitrarily fudge the lookup size to be twice the diameter. radius *= 4; - box = Box2.CenteredAround(epicenter.Position, (radius, radius)); + box = Box2.CenteredAround(epicenter.Position, new Vector2(radius, radius)); var mapGrids = _mapManager.FindGridsIntersecting(epicenter.MapId, box).ToList(); var grids = mapGrids.Select(x => x.Owner).ToList(); diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs index 73e48d1731b..27b4141e1f3 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Administration.Logs; using Content.Server.Atmos.Components; using Content.Server.Chat.Managers; @@ -344,10 +345,10 @@ private void CameraShake(float range, MapCoordinates epicenter, float totalInten if (delta.EqualsApprox(Vector2.Zero)) delta = new(0.01f, 0); - var distance = delta.Length; + var distance = delta.Length(); var effect = 5 * MathF.Pow(totalIntensity, 0.5f) * (1 - distance / range); if (effect > 0.01f) - _recoilSystem.KickCamera(uid, -delta.Normalized * effect); + _recoilSystem.KickCamera(uid, -delta.Normalized() * effect); } } diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs index d082b17d995..01d8ea47165 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs @@ -148,7 +148,7 @@ private void UpdateProximity() if (Deleted(collidingUid)) continue; - if (colliding.LinearVelocity.Length < trigger.TriggerSpeed) + if (colliding.LinearVelocity.Length() < trigger.TriggerSpeed) continue; // Trigger! diff --git a/Content.Server/Fluids/EntitySystems/PuddleDebugDebugOverlaySystem.cs b/Content.Server/Fluids/EntitySystems/PuddleDebugDebugOverlaySystem.cs index ce28dad0c10..b09d74c4d0c 100644 --- a/Content.Server/Fluids/EntitySystems/PuddleDebugDebugOverlaySystem.cs +++ b/Content.Server/Fluids/EntitySystems/PuddleDebugDebugOverlaySystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Fluids.Components; using Content.Shared.Fluids; using Content.Shared.Fluids.Components; diff --git a/Content.Server/Fluids/EntitySystems/SpraySystem.cs b/Content.Server/Fluids/EntitySystems/SpraySystem.cs index cb01078bef0..0c137caeb46 100644 --- a/Content.Server/Fluids/EntitySystems/SpraySystem.cs +++ b/Content.Server/Fluids/EntitySystems/SpraySystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Chemistry.Components; using Content.Server.Chemistry.EntitySystems; using Content.Server.Cooldown; @@ -68,11 +69,11 @@ private void OnAfterInteract(EntityUid uid, SprayComponent component, AfterInter var clickMapPos = args.ClickLocation.ToMap(EntityManager, _transform); var diffPos = clickMapPos.Position - userMapPos.Position; - if (diffPos == Vector2.Zero || diffPos == Vector2.NaN) + if (diffPos == Vector2.Zero || diffPos == Vector2Helpers.NaN) return; - var diffNorm = diffPos.Normalized; - var diffLength = diffPos.Length; + var diffNorm = diffPos.Normalized(); + var diffLength = diffPos.Length(); if (diffLength > component.SprayDistance) { @@ -97,9 +98,9 @@ private void OnAfterInteract(EntityUid uid, SprayComponent component, AfterInter // Calculate the destination for the vapor cloud. Limit to the maximum spray distance. var target = userMapPos - .Offset((diffNorm + rotation.ToVec()).Normalized * diffLength + quarter); + .Offset((diffNorm + rotation.ToVec()).Normalized() * diffLength + quarter); - var distance = (target.Position - userMapPos.Position).Length; + var distance = (target.Position - userMapPos.Position).Length(); if (distance > component.SprayDistance) target = userMapPos.Offset(diffNorm * component.SprayDistance); diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs index 1e519eaa6f1..3a08bd41903 100644 --- a/Content.Server/GameTicking/GameTicker.Spawning.cs +++ b/Content.Server/GameTicking/GameTicker.Spawning.cs @@ -1,5 +1,6 @@ using System.Globalization; using System.Linq; +using System.Numerics; using Content.Server.Ghost; using Content.Server.Players; using Content.Server.Spawners.Components; diff --git a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs index b99af24f0e9..358eb3b5573 100644 --- a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Administration.Commands; using Content.Server.Chat.Managers; using Content.Server.GameTicking.Rules.Components; @@ -640,7 +641,7 @@ private bool SpawnMap(EntityUid uid, NukeopsRuleComponent? component = null) component.NukieOutpost = outpostGrids[0]; // Listen I just don't want it to overlap. - if (!_map.TryLoad(mapId, shuttlePath.ToString(), out var grids, new MapLoadOptions {Offset = Vector2.One*1000f}) || !grids.Any()) + if (!_map.TryLoad(mapId, shuttlePath.ToString(), out var grids, new MapLoadOptions {Offset = Vector2.One * 1000f}) || !grids.Any()) { Logger.ErrorS("nukies", $"Error loading grid {shuttlePath} for nukies!"); return false; diff --git a/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs b/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs index 5bccab0b9ef..f98adb93e41 100644 --- a/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Administration.Commands; using Content.Server.Cargo.Systems; using Content.Server.Chat.Managers; @@ -160,9 +161,12 @@ private void OnPlayerSpawningEvent(RulePlayerSpawningEvent ev) aabb.Union(aabbs[i]); } + // (Not commented?) + var a = MathF.Max(aabb.Height / 2f, aabb.Width / 2f) * 2.5f; + var gridId = _map.LoadGrid(GameTicker.DefaultMap, map, new MapLoadOptions { - Offset = aabb.Center + MathF.Max(aabb.Height / 2f, aabb.Width / 2f) * 2.5f + Offset = aabb.Center + new Vector2(a, a), }); if (!gridId.HasValue) diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index 6bc2604e603..5d17820b84b 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.GameTicking; using Content.Server.Ghost.Components; using Content.Server.Mind; diff --git a/Content.Server/Hands/Systems/HandsSystem.cs b/Content.Server/Hands/Systems/HandsSystem.cs index 84605b8e7c2..a792b27c719 100644 --- a/Content.Server/Hands/Systems/HandsSystem.cs +++ b/Content.Server/Hands/Systems/HandsSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Popups; using Content.Server.Pulling; using Content.Server.Stack; @@ -204,7 +205,7 @@ hands.ActiveHandEntity is not EntityUid throwEnt || if (direction == Vector2.Zero) return true; - direction = direction.Normalized * Math.Min(direction.Length, hands.ThrowRange); + direction = direction.Normalized() * Math.Min(direction.Length(), hands.ThrowRange); var throwStrength = hands.ThrowForceMultiplier; diff --git a/Content.Server/Interaction/TilePryCommand.cs b/Content.Server/Interaction/TilePryCommand.cs index bf277d7b255..157fa2cc80c 100644 --- a/Content.Server/Interaction/TilePryCommand.cs +++ b/Content.Server/Interaction/TilePryCommand.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Administration; using Content.Server.Tools.Components; using Content.Shared.Administration; @@ -60,7 +61,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args) { for (var j = -radius; j <= radius; j++) { - var tile = mapGrid.GetTileRef(playerPosition.Offset((i, j))); + var tile = mapGrid.GetTileRef(playerPosition.Offset(new Vector2(i, j))); var coordinates = mapGrid.GridTileToLocal(tile.GridIndices); var tileDef = (ContentTileDefinition) tileDefinitionManager[tile.Tile.TypeId]; diff --git a/Content.Server/Magic/Events/WorldSpawnSpellEvent.cs b/Content.Server/Magic/Events/WorldSpawnSpellEvent.cs index a0f19b8788d..9d1cc2c8441 100644 --- a/Content.Server/Magic/Events/WorldSpawnSpellEvent.cs +++ b/Content.Server/Magic/Events/WorldSpawnSpellEvent.cs @@ -1,4 +1,5 @@ -using Content.Shared.Actions; +using System.Numerics; +using Content.Shared.Actions; using Content.Shared.Storage; namespace Content.Server.Magic.Events; diff --git a/Content.Server/Magic/MagicSystem.cs b/Content.Server/Magic/MagicSystem.cs index a8ada5280c9..e75bae0249a 100644 --- a/Content.Server/Magic/MagicSystem.cs +++ b/Content.Server/Magic/MagicSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Body.Components; using Content.Server.Body.Systems; using Content.Server.Chat.Systems; @@ -213,7 +214,7 @@ private List GetSpawnPositions(TransformComponent casterXform case TargetInFront: { // This is shit but you get the idea. - var directionPos = casterXform.Coordinates.Offset(casterXform.LocalRotation.ToWorldVec().Normalized); + var directionPos = casterXform.Coordinates.Offset(casterXform.LocalRotation.ToWorldVec().Normalized()); if (!_mapManager.TryGetGrid(casterXform.GridUid, out var mapGrid)) return new List(); diff --git a/Content.Server/Maps/TileSystem.cs b/Content.Server/Maps/TileSystem.cs index 3a11ebaa54f..ceaadc67730 100644 --- a/Content.Server/Maps/TileSystem.cs +++ b/Content.Server/Maps/TileSystem.cs @@ -1,4 +1,5 @@ -using Content.Server.Decals; +using System.Numerics; +using Content.Server.Decals; using Content.Shared.Coordinates.Helpers; using Content.Shared.Decals; using Content.Shared.Maps; diff --git a/Content.Server/Mech/Equipment/Components/MechGrabberComponent.cs b/Content.Server/Mech/Equipment/Components/MechGrabberComponent.cs index c93e69e48d9..6b3cceaafeb 100644 --- a/Content.Server/Mech/Equipment/Components/MechGrabberComponent.cs +++ b/Content.Server/Mech/Equipment/Components/MechGrabberComponent.cs @@ -1,4 +1,5 @@ -using System.Threading; +using System.Numerics; +using System.Threading; using Robust.Shared.Audio; using Robust.Shared.Containers; diff --git a/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs b/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs index a5b188b3735..18d1d009f44 100644 --- a/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs +++ b/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Interaction; using Content.Shared.Audio; using Content.Shared.Jittering; @@ -65,7 +66,7 @@ public override void Update(float frameTime) if (_robustRandom.Prob(0.03f) && reclaimer.SpawnedEntities.Count > 0) { var thrown = Spawn(_robustRandom.Pick(reclaimer.SpawnedEntities).PrototypeId, Transform(reclaimer.Owner).Coordinates); - Vector2 direction = (_robustRandom.Next(-30, 30), _robustRandom.Next(-30, 30)); + var direction = new Vector2(_robustRandom.Next(-30, 30), _robustRandom.Next(-30, 30)); _throwing.TryThrow(thrown, direction, _robustRandom.Next(1, 10)); } reclaimer.RandomMessTimer += (float) reclaimer.RandomMessInterval.TotalSeconds; @@ -162,7 +163,7 @@ private void OnClimbedOn(EntityUid uid, BiomassReclaimerComponent component, Cli { if (!CanGib(uid, args.Climber, component)) { - Vector2 direction = (_robustRandom.Next(-2, 2), _robustRandom.Next(-2, 2)); + var direction = new Vector2(_robustRandom.Next(-2, 2), _robustRandom.Next(-2, 2)); _throwing.TryThrow(args.Climber, direction, 0.5f); return; } diff --git a/Content.Server/Movement/Components/StressTestMovementComponent.cs b/Content.Server/Movement/Components/StressTestMovementComponent.cs index 615a4876e6d..10b8fbc6744 100644 --- a/Content.Server/Movement/Components/StressTestMovementComponent.cs +++ b/Content.Server/Movement/Components/StressTestMovementComponent.cs @@ -1,3 +1,5 @@ +using System.Numerics; + namespace Content.Server.Movement.Components { [RegisterComponent] diff --git a/Content.Server/Movement/StressTestMovementSystem.cs b/Content.Server/Movement/StressTestMovementSystem.cs index a23397dc7d4..5483b89b48f 100644 --- a/Content.Server/Movement/StressTestMovementSystem.cs +++ b/Content.Server/Movement/StressTestMovementSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Movement.Components; using JetBrains.Annotations; diff --git a/Content.Server/NPC/Components/NPCSteeringComponent.cs b/Content.Server/NPC/Components/NPCSteeringComponent.cs index 18a5a565275..ed1eaa4a716 100644 --- a/Content.Server/NPC/Components/NPCSteeringComponent.cs +++ b/Content.Server/NPC/Components/NPCSteeringComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using System.Threading; using Content.Server.NPC.Pathfinding; using Content.Shared.DoAfter; diff --git a/Content.Server/NPC/Events/NPCSteeringEvent.cs b/Content.Server/NPC/Events/NPCSteeringEvent.cs index b94e09cff3e..21c03eefcb3 100644 --- a/Content.Server/NPC/Events/NPCSteeringEvent.cs +++ b/Content.Server/NPC/Events/NPCSteeringEvent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.NPC.Components; namespace Content.Server.NPC.Events; diff --git a/Content.Server/NPC/HTN/PrimitiveTasks/Operators/UtilityOperator.cs b/Content.Server/NPC/HTN/PrimitiveTasks/Operators/UtilityOperator.cs index 523b24ddf29..698329635c1 100644 --- a/Content.Server/NPC/HTN/PrimitiveTasks/Operators/UtilityOperator.cs +++ b/Content.Server/NPC/HTN/PrimitiveTasks/Operators/UtilityOperator.cs @@ -1,3 +1,4 @@ +using System.Numerics; using System.Threading; using System.Threading.Tasks; using Content.Server.NPC.Queries; diff --git a/Content.Server/NPC/Pathfinding/PathfindingSystem.Distance.cs b/Content.Server/NPC/Pathfinding/PathfindingSystem.Distance.cs index 5d7ac4ad034..95d5c9c4651 100644 --- a/Content.Server/NPC/Pathfinding/PathfindingSystem.Distance.cs +++ b/Content.Server/NPC/Pathfinding/PathfindingSystem.Distance.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.NPC; namespace Content.Server.NPC.Pathfinding; diff --git a/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs b/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs index b80513fd78e..a775e1f9a59 100644 --- a/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs +++ b/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; +using System.Numerics; using System.Threading; using System.Threading.Tasks; using Content.Server.Destructible; diff --git a/Content.Server/NPC/Pathfinding/PathfindingSystem.cs b/Content.Server/NPC/Pathfinding/PathfindingSystem.cs index dcedd6b19b8..f8d7c725f89 100644 --- a/Content.Server/NPC/Pathfinding/PathfindingSystem.cs +++ b/Content.Server/NPC/Pathfinding/PathfindingSystem.cs @@ -1,5 +1,6 @@ using System.Buffers; using System.Linq; +using System.Numerics; using System.Threading; using System.Threading.Tasks; using Content.Server.Administration.Managers; diff --git a/Content.Server/NPC/Queries/Queries/NearbyHostilesQuery.cs b/Content.Server/NPC/Queries/Queries/NearbyHostilesQuery.cs index f3b151832b4..25e53438f6d 100644 --- a/Content.Server/NPC/Queries/Queries/NearbyHostilesQuery.cs +++ b/Content.Server/NPC/Queries/Queries/NearbyHostilesQuery.cs @@ -1,3 +1,5 @@ +using Content.Server.NPC.Systems; + namespace Content.Server.NPC.Queries.Queries; /// diff --git a/Content.Server/NPC/Systems/NPCCombatSystem.Melee.cs b/Content.Server/NPC/Systems/NPCCombatSystem.Melee.cs index a4ece57beb1..19abfb74675 100644 --- a/Content.Server/NPC/Systems/NPCCombatSystem.Melee.cs +++ b/Content.Server/NPC/Systems/NPCCombatSystem.Melee.cs @@ -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 @@ private void OnMeleeSteering(EntityUid uid, NPCMeleeCombatComponent component, r 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 @@ private void OnMeleeSteering(EntityUid uid, NPCMeleeCombatComponent component, r 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 @@ private void Attack(EntityUid uid, NPCMeleeCombatComponent component, TimeSpan c 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))); } diff --git a/Content.Server/NPC/Systems/NPCCombatSystem.Ranged.cs b/Content.Server/NPC/Systems/NPCCombatSystem.Ranged.cs index 0b07116b144..c3822eea3d3 100644 --- a/Content.Server/NPC/Systems/NPCCombatSystem.Ranged.cs +++ b/Content.Server/NPC/Systems/NPCCombatSystem.Ranged.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.NPC.Components; using Content.Shared.CombatMode; using Content.Shared.Interaction; @@ -90,7 +91,7 @@ private void UpdateRanged(float frameTime) var (targetPos, targetRot) = _transform.GetWorldPositionRotation(targetXform, xformQuery); // We'll work out the projected spot of the target and shoot there instead of where they are. - var distance = (targetPos - worldPos).Length; + var distance = (targetPos - worldPos).Length(); var oldInLos = comp.TargetInLOS; // TODO: Should be doing these raycasts in parallel diff --git a/Content.Server/NPC/Systems/NPCSteeringSystem.Context.cs b/Content.Server/NPC/Systems/NPCSteeringSystem.Context.cs index abae513dbed..cbe95be1408 100644 --- a/Content.Server/NPC/Systems/NPCSteeringSystem.Context.cs +++ b/Content.Server/NPC/Systems/NPCSteeringSystem.Context.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Examine; using Content.Server.NPC.Components; using Content.Server.NPC.Pathfinding; @@ -113,7 +114,7 @@ private bool TrySeek( var direction = targetMap.Position - ourMap.Position; // Are we in range - if (direction.Length <= arrivalDistance) + if (direction.Length() <= arrivalDistance) { // Node needs some kind of special handling like access or smashing. if (steering.CurrentPath.TryPeek(out var node) && !node.Data.IsFreeSpace) @@ -126,7 +127,7 @@ private bool TrySeek( lock (_obstacles) { // We're still coming to a stop so wait for the do_after. - if (body.LinearVelocity.LengthSquared > 0.01f) + if (body.LinearVelocity.LengthSquared() > 0.01f) { return true; } @@ -231,21 +232,21 @@ private bool TrySeek( return false; } - var input = direction.Normalized; + var input = direction.Normalized(); var tickMovement = moveSpeed * frameTime; // We have the input in world terms but need to convert it back to what movercontroller is doing. input = offsetRot.RotateVec(input); - var norm = input.Normalized; - var weight = MapValue(direction.Length, tickMovement * 0.5f, tickMovement * 0.75f); + var norm = input.Normalized(); + var weight = MapValue(direction.Length(), tickMovement * 0.5f, tickMovement * 0.75f); ApplySeek(interest, norm, weight); // Prefer our current direction - if (weight > 0f && body.LinearVelocity.LengthSquared > 0f) + if (weight > 0f && body.LinearVelocity.LengthSquared() > 0f) { const float sameDirectionWeight = 0.1f; - norm = body.LinearVelocity.Normalized; + norm = body.LinearVelocity.Normalized(); ApplySeek(interest, norm, sameDirectionWeight); } @@ -310,7 +311,7 @@ public void PrunePath(EntityUid uid, MapCoordinates mapCoordinates, Vector2 dire // Then don't consider pruning. var goal = nodes.Last().Coordinates.ToMap(EntityManager, _transform); var canPrune = - _interaction.InRangeUnobstructed(mapCoordinates, goal, (goal.Position - mapCoordinates.Position).Length + 0.1f, mask); + _interaction.InRangeUnobstructed(mapCoordinates, goal, (goal.Position - mapCoordinates.Position).Length() + 0.1f, mask); while (nodes.TryPeek(out var node)) { @@ -424,7 +425,7 @@ private void CollisionAvoidance( continue; obstacleDirection = offsetRot.RotateVec(obstacleDirection); - var norm = obstacleDirection.Normalized; + var norm = obstacleDirection.Normalized(); for (var i = 0; i < InterestDirections; i++) { @@ -506,7 +507,7 @@ private void Separation( } obstacleDirection = offsetRot.RotateVec(obstacleDirection); - var norm = obstacleDirection.Normalized; + var norm = obstacleDirection.Normalized(); weight *= 0.25f; for (var i = 0; i < InterestDirections; i++) diff --git a/Content.Server/NPC/Systems/NPCSteeringSystem.cs b/Content.Server/NPC/Systems/NPCSteeringSystem.cs index 4c7984226de..7b1d21164aa 100644 --- a/Content.Server/NPC/Systems/NPCSteeringSystem.cs +++ b/Content.Server/NPC/Systems/NPCSteeringSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using System.Threading; using System.Threading.Tasks; using Content.Server.Administration.Managers; diff --git a/Content.Server/Parallax/BiomeSystem.cs b/Content.Server/Parallax/BiomeSystem.cs index 889cd0185bb..6915ed5a113 100644 --- a/Content.Server/Parallax/BiomeSystem.cs +++ b/Content.Server/Parallax/BiomeSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Decals; using Content.Server.Ghost.Roles.Components; using Content.Server.Shuttles.Events; @@ -195,7 +196,8 @@ private void OnFTLStarted(ref FTLStartedEvent ev) if (!TryComp(targetMapUid, out var biome)) return; - var targetArea = new Box2(targetMap.Position - 32f, targetMap.Position + 32f); + var preloadArea = new Vector2(32f, 32f); + var targetArea = new Box2(targetMap.Position - preloadArea, targetMap.Position + preloadArea); Preload(targetMapUid, biome, targetArea); } @@ -337,7 +339,9 @@ private void AddMarkerChunksInRange(BiomeComponent biome, Vector2 worldPos, IBio { // Offset the load area so it's centralised. var loadArea = new Box2(0, 0, layer.Size, layer.Size); - var enumerator = new ChunkIndicesEnumerator(loadArea.Translated(worldPos - layer.Size / 2f), layer.Size); + var halfLayer = new Vector2(layer.Size / 2f); + + var enumerator = new ChunkIndicesEnumerator(loadArea.Translated(worldPos - halfLayer), layer.Size); while (enumerator.MoveNext(out var chunkOrigin)) { diff --git a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs index 409b78ad1b9..d3ca674a91b 100644 --- a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs +++ b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs @@ -4,6 +4,7 @@ using Robust.Shared.Map.Components; using Robust.Shared.Physics.Events; using System.Diagnostics.CodeAnalysis; +using System.Numerics; namespace Content.Server.ParticleAccelerator.EntitySystems; @@ -75,12 +76,12 @@ public void RescanParts(EntityUid uid, IPlayerSession? user = null, ParticleAcce // Calculate offsets for each of the parts of the PA. // These are all done relative to the fuel chamber BC that is basically the center of the machine. - var positionFuelChamber = grid.TileIndicesFor(fuelXform.Coordinates); // // - var positionEndCap = positionFuelChamber + (Vector2i) rotation.RotateVec((0, 1)); // n // n: End Cap - var positionPowerBox = positionFuelChamber + (Vector2i) rotation.RotateVec((0, -1)); // CF // C: Control Box, F: Fuel Chamber - var positionPortEmitter = positionFuelChamber + (Vector2i) rotation.RotateVec((1, -2)); // P // P: Power Box - var positionForeEmitter = positionFuelChamber + (Vector2i) rotation.RotateVec((0, -2)); // EEE // E: Emitter (Starboard, Fore, Port) - var positionStarboardEmitter = positionFuelChamber + (Vector2i) rotation.RotateVec((-1, -2)); // // + var positionFuelChamber = grid.TileIndicesFor(fuelXform.Coordinates); // // + var positionEndCap = positionFuelChamber + (Vector2i) rotation.RotateVec(new Vector2(0, 1)); // n // n: End Cap + var positionPowerBox = positionFuelChamber + (Vector2i) rotation.RotateVec(new Vector2(0, -1)); // CF // C: Control Box, F: Fuel Chamber + var positionPortEmitter = positionFuelChamber + (Vector2i) rotation.RotateVec(new Vector2(1, -2)); // P // P: Power Box + var positionForeEmitter = positionFuelChamber + (Vector2i) rotation.RotateVec(new Vector2(0, -2)); // EEE // E: Emitter (Starboard, Fore, Port) + var positionStarboardEmitter = positionFuelChamber + (Vector2i) rotation.RotateVec(new Vector2(-1, -2)); // // ScanPart(gridUid!.Value, positionEndCap, rotation, out controller.EndCap, out var _, grid); ScanPart(gridUid!.Value, positionPowerBox, rotation, out controller.PowerBox, out var _, grid); diff --git a/Content.Server/Physics/Controllers/MoverController.cs b/Content.Server/Physics/Controllers/MoverController.cs index 5157c4bc9b8..d640a384d40 100644 --- a/Content.Server/Physics/Controllers/MoverController.cs +++ b/Content.Server/Physics/Controllers/MoverController.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Cargo.Components; using Content.Server.Shuttle.Components; using Content.Server.Shuttles.Components; @@ -309,7 +310,7 @@ private void HandleShuttleMovement(float frameTime) brakeInput += pilotInput.Brakes; } - if (pilotInput.Strafe.Length > 0f) + if (pilotInput.Strafe.Length() > 0f) { var offsetRotation = consoleXform.LocalRotation; linearInput += offsetRotation.RotateVec(pilotInput.Strafe); @@ -329,7 +330,7 @@ private void HandleShuttleMovement(float frameTime) // Handle shuttle movement if (brakeInput > 0f) { - if (body.LinearVelocity.Length > 0f) + if (body.LinearVelocity.Length() > 0f) { // Minimum brake velocity for a direction to show its thrust appearance. const float appearanceThreshold = 0.1f; @@ -383,11 +384,11 @@ private void HandleShuttleMovement(float frameTime) var impulse = force * brakeInput * ShuttleComponent.BrakeCoefficient; impulse = shuttleNorthAngle.RotateVec(impulse); var forceMul = frameTime * body.InvMass; - var maxVelocity = (-body.LinearVelocity).Length / forceMul; + var maxVelocity = (-body.LinearVelocity).Length() / forceMul; // Don't overshoot - if (impulse.Length > maxVelocity) - impulse = impulse.Normalized * maxVelocity; + if (impulse.Length() > maxVelocity) + impulse = impulse.Normalized() * maxVelocity; PhysicsSystem.ApplyForce(shuttle.Owner, impulse, body: body); } @@ -422,7 +423,7 @@ private void HandleShuttleMovement(float frameTime) } } - if (linearInput.Length.Equals(0f)) + if (linearInput.Length().Equals(0f)) { PhysicsSystem.SetSleepingAllowed(shuttle.Owner, body, true); @@ -481,20 +482,20 @@ private void HandleShuttleMovement(float frameTime) } _thruster.EnableLinearThrustDirection(shuttle, dir); - var impulse = force * linearInput.Length; + var impulse = force * linearInput.Length(); totalForce += impulse; } totalForce = shuttleNorthAngle.RotateVec(totalForce); var forceMul = frameTime * body.InvMass; - var maxVelocity = (ShuttleComponent.MaxLinearVelocity - body.LinearVelocity.Length) / forceMul; + var maxVelocity = (ShuttleComponent.MaxLinearVelocity - body.LinearVelocity.Length()) / forceMul; if (maxVelocity != 0f) { // Don't overshoot - if (totalForce.Length > maxVelocity) - totalForce = totalForce.Normalized * maxVelocity; + if (totalForce.Length() > maxVelocity) + totalForce = totalForce.Normalized() * maxVelocity; PhysicsSystem.ApplyForce(shuttle.Owner, totalForce, body: body); } diff --git a/Content.Server/Physics/Controllers/PullController.cs b/Content.Server/Physics/Controllers/PullController.cs index 407f6aa3820..868c6eb82cc 100644 --- a/Content.Server/Physics/Controllers/PullController.cs +++ b/Content.Server/Physics/Controllers/PullController.cs @@ -1,4 +1,5 @@ -using Content.Shared.Gravity; +using System.Numerics; +using Content.Shared.Gravity; using Content.Shared.Pulling; using Content.Shared.Pulling.Components; using Content.Shared.Rotatable; @@ -72,7 +73,7 @@ private void OnPullerMove(EntityUid uid, SharedPullerComponent component, ref Mo UpdatePulledRotation(uid, pullable); if (args.NewPosition.EntityId == args.OldPosition.EntityId && - (args.NewPosition.Position - args.OldPosition.Position).LengthSquared < MinimumMovementDistance * MinimumMovementDistance) + (args.NewPosition.Position - args.OldPosition.Position).LengthSquared() < MinimumMovementDistance * MinimumMovementDistance) return; if (TryComp(pullable, out var physics)) @@ -98,7 +99,7 @@ private void UpdatePulledRotation(EntityUid puller, EntityUid pulled) var pulledData = TransformSystem.GetWorldPositionRotation(pulledXform, xforms); var dir = pullerData.WorldPosition - pulledData.WorldPosition; - if (dir.LengthSquared > ThresholdRotDistance * ThresholdRotDistance) + if (dir.LengthSquared() > ThresholdRotDistance * ThresholdRotDistance) { var oldAngle = pulledData.WorldRotation; var newAngle = Angle.FromWorldVec(dir); @@ -163,9 +164,9 @@ public override void UpdateBeforeSolve(bool prediction, float frameTime) var ownerPosition = pullableXform.MapPosition.Position; var diff = movingPosition - ownerPosition; - var diffLength = diff.Length; + var diffLength = diff.Length(); - if (diffLength < MaximumSettleDistance && physics.LinearVelocity.Length < MaximumSettleVelocity) + if (diffLength < MaximumSettleDistance && physics.LinearVelocity.Length() < MaximumSettleVelocity) { PhysicsSystem.SetLinearVelocity(pullableEnt, Vector2.Zero, body: physics); _pullableSystem.StopMoveTo(pullable); @@ -176,9 +177,9 @@ public override void UpdateBeforeSolve(bool prediction, float frameTime) var impulseModifier = MathHelper.Lerp(AccelModifierLow, AccelModifierHigh, impulseModifierLerp); var multiplier = diffLength < 1 ? impulseModifier * diffLength : impulseModifier; // Note the implication that the real rules of physics don't apply to pulling control. - var accel = diff.Normalized * multiplier; + var accel = diff.Normalized() * multiplier; // Now for the part where velocity gets shutdown... - if (diffLength < SettleShutdownDistance && physics.LinearVelocity.Length >= SettleMinimumShutdownVelocity) + if (diffLength < SettleShutdownDistance && physics.LinearVelocity.Length() >= SettleMinimumShutdownVelocity) { // Shutdown velocity increases as we get closer to centre var scaling = (SettleShutdownDistance - diffLength) / SettleShutdownDistance; diff --git a/Content.Server/Pinpointer/PinpointerSystem.cs b/Content.Server/Pinpointer/PinpointerSystem.cs index d0e4831891f..f201baaa0f0 100644 --- a/Content.Server/Pinpointer/PinpointerSystem.cs +++ b/Content.Server/Pinpointer/PinpointerSystem.cs @@ -1,6 +1,7 @@ using Content.Shared.Interaction; using Content.Shared.Pinpointer; using System.Linq; +using System.Numerics; using Robust.Shared.Utility; using Content.Server.Shuttles.Events; using Content.Shared.IdentityManagement; @@ -117,7 +118,7 @@ public override void Update(float frameTime) if (!xformQuery.TryGetComponent(comp.Owner, out var compXform) || compXform.MapID != mapId) continue; - var dist = (_transform.GetWorldPosition(compXform, xformQuery) - worldPos).LengthSquared; + var dist = (_transform.GetWorldPosition(compXform, xformQuery) - worldPos).LengthSquared(); l.TryAdd(dist, comp.Owner); } @@ -198,7 +199,7 @@ private void UpdateDirectionToTarget(EntityUid uid, PinpointerComponent pinpoint private Distance CalculateDistance(Vector2 vec, PinpointerComponent pinpointer) { - var dist = vec.Length; + var dist = vec.Length(); if (dist <= pinpointer.ReachedDistance) return Distance.Reached; else if (dist <= pinpointer.CloseDistance) diff --git a/Content.Server/Pinpointer/ProximityBeeperSystem.cs b/Content.Server/Pinpointer/ProximityBeeperSystem.cs index 85a9a083d5c..2083a3d9853 100644 --- a/Content.Server/Pinpointer/ProximityBeeperSystem.cs +++ b/Content.Server/Pinpointer/ProximityBeeperSystem.cs @@ -69,7 +69,7 @@ public void UpdateBeep(EntityUid uid, ProximityBeeperComponent? component = null // forgive me father, for i have sinned. var ent = comp.Owner; - var dist = (_transform.GetWorldPosition(xform, xformQuery) - _transform.GetWorldPosition(ent, xformQuery)).Length; + var dist = (_transform.GetWorldPosition(xform, xformQuery) - _transform.GetWorldPosition(ent, xformQuery)).Length(); if (dist >= (closestDistance ?? float.MaxValue)) continue; closestDistance = dist; diff --git a/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs b/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs index 143192a811d..0d88b442d33 100644 --- a/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs +++ b/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs @@ -129,7 +129,8 @@ private IEnumerable FindAvailableReceivers(Enti foreach (var entity in nearbyEntities) { - if (entity == owner) continue; + if (entity == owner) + continue; if (EntityManager.IsQueuedForDeletion(entity) || MetaData(entity).EntityLifeStage > EntityLifeStage.MapInitialized) continue; @@ -140,7 +141,7 @@ private IEnumerable FindAvailableReceivers(Enti if (!receiver.Connectable || receiver.Provider != null) continue; - if ((Transform(entity).LocalPosition - xform.LocalPosition).Length < Math.Min(range, receiver.ReceptionRange)) + if ((Transform(entity).LocalPosition - xform.LocalPosition).Length() < Math.Min(range, receiver.ReceptionRange)) yield return receiver; } } @@ -268,7 +269,7 @@ private bool TryFindAvailableProvider(EntityUid owner, float range, [NotNullWhen // Find the closest provider if (!xformQuery.TryGetComponent(entity, out var entityXform)) continue; - var distance = (entityXform.LocalPosition - xform.LocalPosition).Length; + var distance = (entityXform.LocalPosition - xform.LocalPosition).Length(); if (distance >= closestDistanceFound) continue; diff --git a/Content.Server/Procedural/DungeonJob.Generator.cs b/Content.Server/Procedural/DungeonJob.Generator.cs index 3c64eadfc28..7720110fd24 100644 --- a/Content.Server/Procedural/DungeonJob.Generator.cs +++ b/Content.Server/Procedural/DungeonJob.Generator.cs @@ -1,3 +1,4 @@ +using System.Numerics; using System.Threading.Tasks; using Content.Shared.Decals; using Content.Shared.Procedural; @@ -64,7 +65,7 @@ private async Task GeneratePrefabDungeon(PrefabDunGen prefab, EntityUid roomA.Sort((x, y) => string.Compare(x.ID, y.ID, StringComparison.Ordinal)); } - + var tiles = new List<(Vector2i, Tile)>(); var dungeon = new Dungeon(); var availablePacks = new List(); @@ -183,7 +184,7 @@ private async Task GeneratePrefabDungeon(PrefabDunGen prefab, EntityUid { for (var y = roomSize.Bottom; y < roomSize.Top; y++) { - var index = matty.Transform(new Vector2(x, y) + grid.TileSize / 2f - packCenter).Floored(); + var index = matty.Transform(new Vector2(x, y) + grid.TileSizeHalfVector - packCenter).Floored(); tiles.Add((index, new Tile(_tileDefManager["FloorPlanetGrass"].TileId))); } } @@ -221,7 +222,7 @@ private async Task GeneratePrefabDungeon(PrefabDunGen prefab, EntityUid var roomCenter = (room.Offset + room.Size / 2f) * grid.TileSize; var roomTiles = new HashSet(room.Size.X * room.Size.Y); var exterior = new HashSet(room.Size.X * 2 + room.Size.Y * 2); - var tileOffset = -roomCenter + grid.TileSize / 2f; + var tileOffset = -roomCenter + grid.TileSizeHalfVector; Box2i? mapBounds = null; // Load tiles @@ -262,7 +263,7 @@ private async Task GeneratePrefabDungeon(PrefabDunGen prefab, EntityUid foreach (var tile in roomTiles) { - center += (Vector2) tile + grid.TileSize / 2f; + center += (Vector2) tile + grid.TileSizeHalfVector; } center /= roomTiles.Count; @@ -308,8 +309,8 @@ private async Task GeneratePrefabDungeon(PrefabDunGen prefab, EntityUid // Offset by 0.5 because decals are offset from bot-left corner // So we convert it to center of tile then convert it back again after transform. // Do these shenanigans because 32x32 decals assume as they are centered on bottom-left of tiles. - var position = dungeonMatty.Transform(decal.Coordinates + 0.5f - roomCenter); - position -= 0.5f; + var position = dungeonMatty.Transform(decal.Coordinates + Vector2Helpers.Half - roomCenter); + position -= Vector2Helpers.Half; // Umm uhh I love decals so uhhhh idk what to do about this var angle = (decal.Angle + finalRoomRotation).Reduced(); diff --git a/Content.Server/Procedural/DungeonJob.PostGen.cs b/Content.Server/Procedural/DungeonJob.PostGen.cs index 1aaaa4c31de..f0c96e490d5 100644 --- a/Content.Server/Procedural/DungeonJob.PostGen.cs +++ b/Content.Server/Procedural/DungeonJob.PostGen.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using System.Threading.Tasks; using Content.Server.NodeContainer; using Content.Shared.Doors.Components; @@ -301,7 +302,7 @@ private async Task PostGen(CornerClutterPostGen gen, Dungeon dungeon, EntityUid if (!blocked) continue; - + var nextDir = (Direction) ((i + 1) * 2 % 8); blocked = HasWall(grid, tile + nextDir.ToIntVec()); @@ -326,7 +327,7 @@ private async Task PostGen(CorridorDecalSkirtingPostGen decks, Dungeon dungeon, var pocketDirections = new ValueList(4); var doorQuery = _entManager.GetEntityQuery(); var physicsQuery = _entManager.GetEntityQuery(); - var offset = new Vector2(-_grid.TileSize / 2f, -_grid.TileSize / 2f); + var offset = -_grid.TileSizeHalfVector; var color = decks.Color; foreach (var tile in dungeon.CorridorTiles) @@ -649,7 +650,7 @@ private async Task PostGen(InternalWindowPostGen gen, Dungeon dungeon, EntityUid foreach (var tile in room.Tiles) { - var tileAngle = ((Vector2) tile + grid.TileSize / 2f - room.Center).ToAngle(); + var tileAngle = ((Vector2) tile + grid.TileSizeHalfVector - room.Center).ToAngle(); var roundedAngle = Math.Round(tileAngle.Theta / (Math.PI / 2)) * (Math.PI / 2); var tileVec = (Vector2i) new Angle(roundedAngle).ToVec().Rounded(); @@ -689,7 +690,7 @@ private async Task PostGen(InternalWindowPostGen gen, Dungeon dungeon, EntityUid validTiles.Add(windowTile); } - validTiles.Sort((x, y) => ((Vector2) x + grid.TileSize / 2f - room.Center).LengthSquared.CompareTo(((Vector2) y + grid.TileSize / 2f - room.Center).LengthSquared)); + validTiles.Sort((x, y) => ((Vector2) x + grid.TileSizeHalfVector - room.Center).LengthSquared().CompareTo((y + grid.TileSizeHalfVector - room.Center).LengthSquared)); for (var j = 0; j < Math.Min(validTiles.Count, 3); j++) { @@ -795,7 +796,7 @@ private async Task PostGen(CorridorPostGen gen, Dungeon dungeon, EntityUid gridU foreach (var entrance in room.Entrances) { // Just so we can still actually get in to the entrance we won't deter from a tile away from it. - var normal = ((Vector2) entrance + grid.TileSize / 2f - room.Center).ToWorldAngle().GetCardinalDir().ToIntVec(); + var normal = ((Vector2) entrance + grid.TileSizeHalfVector - room.Center).ToWorldAngle().GetCardinalDir().ToIntVec(); deterredTiles.Remove(entrance + normal); } } @@ -1112,7 +1113,7 @@ private async Task PostGen(MiddleConnectionPostGen gen, Dungeon dungeon, EntityU foreach (var node in flipp) { - center += (Vector2) node + grid.TileSize / 2f; + center += (Vector2) node + grid.TileSizeHalfVector; } center /= flipp.Count; @@ -1121,7 +1122,7 @@ private async Task PostGen(MiddleConnectionPostGen gen, Dungeon dungeon, EntityU foreach (var node in flipp) { - nodeDistances.Add((node, ((Vector2) node + grid.TileSize / 2f - center).LengthSquared)); + nodeDistances.Add((node, ((Vector2) node + grid.TileSizeHalfVector - center).LengthSquared())); } nodeDistances.Sort((x, y) => x.Distance.CompareTo(y.Distance)); diff --git a/Content.Server/Projectiles/ProjectileSystem.cs b/Content.Server/Projectiles/ProjectileSystem.cs index a8803a17235..5529a5f4f6b 100644 --- a/Content.Server/Projectiles/ProjectileSystem.cs +++ b/Content.Server/Projectiles/ProjectileSystem.cs @@ -44,7 +44,7 @@ private void OnStartCollide(EntityUid uid, ProjectileComponent component, ref St } var otherName = ToPrettyString(otherEntity); - var direction = args.OurBody.LinearVelocity.Normalized; + var direction = args.OurBody.LinearVelocity.Normalized(); var modifiedDamage = _damageableSystem.TryChangeDamage(otherEntity, component.Damage, component.IgnoreResistances, origin: component.Shooter); var deleted = Deleted(otherEntity); diff --git a/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs b/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs index 4097b978ebe..c4a6a67033e 100644 --- a/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs +++ b/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Radiation.Components; using Content.Server.Radiation.Events; using Content.Shared.Radiation.Components; @@ -101,7 +102,7 @@ private void UpdateGridcast() // get direction from rad source to destination and its distance var dir = destWorld - sourceWorld; - var dist = dir.Length; + var dist = dir.Length(); // check if receiver is too far away if (dist > GridcastMaxDistance) diff --git a/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs b/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs index 1e2dc45854b..553a54d92a6 100644 --- a/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs +++ b/Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs @@ -14,6 +14,7 @@ using Content.Shared.Item; using Content.Shared.Bed.Sleep; using System.Linq; +using System.Numerics; using Content.Server.Maps; using Content.Server.Revenant.Components; using Content.Shared.DoAfter; @@ -214,7 +215,7 @@ private void OnDefileAction(EntityUid uid, RevenantComponent component, Revenant if (!_mapManager.TryGetGrid(xform.GridUid, out var map)) return; var tiles = map.GetTilesIntersecting(Box2.CenteredAround(xform.WorldPosition, - (component.DefileRadius*2, component.DefileRadius))).ToArray(); + new Vector2(component.DefileRadius * 2, component.DefileRadius))).ToArray(); _random.Shuffle(tiles); diff --git a/Content.Server/Revenant/EntitySystems/RevenantSystem.cs b/Content.Server/Revenant/EntitySystems/RevenantSystem.cs index a1a594dc310..73a04ca8a40 100644 --- a/Content.Server/Revenant/EntitySystems/RevenantSystem.cs +++ b/Content.Server/Revenant/EntitySystems/RevenantSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Actions; using Content.Shared.Popups; using Content.Shared.Alert; diff --git a/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs b/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs index ce53041456f..e7938ae5d95 100644 --- a/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs +++ b/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Salvage; using Content.Shared.Salvage.Expeditions; using Robust.Shared.Audio; diff --git a/Content.Server/Salvage/Expeditions/SalvageMiningExpeditionComponent.cs b/Content.Server/Salvage/Expeditions/SalvageMiningExpeditionComponent.cs index 6aee2cc0211..6fdbc7d57e7 100644 --- a/Content.Server/Salvage/Expeditions/SalvageMiningExpeditionComponent.cs +++ b/Content.Server/Salvage/Expeditions/SalvageMiningExpeditionComponent.cs @@ -1,3 +1,5 @@ +using Content.Shared.Salvage; + namespace Content.Server.Salvage.Expeditions; /// diff --git a/Content.Server/Salvage/SalvageSystem.Runner.cs b/Content.Server/Salvage/SalvageSystem.Runner.cs index 208f3deca02..f94d71bf677 100644 --- a/Content.Server/Salvage/SalvageSystem.Runner.cs +++ b/Content.Server/Salvage/SalvageSystem.Runner.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Salvage.Expeditions; using Content.Server.Salvage.Expeditions.Structure; using Content.Server.Shuttles.Components; diff --git a/Content.Server/Salvage/SalvageSystem.cs b/Content.Server/Salvage/SalvageSystem.cs index d3cff136296..cccc81a239b 100644 --- a/Content.Server/Salvage/SalvageSystem.cs +++ b/Content.Server/Salvage/SalvageSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Construction; using Content.Server.GameTicking; using Content.Server.Radio.EntitySystems; diff --git a/Content.Server/Salvage/SpawnSalvageMissionJob.cs b/Content.Server/Salvage/SpawnSalvageMissionJob.cs index 897c01d0346..949ae834ec2 100644 --- a/Content.Server/Salvage/SpawnSalvageMissionJob.cs +++ b/Content.Server/Salvage/SpawnSalvageMissionJob.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using System.Threading; using System.Threading.Tasks; using Content.Server.Atmos; diff --git a/Content.Server/Shuttles/Components/ShuttleComponent.cs b/Content.Server/Shuttles/Components/ShuttleComponent.cs index 0e42092c579..e8d9f6eee91 100644 --- a/Content.Server/Shuttles/Components/ShuttleComponent.cs +++ b/Content.Server/Shuttles/Components/ShuttleComponent.cs @@ -1,3 +1,5 @@ +using System.Numerics; + namespace Content.Server.Shuttles.Components { [RegisterComponent] diff --git a/Content.Server/Shuttles/Components/ShuttleConsoleComponent.cs b/Content.Server/Shuttles/Components/ShuttleConsoleComponent.cs index 1ad07afa4c5..da21887f30f 100644 --- a/Content.Server/Shuttles/Components/ShuttleConsoleComponent.cs +++ b/Content.Server/Shuttles/Components/ShuttleConsoleComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Shuttles.Components; namespace Content.Server.Shuttles.Components diff --git a/Content.Server/Shuttles/Components/ThrusterComponent.cs b/Content.Server/Shuttles/Components/ThrusterComponent.cs index 4adf3d7b800..7b6044ccc71 100644 --- a/Content.Server/Shuttles/Components/ThrusterComponent.cs +++ b/Content.Server/Shuttles/Components/ThrusterComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Shuttles.Systems; using Content.Shared.Construction.Prototypes; using Content.Shared.Damage; diff --git a/Content.Server/Shuttles/Systems/DockingSystem.AutoDock.cs b/Content.Server/Shuttles/Systems/DockingSystem.AutoDock.cs index 7474c5297ed..1a18cd2cb32 100644 --- a/Content.Server/Shuttles/Systems/DockingSystem.AutoDock.cs +++ b/Content.Server/Shuttles/Systems/DockingSystem.AutoDock.cs @@ -62,7 +62,7 @@ private void UpdateAutodock() var worldPos = _transform.GetWorldPosition(xform, xformQuery); var otherWorldPos = _transform.GetWorldPosition(otherXform, xformQuery); - if ((worldPos - otherWorldPos).Length < comp.Radius) + if ((worldPos - otherWorldPos).Length() < comp.Radius) continue; _sawmill.Debug($"Removed RecentlyDocked from {ToPrettyString(uid)} and {ToPrettyString(comp.LastDocked)}"); diff --git a/Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs b/Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs index d75e65143f9..c393da69fab 100644 --- a/Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs +++ b/Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; +using System.Numerics; using Content.Server.Shuttles.Components; using Robust.Shared.Map; using Robust.Shared.Map.Components; diff --git a/Content.Server/Shuttles/Systems/DockingSystem.cs b/Content.Server/Shuttles/Systems/DockingSystem.cs index cc61491be38..16b62378834 100644 --- a/Content.Server/Shuttles/Systems/DockingSystem.cs +++ b/Content.Server/Shuttles/Systems/DockingSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Doors.Systems; using Content.Server.NPC.Pathfinding; using Content.Server.Shuttles.Components; diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs index 5a14a30c5eb..9b0a5f85e61 100644 --- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using System.Threading; using Content.Server.Access.Systems; using Content.Server.Administration.Logs; diff --git a/Content.Server/Shuttles/Systems/RadarConsoleSystem.cs b/Content.Server/Shuttles/Systems/RadarConsoleSystem.cs index 961539262cd..17341ab7ec3 100644 --- a/Content.Server/Shuttles/Systems/RadarConsoleSystem.cs +++ b/Content.Server/Shuttles/Systems/RadarConsoleSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.UserInterface; using Content.Shared.Shuttles.BUIStates; using Content.Shared.Shuttles.Components; diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs index 18a5000bcfc..2be0ef57d78 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs @@ -9,6 +9,7 @@ using Robust.Shared.Player; using Robust.Shared.Utility; using System.Diagnostics.CodeAnalysis; +using System.Numerics; using Content.Server.Shuttles.Events; using Content.Shared.Body.Components; using Content.Shared.Buckle.Components; @@ -541,7 +542,7 @@ public bool TryFTLProximity(EntityUid shuttleUid, ShuttleComponent component, En } var targetAABB = _transform.GetWorldMatrix(targetXform, xformQuery) - .TransformBox(targetLocalAABB).Enlarged(shuttleAABB.Size.Length); + .TransformBox(targetLocalAABB).Enlarged(shuttleAABB.Size.Length()); var nearbyGrids = new HashSet(); var iteration = 0; var lastCount = nearbyGrids.Count; @@ -564,7 +565,7 @@ public bool TryFTLProximity(EntityUid shuttleUid, ShuttleComponent component, En break; } - targetAABB = targetAABB.Enlarged(shuttleAABB.Size.Length / 2f); + targetAABB = targetAABB.Enlarged(shuttleAABB.Size.Length() / 2f); iteration++; lastCount = nearbyGrids.Count; diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs index 97be835cd18..4fbd90449fe 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs @@ -42,7 +42,7 @@ private void OnShuttleCollide(EntityUid uid, ShuttleComponent component, ref Sta var ourVelocity = _physics.GetLinearVelocity(uid, ourPoint, ourBody, ourXform); var otherVelocity = _physics.GetLinearVelocity(args.OtherEntity, otherPoint, otherBody, otherXform); - var jungleDiff = (ourVelocity - otherVelocity).Length; + var jungleDiff = (ourVelocity - otherVelocity).Length(); if (jungleDiff < MinimumImpactVelocity) { diff --git a/Content.Server/Shuttles/Systems/ThrusterSystem.cs b/Content.Server/Shuttles/Systems/ThrusterSystem.cs index 51d6d9217bb..dacec415e57 100644 --- a/Content.Server/Shuttles/Systems/ThrusterSystem.cs +++ b/Content.Server/Shuttles/Systems/ThrusterSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Audio; using Content.Server.Construction; using Content.Server.Power.Components; diff --git a/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs b/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs index c6449f9a883..8e89fda9ec8 100644 --- a/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs +++ b/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs @@ -295,10 +295,10 @@ private List GenerateFieldConnection(ContainmentFieldGeneratorCompone var gen2Coords = Transform(secondGenComp.Owner).Coordinates; var delta = (gen2Coords - gen1Coords).Position; - var dirVec = delta.Normalized; - var stopDist = delta.Length; + var dirVec = delta.Normalized(); + var stopDist = delta.Length(); var currentOffset = dirVec; - while (currentOffset.Length < stopDist) + while (currentOffset.Length() < stopDist) { var currentCoords = gen1Coords.Offset(currentOffset); var newField = Spawn(firstGenComp.CreatedField, currentCoords); diff --git a/Content.Server/Singularity/EntitySystems/EmitterSystem.cs b/Content.Server/Singularity/EntitySystems/EmitterSystem.cs index bfe5ca27b96..e737cd0a8d7 100644 --- a/Content.Server/Singularity/EntitySystems/EmitterSystem.cs +++ b/Content.Server/Singularity/EntitySystems/EmitterSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using System.Threading; using Content.Server.Administration.Logs; using Content.Server.Construction; @@ -292,7 +293,7 @@ private void Fire(EntityUid uid, EmitterComponent component) var proj = EnsureComp(ent); _projectile.SetShooter(proj, uid); - var targetPos = new EntityCoordinates(uid, (0, -1)); + var targetPos = new EntityCoordinates(uid, new Vector2(0, -1)); _gun.Shoot(uid, gunComponent, ent, xform.Coordinates, targetPos, out _); } diff --git a/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs b/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs index 45854a88af6..ceaf6acaae6 100644 --- a/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs +++ b/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Administration.Logs; using Robust.Shared.Containers; using Robust.Shared.Timing; diff --git a/Content.Server/Singularity/EntitySystems/GravityWellSystem.cs b/Content.Server/Singularity/EntitySystems/GravityWellSystem.cs index eaa3c0a9365..493f7deb938 100644 --- a/Content.Server/Singularity/EntitySystems/GravityWellSystem.cs +++ b/Content.Server/Singularity/EntitySystems/GravityWellSystem.cs @@ -197,7 +197,7 @@ public void GravPulse(MapCoordinates mapPos, float maxRange, float minRange, in continue; var displacement = epicenter - _transform.GetWorldPosition(entity, xformQuery); - var distance2 = displacement.LengthSquared; + var distance2 = displacement.LengthSquared(); if (distance2 < minRange2) continue; diff --git a/Content.Server/Spawners/EntitySystems/ConditionalSpawnerSystem.cs b/Content.Server/Spawners/EntitySystems/ConditionalSpawnerSystem.cs index 341a2c9d440..5248d512b89 100644 --- a/Content.Server/Spawners/EntitySystems/ConditionalSpawnerSystem.cs +++ b/Content.Server/Spawners/EntitySystems/ConditionalSpawnerSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.GameTicking; using Content.Server.GameTicking.Rules.Components; using Content.Server.Spawners.Components; diff --git a/Content.Server/Speech/EntitySystems/ListeningSystem.cs b/Content.Server/Speech/EntitySystems/ListeningSystem.cs index f33f0aedf8b..d0a7b417901 100644 --- a/Content.Server/Speech/EntitySystems/ListeningSystem.cs +++ b/Content.Server/Speech/EntitySystems/ListeningSystem.cs @@ -42,7 +42,7 @@ public void PingListeners(EntityUid source, string message, string? obfuscatedMe // range checks // TODO proper speech occlusion - var distance = (sourcePos - _xforms.GetWorldPosition(xform, xformQuery)).LengthSquared; + var distance = (sourcePos - _xforms.GetWorldPosition(xform, xformQuery)).LengthSquared(); if (distance > listener.Range * listener.Range) continue; diff --git a/Content.Server/Standing/StandingStateSystem.cs b/Content.Server/Standing/StandingStateSystem.cs index 775df13d365..e2b64958446 100644 --- a/Content.Server/Standing/StandingStateSystem.cs +++ b/Content.Server/Standing/StandingStateSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Hands.Components; using Content.Shared.Hands.EntitySystems; using Content.Shared.Standing; diff --git a/Content.Server/Station/Systems/StationSystem.cs b/Content.Server/Station/Systems/StationSystem.cs index ff2446eeb66..7f8507205b1 100644 --- a/Content.Server/Station/Systems/StationSystem.cs +++ b/Content.Server/Station/Systems/StationSystem.cs @@ -197,7 +197,7 @@ private void OnRoundEnd(GameRunLevelChangedEvent eventArgs) foreach (var gridUid in component.Grids) { if (!TryComp(gridUid, out var grid) || - grid.LocalAABB.Size.LengthSquared < largestBounds.Size.LengthSquared) + grid.LocalAABB.Size.LengthSquared() < largestBounds.Size.LengthSquared()) continue; largestBounds = grid.LocalAABB; diff --git a/Content.Server/StationEvents/Events/ImmovableRodRule.cs b/Content.Server/StationEvents/Events/ImmovableRodRule.cs index e6c868fa188..b92ac917bc9 100644 --- a/Content.Server/StationEvents/Events/ImmovableRodRule.cs +++ b/Content.Server/StationEvents/Events/ImmovableRodRule.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.GameTicking.Rules.Components; using Content.Server.ImmovableRod; using Content.Server.StationEvents.Components; diff --git a/Content.Server/StationEvents/Events/MeteorSwarmRule.cs b/Content.Server/StationEvents/Events/MeteorSwarmRule.cs index acae238a6cb..b5408ac982f 100644 --- a/Content.Server/StationEvents/Events/MeteorSwarmRule.cs +++ b/Content.Server/StationEvents/Events/MeteorSwarmRule.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.GameTicking.Rules.Components; using Content.Server.StationEvents.Components; using Content.Shared.Spawners.Components; @@ -53,7 +54,7 @@ protected override void ActiveTick(EntityUid uid, MeteorSwarmRuleComponent compo return; } - var minimumDistance = (playableArea.Value.TopRight - playableArea.Value.Center).Length + 50f; + var minimumDistance = (playableArea.Value.TopRight - playableArea.Value.Center).Length() + 50f; var maximumDistance = minimumDistance + 100f; var center = playableArea.Value.Center; @@ -68,7 +69,7 @@ protected override void ActiveTick(EntityUid uid, MeteorSwarmRuleComponent compo _physics.SetBodyStatus(physics, BodyStatus.InAir); _physics.SetLinearDamping(physics, 0f); _physics.SetAngularDamping(physics, 0f); - _physics.ApplyLinearImpulse(meteor, -offset.Normalized * component.MeteorVelocity * physics.Mass, body: physics); + _physics.ApplyLinearImpulse(meteor, -offset.Normalized() * component.MeteorVelocity * physics.Mass, body: physics); _physics.ApplyAngularImpulse( meteor, physics.Mass * ((component.MaxAngularVelocity - component.MinAngularVelocity) * RobustRandom.NextFloat() + component.MinAngularVelocity), diff --git a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMicrophoneSystem.cs b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMicrophoneSystem.cs index c84efccca01..b4054a290da 100644 --- a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMicrophoneSystem.cs +++ b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMicrophoneSystem.cs @@ -34,7 +34,7 @@ private void OnExpandRecipients(ExpandICChatRecipientstEvent ev) // get range to camera. This way wispers will still appear as obfuscated if they are too far from the camera's microphone var range = (xform.MapID != sourceXform.MapID) ? -1 - : (sourcePos - _xforms.GetWorldPosition(xform, xformQuery)).Length; + : (sourcePos - _xforms.GetWorldPosition(xform, xformQuery)).Length(); if (range < 0 || range > ev.VoiceRange) continue; diff --git a/Content.Server/Tabletop/Components/TabletopGameComponent.cs b/Content.Server/Tabletop/Components/TabletopGameComponent.cs index cd57e971c9c..7ebd12f200d 100644 --- a/Content.Server/Tabletop/Components/TabletopGameComponent.cs +++ b/Content.Server/Tabletop/Components/TabletopGameComponent.cs @@ -1,3 +1,5 @@ +using System.Numerics; + namespace Content.Server.Tabletop.Components { /// diff --git a/Content.Server/Tabletop/TabletopSession.cs b/Content.Server/Tabletop/TabletopSession.cs index 3613bbbdae9..d94b4fd6575 100644 --- a/Content.Server/Tabletop/TabletopSession.cs +++ b/Content.Server/Tabletop/TabletopSession.cs @@ -1,4 +1,5 @@ -using Robust.Server.Player; +using System.Numerics; +using Robust.Server.Player; using Robust.Shared.Map; namespace Content.Server.Tabletop diff --git a/Content.Server/Tabletop/TabletopSystem.Map.cs b/Content.Server/Tabletop/TabletopSystem.Map.cs index 8f1b8edd205..40489625918 100644 --- a/Content.Server/Tabletop/TabletopSystem.Map.cs +++ b/Content.Server/Tabletop/TabletopSystem.Map.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.GameTicking; using Robust.Shared.Map; using Robust.Shared.Map.Components; diff --git a/Content.Server/Tabletop/TabletopSystem.Session.cs b/Content.Server/Tabletop/TabletopSystem.Session.cs index 5dd822120c8..2f73d0e0d2b 100644 --- a/Content.Server/Tabletop/TabletopSystem.Session.cs +++ b/Content.Server/Tabletop/TabletopSystem.Session.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Tabletop.Components; using Content.Shared.Tabletop.Events; using Robust.Server.GameObjects; diff --git a/Content.Server/Traits/Assorted/NarcolepsyComponent.cs b/Content.Server/Traits/Assorted/NarcolepsyComponent.cs index 6cf153fd515..be8f6cde549 100644 --- a/Content.Server/Traits/Assorted/NarcolepsyComponent.cs +++ b/Content.Server/Traits/Assorted/NarcolepsyComponent.cs @@ -1,4 +1,6 @@ -namespace Content.Server.Traits.Assorted; +using System.Numerics; + +namespace Content.Server.Traits.Assorted; /// /// This is used for the narcolepsy trait. diff --git a/Content.Server/VendingMachines/VendingMachineSystem.cs b/Content.Server/VendingMachines/VendingMachineSystem.cs index 9d8c6d98f5a..f9d7759d0c5 100644 --- a/Content.Server/VendingMachines/VendingMachineSystem.cs +++ b/Content.Server/VendingMachines/VendingMachineSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Cargo.Systems; using Content.Server.Emp; using Content.Server.Power.Components; diff --git a/Content.Server/Weapons/Melee/MeleeWeaponSystem.cs b/Content.Server/Weapons/Melee/MeleeWeaponSystem.cs index 6f93edb13d8..bb0442b6714 100644 --- a/Content.Server/Weapons/Melee/MeleeWeaponSystem.cs +++ b/Content.Server/Weapons/Melee/MeleeWeaponSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Body.Components; using Content.Server.Body.Systems; using Content.Server.Chat.Systems; @@ -46,8 +47,6 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem [Dependency] private readonly SolutionContainerSystem _solutions = default!; [Dependency] private readonly TagSystem _tag = default!; [Dependency] private readonly ChatSystem _chat = default!; - [Dependency] private readonly PopupSystem _popupSystem = default!; - public override void Initialize() { diff --git a/Content.Server/Weapons/Ranged/Systems/GunSystem.cs b/Content.Server/Weapons/Ranged/Systems/GunSystem.cs index f14524c6075..d43d845b165 100644 --- a/Content.Server/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Server/Weapons/Ranged/Systems/GunSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Administration.Logs; using Content.Server.Cargo.Systems; using Content.Server.Examine; @@ -108,7 +109,7 @@ public override void Shoot(EntityUid gunUid, GunComponent gun, List<(EntityUid? : new EntityCoordinates(MapManager.GetMapEntityId(fromMap.MapId), fromMap.Position); // Update shot based on the recoil - toMap = fromMap.Position + angle.ToVec() * mapDirection.Length; + toMap = fromMap.Position + angle.ToVec() * mapDirection.Length(); mapDirection = toMap - fromMap.Position; var gunVelocity = Physics.GetMapLinearVelocity(gunUid); @@ -186,8 +187,9 @@ public override void Shoot(EntityUid gunUid, GunComponent gun, List<(EntityUid? EntityUid? lastHit = null; var from = fromMap; - var fromEffect = fromCoordinates; // can't use map coords above because funny FireEffects - var dir = mapDirection.Normalized; + // can't use map coords above because funny FireEffects + var fromEffect = fromCoordinates; + var dir = mapDirection.Normalized(); var lastUser = user; if (hitscan.Reflective != ReflectType.None) @@ -204,7 +206,7 @@ public override void Shoot(EntityUid gunUid, GunComponent gun, List<(EntityUid? var hit = result.HitEntity; lastHit = hit; - FireEffects(fromEffect, result.Distance, dir.Normalized.ToAngle(), hitscan, hit); + FireEffects(fromEffect, result.Distance, dir.Normalized().ToAngle(), hitscan, hit); var ev = new HitScanReflectAttemptEvent(user, gunUid, hitscan.Reflective, dir, false); RaiseLocalEvent(hit, ref ev); @@ -221,7 +223,7 @@ public override void Shoot(EntityUid gunUid, GunComponent gun, List<(EntityUid? if (lastHit != null) { - EntityUid hitEntity = lastHit.Value; + var hitEntity = lastHit.Value; if (hitscan.StaminaDamage > 0f) _stamina.TakeStaminaDamage(hitEntity, hitscan.StaminaDamage, source:user); @@ -292,7 +294,7 @@ public void ShootProjectile(EntityUid uid, Vector2 direction, Vector2 gunVelocit var physics = EnsureComp(uid); Physics.SetBodyStatus(physics, BodyStatus.InAir); - var targetMapVelocity = gunVelocity + direction.Normalized * speed; + var targetMapVelocity = gunVelocity + direction.Normalized() * speed; var currentMapVelocity = Physics.GetMapLinearVelocity(uid, physics); var finalLinear = physics.LinearVelocity + targetMapVelocity - currentMapVelocity; Physics.SetLinearVelocity(uid, finalLinear, body: physics); @@ -416,7 +418,7 @@ private void FireEffects(EntityCoordinates fromCoordinates, float distance, Angl { if (hitscan.MuzzleFlash != null) { - sprites.Add((fromCoordinates.Offset(angle.ToVec().Normalized / 2), angle, hitscan.MuzzleFlash, 1f)); + sprites.Add((fromCoordinates.Offset(angle.ToVec().Normalized() / 2), angle, hitscan.MuzzleFlash, 1f)); } if (hitscan.TravelFlash != null) diff --git a/Content.Server/Worldgen/Components/Carvers/NoiseRangeCarverComponent.cs b/Content.Server/Worldgen/Components/Carvers/NoiseRangeCarverComponent.cs index 164f8ff0593..141d54c8df9 100644 --- a/Content.Server/Worldgen/Components/Carvers/NoiseRangeCarverComponent.cs +++ b/Content.Server/Worldgen/Components/Carvers/NoiseRangeCarverComponent.cs @@ -1,4 +1,5 @@ -using Content.Server.Worldgen.Prototypes; +using System.Numerics; +using Content.Server.Worldgen.Prototypes; using Content.Server.Worldgen.Systems.Carvers; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; diff --git a/Content.Server/Worldgen/Components/Debris/DebrisFeaturePlacerControllerComponent.cs b/Content.Server/Worldgen/Components/Debris/DebrisFeaturePlacerControllerComponent.cs index 1d59960f2e3..0a10a1360a2 100644 --- a/Content.Server/Worldgen/Components/Debris/DebrisFeaturePlacerControllerComponent.cs +++ b/Content.Server/Worldgen/Components/Debris/DebrisFeaturePlacerControllerComponent.cs @@ -1,4 +1,5 @@ -using Content.Server.Worldgen.Prototypes; +using System.Numerics; +using Content.Server.Worldgen.Prototypes; using Content.Server.Worldgen.Systems.Debris; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; diff --git a/Content.Server/Worldgen/Components/Debris/OwnedDebrisComponent.cs b/Content.Server/Worldgen/Components/Debris/OwnedDebrisComponent.cs index 73a6cf89753..42bc50c5fcd 100644 --- a/Content.Server/Worldgen/Components/Debris/OwnedDebrisComponent.cs +++ b/Content.Server/Worldgen/Components/Debris/OwnedDebrisComponent.cs @@ -1,4 +1,5 @@ -using Content.Server.Worldgen.Systems.Debris; +using System.Numerics; +using Content.Server.Worldgen.Systems.Debris; namespace Content.Server.Worldgen.Components.Debris; diff --git a/Content.Server/Worldgen/Prototypes/BiomePrototype.cs b/Content.Server/Worldgen/Prototypes/BiomePrototype.cs index 3c83a5c7115..5417c60fb9e 100644 --- a/Content.Server/Worldgen/Prototypes/BiomePrototype.cs +++ b/Content.Server/Worldgen/Prototypes/BiomePrototype.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Prototypes; +using System.Numerics; +using Robust.Shared.Prototypes; using Robust.Shared.Serialization.Manager; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array; diff --git a/Content.Server/Worldgen/Prototypes/NoiseChannelPrototype.cs b/Content.Server/Worldgen/Prototypes/NoiseChannelPrototype.cs index 0d1ff775693..8e495c2ad0a 100644 --- a/Content.Server/Worldgen/Prototypes/NoiseChannelPrototype.cs +++ b/Content.Server/Worldgen/Prototypes/NoiseChannelPrototype.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Noise; +using System.Numerics; +using Robust.Shared.Noise; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array; diff --git a/Content.Server/Worldgen/Systems/BaseWorldSystem.cs b/Content.Server/Worldgen/Systems/BaseWorldSystem.cs index ea6a5eaa970..78326651c9c 100644 --- a/Content.Server/Worldgen/Systems/BaseWorldSystem.cs +++ b/Content.Server/Worldgen/Systems/BaseWorldSystem.cs @@ -1,4 +1,5 @@ -using Content.Server.Worldgen.Components; +using System.Numerics; +using Content.Server.Worldgen.Components; using JetBrains.Annotations; namespace Content.Server.Worldgen.Systems; diff --git a/Content.Server/Worldgen/Systems/Debris/DebrisFeaturePlacerSystem.cs b/Content.Server/Worldgen/Systems/Debris/DebrisFeaturePlacerSystem.cs index 8c8360af31e..bcfb761c728 100644 --- a/Content.Server/Worldgen/Systems/Debris/DebrisFeaturePlacerSystem.cs +++ b/Content.Server/Worldgen/Systems/Debris/DebrisFeaturePlacerSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Server.Worldgen.Components; using Content.Server.Worldgen.Components.Debris; using Content.Server.Worldgen.Systems.GC; @@ -231,8 +232,8 @@ private void OnChunkLoaded(EntityUid uid, DebrisFeaturePlacerControllerComponent private List GeneratePointsInChunk(EntityUid chunk, float density, Vector2 coords, EntityUid map) { var offs = (int) ((WorldGen.ChunkSize - WorldGen.ChunkSize / 8.0f) / 2.0f); - var topLeft = (-offs, -offs); - var lowerRight = (offs, offs); + var topLeft = new Vector2(-offs, -offs); + var lowerRight = new Vector2(offs, offs); var enumerator = _sampler.SampleRectangle(topLeft, lowerRight, density); var debrisPoints = new List(); diff --git a/Content.Server/Worldgen/Systems/LocalityLoaderSystem.cs b/Content.Server/Worldgen/Systems/LocalityLoaderSystem.cs index 2f3cffbe118..fb02e8aa0bd 100644 --- a/Content.Server/Worldgen/Systems/LocalityLoaderSystem.cs +++ b/Content.Server/Worldgen/Systems/LocalityLoaderSystem.cs @@ -42,7 +42,7 @@ public override void Update(float frameTime) if (!xformQuery.TryGetComponent(loader, out var loaderXform)) continue; - if ((_xformSys.GetWorldPosition(loaderXform) - _xformSys.GetWorldPosition(xform)).Length > loadable.LoadingDistance) + if ((_xformSys.GetWorldPosition(loaderXform) - _xformSys.GetWorldPosition(xform)).Length() > loadable.LoadingDistance) continue; RaiseLocalEvent(uid, new LocalStructureLoadedEvent()); diff --git a/Content.Server/Worldgen/Systems/NoiseIndexSystem.cs b/Content.Server/Worldgen/Systems/NoiseIndexSystem.cs index 59de257c0bf..5a7e02c803a 100644 --- a/Content.Server/Worldgen/Systems/NoiseIndexSystem.cs +++ b/Content.Server/Worldgen/Systems/NoiseIndexSystem.cs @@ -1,4 +1,5 @@ -using Content.Server.Worldgen.Components; +using System.Numerics; +using Content.Server.Worldgen.Components; using Content.Server.Worldgen.Prototypes; using Robust.Shared.Prototypes; using Robust.Shared.Random; diff --git a/Content.Server/Worldgen/Tools/PoissonDiskSampler.cs b/Content.Server/Worldgen/Tools/PoissonDiskSampler.cs index e372b4fbd5b..cb7c5a14114 100644 --- a/Content.Server/Worldgen/Tools/PoissonDiskSampler.cs +++ b/Content.Server/Worldgen/Tools/PoissonDiskSampler.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; -using Robust.Shared.Random; +using System.Numerics; +using Robust.Shared.Random; using Robust.Shared.Utility; namespace Content.Server.Worldgen.Tools; @@ -90,7 +91,7 @@ private Vector2 AddFirstPoint(ref SampleSettings settings, ref State state) var p = new Vector2((float) xr, (float) yr); if (settings.RejectionSqDistance != null && - (settings.Center - p).LengthSquared > settings.RejectionSqDistance) + (settings.Center - p).LengthSquared() > settings.RejectionSqDistance) continue; var index = Denormalize(p, settings.TopLeft, settings.CellSize); @@ -109,7 +110,7 @@ private Vector2 AddFirstPoint(ref SampleSettings settings, ref State state) if (q.X >= settings.TopLeft.X && q.X < settings.LowerRight.X && q.Y > settings.TopLeft.Y && q.Y < settings.LowerRight.Y && (settings.RejectionSqDistance == null || - (settings.Center - q).LengthSquared <= settings.RejectionSqDistance)) + (settings.Center - q).LengthSquared() <= settings.RejectionSqDistance)) { var qIndex = Denormalize(q, settings.TopLeft, settings.CellSize); var tooClose = false; @@ -121,7 +122,7 @@ private Vector2 AddFirstPoint(ref SampleSettings settings, ref State state) j < Math.Min(settings.GridHeight, qIndex.Y + 3) && !tooClose; j++) { - if (state.Grid[i, j].HasValue && (state.Grid[i, j]!.Value - q).Length < settings.MinimumDistance) + if (state.Grid[i, j].HasValue && (state.Grid[i, j]!.Value - q).Length() < settings.MinimumDistance) tooClose = true; } diff --git a/Content.Server/Worldgen/WorldGen.cs b/Content.Server/Worldgen/WorldGen.cs index 4dc64c5657a..1ed20b9f1fa 100644 --- a/Content.Server/Worldgen/WorldGen.cs +++ b/Content.Server/Worldgen/WorldGen.cs @@ -1,4 +1,5 @@ using System.Diagnostics.Contracts; +using System.Numerics; namespace Content.Server.Worldgen; @@ -21,7 +22,7 @@ public static class WorldGen [Pure] public static Vector2i WorldToChunkCoords(Vector2i inp) { - return ((Vector2) inp * (1.0f / ChunkSize, 1.0f / ChunkSize)).Floored(); + return (inp * new Vector2(1.0f / ChunkSize, 1.0f / ChunkSize)).Floored(); } /// @@ -32,7 +33,7 @@ public static Vector2i WorldToChunkCoords(Vector2i inp) [Pure] public static Vector2 WorldToChunkCoords(Vector2 inp) { - return inp * (1.0f / ChunkSize, 1.0f / ChunkSize); + return inp * new Vector2(1.0f / ChunkSize, 1.0f / ChunkSize); } /// diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/SpawnArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/SpawnArtifactSystem.cs index 4ac173a1606..fcb33ae41fd 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/SpawnArtifactSystem.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/SpawnArtifactSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components; using Content.Server.Xenoarchaeology.XenoArtifacts.Events; using Content.Shared.Storage; diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ThrowArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ThrowArtifactSystem.cs index e2af7ef3350..55159feebbf 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ThrowArtifactSystem.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ThrowArtifactSystem.cs @@ -1,4 +1,5 @@ -using Content.Server.Maps; +using System.Numerics; +using Content.Server.Maps; using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components; using Content.Server.Xenoarchaeology.XenoArtifacts.Events; using Content.Shared.Maps; @@ -28,7 +29,7 @@ private void OnActivated(EntityUid uid, ThrowArtifactComponent component, Artifa if (_map.TryGetGrid(xform.GridUid, out var grid)) { var tiles = grid.GetTilesIntersecting( - Box2.CenteredAround(xform.WorldPosition, (component.Range*2, component.Range))); + Box2.CenteredAround(xform.WorldPosition, new Vector2(component.Range * 2, component.Range))); foreach (var tile in tiles) { diff --git a/Content.Shared/Actions/SharedActionsSystem.cs b/Content.Shared/Actions/SharedActionsSystem.cs index 35954464f24..8dce478eb2f 100644 --- a/Content.Shared/Actions/SharedActionsSystem.cs +++ b/Content.Shared/Actions/SharedActionsSystem.cs @@ -241,7 +241,7 @@ public bool ValidateEntityTarget(EntityUid user, EntityUid target, EntityTargetA if (action.Range <= 0) return true; - var distance = (_transformSystem.GetWorldPosition(xform) - _transformSystem.GetWorldPosition(targetXform)).Length; + var distance = (_transformSystem.GetWorldPosition(xform) - _transformSystem.GetWorldPosition(targetXform)).Length(); return distance <= action.Range; } diff --git a/Content.Shared/Anomaly/Components/AnomalyComponent.cs b/Content.Shared/Anomaly/Components/AnomalyComponent.cs index ff95e419406..42d6542209d 100644 --- a/Content.Shared/Anomaly/Components/AnomalyComponent.cs +++ b/Content.Shared/Anomaly/Components/AnomalyComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Damage; using Robust.Shared.Audio; using Robust.Shared.GameStates; @@ -112,7 +113,7 @@ public sealed class AnomalyComponent : Component /// This is more likely to trend upwards than donwards, because that's funny /// [DataField("pulseStabilityVariation")] - public Vector2 PulseStabilityVariation = (-0.1f, 0.15f); + public Vector2 PulseStabilityVariation = new(-0.1f, 0.15f); /// /// The sound played when an anomaly pulses @@ -219,7 +220,7 @@ public sealed class AnomalyComponent : Component /// [ViewVariables(VVAccess.ReadWrite)] [DataField("offset")] - public readonly Vector2 FloatingOffset = (0, 0.15f); + public readonly Vector2 FloatingOffset = new(0, 0.15f); public readonly string AnimationKey = "anomalyfloat"; #endregion diff --git a/Content.Shared/Audio/AmbientSoundComponent.cs b/Content.Shared/Audio/AmbientSoundComponent.cs index 81b7a75ed87..b120510f4af 100644 --- a/Content.Shared/Audio/AmbientSoundComponent.cs +++ b/Content.Shared/Audio/AmbientSoundComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Shared.Audio; using Robust.Shared.ComponentTrees; using Robust.Shared.GameStates; @@ -25,6 +26,8 @@ public sealed class AmbientSoundComponent : Component, IComponentTreeEntry new Vector2(Range, Range); + /// /// Applies this volume to the sound being played. /// diff --git a/Content.Shared/Buckle/Components/StrapComponent.cs b/Content.Shared/Buckle/Components/StrapComponent.cs index 8d2515de6d8..6a0b27650c7 100644 --- a/Content.Shared/Buckle/Components/StrapComponent.cs +++ b/Content.Shared/Buckle/Components/StrapComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Alert; using Content.Shared.Vehicle; using Content.Shared.Whitelist; diff --git a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs index d9c1e76b9cf..399070b12ca 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using System.Numerics; using Content.Shared.Alert; using Content.Shared.Bed.Sleep; using Content.Shared.Buckle.Components; diff --git a/Content.Shared/Camera/CameraRecoilComponent.cs b/Content.Shared/Camera/CameraRecoilComponent.cs index 1234cc9a25a..3784b8b6334 100644 --- a/Content.Shared/Camera/CameraRecoilComponent.cs +++ b/Content.Shared/Camera/CameraRecoilComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Shared.GameStates; namespace Content.Shared.Camera; diff --git a/Content.Shared/Camera/SharedCameraRecoilSystem.cs b/Content.Shared/Camera/SharedCameraRecoilSystem.cs index 331c2fe25bd..3a5fe372e24 100644 --- a/Content.Shared/Camera/SharedCameraRecoilSystem.cs +++ b/Content.Shared/Camera/SharedCameraRecoilSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using JetBrains.Annotations; using Robust.Shared.Player; using Robust.Shared.Serialization; @@ -52,7 +53,7 @@ public override void FrameUpdate(float frameTime) { var recoil = entity.Item2; var eye = entity.Item1; - var magnitude = recoil.CurrentKick.Length; + var magnitude = recoil.CurrentKick.Length(); if (magnitude <= 0.005f) { recoil.CurrentKick = Vector2.Zero; @@ -60,7 +61,7 @@ public override void FrameUpdate(float frameTime) } else // Continually restore camera to 0. { - var normalized = recoil.CurrentKick.Normalized; + var normalized = recoil.CurrentKick.Normalized(); recoil.LastKickTime += frameTime; var restoreRate = MathHelper.Lerp(RestoreRateMin, RestoreRateMax, Math.Min(1, recoil.LastKickTime / RestoreRateRamp)); var restore = normalized * restoreRate * frameTime; @@ -69,7 +70,7 @@ public override void FrameUpdate(float frameTime) if (Math.Sign(y) != Math.Sign(recoil.CurrentKick.Y)) y = 0; - recoil.CurrentKick = (x, y); + recoil.CurrentKick = new Vector2(x, y); eye.Offset = recoil.BaseOffset + recoil.CurrentKick; } diff --git a/Content.Shared/Chat/TypingIndicator/TypingIndicatorPrototype.cs b/Content.Shared/Chat/TypingIndicator/TypingIndicatorPrototype.cs index 578fdbecee9..5d3c0dd3f4f 100644 --- a/Content.Shared/Chat/TypingIndicator/TypingIndicatorPrototype.cs +++ b/Content.Shared/Chat/TypingIndicator/TypingIndicatorPrototype.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Prototypes; +using System.Numerics; +using Robust.Shared.Prototypes; using Robust.Shared.Utility; namespace Content.Shared.Chat.TypingIndicator; diff --git a/Content.Shared/Construction/Conditions/WallmountCondition.cs b/Content.Shared/Construction/Conditions/WallmountCondition.cs index 5d548c235e5..7bde86802b5 100644 --- a/Content.Shared/Construction/Conditions/WallmountCondition.cs +++ b/Content.Shared/Construction/Conditions/WallmountCondition.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Shared.Physics; using Content.Shared.Tag; using JetBrains.Annotations; @@ -28,14 +29,14 @@ public bool Condition(EntityUid user, EntityCoordinates location, Direction dire var directionWithOffset = gridRotation.RotateVec(direction.ToVec()); // dot product will be positive if user direction and blueprint are co-directed - var dotProd = Vector2.Dot(directionWithOffset.Normalized, userToObject.Normalized); + var dotProd = Vector2.Dot(directionWithOffset.Normalized(), userToObject.Normalized()); if (dotProd > 0) return false; // now we need to check that user actually tries to build wallmount on a wall var physics = entManager.System(); - var rUserToObj = new CollisionRay(userWorldPosition, userToObject.Normalized, (int) CollisionGroup.Impassable); - var length = userToObject.Length; + var rUserToObj = new CollisionRay(userWorldPosition, userToObject.Normalized(), (int) CollisionGroup.Impassable); + var length = userToObject.Length(); var tagSystem = entManager.System(); @@ -49,7 +50,7 @@ public bool Condition(EntityUid user, EntityCoordinates location, Direction dire // get this wall entity // check that we didn't try to build wallmount that facing another adjacent wall - var rAdjWall = new CollisionRay(objWorldPosition, directionWithOffset.Normalized, (int) CollisionGroup.Impassable); + var rAdjWall = new CollisionRay(objWorldPosition, directionWithOffset.Normalized(), (int) CollisionGroup.Impassable); var adjWallRaycastResults = physics.IntersectRayWithPredicate(entManager.GetComponent(user).MapID, rAdjWall, maxLength: 0.5f, predicate: e => e == targetWall.Value.HitEntity || !tagSystem.HasTag(e, "Wall")); diff --git a/Content.Shared/Containers/ContainerFillSystem.cs b/Content.Shared/Containers/ContainerFillSystem.cs index fb26d9b2cd1..81b9782dcde 100644 --- a/Content.Shared/Containers/ContainerFillSystem.cs +++ b/Content.Shared/Containers/ContainerFillSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Shared.Containers; using Robust.Shared.Map; diff --git a/Content.Shared/Coordinates/EntityCoordinatesExtensions.cs b/Content.Shared/Coordinates/EntityCoordinatesExtensions.cs index c50bbb1579f..f660ee5eb09 100644 --- a/Content.Shared/Coordinates/EntityCoordinatesExtensions.cs +++ b/Content.Shared/Coordinates/EntityCoordinatesExtensions.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Map; +using System.Numerics; +using Robust.Shared.Map; using Robust.Shared.Map.Components; namespace Content.Shared.Coordinates diff --git a/Content.Shared/Coordinates/Helpers/SnapgridHelper.cs b/Content.Shared/Coordinates/Helpers/SnapgridHelper.cs index a0294140e89..567a600388e 100644 --- a/Content.Shared/Coordinates/Helpers/SnapgridHelper.cs +++ b/Content.Shared/Coordinates/Helpers/SnapgridHelper.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Shared.Map; using Robust.Shared.Map.Components; diff --git a/Content.Shared/Decals/Decal.cs b/Content.Shared/Decals/Decal.cs index e576bfdd50d..7368b6f2cd3 100644 --- a/Content.Shared/Decals/Decal.cs +++ b/Content.Shared/Decals/Decal.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Shared.Serialization; namespace Content.Shared.Decals diff --git a/Content.Shared/Decals/DecalGridChunkCollectionTypeSerializer.cs b/Content.Shared/Decals/DecalGridChunkCollectionTypeSerializer.cs index fe27df08663..be10e8f41ac 100644 --- a/Content.Shared/Decals/DecalGridChunkCollectionTypeSerializer.cs +++ b/Content.Shared/Decals/DecalGridChunkCollectionTypeSerializer.cs @@ -1,5 +1,6 @@ using System.Globalization; using System.Linq; +using System.Numerics; using Robust.Shared.Map; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager; diff --git a/Content.Shared/Decals/SharedDecalSystem.cs b/Content.Shared/Decals/SharedDecalSystem.cs index d1fcccaec61..f22029d6e13 100644 --- a/Content.Shared/Decals/SharedDecalSystem.cs +++ b/Content.Shared/Decals/SharedDecalSystem.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using System.Numerics; using Robust.Shared.GameStates; using Robust.Shared.Map; using Robust.Shared.Prototypes; diff --git a/Content.Shared/Examine/ExamineSystemShared.cs b/Content.Shared/Examine/ExamineSystemShared.cs index 77ab083a2f5..a092b7052f9 100644 --- a/Content.Shared/Examine/ExamineSystemShared.cs +++ b/Content.Shared/Examine/ExamineSystemShared.cs @@ -158,7 +158,7 @@ public static bool InRangeUnOccluded(MapCoordinates origin, MapCoordinat other.MapId == MapId.Nullspace) return false; var dir = other.Position - origin.Position; - var length = dir.Length; + var length = dir.Length(); // If range specified also check it // TODO: This rounding check is here because the API is kinda eh @@ -175,7 +175,7 @@ public static bool InRangeUnOccluded(MapCoordinates origin, MapCoordinat var occluderSystem = Get(); IoCManager.Resolve(ref entMan); - var ray = new Ray(origin.Position, dir.Normalized); + var ray = new Ray(origin.Position, dir.Normalized()); var rayResults = occluderSystem .IntersectRayWithPredicate(origin.MapId, ray, length, state, predicate, false).ToList(); diff --git a/Content.Shared/Follower/FollowerSystem.cs b/Content.Shared/Follower/FollowerSystem.cs index d3b0747acc5..ab194f5bb69 100644 --- a/Content.Shared/Follower/FollowerSystem.cs +++ b/Content.Shared/Follower/FollowerSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Database; using Content.Shared.Follower.Components; using Content.Shared.Ghost; diff --git a/Content.Shared/Friction/TileFrictionController.cs b/Content.Shared/Friction/TileFrictionController.cs index f3775d0f9dc..c0af2f4ed4a 100644 --- a/Content.Shared/Friction/TileFrictionController.cs +++ b/Content.Shared/Friction/TileFrictionController.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.CCVar; using Content.Shared.Gravity; using Content.Shared.Movement.Events; @@ -112,7 +113,7 @@ public override void UpdateBeforeMapSolve(bool prediction, PhysicsMapComponent m private void ReduceLinearVelocity(EntityUid uid, bool prediction, PhysicsComponent body, float friction, float frameTime) { - var speed = body.LinearVelocity.Length; + var speed = body.LinearVelocity.Length(); if (speed <= 0.0f) return; diff --git a/Content.Shared/Gravity/FloatingVisualsComponent.cs b/Content.Shared/Gravity/FloatingVisualsComponent.cs index 40186db8441..53b28aef902 100644 --- a/Content.Shared/Gravity/FloatingVisualsComponent.cs +++ b/Content.Shared/Gravity/FloatingVisualsComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Shared.GameStates; using Robust.Shared.Serialization; diff --git a/Content.Shared/Gravity/SharedFloatingVisualizerSystem.cs b/Content.Shared/Gravity/SharedFloatingVisualizerSystem.cs index 67da1e51691..204f3978011 100644 --- a/Content.Shared/Gravity/SharedFloatingVisualizerSystem.cs +++ b/Content.Shared/Gravity/SharedFloatingVisualizerSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Shared.GameStates; using Robust.Shared.Map; diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs index 0d794f87166..87edd472820 100644 --- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs +++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Hands.Components; using Content.Shared.Interaction; using Robust.Shared.Containers; @@ -134,18 +135,18 @@ public bool TryDropIntoContainer(EntityUid uid, EntityUid entity, IContainer tar private Vector2 GetFinalDropCoordinates(EntityUid user, MapCoordinates origin, MapCoordinates target) { var dropVector = target.Position - origin.Position; - var requestedDropDistance = dropVector.Length; + var requestedDropDistance = dropVector.Length(); - if (dropVector.Length > SharedInteractionSystem.InteractionRange) + if (dropVector.Length() > SharedInteractionSystem.InteractionRange) { - dropVector = dropVector.Normalized * SharedInteractionSystem.InteractionRange; + dropVector = dropVector.Normalized() * SharedInteractionSystem.InteractionRange; target = new MapCoordinates(origin.Position + dropVector, target.MapId); } var dropLength = _interactionSystem.UnobstructedDistance(origin, target, predicate: e => e == user); if (dropLength < requestedDropDistance) - return origin.Position + dropVector.Normalized * dropLength; + return origin.Position + dropVector.Normalized() * dropLength; return target.Position; } diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs index c7706d492c0..b5c8aea415b 100644 --- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs +++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Database; using Content.Shared.Hands.Components; using Content.Shared.Item; @@ -111,7 +112,7 @@ public bool TryPickup( var itemPos = Transform(entity).MapPosition; if (itemPos.MapId == xform.MapID - && (itemPos.Position - xform.MapPosition.Position).Length <= MaxAnimationRange + && (itemPos.Position - xform.MapPosition.Position).Length() <= MaxAnimationRange && MetaData(entity).VisibilityMask == MetaData(uid).VisibilityMask) // Don't animate aghost pickups. { var initialPosition = EntityCoordinates.FromMap(coordinateEntity, itemPos, EntityManager); diff --git a/Content.Shared/Hands/HandEvents.cs b/Content.Shared/Hands/HandEvents.cs index 325601d9a0e..b5068d34c3e 100644 --- a/Content.Shared/Hands/HandEvents.cs +++ b/Content.Shared/Hands/HandEvents.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Hands.Components; using JetBrains.Annotations; using Robust.Shared.Map; diff --git a/Content.Shared/Interaction/RotateToFaceSystem.cs b/Content.Shared/Interaction/RotateToFaceSystem.cs index e10f5df244b..d5fa01a71bd 100644 --- a/Content.Shared/Interaction/RotateToFaceSystem.cs +++ b/Content.Shared/Interaction/RotateToFaceSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.ActionBlocker; using Content.Shared.Buckle.Components; using Content.Shared.Mobs.Systems; @@ -70,7 +71,7 @@ public bool TryFaceCoordinates(EntityUid user, Vector2 coordinates, TransformCom return false; var diff = coordinates - xform.MapPosition.Position; - if (diff.LengthSquared <= 0.01f) + if (diff.LengthSquared() <= 0.01f) return true; var diffAngle = Angle.FromWorldVec(diff); diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index 26dcae91cc6..8f0f52c7a3c 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -446,17 +446,17 @@ public float UnobstructedDistance( { var dir = other.Position - origin.Position; - if (dir.LengthSquared.Equals(0f)) + if (dir.LengthSquared().Equals(0f)) return 0f; predicate ??= _ => false; - var ray = new CollisionRay(origin.Position, dir.Normalized, collisionMask); - var rayResults = _sharedBroadphaseSystem.IntersectRayWithPredicate(origin.MapId, ray, dir.Length, predicate.Invoke, false).ToList(); + var ray = new CollisionRay(origin.Position, dir.Normalized(), collisionMask); + var rayResults = _sharedBroadphaseSystem.IntersectRayWithPredicate(origin.MapId, ray, dir.Length(), predicate.Invoke, false).ToList(); if (rayResults.Count == 0) - return dir.Length; + return dir.Length(); - return (rayResults[0].HitPos - origin.Position).Length; + return (rayResults[0].HitPos - origin.Position).Length(); } /// @@ -496,7 +496,7 @@ public bool InRangeUnobstructed( return true; var dir = other.Position - origin.Position; - var length = dir.Length; + var length = dir.Length(); // If range specified also check it if (range > 0f && length > range) @@ -513,7 +513,7 @@ public bool InRangeUnobstructed( length = MaxRaycastRange; } - var ray = new CollisionRay(origin.Position, dir.Normalized, (int) collisionMask); + var ray = new CollisionRay(origin.Position, dir.Normalized(), (int) collisionMask); var rayResults = _sharedBroadphaseSystem.IntersectRayWithPredicate(origin.MapId, ray, length, predicate.Invoke, false).ToList(); return rayResults.Count == 0; @@ -623,7 +623,7 @@ public bool InRangeUnobstructed( { // We'll still do the raycast from the centres but we'll bump the range as we know they're in range. originPos = xformA.MapPosition; - range = (originPos.Position - targetPos.Position).Length; + range = (originPos.Position - targetPos.Position).Length(); } } // No fixtures, e.g. wallmounts. diff --git a/Content.Shared/Inventory/InventoryTemplatePrototype.cs b/Content.Shared/Inventory/InventoryTemplatePrototype.cs index 8487725229b..8faa58f854b 100644 --- a/Content.Shared/Inventory/InventoryTemplatePrototype.cs +++ b/Content.Shared/Inventory/InventoryTemplatePrototype.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Whitelist; using Robust.Shared.Prototypes; diff --git a/Content.Shared/Jittering/JitteringComponent.cs b/Content.Shared/Jittering/JitteringComponent.cs index 58047c7fa3e..85b8fe73dc8 100644 --- a/Content.Shared/Jittering/JitteringComponent.cs +++ b/Content.Shared/Jittering/JitteringComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Shared.GameStates; using Robust.Shared.Serialization; diff --git a/Content.Shared/Maps/SharedGridDraggingSystem.cs b/Content.Shared/Maps/SharedGridDraggingSystem.cs index b53f64c65b4..40dc6852aa4 100644 --- a/Content.Shared/Maps/SharedGridDraggingSystem.cs +++ b/Content.Shared/Maps/SharedGridDraggingSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Shared.Serialization; namespace Content.Shared.Maps; diff --git a/Content.Shared/Maps/TurfSystem.cs b/Content.Shared/Maps/TurfSystem.cs index d2664d2f915..a344193f123 100644 --- a/Content.Shared/Maps/TurfSystem.cs +++ b/Content.Shared/Maps/TurfSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Physics; using Robust.Shared.Map; using Robust.Shared.Map.Components; diff --git a/Content.Shared/Medical/Cryogenics/InsideCryoPodComponent.cs b/Content.Shared/Medical/Cryogenics/InsideCryoPodComponent.cs index dc5f9b47d84..79265183440 100644 --- a/Content.Shared/Medical/Cryogenics/InsideCryoPodComponent.cs +++ b/Content.Shared/Medical/Cryogenics/InsideCryoPodComponent.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameStates; +using System.Numerics; +using Robust.Shared.GameStates; namespace Content.Shared.Medical.Cryogenics; diff --git a/Content.Shared/Movement/Components/ContentEyeComponent.cs b/Content.Shared/Movement/Components/ContentEyeComponent.cs index eac58161988..af37ebfd78b 100644 --- a/Content.Shared/Movement/Components/ContentEyeComponent.cs +++ b/Content.Shared/Movement/Components/ContentEyeComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Movement.Systems; using Robust.Shared.GameStates; diff --git a/Content.Shared/Movement/Components/InputMoverComponent.cs b/Content.Shared/Movement/Components/InputMoverComponent.cs index 0b87e4311dc..65f507c1ead 100644 --- a/Content.Shared/Movement/Components/InputMoverComponent.cs +++ b/Content.Shared/Movement/Components/InputMoverComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Movement.Systems; using Robust.Shared.GameStates; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; diff --git a/Content.Shared/Movement/Systems/SharedContentEyeSystem.cs b/Content.Shared/Movement/Systems/SharedContentEyeSystem.cs index ab3a1e79a99..4bfe1c22b53 100644 --- a/Content.Shared/Movement/Systems/SharedContentEyeSystem.cs +++ b/Content.Shared/Movement/Systems/SharedContentEyeSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Administration.Managers; using Content.Shared.Ghost; using Content.Shared.Input; @@ -113,7 +114,7 @@ protected void UpdateEye(EntityUid uid, ContentEyeComponent content, SharedEyeCo { var diff = content.TargetZoom - eye.Zoom; - if (diff.LengthSquared < 0.00001f) + if (diff.LengthSquared() < 0.00001f) { eye.Zoom = content.TargetZoom; Dirty(eye); diff --git a/Content.Shared/Movement/Systems/SharedMoverController.Input.cs b/Content.Shared/Movement/Systems/SharedMoverController.Input.cs index bdc4b6a9f84..e59abc56c98 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.Input.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.Input.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.CCVar; using Content.Shared.Follower.Components; using Content.Shared.Input; @@ -475,10 +476,10 @@ private Vector2 DirVecForButtons(MoveButtons buttons) var vec = new Vector2(x, y); // can't normalize zero length vector - if (vec.LengthSquared > 1.0e-6) + if (vec.LengthSquared() > 1.0e-6) { // Normalize so that diagonals aren't faster or something. - vec = vec.Normalized; + vec = vec.Normalized(); } return vec; diff --git a/Content.Shared/Movement/Systems/SharedMoverController.cs b/Content.Shared/Movement/Systems/SharedMoverController.cs index 80ee0c38a7b..b841f882e7d 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.cs @@ -16,6 +16,7 @@ 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 @@ protected void HandleMobMovement( 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 @@ public void LerpRotation(InputMoverComponent mover, float frameTime) 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 @@ private void Friction(float minimumFrictionSpeed, float frameTime, float frictio 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; diff --git a/Content.Shared/NPC/Events/NPCSteeringDebugEvent.cs b/Content.Shared/NPC/Events/NPCSteeringDebugEvent.cs index 35f7e6493d1..0dd14c4c1a6 100644 --- a/Content.Shared/NPC/Events/NPCSteeringDebugEvent.cs +++ b/Content.Shared/NPC/Events/NPCSteeringDebugEvent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Shared.Serialization; namespace Content.Shared.NPC.Events; diff --git a/Content.Shared/NPC/SharedPathfindingSystem.cs b/Content.Shared/NPC/SharedPathfindingSystem.cs index b12d2e68d44..8831acc1ddb 100644 --- a/Content.Shared/NPC/SharedPathfindingSystem.cs +++ b/Content.Shared/NPC/SharedPathfindingSystem.cs @@ -1,3 +1,5 @@ +using System.Numerics; + namespace Content.Shared.NPC; public abstract class SharedPathfindingSystem : EntitySystem @@ -9,15 +11,18 @@ public abstract class SharedPathfindingSystem : EntitySystem public const byte SubStep = 4; public const byte ChunkSize = 8; + public static readonly Vector2 ChunkSizeVec = new(ChunkSize, ChunkSize); /// /// We won't do points on edges so we'll offset them slightly. /// protected const float StepOffset = 1f / SubStep / 2f; + private static readonly Vector2 StepOffsetVec = new(StepOffset, StepOffset); + public Vector2 GetCoordinate(Vector2i chunk, Vector2i index) { - return new Vector2(index.X, index.Y) / SubStep+ (chunk) * ChunkSize + StepOffset; + return new Vector2(index.X, index.Y) / SubStep+ (chunk) * ChunkSizeVec + StepOffsetVec; } public static float ManhattanDistance(Vector2i start, Vector2i end) diff --git a/Content.Shared/Parallax/Biomes/SharedBiomeSystem.cs b/Content.Shared/Parallax/Biomes/SharedBiomeSystem.cs index 9d08f9682ed..4608b863dcd 100644 --- a/Content.Shared/Parallax/Biomes/SharedBiomeSystem.cs +++ b/Content.Shared/Parallax/Biomes/SharedBiomeSystem.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using System.Numerics; using Content.Shared.Maps; using Content.Shared.Parallax.Biomes.Layers; using Robust.Shared.Map; diff --git a/Content.Shared/Physics/Controllers/SharedConveyorController.cs b/Content.Shared/Physics/Controllers/SharedConveyorController.cs index 29643e4bb5a..1ba66aa1a37 100644 --- a/Content.Shared/Physics/Controllers/SharedConveyorController.cs +++ b/Content.Shared/Physics/Controllers/SharedConveyorController.cs @@ -1,4 +1,5 @@ -using Content.Shared.Conveyor; +using System.Numerics; +using Content.Shared.Conveyor; using Content.Shared.Gravity; using Content.Shared.Movement.Systems; using Robust.Shared.GameStates; @@ -19,6 +20,9 @@ public abstract class SharedConveyorController : VirtualController [Dependency] private readonly SharedGravitySystem _gravity = default!; protected const string ConveyorFixture = "conveyor"; + + private static readonly Vector2 _expansion = new Vector2(0.1f, 0.1f); + public override void Initialize() { UpdatesAfter.Add(typeof(SharedMoverController)); @@ -123,7 +127,7 @@ private void Convey(EntityUid uid, ConveyorComponent comp, EntityQuery Tiles, Vector2 Center, Box2i Bounds, HashSet Exterior) diff --git a/Content.Shared/Projectiles/SharedProjectileSystem.cs b/Content.Shared/Projectiles/SharedProjectileSystem.cs index 9aed24144c4..e5e51080a1c 100644 --- a/Content.Shared/Projectiles/SharedProjectileSystem.cs +++ b/Content.Shared/Projectiles/SharedProjectileSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Projectiles; using Content.Shared.Weapons.Ranged.Components; using Robust.Shared.Map; diff --git a/Content.Shared/Radiation/RadiationRay.cs b/Content.Shared/Radiation/RadiationRay.cs index 662d707dfd1..31c466e6c20 100644 --- a/Content.Shared/Radiation/RadiationRay.cs +++ b/Content.Shared/Radiation/RadiationRay.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Radiation.Components; using Robust.Shared.Map; using Robust.Shared.Serialization; diff --git a/Content.Shared/Random/Helpers/SharedEntityExtensions.cs b/Content.Shared/Random/Helpers/SharedEntityExtensions.cs index 5a37584bb46..5b12ffb94d0 100644 --- a/Content.Shared/Random/Helpers/SharedEntityExtensions.cs +++ b/Content.Shared/Random/Helpers/SharedEntityExtensions.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Random; +using System.Numerics; +using Robust.Shared.Random; using Robust.Shared.Utility; namespace Content.Shared.Random.Helpers diff --git a/Content.Shared/Random/RulesSystem.cs b/Content.Shared/Random/RulesSystem.cs index 54ddc8348dd..8e9ccadc717 100644 --- a/Content.Shared/Random/RulesSystem.cs +++ b/Content.Shared/Random/RulesSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Access.Components; using Content.Shared.Access.Systems; using Robust.Shared.Map; @@ -35,10 +36,11 @@ public bool IsTrue(EntityUid uid, RulesPrototype rules) } var worldPos = _transform.GetWorldPosition(xform); + var gridRange = new Vector2(griddy.Range, griddy.Range); foreach (var _ in _mapManager.FindGridsIntersecting( xform.MapID, - new Box2(worldPos - griddy.Range, worldPos + griddy.Range))) + new Box2(worldPos - gridRange, worldPos + gridRange))) { return !griddy.Inverted; } diff --git a/Content.Shared/Revenant/Components/RevenantComponent.cs b/Content.Shared/Revenant/Components/RevenantComponent.cs index ba93cfe77c6..5f1b3802e66 100644 --- a/Content.Shared/Revenant/Components/RevenantComponent.cs +++ b/Content.Shared/Revenant/Components/RevenantComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.FixedPoint; using Content.Shared.Store; using Robust.Shared.GameStates; @@ -65,7 +66,7 @@ public sealed class RevenantComponent : Component /// the second corresponds to the amount of time the entity is made solid. /// [DataField("harvestDebuffs")] - public Vector2 HarvestDebuffs = (5, 5); + public Vector2 HarvestDebuffs = new(5, 5); /// /// The amount that is given to the revenant each time it's max essence is upgraded. @@ -89,7 +90,7 @@ public sealed class RevenantComponent : Component /// the second corresponds to the amount of time the entity is made solid. /// [DataField("defileDebuffs")] - public Vector2 DefileDebuffs = (1, 4); + public Vector2 DefileDebuffs = new(1, 4); /// /// The radius around the user that this ability affects @@ -124,7 +125,7 @@ public sealed class RevenantComponent : Component /// the second corresponds to the amount of time the entity is made solid. /// [DataField("overloadDebuffs")] - public Vector2 OverloadDebuffs = (3, 8); + public Vector2 OverloadDebuffs = new(3, 8); /// /// The radius around the user that this ability affects @@ -152,7 +153,7 @@ public sealed class RevenantComponent : Component /// the second corresponds to the amount of time the entity is made solid. /// [DataField("blightDebuffs")] - public Vector2 BlightDebuffs = (2, 5); + public Vector2 BlightDebuffs = new(2, 5); /// /// The radius around the user that this ability affects @@ -174,7 +175,7 @@ public sealed class RevenantComponent : Component /// the second corresponds to the amount of time the entity is made solid. /// [DataField("malfunctionDebuffs")] - public Vector2 MalfunctionDebuffs = (2, 8); + public Vector2 MalfunctionDebuffs = new(2, 8); /// /// The radius around the user that this ability affects diff --git a/Content.Shared/Shuttles/Components/PilotComponent.cs b/Content.Shared/Shuttles/Components/PilotComponent.cs index c3918a3cd3a..6d05a18c4ae 100644 --- a/Content.Shared/Shuttles/Components/PilotComponent.cs +++ b/Content.Shared/Shuttles/Components/PilotComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Movement.Systems; using Robust.Shared.GameStates; using Robust.Shared.Map; diff --git a/Content.Shared/Singularity/EntitySystems/SharedSingularitySystem.cs b/Content.Shared/Singularity/EntitySystems/SharedSingularitySystem.cs index c720330ee72..676987b0175 100644 --- a/Content.Shared/Singularity/EntitySystems/SharedSingularitySystem.cs +++ b/Content.Shared/Singularity/EntitySystems/SharedSingularitySystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Shared.Containers; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Systems; diff --git a/Content.Shared/Sound/SharedEmitSoundSystem.cs b/Content.Shared/Sound/SharedEmitSoundSystem.cs index 9c44c9a1a0f..ea42b4bff93 100644 --- a/Content.Shared/Sound/SharedEmitSoundSystem.cs +++ b/Content.Shared/Sound/SharedEmitSoundSystem.cs @@ -128,7 +128,7 @@ private void OnEmitSoundOnCollide(EntityUid uid, EmitSoundOnCollideComponent com if (!args.OurFixture.Hard || !args.OtherFixture.Hard || !TryComp(uid, out var physics) || - physics.LinearVelocity.Length < component.MinimumVelocity || + physics.LinearVelocity.Length() < component.MinimumVelocity || _timing.CurTime < component.NextSound || MetaData(uid).EntityPaused) { @@ -139,7 +139,7 @@ private void OnEmitSoundOnCollide(EntityUid uid, EmitSoundOnCollideComponent com const float MinVolume = -10f; const float MaxVolume = 2f; - var fraction = MathF.Min(1f, (physics.LinearVelocity.Length - component.MinimumVelocity) / MaxVolumeVelocity); + var fraction = MathF.Min(1f, (physics.LinearVelocity.Length() - component.MinimumVelocity) / MaxVolumeVelocity); var volume = MinVolume + (MaxVolume - MinVolume) * fraction; component.NextSound = _timing.CurTime + EmitSoundOnCollideComponent.CollideCooldown; diff --git a/Content.Shared/Stacks/SharedStackSystem.cs b/Content.Shared/Stacks/SharedStackSystem.cs index a9798bf54ac..f41147fa056 100644 --- a/Content.Shared/Stacks/SharedStackSystem.cs +++ b/Content.Shared/Stacks/SharedStackSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Examine; using Content.Shared.Hands.Components; using Content.Shared.Hands.EntitySystems; diff --git a/Content.Shared/Stealth/SharedStealthSystem.cs b/Content.Shared/Stealth/SharedStealthSystem.cs index bba9e8a075a..67858c1942c 100644 --- a/Content.Shared/Stealth/SharedStealthSystem.cs +++ b/Content.Shared/Stealth/SharedStealthSystem.cs @@ -102,7 +102,7 @@ private void OnMove(EntityUid uid, StealthOnMoveComponent component, ref MoveEve if (args.NewPosition.EntityId != args.OldPosition.EntityId) return; - var delta = component.MovementVisibilityRate * (args.NewPosition.Position - args.OldPosition.Position).Length; + var delta = component.MovementVisibilityRate * (args.NewPosition.Position - args.OldPosition.Position).Length(); ModifyVisibility(uid, delta); } diff --git a/Content.Shared/StepTrigger/Systems/StepTriggerSystem.cs b/Content.Shared/StepTrigger/Systems/StepTriggerSystem.cs index 3e1e10a07aa..1591ce623a6 100644 --- a/Content.Shared/StepTrigger/Systems/StepTriggerSystem.cs +++ b/Content.Shared/StepTrigger/Systems/StepTriggerSystem.cs @@ -98,7 +98,7 @@ private void UpdateColliding(StepTriggerComponent component, TransformComponent return; } - if (otherPhysics.LinearVelocity.Length < component.RequiredTriggerSpeed + if (otherPhysics.LinearVelocity.Length() < component.RequiredTriggerSpeed || component.CurrentlySteppedOn.Contains(otherUid) || otherAabb.IntersectPercentage(ourAabb) < component.IntersectRatio || !CanTrigger(component.Owner, otherUid, component)) diff --git a/Content.Shared/Storage/Components/SharedEntityStorageComponent.cs b/Content.Shared/Storage/Components/SharedEntityStorageComponent.cs index f920bb29d14..e3893da19a9 100644 --- a/Content.Shared/Storage/Components/SharedEntityStorageComponent.cs +++ b/Content.Shared/Storage/Components/SharedEntityStorageComponent.cs @@ -1,4 +1,5 @@ -using Content.Shared.Physics; +using System.Numerics; +using Content.Shared.Physics; using Content.Shared.Whitelist; using Robust.Shared.Audio; using Robust.Shared.Containers; diff --git a/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs index da8e6cc18e9..8ea40f525c3 100644 --- a/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Shared.Body.Components; using Content.Shared.Destructible; using Content.Shared.Hands.Components; @@ -331,7 +332,7 @@ public bool CanOpen(EntityUid user, EntityUid target, bool silent = false, Share } //Checks to see if the opening position, if offset, is inside of a wall. - if (component.EnteringOffset != (0, 0) && !HasComp(target)) //if the entering position is offset + if (component.EnteringOffset != new Vector2(0, 0) && !HasComp(target)) //if the entering position is offset { var newCoords = new EntityCoordinates(target, component.EnteringOffset); if (!_interaction.InRangeUnobstructed(target, newCoords, 0, collisionMask: component.EnteringOffsetCollisionFlags)) diff --git a/Content.Shared/Tabletop/SharedTabletopSystem.cs b/Content.Shared/Tabletop/SharedTabletopSystem.cs index 9cb683a9180..5fcf9b234ff 100644 --- a/Content.Shared/Tabletop/SharedTabletopSystem.cs +++ b/Content.Shared/Tabletop/SharedTabletopSystem.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using System.Numerics; using Content.Shared.ActionBlocker; using Content.Shared.Hands.Components; using Content.Shared.Interaction; diff --git a/Content.Shared/Throwing/BeforeThrowEvent.cs b/Content.Shared/Throwing/BeforeThrowEvent.cs index 349a18c56d1..546bf26d8e7 100644 --- a/Content.Shared/Throwing/BeforeThrowEvent.cs +++ b/Content.Shared/Throwing/BeforeThrowEvent.cs @@ -1,3 +1,5 @@ +using System.Numerics; + namespace Content.Shared.Throwing { public sealed class BeforeThrowEvent : HandledEntityEventArgs diff --git a/Content.Shared/Throwing/ThrowingSystem.cs b/Content.Shared/Throwing/ThrowingSystem.cs index 16f86438fb8..07b35ca8b71 100644 --- a/Content.Shared/Throwing/ThrowingSystem.cs +++ b/Content.Shared/Throwing/ThrowingSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Gravity; using Content.Shared.Interaction; using Content.Shared.Movement.Components; @@ -99,7 +100,7 @@ public void TryThrow(EntityUid uid, float pushbackRatio = PushbackDefault, bool playSound = true) { - if (strength <= 0 || direction == Vector2.Infinity || direction == Vector2.NaN || direction == Vector2.Zero) + if (strength <= 0 || direction == Vector2Helpers.Infinity || direction == Vector2Helpers.NaN || direction == Vector2.Zero) return; if ((physics.BodyType & (BodyType.Dynamic | BodyType.KinematicController)) == 0x0) @@ -123,11 +124,11 @@ public void TryThrow(EntityUid uid, if (user != null) _interactionSystem.ThrownInteraction(user.Value, uid); - var impulseVector = direction.Normalized * strength * physics.Mass; + var impulseVector = direction.Normalized() * strength * physics.Mass; _physics.ApplyLinearImpulse(uid, impulseVector, body: physics); // Estimate time to arrival so we can apply OnGround status and slow it much faster. - var time = direction.Length / strength; + var time = direction.Length() / strength; if (time < FlyTime) { diff --git a/Content.Shared/Tiles/FloorTileSystem.cs b/Content.Shared/Tiles/FloorTileSystem.cs index 57be6b8ccd6..e121f11d875 100644 --- a/Content.Shared/Tiles/FloorTileSystem.cs +++ b/Content.Shared/Tiles/FloorTileSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Numerics; using Content.Shared.Administration.Logs; using Content.Shared.Audio; using Content.Shared.Database; @@ -34,6 +35,8 @@ public sealed class FloorTileSystem : EntitySystem [Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!; + private static readonly Vector2 CheckRange = new(1f, 1f); + public override void Initialize() { base.Initialize(); @@ -68,7 +71,7 @@ private void OnAfterInteract(EntityUid uid, FloorTileComponent component, AfterI // so we're just gon with this for now. const bool inRange = true; var state = (inRange, location.EntityId); - _mapManager.FindGridsIntersecting(map.MapId, new Box2(map.Position - 1f, map.Position + 1f), ref state, + _mapManager.FindGridsIntersecting(map.MapId, new Box2(map.Position - CheckRange, map.Position + CheckRange), ref state, static (EntityUid entityUid, MapGridComponent grid, ref (bool weh, EntityUid EntityId) tuple) => { if (tuple.EntityId == entityUid) @@ -89,10 +92,10 @@ private void OnAfterInteract(EntityUid uid, FloorTileComponent component, AfterI var userPos = transformQuery.GetComponent(args.User).Coordinates.ToMapPos(EntityManager, _transform); var dir = userPos - map.Position; var canAccessCenter = false; - if (dir.LengthSquared > 0.01) + if (dir.LengthSquared() > 0.01) { - var ray = new CollisionRay(map.Position, dir.Normalized, (int) CollisionGroup.Impassable); - var results = _physics.IntersectRay(locationMap.MapId, ray, dir.Length, returnOnFirstHit: true); + var ray = new CollisionRay(map.Position, dir.Normalized(), (int) CollisionGroup.Impassable); + var results = _physics.IntersectRay(locationMap.MapId, ray, dir.Length(), returnOnFirstHit: true); canAccessCenter = !results.Any(); } diff --git a/Content.Shared/Vehicle/Components/VehicleComponent.cs b/Content.Shared/Vehicle/Components/VehicleComponent.cs index 101dca60241..3868b8977f0 100644 --- a/Content.Shared/Vehicle/Components/VehicleComponent.cs +++ b/Content.Shared/Vehicle/Components/VehicleComponent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Actions.ActionTypes; using Robust.Shared.Audio; using Robust.Shared.GameStates; diff --git a/Content.Shared/Vehicle/SharedVehicleSystem.cs b/Content.Shared/Vehicle/SharedVehicleSystem.cs index c854febad37..00ab81a333e 100644 --- a/Content.Shared/Vehicle/SharedVehicleSystem.cs +++ b/Content.Shared/Vehicle/SharedVehicleSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Access.Components; using Content.Shared.Access.Systems; using Content.Shared.Vehicle.Components; @@ -304,11 +305,11 @@ private void UpdateBuckleOffset(EntityUid uid, TransformComponent xform, Vehicle strap.BuckleOffsetUnclamped = xform.LocalRotation.Degrees switch { - < 45f => (0, component.SouthOverride), + < 45f => new(0, component.SouthOverride), <= 135f => component.BaseBuckleOffset, - < 225f => (0, component.NorthOverride), - <= 315f => (component.BaseBuckleOffset.X * -1, component.BaseBuckleOffset.Y), - _ => (0, component.SouthOverride) + < 225f => new(0, component.NorthOverride), + <= 315f => new(component.BaseBuckleOffset.X * -1, component.BaseBuckleOffset.Y), + _ => new(0, component.SouthOverride) }; if (!oldOffset.Equals(strap.BuckleOffsetUnclamped)) diff --git a/Content.Shared/Weapons/Melee/Events/MeleeLungeEvent.cs b/Content.Shared/Weapons/Melee/Events/MeleeLungeEvent.cs index 22f6ff89879..012bec8ab5b 100644 --- a/Content.Shared/Weapons/Melee/Events/MeleeLungeEvent.cs +++ b/Content.Shared/Weapons/Melee/Events/MeleeLungeEvent.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Robust.Shared.Serialization; namespace Content.Shared.Weapons.Melee.Events; diff --git a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs index 72536997216..b52dbbd776f 100644 --- a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs +++ b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs @@ -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 @@ private void DoHeavyAttack(EntityUid user, HeavyAttackEvent ev, EntityUid meleeU 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 @@ private void DoLungeAnimation(EntityUid user, Angle angle, MapCoordinates coordi 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 @@ private void DoLungeAnimation(EntityUid user, Angle angle, MapCoordinates coordi 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); } diff --git a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs index aa2cf4feb9c..7713c98955e 100644 --- a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs +++ b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.CombatMode; using Content.Shared.Hands; using Content.Shared.Hands.Components; diff --git a/Content.Shared/Weapons/Misc/SharedTetherGunSystem.Force.cs b/Content.Shared/Weapons/Misc/SharedTetherGunSystem.Force.cs index c76d60888ce..eec115b02df 100644 --- a/Content.Shared/Weapons/Misc/SharedTetherGunSystem.Force.cs +++ b/Content.Shared/Weapons/Misc/SharedTetherGunSystem.Force.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Interaction; using Robust.Shared.Map; diff --git a/Content.Shared/Weapons/Ranged/Events/HitScanReflectAttempt.cs b/Content.Shared/Weapons/Ranged/Events/HitScanReflectAttempt.cs index f9e46f3aeb1..31c9c4cdd44 100644 --- a/Content.Shared/Weapons/Ranged/Events/HitScanReflectAttempt.cs +++ b/Content.Shared/Weapons/Ranged/Events/HitScanReflectAttempt.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Weapons.Reflect; namespace Content.Shared.Weapons.Ranged.Events; diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index fdbf978bd9c..3d0530e3aa0 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -410,7 +410,7 @@ public void CauseImpulse(EntityCoordinates fromCoordinates, EntityCoordinates to { 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; diff --git a/Content.Shared/Weapons/Reflect/SharedReflectSystem.cs b/Content.Shared/Weapons/Reflect/SharedReflectSystem.cs index 1ee05f8f99c..e38c08a9d0b 100644 --- a/Content.Shared/Weapons/Reflect/SharedReflectSystem.cs +++ b/Content.Shared/Weapons/Reflect/SharedReflectSystem.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using System.Numerics; using Content.Shared.Administration.Logs; using Content.Shared.Audio; using Content.Shared.Database; diff --git a/Content.Tests/Client/UserInterface/Controls/ListContainerTest.cs b/Content.Tests/Client/UserInterface/Controls/ListContainerTest.cs index 946fd52a638..d7303470693 100644 --- a/Content.Tests/Client/UserInterface/Controls/ListContainerTest.cs +++ b/Content.Tests/Client/UserInterface/Controls/ListContainerTest.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Numerics; using Content.Client.UserInterface.Controls; using NUnit.Framework; using Robust.Client.UserInterface; @@ -28,11 +29,11 @@ public void Setup() [Test] public void TestLayoutBasic() { - var root = new Control { MinSize = (50, 60) }; + var root = new Control { MinSize = new Vector2(50, 60) }; var listContainer = new ListContainer { SeparationOverride = 3 }; root.AddChild(listContainer); listContainer.GenerateItem += (_, button) => { - button.AddChild(new Control { MinSize = (10, 10) }); + button.AddChild(new Control { MinSize = new Vector2(10, 10) }); }; var list = new List {new(0), new(1)}; @@ -53,11 +54,11 @@ public void TestCreatePopulateAndEmpty() { const int x = 50; const int y = 10; - var root = new Control { MinSize = (x, y) }; + var root = new Control { MinSize = new Vector2(x, y) }; var listContainer = new ListContainer { SeparationOverride = 3 }; root.AddChild(listContainer); listContainer.GenerateItem += (_, button) => { - button.AddChild(new Control { MinSize = (10, 10) }); + button.AddChild(new Control { MinSize = new Vector2(10, 10) }); }; var list = new List(); @@ -82,11 +83,11 @@ public void TestOnlyVisibleItemsAreAdded() * One items should be off the render * 0 13 26 39 52 65 | 75 height */ - var root = new Control { MinSize = (50, 60) }; + var root = new Control { MinSize = new Vector2(50, 60) }; var listContainer = new ListContainer { SeparationOverride = 3 }; root.AddChild(listContainer); listContainer.GenerateItem += (_, button) => { - button.AddChild(new Control { MinSize = (10, 10) }); + button.AddChild(new Control { MinSize = new Vector2(10, 10) }); }; var list = new List {new(0), new(1), new(2), new(3), new(4), new(5)}; @@ -121,11 +122,11 @@ public void TestNextItemIsVisibleWhenScrolled() * One items should be off the render * 0 13 26 39 52 65 | 75 height */ - var root = new Control { MinSize = (50, 60) }; + var root = new Control { MinSize = new Vector2(50, 60) }; var listContainer = new ListContainer { SeparationOverride = 3 }; root.AddChild(listContainer); listContainer.GenerateItem += (_, button) => { - button.AddChild(new Control { MinSize = (10, 10) }); + button.AddChild(new Control { MinSize = new Vector2(10, 10) }); }; var list = new List {new(0), new(1), new(2), new(3), new(4), new(5)}; @@ -169,11 +170,11 @@ public void TestPreviousItemIsVisibleWhenScrolled() * One items should be off the render * 0 13 26 39 52 65 | 75 height */ - var root = new Control { MinSize = (50, 60) }; + var root = new Control { MinSize = new Vector2(50, 60) }; var listContainer = new ListContainer { SeparationOverride = 3 }; root.AddChild(listContainer); listContainer.GenerateItem += (_, button) => { - button.AddChild(new Control { MinSize = (10, 10) }); + button.AddChild(new Control { MinSize = new Vector2(10, 10) }); }; var list = new List {new(0), new(1), new(2), new(3), new(4), new(5)}; @@ -222,17 +223,17 @@ public void TestDoesNotExpandWhenChildrenAreAdded() var root = new BoxContainer { Orientation = BoxContainer.LayoutOrientation.Vertical, - MinSize = (50, height) + MinSize = new Vector2(50, height) }; var listContainer = new ListContainer { SeparationOverride = 0, - GenerateItem = (_, button) => { button.AddChild(new Control {MinSize = (10, 10)}); } + GenerateItem = (_, button) => { button.AddChild(new Control {MinSize = new Vector2(10, 10)}); } }; root.AddChild(listContainer); var button = new ContainerButton { - MinSize = (10, 10) + MinSize = new Vector2(10, 10) }; root.AddChild(button); @@ -255,11 +256,11 @@ public void TestDoesNotExpandWhenChildrenAreAdded() public void TestSelectedItemStillSelectedWhenScrolling() { var height = 10; - var root = new Control { MinSize = (50, height) }; + var root = new Control { MinSize = new Vector2(50, height) }; var listContainer = new ListContainer { SeparationOverride = 0, Toggle = true }; root.AddChild(listContainer); listContainer.GenerateItem += (_, button) => { - button.AddChild(new Control { MinSize = (10, 10) }); + button.AddChild(new Control { MinSize = new Vector2(10, 10) }); }; var list = new List {new(0), new(1), new(2), new(3), new(4), new(5)}; diff --git a/Pow3r/Program.UI.cs b/Pow3r/Program.UI.cs index aaa02f7135b..1f9da3db0e6 100644 --- a/Pow3r/Program.UI.cs +++ b/Pow3r/Program.UI.cs @@ -5,7 +5,7 @@ using static ImGuiNET.ImGui; using Color = System.Drawing.Color; using Vector2 = System.Numerics.Vector2; -using RobustVec2 = Robust.Shared.Maths.Vector2; +using RobustVec2 = System.Numerics.Vector2; using static Content.Server.Power.Pow3r.PowerState; namespace Pow3r