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

@@ -11,6 +11,7 @@ using Robust.Shared.Random;
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 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
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 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
? 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 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
? 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 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
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