Update content vectors to numerics (#17759)

This commit is contained in:
metalgearsloth
2023-07-08 14:08:32 +10:00
committed by GitHub
parent 15772478c9
commit 68480af109
383 changed files with 978 additions and 575 deletions

View File

@@ -1,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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 @@ public sealed class DebrisFeaturePlacerSystem : BaseWorldSystem
private List<Vector2> 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<Vector2>();

View File

@@ -42,7 +42,7 @@ public sealed class LocalityLoaderSystem : BaseWorldSystem
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());

View File

@@ -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;

View File

@@ -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 @@ public sealed class PoissonDiskSampler
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 @@ public sealed class PoissonDiskSampler
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 @@ public sealed class PoissonDiskSampler
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;
}

View File

@@ -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();
}
/// <summary>
@@ -32,7 +33,7 @@ public static class WorldGen
[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);
}
/// <summary>