Transform cleanups (#25963)
* Transform cleanups * Fix build * ascension
This commit is contained in:
@@ -8,6 +8,7 @@ using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Teleportation.Components;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Collections;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Anomaly.Effects;
|
||||
@@ -35,20 +36,19 @@ public sealed class BluespaceAnomalySystem : EntitySystem
|
||||
var range = component.MaxShuffleRadius * args.Severity;
|
||||
var mobs = new HashSet<Entity<MobStateComponent>>();
|
||||
_lookup.GetEntitiesInRange(xform.Coordinates, range, mobs);
|
||||
var allEnts = new List<EntityUid>(mobs.Select(m => m.Owner)) { uid };
|
||||
var coords = new List<Vector2>();
|
||||
var allEnts = new ValueList<EntityUid>(mobs.Select(m => m.Owner)) { uid };
|
||||
var coords = new ValueList<Vector2>();
|
||||
foreach (var ent in allEnts)
|
||||
{
|
||||
if (xformQuery.TryGetComponent(ent, out var xf))
|
||||
coords.Add(xf.MapPosition.Position);
|
||||
if (xformQuery.TryGetComponent(ent, out var allXform))
|
||||
coords.Add(_xform.GetWorldPosition(allXform));
|
||||
}
|
||||
|
||||
_random.Shuffle(coords);
|
||||
for (var i = 0; i < allEnts.Count; i++)
|
||||
{
|
||||
|
||||
_adminLogger.Add(LogType.Teleport, $"{ToPrettyString(allEnts[i])} has been shuffled to {coords[i]} by the {ToPrettyString(uid)} at {xform.Coordinates}");
|
||||
_xform.SetWorldPosition(allEnts[i], coords[i], xformQuery);
|
||||
_xform.SetWorldPosition(allEnts[i], coords[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user