Remove 700 usages of Component.Owner (#21100)
This commit is contained in:
@@ -28,9 +28,9 @@ public sealed class BluespaceAnomalySystem : EntitySystem
|
||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||
var xform = xformQuery.GetComponent(uid);
|
||||
var range = component.MaxShuffleRadius * args.Severity;
|
||||
var allEnts = _lookup.GetComponentsInRange<MobStateComponent>(xform.Coordinates, range)
|
||||
.Select(x => x.Owner).ToList();
|
||||
allEnts.Add(uid);
|
||||
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>();
|
||||
foreach (var ent in allEnts)
|
||||
{
|
||||
@@ -51,7 +51,9 @@ public sealed class BluespaceAnomalySystem : EntitySystem
|
||||
var mapPos = _xform.GetWorldPosition(xform);
|
||||
var radius = component.SupercriticalTeleportRadius;
|
||||
var gridBounds = new Box2(mapPos - new Vector2(radius, radius), mapPos + new Vector2(radius, radius));
|
||||
foreach (var comp in _lookup.GetComponentsInRange<MobStateComponent>(xform.Coordinates, component.MaxShuffleRadius))
|
||||
var mobs = new HashSet<Entity<MobStateComponent>>();
|
||||
_lookup.GetEntitiesInRange(xform.Coordinates, component.MaxShuffleRadius, mobs);
|
||||
foreach (var comp in mobs)
|
||||
{
|
||||
var ent = comp.Owner;
|
||||
var randomX = _random.NextFloat(gridBounds.Left, gridBounds.Right);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Content.Server.Electrocution;
|
||||
using Content.Server.Emp;
|
||||
using Content.Server.Emp;
|
||||
using Content.Server.Lightning;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Anomaly.Components;
|
||||
@@ -31,9 +31,8 @@ public sealed class ElectricityAnomalySystem : EntitySystem
|
||||
{
|
||||
var range = component.MaxElectrocuteRange * args.Stability;
|
||||
var xform = Transform(uid);
|
||||
foreach (var comp in _lookup.GetComponentsInRange<MobStateComponent>(xform.MapPosition, range))
|
||||
foreach (var (ent, comp) in _lookup.GetEntitiesInRange<MobStateComponent>(xform.MapPosition, range))
|
||||
{
|
||||
var ent = comp.Owner;
|
||||
_lightning.ShootLightning(uid, ent);
|
||||
}
|
||||
}
|
||||
@@ -66,14 +65,13 @@ public sealed class ElectricityAnomalySystem : EntitySystem
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
foreach (var (elec, anom, xform) in EntityQuery<ElectricityAnomalyComponent, AnomalyComponent, TransformComponent>())
|
||||
var query = EntityQueryEnumerator<ElectricityAnomalyComponent, AnomalyComponent, TransformComponent>();
|
||||
while (query.MoveNext(out var uid, out var elec, out var anom, out var xform))
|
||||
{
|
||||
if (_timing.CurTime < elec.NextSecond)
|
||||
continue;
|
||||
elec.NextSecond = _timing.CurTime + TimeSpan.FromSeconds(1);
|
||||
|
||||
var owner = xform.Owner;
|
||||
|
||||
if (!_random.Prob(elec.PassiveElectrocutionChance * anom.Stability))
|
||||
continue;
|
||||
|
||||
@@ -81,11 +79,9 @@ public sealed class ElectricityAnomalySystem : EntitySystem
|
||||
var damage = (int) (elec.MaxElectrocuteDamage * anom.Severity);
|
||||
var duration = elec.MaxElectrocuteDuration * anom.Severity;
|
||||
|
||||
foreach (var comp in _lookup.GetComponentsInRange<StatusEffectsComponent>(xform.MapPosition, range))
|
||||
foreach (var (ent, comp) in _lookup.GetEntitiesInRange<StatusEffectsComponent>(xform.MapPosition, range))
|
||||
{
|
||||
var ent = comp.Owner;
|
||||
|
||||
_electrocution.TryDoElectrocution(ent, owner, damage, duration, true, statusEffects: comp, ignoreInsulation: true);
|
||||
_electrocution.TryDoElectrocution(ent, uid, damage, duration, true, statusEffects: comp, ignoreInsulation: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Anomaly.Components;
|
||||
using Content.Shared.Anomaly.Components;
|
||||
using Content.Shared.Chemistry.Components.SolutionManager;
|
||||
using Content.Shared.Chemistry.EntitySystems;
|
||||
using Content.Shared.Anomaly.Components;
|
||||
|
||||
namespace Content.Server.Anomaly.Effects;
|
||||
/// <summary>
|
||||
@@ -44,7 +44,7 @@ public sealed class InjectionAnomalySystem : EntitySystem
|
||||
//We get all the entity in the radius into which the reagent will be injected.
|
||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||
var xform = xformQuery.GetComponent(uid);
|
||||
var allEnts = _lookup.GetComponentsInRange<InjectableSolutionComponent>(xform.MapPosition, injectRadius)
|
||||
var allEnts = _lookup.GetEntitiesInRange<InjectableSolutionComponent>(xform.MapPosition, injectRadius)
|
||||
.Select(x => x.Owner).ToList();
|
||||
|
||||
//for each matching entity found
|
||||
|
||||
@@ -36,7 +36,10 @@ public sealed class PyroclasticAnomalySystem : EntitySystem
|
||||
|
||||
public void IgniteNearby(EntityUid uid, EntityCoordinates coordinates, float severity, float radius)
|
||||
{
|
||||
foreach (var flammable in _lookup.GetComponentsInRange<FlammableComponent>(coordinates, radius))
|
||||
var flammables = new HashSet<Entity<FlammableComponent>>();
|
||||
_lookup.GetEntitiesInRange(coordinates, radius, flammables);
|
||||
|
||||
foreach (var flammable in flammables)
|
||||
{
|
||||
var ent = flammable.Owner;
|
||||
var stackAmount = 1 + (int) (severity / 0.15f);
|
||||
|
||||
Reference in New Issue
Block a user