Remove 700 usages of Component.Owner (#21100)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user