Remove most usages of obsolete TransformComponent methods (#19571)

This commit is contained in:
Visne
2023-08-30 04:05:19 +02:00
committed by GitHub
parent 3ba60835ec
commit 1416942bea
91 changed files with 312 additions and 221 deletions

View File

@@ -29,6 +29,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
protected override void QueueUpdate(EntityUid uid, AmbientSoundComponent ambience)
=> _treeSys.QueueTreeUpdate(uid, ambience);
@@ -201,7 +202,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
}
}
private static bool Callback(
private bool Callback(
ref QueryState state,
in ComponentTreeEntry<AmbientSoundComponent> value)
{
@@ -211,7 +212,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
var delta = xform.ParentUid == state.Player.ParentUid
? xform.LocalPosition - state.Player.LocalPosition
: xform.WorldPosition - state.MapPos;
: _transform.GetWorldPosition(xform) - state.MapPos;
var range = delta.Length();
if (range >= ambientComp.Range)
@@ -253,7 +254,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
{
var distance = (xform.ParentUid == playerXform.ParentUid)
? xform.LocalPosition - playerXform.LocalPosition
: xform.WorldPosition - mapPos.Position;
: _transform.GetWorldPosition(xform) - mapPos.Position;
if (distance.LengthSquared() < comp.Range * comp.Range)
continue;