Fix IDE0200

This commit is contained in:
RoosterDragon
2024-11-25 20:44:40 +00:00
committed by Gustas Kažukauskas
parent ce3ad6fbb3
commit 0338258b45
45 changed files with 64 additions and 64 deletions

View File

@@ -90,7 +90,7 @@ namespace OpenRA.Mods.Common.Traits
: base(self, info)
{
Info = info;
coords = Exts.Lazy(() => self.Trait<BodyOrientation>());
coords = Exts.Lazy(self.Trait<BodyOrientation>);
armaments = new List<Armament>();
muzzles = new List<AnimationWithOffset>();
paxFacing = new Dictionary<Actor, IFacing>();

View File

@@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Traits
if (minelayers.Length == 0)
return;
var enemies = world.Actors.Where(a => IsPreferredEnemyUnit(a)).ToArray();
var enemies = world.Actors.Where(IsPreferredEnemyUnit).ToArray();
if (enemies.Length == 0)
return;

View File

@@ -553,14 +553,14 @@ namespace OpenRA.Mods.Common.Traits
{
unitsHangingAroundTheBase.Clear();
unitsHangingAroundTheBase.AddRange(FieldLoader.GetValue<uint[]>("UnitsHangingAroundTheBase", unitsHangingAroundTheBaseNode.Value)
.Select(a => self.World.GetActorById(a)).Where(a => a != null));
.Select(self.World.GetActorById).Where(a => a != null));
}
if (nodes.TryGetValue("ActiveUnits", out var activeUnitsNode))
{
activeUnits.Clear();
activeUnits.UnionWith(FieldLoader.GetValue<uint[]>("ActiveUnits", activeUnitsNode.Value)
.Select(a => self.World.GetActorById(a)).Where(a => a != null));
.Select(self.World.GetActorById).Where(a => a != null));
}
if (nodes.TryGetValue("RushTicks", out var rushTicksNode))

View File

@@ -174,7 +174,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
var unitsNode = yaml.NodeWithKeyOrDefault("Units");
if (unitsNode != null)
squad.Units.UnionWith(FieldLoader.GetValue<uint[]>("Units", unitsNode.Value.Value)
.Select(a => squadManager.World.GetActorById(a)));
.Select(squadManager.World.GetActorById));
return squad;
}

View File

@@ -288,7 +288,7 @@ namespace OpenRA.Mods.Common.Traits
bool IDisableEnemyAutoTarget.DisableEnemyAutoTarget(Actor self, Actor attacker)
{
return info.PreventsAutoTarget && currentCaptors.Any(c => attacker.AppearsFriendlyTo(c));
return info.PreventsAutoTarget && currentCaptors.Any(attacker.AppearsFriendlyTo);
}
}
}

View File

@@ -123,7 +123,7 @@ namespace OpenRA.Mods.Common.Traits
if (runtimeCargoInit != null)
{
cargo = runtimeCargoInit.Value.ToList();
totalWeight = cargo.Sum(c => GetWeight(c));
totalWeight = cargo.Sum(GetWeight);
}
else if (cargoInit != null)
{
@@ -135,7 +135,7 @@ namespace OpenRA.Mods.Common.Traits
cargo.Add(unit);
}
totalWeight = cargo.Sum(c => GetWeight(c));
totalWeight = cargo.Sum(GetWeight);
}
else
{
@@ -147,7 +147,7 @@ namespace OpenRA.Mods.Common.Traits
cargo.Add(unit);
}
totalWeight = cargo.Sum(c => GetWeight(c));
totalWeight = cargo.Sum(GetWeight);
}
facing = Exts.Lazy(self.TraitOrDefault<IFacing>);

View File

@@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Traits
if (buildingInfo != null)
{
var footprint = buildingInfo.PathableTiles(target.Location);
if (footprint.All(c => self.World.ShroudObscures(c)))
if (footprint.All(self.World.ShroudObscures))
return false;
}

View File

@@ -83,7 +83,7 @@ namespace OpenRA.Mods.Common.Traits.Render
DefaultAnimation = new Animation(self.World, rs.GetImage(self), () => turreted.WorldOrientation.Yaw);
DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence));
rs.Add(new AnimationWithOffset(
DefaultAnimation, () => BarrelOffset(), () => IsTraitDisabled, p => RenderUtils.ZOffsetFromCenter(self, p, 0)));
DefaultAnimation, BarrelOffset, () => IsTraitDisabled, p => RenderUtils.ZOffsetFromCenter(self, p, 0)));
// Restrict turret facings to match the sprite
turreted.QuantizedFacings = DefaultAnimation.CurrentSequence.Facings;

View File

@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits
{
this.self = self;
this.info = info;
health = Exts.Lazy(() => self.TraitOrDefault<IHealth>());
health = Exts.Lazy(self.TraitOrDefault<IHealth>);
}
public void ResolveOrder(Actor self, Order order)

View File

@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
public AnnounceOnSeen(Actor self, AnnounceOnSeenInfo info)
{
Info = info;
radarPings = Exts.Lazy(() => self.World.WorldActor.Trait<RadarPings>());
radarPings = Exts.Lazy(self.World.WorldActor.Trait<RadarPings>);
}
public void OnDiscovered(Actor self, Player discoverer, bool playNotification)

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
Self = init.Self;
DevMode = Self.Trait<DeveloperMode>();
TechTree = Self.Trait<TechTree>();
RadarPings = Exts.Lazy(() => Self.World.WorldActor.TraitOrDefault<RadarPings>());
RadarPings = Exts.Lazy(Self.World.WorldActor.TraitOrDefault<RadarPings>);
init.World.ActorAdded += ActorAdded;
init.World.ActorRemoved += ActorRemoved;

View File

@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits
// All the map cells that visually overlap the current cell
var testCells = w.Map.ProjectedCellsCovering(uv)
.SelectMany(puv => w.Map.Unproject(puv));
.SelectMany(w.Map.Unproject);
if (testCells.Any(x => x.V >= uv.V + 4))
w.Map.CustomTerrain[uv] = tileType;
}

View File

@@ -141,7 +141,7 @@ namespace OpenRA.Mods.Common.Traits
foreach (var n in groupsNode.Value.Nodes)
{
var group = FieldLoader.GetValue<uint[]>(n.Key, n.Value.Value)
.Select(a => self.World.GetActorById(a)).Where(a => a != null);
.Select(self.World.GetActorById).Where(a => a != null);
controlGroups[Exts.ParseInt32Invariant(n.Key)].AddRange(group);
}
}

View File

@@ -191,7 +191,7 @@ namespace OpenRA.Mods.Common.Traits
if (selectionNode != null)
{
var selected = FieldLoader.GetValue<uint[]>("Selection", selectionNode.Value.Value)
.Select(a => self.World.GetActorById(a)).Where(a => a != null);
.Select(self.World.GetActorById).Where(a => a != null);
Combine(self.World, selected, false, false);
}
}

View File

@@ -303,7 +303,7 @@ namespace OpenRA.Mods.Common.Traits
if (newShroud != null)
{
cellVisibility = puv => newShroud.GetVisibility(puv);
cellVisibility = newShroud.GetVisibility;
newShroud.OnShroudChanged += UpdateShroudCell;
}
else