.Any(), .Count() -> .Count or .Length
This commit is contained in:
committed by
atlimit8
parent
6eb4fe8980
commit
79f321cb44
@@ -124,7 +124,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
searchCells.Add(cell);
|
||||
}
|
||||
|
||||
if (!searchCells.Any())
|
||||
if (searchCells.Count == 0)
|
||||
return PathFinder.NoPath;
|
||||
|
||||
var path = Mobile.PathFinder.FindUnitPathToTargetCell(self, searchCells, loc, check);
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
unitCost = valued != null ? valued.Cost : 0;
|
||||
|
||||
var cannotRepairAtHost = health == null || health.DamageState == DamageState.Undamaged
|
||||
|| !allRepairsUnits.Any()
|
||||
|| allRepairsUnits.Length == 0
|
||||
|| ((repairable == null || !repairable.Info.RepairActors.Contains(host.Info.Name))
|
||||
&& (repairableNear == null || !repairableNear.Info.RepairActors.Contains(host.Info.Name)));
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
|
||||
// Logic classes can declare the data key names that specify hotkeys
|
||||
if (node.Key == "Logic" && node.Value.Nodes.Any())
|
||||
if (node.Key == "Logic" && node.Value.Nodes.Count > 0)
|
||||
{
|
||||
var typeNames = FieldLoader.GetValue<string[]>(node.Key, node.Value.Value);
|
||||
var checkArgKeys = new List<string>();
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var ios = actorInfo.Value.TraitInfoOrDefault<IOccupySpaceInfo>();
|
||||
if (ios == null)
|
||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType()}` but has no IOccupySpace traits!");
|
||||
else if (!ios.OccupiedCells(actorInfo.Value, CPos.Zero).Any())
|
||||
else if (ios.OccupiedCells(actorInfo.Value, CPos.Zero).Count == 0)
|
||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType()}` but does not have any footprint cells!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Server;
|
||||
|
||||
namespace OpenRA.Mods.Common.Lint
|
||||
@@ -38,7 +37,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (title == null)
|
||||
emitError("Map does not define a valid title.");
|
||||
|
||||
if (!categories.Any())
|
||||
if (categories.Length == 0)
|
||||
emitError("Map does not define any categories.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (player.OwnsWorld)
|
||||
{
|
||||
worldOwnerFound = true;
|
||||
if (player.Enemies.Any() || player.Allies.Any())
|
||||
if (player.Enemies.Length > 0 || player.Allies.Length > 0)
|
||||
emitWarning($"The player {player.Name} owning the world should not have any allies or enemies.");
|
||||
|
||||
if (player.Playable)
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Server;
|
||||
using OpenRA.Traits;
|
||||
@@ -41,7 +40,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
|
||||
if (ios == null)
|
||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{rsi.GetType()}` but has no IOccupySpace traits!");
|
||||
else if (!ios.OccupiedCells(actorInfo.Value, CPos.Zero).Any())
|
||||
else if (ios.OccupiedCells(actorInfo.Value, CPos.Zero).Count == 0)
|
||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{rsi.GetType()}` but does not have any footprint cells!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Server;
|
||||
|
||||
@@ -53,7 +52,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
// Removals can never define children or values
|
||||
if (t.Key.StartsWith("-", StringComparison.Ordinal))
|
||||
{
|
||||
if (t.Value.Nodes.Any())
|
||||
if (t.Value.Nodes.Count > 0)
|
||||
emitError($"{t.Location} {t.Key} defines child nodes, which are not valid for removals.");
|
||||
|
||||
if (!string.IsNullOrEmpty(t.Value.Value))
|
||||
@@ -65,7 +64,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var traitName = NormalizeName(t.Key);
|
||||
|
||||
// Inherits can never define children
|
||||
if (traitName == "Inherits" && t.Value.Nodes.Any())
|
||||
if (traitName == "Inherits" && t.Value.Nodes.Count > 0)
|
||||
{
|
||||
emitError($"{t.Location} defines child nodes, which are not valid for Inherits.");
|
||||
continue;
|
||||
@@ -91,7 +90,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
foreach (var f in mapFiles)
|
||||
CheckActors(MiniYaml.FromStream(fileSystem.Open(f), f), emitError, modData);
|
||||
|
||||
if (ruleDefinitions.Nodes.Any())
|
||||
if (ruleDefinitions.Nodes.Count > 0)
|
||||
CheckActors(ruleDefinitions.Nodes, emitError, modData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Server;
|
||||
@@ -55,7 +54,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
// Removals can never define children or values
|
||||
if (field.Key.StartsWith("-", StringComparison.Ordinal))
|
||||
{
|
||||
if (field.Value.Nodes.Any())
|
||||
if (field.Value.Nodes.Count > 0)
|
||||
emitError($"{field.Location} {field.Key} defines child nodes, which is not valid for removals.");
|
||||
|
||||
if (!string.IsNullOrEmpty(field.Value.Value))
|
||||
@@ -108,7 +107,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
foreach (var f in mapFiles)
|
||||
CheckWeapons(MiniYaml.FromStream(fileSystem.Open(f), f), emitError, emitWarning, modData);
|
||||
|
||||
if (weaponDefinitions.Nodes.Any())
|
||||
if (weaponDefinitions.Nodes.Count > 0)
|
||||
CheckWeapons(weaponDefinitions.Nodes, emitError, emitWarning, modData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace OpenRA.Mods.Common.Effects
|
||||
|
||||
if (!isLaunched)
|
||||
{
|
||||
if (weapon.Report != null && weapon.Report.Any())
|
||||
if (weapon.Report != null && weapon.Report.Length > 0)
|
||||
Game.Sound.Play(SoundType.World, weapon.Report, world, pos);
|
||||
|
||||
if (anim != null)
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
try
|
||||
{
|
||||
group.Remove(m);
|
||||
if (!group.Any())
|
||||
if (group.Count == 0)
|
||||
using (f)
|
||||
f.Call();
|
||||
}
|
||||
@@ -218,7 +218,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
if (!group.Remove(m))
|
||||
return;
|
||||
|
||||
if (!group.Any())
|
||||
if (group.Count == 0)
|
||||
{
|
||||
// Functions can only be .Call()ed once, so operate on a copy so we can reuse it later
|
||||
var temp = (LuaFunction)f.CopyReference();
|
||||
@@ -304,7 +304,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
if (!group.Remove(m))
|
||||
return;
|
||||
|
||||
if (!group.Any())
|
||||
if (group.Count == 0)
|
||||
using (f)
|
||||
f.Call().Dispose();
|
||||
}
|
||||
|
||||
@@ -134,10 +134,10 @@ namespace OpenRA.Mods.Common.Terrain
|
||||
if (terrainInfo.IgnoreTileSpriteOffsets)
|
||||
allSprites = allSprites.Select(s => new Sprite(s.Sheet, s.Bounds, s.ZRamp, new float3(float2.Zero, s.Offset.Z), s.Channel, s.BlendMode));
|
||||
|
||||
if (onMissingImage != null && !variants.Any())
|
||||
if (onMissingImage != null && variants.Count == 0)
|
||||
continue;
|
||||
|
||||
templates.Add(t.Value.Id, new TheaterTemplate(allSprites.ToArray(), variants.First().Count(), templateInfo.Images.Length));
|
||||
templates.Add(t.Value.Id, new TheaterTemplate(allSprites.ToArray(), variants.First().Length, templateInfo.Images.Length));
|
||||
}
|
||||
|
||||
// 1x1px transparent tile
|
||||
|
||||
@@ -1012,13 +1012,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
Order IIssueDeployOrder.IssueDeployOrder(Actor self, bool queued)
|
||||
{
|
||||
if (IsTraitDisabled || rearmable == null || !rearmable.Info.RearmActors.Any())
|
||||
if (IsTraitDisabled || rearmable == null || rearmable.Info.RearmActors.Count == 0)
|
||||
return null;
|
||||
|
||||
return new Order("ReturnToBase", self, queued);
|
||||
}
|
||||
|
||||
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self, bool queued) { return rearmable != null && rearmable.Info.RearmActors.Any(); }
|
||||
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self, bool queued) { return rearmable != null && rearmable.Info.RearmActors.Count > 0; }
|
||||
|
||||
public string VoicePhraseForOrder(Actor self, Order order)
|
||||
{
|
||||
@@ -1043,7 +1043,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
case "Scatter":
|
||||
return Info.Voice;
|
||||
case "ReturnToBase":
|
||||
return rearmable != null && rearmable.Info.RearmActors.Any() ? Info.Voice : null;
|
||||
return rearmable != null && rearmable.Info.RearmActors.Count > 0 ? Info.Voice : null;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
@@ -1123,7 +1123,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
else if (orderString == "ReturnToBase")
|
||||
{
|
||||
// Do nothing if not rearmable and don't restart activity every time deploy hotkey is triggered
|
||||
if (rearmable == null || !rearmable.Info.RearmActors.Any() || self.CurrentActivity is ReturnToBase || GetActorBelow() != null)
|
||||
if (rearmable == null || rearmable.Info.RearmActors.Count == 0 || self.CurrentActivity is ReturnToBase || GetActorBelow() != null)
|
||||
return;
|
||||
|
||||
if (!order.Queued)
|
||||
|
||||
@@ -330,10 +330,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (projectile != null)
|
||||
self.World.Add(projectile);
|
||||
|
||||
if (args.Weapon.Report != null && args.Weapon.Report.Any())
|
||||
if (args.Weapon.Report != null && args.Weapon.Report.Length > 0)
|
||||
Game.Sound.Play(SoundType.World, args.Weapon.Report, self.World, self.CenterPosition);
|
||||
|
||||
if (burst == args.Weapon.Burst && args.Weapon.StartBurstReport != null && args.Weapon.StartBurstReport.Any())
|
||||
if (burst == args.Weapon.Burst && args.Weapon.StartBurstReport != null && args.Weapon.StartBurstReport.Length > 0)
|
||||
Game.Sound.Play(SoundType.World, args.Weapon.StartBurstReport, self.World, self.CenterPosition);
|
||||
|
||||
foreach (var na in notifyAttacks)
|
||||
@@ -359,7 +359,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
FireDelay = Util.ApplyPercentageModifiers(Weapon.ReloadDelay, modifiers);
|
||||
Burst = Weapon.Burst;
|
||||
|
||||
if (Weapon.AfterFireSound != null && Weapon.AfterFireSound.Any())
|
||||
if (Weapon.AfterFireSound != null && Weapon.AfterFireSound.Length > 0)
|
||||
ScheduleDelayedAction(Weapon.AfterFireSoundDelay, Burst, (burst) => Game.Sound.Play(SoundType.World, Weapon.AfterFireSound, self.World, self.CenterPosition));
|
||||
|
||||
foreach (var nbc in notifyBurstComplete)
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
.Where(Exts.IsTraitEnabled).Where(t => t.ValidRelationships.HasRelationship(a.Owner.RelationshipWith(owner)))
|
||||
.ToList();
|
||||
|
||||
if (!blockers.Any())
|
||||
if (blockers.Count == 0)
|
||||
continue;
|
||||
|
||||
var hitPos = WorldExtensions.MinimumPointLineProjection(start, end, a.CenterPosition);
|
||||
|
||||
@@ -255,7 +255,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// Require at least one refinery, unless we can't build it.
|
||||
public bool HasAdequateRefineryCount =>
|
||||
!Info.RefineryTypes.Any() ||
|
||||
Info.RefineryTypes.Count == 0 ||
|
||||
AIUtils.CountBuildingByCommonName(Info.RefineryTypes, player) >= MinimumRefineryCount ||
|
||||
AIUtils.CountBuildingByCommonName(Info.PowerTypes, player) == 0 ||
|
||||
AIUtils.CountBuildingByCommonName(Info.ConstructionYardTypes, player) == 0;
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
this.category = category;
|
||||
failRetryTicks = baseBuilder.Info.StructureProductionResumeDelay;
|
||||
minimumExcessPower = baseBuilder.Info.MinimumExcessPower;
|
||||
if (!baseBuilder.Info.NavalProductionTypes.Any())
|
||||
if (baseBuilder.Info.NavalProductionTypes.Count == 0)
|
||||
waterState = WaterCheck.DontCheck;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
playerBuildings = world.ActorsHavingTrait<Building>().Where(a => a.Owner == player).ToArray();
|
||||
var excessPowerBonus = baseBuilder.Info.ExcessPowerIncrement * (playerBuildings.Count() / baseBuilder.Info.ExcessPowerIncreaseThreshold.Clamp(1, int.MaxValue));
|
||||
var excessPowerBonus = baseBuilder.Info.ExcessPowerIncrement * (playerBuildings.Length / baseBuilder.Info.ExcessPowerIncreaseThreshold.Clamp(1, int.MaxValue));
|
||||
minimumExcessPower = (baseBuilder.Info.MinimumExcessPower + excessPowerBonus).Clamp(baseBuilder.Info.MinimumExcessPower, baseBuilder.Info.MaximumExcessPower);
|
||||
|
||||
var active = false;
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
void QueueCaptureOrders(IBot bot)
|
||||
{
|
||||
if (!Info.CapturingActorTypes.Any() || player.WinState != WinState.Undefined)
|
||||
if (Info.CapturingActorTypes.Count == 0 || player.WinState != WinState.Undefined)
|
||||
return;
|
||||
|
||||
activeCapturers.RemoveAll(unitCannotBeOrderedOrIsIdle);
|
||||
@@ -151,7 +151,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
.OrderByDescending(target => target.GetSellValue())
|
||||
.Take(maximumCaptureTargetOptions);
|
||||
|
||||
if (Info.CapturableActorTypes.Any())
|
||||
if (Info.CapturableActorTypes.Count > 0)
|
||||
capturableTargetOptions = capturableTargetOptions.Where(target => Info.CapturableActorTypes.Contains(target.Info.Name.ToLowerInvariant()));
|
||||
|
||||
if (!capturableTargetOptions.Any())
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// Less harvesters than refineries - build a new harvester
|
||||
var unitBuilder = requestUnitProduction.FirstOrDefault(Exts.IsTraitEnabled);
|
||||
if (unitBuilder != null && Info.HarvesterTypes.Any())
|
||||
if (unitBuilder != null && Info.HarvesterTypes.Count > 0)
|
||||
{
|
||||
var harvInfo = AIUtils.GetInfoByCommonName(Info.HarvesterTypes, player);
|
||||
var harvCountTooLow = AIUtils.CountActorByCommonName(Info.HarvesterTypes, player) < AIUtils.CountBuildingByCommonName(Info.RefineryTypes, player);
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
.Where(unit => unit.IsIdle && unit.Info.HasTraitInfo<AttackBaseInfo>()
|
||||
&& !Info.AirUnitsTypes.Contains(unit.Info.Name) && !Info.NavalUnitsTypes.Contains(unit.Info.Name) && !Info.ExcludeFromSquadsTypes.Contains(unit.Info.Name)).ToList();
|
||||
|
||||
if (!allEnemyBaseBuilder.Any() || ownUnits.Count < Info.SquadSize)
|
||||
if (allEnemyBaseBuilder.Count == 0 || ownUnits.Count < Info.SquadSize)
|
||||
return;
|
||||
|
||||
foreach (var b in allEnemyBaseBuilder)
|
||||
@@ -328,7 +328,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (AttackOrFleeFuzzy.Rush.CanAttack(ownUnits, enemies))
|
||||
{
|
||||
var target = enemies.Any() ? enemies.Random(World.LocalRandom) : b;
|
||||
var target = enemies.Count > 0 ? enemies.Random(World.LocalRandom) : b;
|
||||
var rush = GetSquadOfType(SquadType.Rush);
|
||||
if (rush == null)
|
||||
rush = RegisterNewSquad(bot, SquadType.Rush, target);
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
FuzzyStateMachine.Update(this);
|
||||
}
|
||||
|
||||
public bool IsValid => Units.Any();
|
||||
public bool IsValid => Units.Count > 0;
|
||||
|
||||
public Actor TargetActor
|
||||
{
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
var unitsAroundPos = owner.World.FindActorsInCircle(loc, WDist.FromCells(dangerRadius))
|
||||
.Where(owner.SquadManager.IsPreferredEnemyUnit).ToList();
|
||||
|
||||
if (!unitsAroundPos.Any())
|
||||
if (unitsAroundPos.Count == 0)
|
||||
return true;
|
||||
|
||||
if (CountAntiAirUnits(unitsAroundPos) * MissileUnitMultiplier < owner.Units.Count)
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
while (true)
|
||||
{
|
||||
var step = NextNeighbourStep(seed, processed).ToList();
|
||||
if (!step.Any())
|
||||
if (step.Count == 0)
|
||||
break;
|
||||
|
||||
foreach (var s in step)
|
||||
@@ -230,7 +230,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!segments.Any())
|
||||
if (segments.Count == 0)
|
||||
return DamageState.Undamaged;
|
||||
|
||||
return segments.Values.Max(s => s.DamageState);
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
float ISelectionBar.GetValue()
|
||||
{
|
||||
if (IsTraitDisabled || !progress.Any())
|
||||
if (IsTraitDisabled || progress.Count == 0)
|
||||
return 0f;
|
||||
|
||||
return progress.Values.Max(p => (float)p.Current / p.Total);
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (enterMobile != null && enterMobile.IsMovingBetweenCells)
|
||||
return false;
|
||||
|
||||
if (progressWatchers.Any() || targetManager.progressWatchers.Any())
|
||||
if (progressWatchers.Length > 0 || targetManager.progressWatchers.Length > 0)
|
||||
{
|
||||
currentTargetTotal = captures.Info.CaptureDelay;
|
||||
if (move != null && captures.Info.ConsumedByCapture)
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
aircraft = self.TraitOrDefault<Aircraft>();
|
||||
|
||||
if (cargo.Any())
|
||||
if (cargo.Count > 0)
|
||||
{
|
||||
foreach (var c in cargo)
|
||||
if (Info.PassengerConditions.TryGetValue(c.Info.Name, out var passengerCondition))
|
||||
@@ -350,10 +350,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var p = passenger.Trait<Passenger>();
|
||||
p.Transport = null;
|
||||
|
||||
if (passengerTokens.TryGetValue(passenger.Info.Name, out var passengerToken) && passengerToken.Any())
|
||||
if (passengerTokens.TryGetValue(passenger.Info.Name, out var passengerToken) && passengerToken.Count > 0)
|
||||
self.RevokeCondition(passengerToken.Pop());
|
||||
|
||||
if (loadedTokens.Any())
|
||||
if (loadedTokens.Count > 0)
|
||||
self.RevokeCondition(loadedTokens.Pop());
|
||||
|
||||
return passenger;
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!IsValidTerrain(self.Location))
|
||||
return;
|
||||
|
||||
if (Info.DeploySounds != null && Info.DeploySounds.Any())
|
||||
if (Info.DeploySounds != null && Info.DeploySounds.Length > 0)
|
||||
Game.Sound.Play(SoundType.World, Info.DeploySounds, self.World, self.CenterPosition);
|
||||
|
||||
// Revoke condition that is applied while undeployed.
|
||||
@@ -270,7 +270,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// If there is no animation to play just grant the condition that is used while deployed.
|
||||
// Alternatively, play the deploy animation and then grant the condition.
|
||||
if (!notify.Any())
|
||||
if (notify.Length == 0)
|
||||
OnDeployCompleted();
|
||||
else
|
||||
foreach (var n in notify)
|
||||
@@ -285,7 +285,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!init && deployState != DeployState.Deployed)
|
||||
return;
|
||||
|
||||
if (Info.UndeploySounds != null && Info.UndeploySounds.Any())
|
||||
if (Info.UndeploySounds != null && Info.UndeploySounds.Length > 0)
|
||||
Game.Sound.Play(SoundType.World, Info.UndeploySounds, self.World, self.CenterPosition);
|
||||
|
||||
if (!init)
|
||||
@@ -293,7 +293,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// If there is no animation to play just grant the condition that is used while undeployed.
|
||||
// Alternatively, play the undeploy animation and then grant the condition.
|
||||
if (!notify.Any())
|
||||
if (notify.Length == 0)
|
||||
OnUndeployCompleted();
|
||||
else
|
||||
foreach (var n in notify)
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
@@ -50,13 +49,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
void INotifyAddedToWorld.AddedToWorld(Actor self)
|
||||
{
|
||||
if (info.Prerequisites.Any())
|
||||
if (info.Prerequisites.Length > 0)
|
||||
globalManager.Register(self, this, info.Prerequisites);
|
||||
}
|
||||
|
||||
void INotifyRemovedFromWorld.RemovedFromWorld(Actor self)
|
||||
{
|
||||
if (info.Prerequisites.Any())
|
||||
if (info.Prerequisites.Length > 0)
|
||||
globalManager.Unregister(self, this, info.Prerequisites);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
void INotifyProduction.UnitProduced(Actor self, Actor other, CPos exit)
|
||||
{
|
||||
if (info.Actors.Any() && !info.Actors.Select(a => a.ToLowerInvariant()).Contains(other.Info.Name))
|
||||
if (info.Actors.Count > 0 && !info.Actors.Select(a => a.ToLowerInvariant()).Contains(other.Info.Name))
|
||||
return;
|
||||
|
||||
if (token == Actor.InvalidConditionToken)
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits.Conditions
|
||||
@@ -36,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits.Conditions
|
||||
|
||||
void INotifyCreated.Created(Actor self)
|
||||
{
|
||||
if (!info.Conditions.Any())
|
||||
if (info.Conditions.Length == 0)
|
||||
return;
|
||||
|
||||
var condition = info.Conditions.Random(self.World.SharedRandom);
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (Info.ExcludedActorTypes.Contains(collector.Info.Name))
|
||||
return 0;
|
||||
|
||||
if (Info.Prerequisites.Any() && !collector.Owner.PlayerActor.Trait<TechTree>().HasPrerequisites(Info.Prerequisites))
|
||||
if (Info.Prerequisites.Length > 0 && !collector.Owner.PlayerActor.Trait<TechTree>().HasPrerequisites(Info.Prerequisites))
|
||||
return 0;
|
||||
|
||||
return GetSelectionShares(collector);
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (collector.Owner.NonCombatant)
|
||||
return false;
|
||||
|
||||
if (info.ValidFactions.Any() && !info.ValidFactions.Contains(collector.Owner.Faction.InternalName))
|
||||
if (info.ValidFactions.Count > 0 && !info.ValidFactions.Contains(collector.Owner.Faction.InternalName))
|
||||
return false;
|
||||
|
||||
if (!info.ValidTargets.Overlaps(collector.GetEnabledTargetTypes()))
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
this.self = self;
|
||||
this.info = info;
|
||||
if (!info.Units.Any())
|
||||
if (info.Units.Length == 0)
|
||||
throw new YamlException("A GiveUnitCrateAction does not specify any units to give. This might be because the yaml is referring to 'Unit' rather than 'Units'.");
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (collector.Owner.NonCombatant)
|
||||
return false;
|
||||
|
||||
if (info.ValidFactions.Any() && !info.ValidFactions.Contains(collector.Owner.Faction.InternalName))
|
||||
if (info.ValidFactions.Count > 0 && !info.ValidFactions.Contains(collector.Owner.Faction.InternalName))
|
||||
return false;
|
||||
|
||||
foreach (var unit in info.Units)
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
var source = Info.DamageSource == DamageSource.Self ? self : e.Attacker;
|
||||
if (weapon.Report != null && weapon.Report.Any())
|
||||
if (weapon.Report != null && weapon.Report.Length > 0)
|
||||
Game.Sound.Play(SoundType.World, weapon.Report, self.World, self.CenterPosition);
|
||||
|
||||
if (Info.Type == ExplosionType.Footprint && buildingInfo != null)
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
@@ -30,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
int IProductionCostModifierInfo.GetProductionCostModifier(TechTree techTree, string queue)
|
||||
{
|
||||
if ((!Queue.Any() || Queue.Contains(queue)) && (!Prerequisites.Any() || techTree.HasPrerequisites(Prerequisites)))
|
||||
if ((Queue.Count == 0 || Queue.Contains(queue)) && (Prerequisites.Length == 0 || techTree.HasPrerequisites(Prerequisites)))
|
||||
return Multiplier;
|
||||
|
||||
return 100;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
@@ -30,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
int IProductionTimeModifierInfo.GetProductionTimeModifier(TechTree techTree, string queue)
|
||||
{
|
||||
if ((!Queue.Any() || Queue.Contains(queue)) && (!Prerequisites.Any() || techTree.HasPrerequisites(Prerequisites)))
|
||||
if ((Queue.Count == 0 || Queue.Contains(queue)) && (Prerequisites.Length == 0 || techTree.HasPrerequisites(Prerequisites)))
|
||||
return Multiplier;
|
||||
|
||||
return 100;
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var list = upgradables[key];
|
||||
|
||||
list.RemoveAll(x => x.Actor == actor && x.GrantConditionOnPrerequisite == u);
|
||||
if (!list.Any())
|
||||
if (list.Count == 0)
|
||||
{
|
||||
upgradables.Remove(key);
|
||||
techTree.Remove(key);
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
.SelectMany(r => r.ReplaceableTypes)
|
||||
.ToHashSet();
|
||||
|
||||
if (replaceableTypes.Any())
|
||||
if (replaceableTypes.Count > 0)
|
||||
foreach (var t in buildingInfo.Tiles(targetLocation))
|
||||
foreach (var a in self.World.ActorMap.GetActorsAt(t))
|
||||
if (a.TraitsImplementing<Replaceable>().Any(r => !r.IsTraitDisabled && r.Info.Types.Overlaps(replaceableTypes)))
|
||||
@@ -145,7 +145,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
.SelectMany(r => r.ReplaceableTypes)
|
||||
.ToHashSet();
|
||||
|
||||
if (replaceableSegments.Any())
|
||||
if (replaceableSegments.Count > 0)
|
||||
foreach (var a in self.World.ActorMap.GetActorsAt(t.Cell))
|
||||
if (a.TraitsImplementing<Replaceable>().Any(r => !r.IsTraitDisabled && r.Info.Types.Overlaps(replaceableSegments)))
|
||||
self.World.Remove(a);
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var startingCash = SelectableCash.ToDictionary(c => c.ToString(), c => "$" + c.ToString());
|
||||
|
||||
if (startingCash.Any())
|
||||
if (startingCash.Count > 0)
|
||||
yield return new LobbyOption("startingcash", DefaultCashDropdownLabel, DefaultCashDropdownDescription, DefaultCashDropdownVisible, DefaultCashDropdownDisplayOrder,
|
||||
startingCash, DefaultCash.ToString(), DefaultCashDropdownLocked);
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Info = info;
|
||||
|
||||
Faction = init.GetValue<FactionInit, string>(self.Owner.Faction.InternalName);
|
||||
IsValidFaction = !info.Factions.Any() || info.Factions.Contains(Faction);
|
||||
IsValidFaction = info.Factions.Count == 0 || info.Factions.Contains(Faction);
|
||||
Enabled = IsValidFaction;
|
||||
|
||||
allProducibles = Producible.Where(a => a.Value.Buildable || a.Value.Visible).Select(a => a.Key);
|
||||
@@ -196,7 +196,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!Info.Sticky)
|
||||
{
|
||||
Faction = self.Owner.Faction.InternalName;
|
||||
IsValidFaction = !Info.Factions.Any() || Info.Factions.Contains(Faction);
|
||||
IsValidFaction = Info.Factions.Count == 0 || Info.Factions.Contains(Faction);
|
||||
}
|
||||
|
||||
// Regenerate the producibles and tech tree state
|
||||
@@ -274,7 +274,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public virtual IEnumerable<ActorInfo> AllItems()
|
||||
{
|
||||
if (productionTraits.Any() && productionTraits.All(p => p.IsTraitDisabled))
|
||||
if (productionTraits.Length > 0 && productionTraits.All(p => p.IsTraitDisabled))
|
||||
return Enumerable.Empty<ActorInfo>();
|
||||
if (developerMode.AllTech)
|
||||
return Producible.Keys;
|
||||
@@ -284,7 +284,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public virtual IEnumerable<ActorInfo> BuildableItems()
|
||||
{
|
||||
if (productionTraits.Any() && productionTraits.All(p => p.IsTraitDisabled))
|
||||
if (productionTraits.Length > 0 && productionTraits.All(p => p.IsTraitDisabled))
|
||||
return Enumerable.Empty<ActorInfo>();
|
||||
if (!Enabled)
|
||||
return Enumerable.Empty<ActorInfo>();
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
@@ -93,10 +92,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (IsTraitDisabled)
|
||||
return;
|
||||
|
||||
if (Info.Factions.Any())
|
||||
if (Info.Factions.Count > 0)
|
||||
enabled = Info.Factions.Contains(faction);
|
||||
|
||||
if (Info.RequiresPrerequisites.Any() && enabled)
|
||||
if (Info.RequiresPrerequisites.Length > 0 && enabled)
|
||||
enabled = techTree.HasPrerequisites(Info.RequiresPrerequisites);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<EditorActorOption> IEditorActorOptions.ActorOptions(ActorInfo ai, World world)
|
||||
{
|
||||
if (!EditorOptions.Any())
|
||||
if (EditorOptions.Count == 0)
|
||||
yield break;
|
||||
|
||||
// Make sure the no-plug option is always available
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public static bool AcceptsOrder(this Actor self, string orderString)
|
||||
{
|
||||
var rejectsOrdersTraits = self.TraitsImplementing<RejectsOrders>().Where(Exts.IsTraitEnabled).ToArray();
|
||||
if (!rejectsOrdersTraits.Any())
|
||||
if (rejectsOrdersTraits.Length == 0)
|
||||
return true;
|
||||
|
||||
var reject = rejectsOrdersTraits.SelectMany(t => t.Reject);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -125,7 +124,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
if (++offset >= Info.Offsets.Length)
|
||||
offset = 0;
|
||||
|
||||
if (!Info.TerrainTypes.Any() || Info.TerrainTypes.Contains(type))
|
||||
if (Info.TerrainTypes.Count == 0 || Info.TerrainTypes.Contains(type))
|
||||
{
|
||||
var spawnFacing = Info.SpawnAtLastPosition ? cachedFacing : facing?.Facing ?? WAngle.Zero;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
public WithAmmoPipsDecoration(Actor self, WithAmmoPipsDecorationInfo info)
|
||||
: base(self, info)
|
||||
{
|
||||
if (info.AmmoPools.Any())
|
||||
if (info.AmmoPools.Length > 0)
|
||||
ammo = self.TraitsImplementing<AmmoPool>()
|
||||
.Where(ap => info.AmmoPools.Contains(ap.Info.Name))
|
||||
.ToArray();
|
||||
|
||||
@@ -106,11 +106,11 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var bDestroyed = bridgeInfo.BOffset != CVec.Zero && NeighbourIsDestroyed(bridgeInfo.BOffset);
|
||||
|
||||
var sequence = DefaultAnimation.CurrentSequence.Name;
|
||||
if (aDestroyed && bDestroyed && bridgeInfo.ABDestroyedSequences.Any())
|
||||
if (aDestroyed && bDestroyed && bridgeInfo.ABDestroyedSequences.Length > 0)
|
||||
sequence = bridgeInfo.ABDestroyedSequences.Random(Game.CosmeticRandom);
|
||||
else if (aDestroyed && bridgeInfo.ADestroyedSequences.Any())
|
||||
else if (aDestroyed && bridgeInfo.ADestroyedSequences.Length > 0)
|
||||
sequence = bridgeInfo.ADestroyedSequences.Random(Game.CosmeticRandom);
|
||||
else if (bDestroyed && bridgeInfo.BDestroyedSequences.Any())
|
||||
else if (bDestroyed && bridgeInfo.BDestroyedSequences.Length > 0)
|
||||
sequence = bridgeInfo.BDestroyedSequences.Random(Game.CosmeticRandom);
|
||||
else
|
||||
sequence = bridgeInfo.Sequences.Random(Game.CosmeticRandom);
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Traits;
|
||||
@@ -59,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
|
||||
var rs = self.Trait<RenderSprites>();
|
||||
var image = rs.GetImage(self);
|
||||
var images = info.XmasImages.Any() && DateTime.Today.Month == 12 ? info.XmasImages : new[] { image };
|
||||
var images = info.XmasImages.Length > 0 && DateTime.Today.Month == 12 ? info.XmasImages : new[] { image };
|
||||
|
||||
anim = new Animation(self.World, images.Random(Game.CosmeticRandom));
|
||||
anim.Play(info.IdleSequence);
|
||||
|
||||
@@ -92,11 +92,11 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var bRamp = bridgeInfo.BOffset != CVec.Zero && RampExists(self, bridgeInfo.BOffset);
|
||||
|
||||
var sequence = DefaultAnimation.CurrentSequence.Name;
|
||||
if (aRamp && bRamp && bridgeInfo.ABRampSequences.Any())
|
||||
if (aRamp && bRamp && bridgeInfo.ABRampSequences.Length > 0)
|
||||
sequence = bridgeInfo.ABRampSequences.Random(Game.CosmeticRandom);
|
||||
else if (aRamp && bridgeInfo.ARampSequences.Any())
|
||||
else if (aRamp && bridgeInfo.ARampSequences.Length > 0)
|
||||
sequence = bridgeInfo.ARampSequences.Random(Game.CosmeticRandom);
|
||||
else if (bRamp && bridgeInfo.BRampSequences.Any())
|
||||
else if (bRamp && bridgeInfo.BRampSequences.Length > 0)
|
||||
sequence = bridgeInfo.BRampSequences.Random(Game.CosmeticRandom);
|
||||
|
||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, sequence));
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
if (self.World.FogObscures(self))
|
||||
return false;
|
||||
|
||||
if (blinkPattern != null && blinkPattern.Any())
|
||||
if (blinkPattern != null && blinkPattern.Length > 0)
|
||||
{
|
||||
var i = (self.World.WorldTick / Info.BlinkInterval) % blinkPattern.Length;
|
||||
if (blinkPattern[i] != BlinkState.On)
|
||||
|
||||
@@ -77,15 +77,15 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
// Per-actor production
|
||||
queues = self.TraitsImplementing<ProductionQueue>()
|
||||
.Where(q => productionInfos.Any(p => p.Produces.Contains(q.Info.Type)))
|
||||
.Where(q => !Info.Queues.Any() || Info.Queues.Contains(q.Info.Type))
|
||||
.Where(q => Info.Queues.Count == 0 || Info.Queues.Contains(q.Info.Type))
|
||||
.ToArray();
|
||||
|
||||
if (!queues.Any())
|
||||
if (queues.Length == 0)
|
||||
{
|
||||
// Player-wide production
|
||||
queues = self.Owner.PlayerActor.TraitsImplementing<ProductionQueue>()
|
||||
.Where(q => productionInfos.Any(p => p.Produces.Contains(q.Info.Type)))
|
||||
.Where(q => !Info.Queues.Any() || Info.Queues.Contains(q.Info.Type))
|
||||
.Where(q => Info.Queues.Count == 0 || Info.Queues.Contains(q.Info.Type))
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits.Sound
|
||||
@@ -43,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
|
||||
|
||||
void PlaySound(Actor self)
|
||||
{
|
||||
if (info.Sounds.Any())
|
||||
if (info.Sounds.Length > 0)
|
||||
Game.Sound.Play(SoundType.World, info.Sounds, self.World, self.CenterPosition);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
@@ -126,7 +125,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public override object Create(ActorInitializer init) { return new NukePower(init.Self, this); }
|
||||
public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(TrailImage) && !TrailSequences.Any())
|
||||
if (!string.IsNullOrEmpty(TrailImage) && TrailSequences.Length == 0)
|
||||
throw new YamlException("At least one entry in TrailSequences must be defined when TrailImage is defined.");
|
||||
|
||||
var weaponToLower = (MissileWeapon ?? string.Empty).ToLowerInvariant();
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
Powers.Add(key, t.CreateInstance(key, this));
|
||||
|
||||
if (t.Info.Prerequisites.Any())
|
||||
if (t.Info.Prerequisites.Length > 0)
|
||||
{
|
||||
TechTree.Add(key, t.Info.Prerequisites, 0, this);
|
||||
TechTree.Update();
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (IsTraitDisabled)
|
||||
return false;
|
||||
|
||||
if (!cloaks.Any() || (!viewer.IsDead && viewer.Info.HasTraitInfo<IgnoresCloakInfo>()))
|
||||
if (cloaks.Length == 0 || (!viewer.IsDead && viewer.Info.HasTraitInfo<IgnoresCloakInfo>()))
|
||||
return true;
|
||||
|
||||
return cloaks.All(c => c.IsTraitDisabled || c.IsVisible(self, viewer.Owner));
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (projectile != null)
|
||||
self.World.Add(projectile);
|
||||
|
||||
if (args.Weapon.Report != null && args.Weapon.Report.Any())
|
||||
if (args.Weapon.Report != null && args.Weapon.Report.Length > 0)
|
||||
Game.Sound.Play(SoundType.World, args.Weapon.Report, self.World, self.CenterPosition);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -120,10 +120,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Actor GetRandomSpawnPoint(World world, Support.MersenneTwister random)
|
||||
{
|
||||
var spawnPointActors = world.ActorsWithTrait<ActorSpawner>()
|
||||
.Where(x => !x.Trait.IsTraitDisabled && (info.Types.Overlaps(x.Trait.Types) || !x.Trait.Types.Any()))
|
||||
.Where(x => !x.Trait.IsTraitDisabled && (info.Types.Overlaps(x.Trait.Types) || x.Trait.Types.Count == 0))
|
||||
.ToArray();
|
||||
|
||||
return spawnPointActors.Any() ? spawnPointActors.Random(random).Actor : null;
|
||||
return spawnPointActors.Length > 0 ? spawnPointActors.Random(random).Actor : null;
|
||||
}
|
||||
|
||||
public void DecreaseActorCount()
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var terrainLinear = terrainColors.Select(c => c.ToLinear()).ToList();
|
||||
var playerLinear = playerColors.Select(c => c.ToLinear()).ToList();
|
||||
|
||||
if (PresetHues.Any())
|
||||
if (PresetHues.Length > 0)
|
||||
{
|
||||
foreach (var i in Exts.MakeArray(PresetHues.Length, x => x).Shuffle(random))
|
||||
{
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
for (var i = 0; i < controlGroups.Length; i++)
|
||||
{
|
||||
var cg = controlGroups[i];
|
||||
if (cg.Any())
|
||||
if (cg.Count > 0)
|
||||
{
|
||||
var actorIds = cg.Select(a => a.ActorID).ToArray();
|
||||
groups.Add(new MiniYamlNode(i.ToString(), FieldSaver.FormatValue(actorIds)));
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Team = client.Team,
|
||||
Handicap = client.Handicap,
|
||||
SpawnPoint = resolvedSpawnPoint,
|
||||
IsRandomFaction = clientFaction.RandomFactionMembers.Any(),
|
||||
IsRandomFaction = clientFaction.RandomFactionMembers.Count > 0,
|
||||
IsRandomSpawnPoint = client.SpawnPoint == 0,
|
||||
Fingerprint = client.Fingerprint,
|
||||
};
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var toProcess = new Stack<ushort>();
|
||||
toProcess.Push(d1);
|
||||
|
||||
while (toProcess.Any())
|
||||
while (toProcess.Count > 0)
|
||||
{
|
||||
var current = toProcess.Pop();
|
||||
if (!transientConnections.ContainsKey(current))
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// Fallback to the actor's CenterPosition for the ActorMap if it has no Footprint
|
||||
var footprint = preview.Footprint.Select(kv => kv.Key).ToArray();
|
||||
if (!footprint.Any())
|
||||
if (footprint.Length == 0)
|
||||
footprint = new[] { worldRenderer.World.Map.CellContaining(preview.CenterPosition) };
|
||||
|
||||
foreach (var cell in footprint)
|
||||
@@ -166,7 +166,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// Fallback to the actor's CenterPosition for the ActorMap if it has no Footprint
|
||||
var footprint = preview.Footprint.Select(kv => kv.Key).ToArray();
|
||||
if (!footprint.Any())
|
||||
if (footprint.Length == 0)
|
||||
footprint = new[] { worldRenderer.World.Map.CellContaining(preview.CenterPosition) };
|
||||
|
||||
foreach (var cell in footprint)
|
||||
@@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
list.Remove(preview);
|
||||
|
||||
if (!list.Any())
|
||||
if (list.Count == 0)
|
||||
cellMap.Remove(cell);
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var map = worldRenderer.World.Map;
|
||||
var previews = PreviewsAt(cell).ToList();
|
||||
if (!previews.Any())
|
||||
if (previews.Count == 0)
|
||||
return map.Grid.DefaultSubCell;
|
||||
|
||||
for (var i = (byte)SubCell.First; i < map.Grid.SubCellOffsets.Length; i++)
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Pathfinder;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -79,7 +78,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var terrainType = map.GetTerrainInfo(cell).Type;
|
||||
var jli = (JumpjetLocomotorInfo)li;
|
||||
if (!jli.JumpjetTransitionTerrainTypes.Contains(terrainType) && jli.JumpjetTransitionTerrainTypes.Any())
|
||||
if (!jli.JumpjetTransitionTerrainTypes.Contains(terrainType) && jli.JumpjetTransitionTerrainTypes.Count > 0)
|
||||
return false;
|
||||
|
||||
if (jli.JumpjetTransitionOnRamps)
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var techLevels = map.PlayerActorInfo.TraitInfos<ProvidesTechPrerequisiteInfo>()
|
||||
.ToDictionary(t => t.Id, t => t.Name);
|
||||
|
||||
if (techLevels.Any())
|
||||
if (techLevels.Count > 0)
|
||||
yield return new LobbyOption("techlevel", TechLevelDropdownLabel, TechLevelDropdownDescription, TechLevelDropdownVisible, TechLevelDropdownDisplayOrder,
|
||||
techLevels, TechLevel, TechLevelDropdownLocked);
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
.ToArray();
|
||||
|
||||
random = playlist.Shuffle(Game.CosmeticRandom).ToArray();
|
||||
IsMusicAvailable = playlist.Any();
|
||||
IsMusicAvailable = playlist.Length > 0;
|
||||
AllowMuteBackgroundMusic = info.AllowMuteBackgroundMusic;
|
||||
|
||||
if (SongExists(info.BackgroundMusic))
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
Info = info;
|
||||
world = self.World;
|
||||
hasSmoke = !string.IsNullOrEmpty(info.SmokeImage) && info.SmokeSequences.Any();
|
||||
hasSmoke = !string.IsNullOrEmpty(info.SmokeImage) && info.SmokeSequences.Length > 0;
|
||||
|
||||
var sequenceProvider = world.Map.Rules.Sequences;
|
||||
var types = sequenceProvider.Sequences(Info.Sequence);
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
foreach (var t in map.WorldActorInfo.TraitInfos<StartingUnitsInfo>())
|
||||
startingUnits[t.Class] = t.ClassName;
|
||||
|
||||
if (startingUnits.Any())
|
||||
if (startingUnits.Count > 0)
|
||||
yield return new LobbyOption("startingunits", DropdownLabel, DropdownDescription, DropdownVisible, DropdownDisplayOrder,
|
||||
startingUnits, StartingUnitsClass, DropdownLocked);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
});
|
||||
}
|
||||
|
||||
if (!unitGroup.SupportActors.Any())
|
||||
if (unitGroup.SupportActors.Length == 0)
|
||||
return;
|
||||
|
||||
var supportSpawnCells = w.Map.FindTilesInAnnulus(p.HomeLocation, unitGroup.InnerSupportRadius + 1, unitGroup.OuterSupportRadius);
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Pathfinder;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -77,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
bool ValidTransitionCell(CPos cell, SubterraneanLocomotorInfo sli)
|
||||
{
|
||||
var terrainType = map.GetTerrainInfo(cell).Type;
|
||||
if (!sli.SubterraneanTransitionTerrainTypes.Contains(terrainType) && sli.SubterraneanTransitionTerrainTypes.Any())
|
||||
if (!sli.SubterraneanTransitionTerrainTypes.Contains(terrainType) && sli.SubterraneanTransitionTerrainTypes.Count > 0)
|
||||
return false;
|
||||
|
||||
if (sli.SubterraneanTransitionOnRamps)
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (locations.Any())
|
||||
if (locations.Count > 0)
|
||||
yield return "[D2k]ResourceRenderer has been added.\n" +
|
||||
"You need to adjust the field RenderTypes on trait [D2k]ResourceRenderer\n" +
|
||||
"on the following actors:\n" +
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (weaponsToUpdate.Any())
|
||||
if (weaponsToUpdate.Count > 0)
|
||||
yield return "Add a ScreenShakeWarhead to the following weapons:\n" +
|
||||
UpdateUtils.FormatMessageList(weaponsToUpdate.Select(x => $"Weapon `{x.Item1}`, used by trait `{x.Item2}` on actor {x.Item3}"));
|
||||
|
||||
|
||||
@@ -29,11 +29,11 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (overrideLocations.Any())
|
||||
if (overrideLocations.Count > 0)
|
||||
yield return "Region-specific image overrides are no longer supported. The following definitions must be replaced:\n" +
|
||||
UpdateUtils.FormatMessageList(overrideLocations);
|
||||
|
||||
if (panelLocations.Any())
|
||||
if (panelLocations.Count > 0)
|
||||
yield return "The following definitions appear to be panels, but could not be converted to the new PanelRegion format.\n" +
|
||||
"You may wish to define PanelRegion/PanelSides manually to reduce duplication:\n" +
|
||||
UpdateUtils.FormatMessageList(panelLocations);
|
||||
@@ -186,7 +186,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
// Reformat region as a list
|
||||
regionsNode.AddNode(n.Key, n.NodeValue<int[]>());
|
||||
|
||||
if (n.Value.Nodes.Any())
|
||||
if (n.Value.Nodes.Count > 0)
|
||||
overrideLocations.Add($"{chromeProviderNode.Key}.{n.Key} ({chromeProviderNode.Location.Filename})");
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
if (!ExtractPanelDefinition(chromeProviderNode, regionsNode))
|
||||
panelLocations.Add($"{chromeProviderNode.Key} ({chromeProviderNode.Location.Filename})");
|
||||
|
||||
if (regionsNode.Value.Nodes.Any())
|
||||
if (regionsNode.Value.Nodes.Count > 0)
|
||||
chromeProviderNode.AddNode(regionsNode);
|
||||
|
||||
yield break;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
+ "You may have to define it manually now in the following places:\n"
|
||||
+ UpdateUtils.FormatMessageList(missingActorTypes.Select(n => n.Item1 + " (" + n.Item2 + ")"));
|
||||
|
||||
if (missingActorTypes.Any())
|
||||
if (missingActorTypes.Count > 0)
|
||||
yield return message;
|
||||
|
||||
missingActorTypes.Clear();
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
+ "You may have to set it manually now in the following places:\n"
|
||||
+ UpdateUtils.FormatMessageList(nonVTOLs.Select(n => n.Item1 + " (" + n.Item2 + ")"));
|
||||
|
||||
if (nonVTOLs.Any())
|
||||
if (nonVTOLs.Count > 0)
|
||||
yield return message;
|
||||
|
||||
nonVTOLs.Clear();
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
@@ -27,7 +26,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (locations.Any())
|
||||
if (locations.Count > 0)
|
||||
yield return "The WithPermanentInjury trait has been removed from the following actors.\n" +
|
||||
"You must manually define TakeCover with a negative ProneTime and use\n" +
|
||||
"GrantConditionOnDamageState/-Health with 'GrantPermanently: true'\n" +
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
@@ -24,7 +23,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (locations.Any())
|
||||
if (locations.Count > 0)
|
||||
yield return "The Spins property has been refactored to MaximumSpinSpeed.\n" +
|
||||
"MaximumSpinSpeed defaults to 'unlimited', while disabling is done by setting it to 0.\n" +
|
||||
"You may want to set a custom MaximumSpinSpeed limiting value in the following places:\n" +
|
||||
|
||||
@@ -49,18 +49,18 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (customPips && locations.Any())
|
||||
if (customPips && locations.Count > 0)
|
||||
yield return "Custom pip Images and Palettes are now defined on the individual With*PipsDecoration traits.\n" +
|
||||
"You should review the following definitions and manually define the Image and Palette properties as required:\n" +
|
||||
UpdateUtils.FormatMessageList(locations);
|
||||
|
||||
if (cargoCustomPips.Any() && cargoPipLocations.Any())
|
||||
if (cargoCustomPips.Count > 0 && cargoPipLocations.Count > 0)
|
||||
yield return "Some passenger types define custom cargo pips. Review the following definitions:\n" +
|
||||
UpdateUtils.FormatMessageList(cargoPipLocations) +
|
||||
"\nand, if required, add the following to the WithCargoPipsDecoration traits:\n" +
|
||||
"CustomPipSequences:\n" + cargoCustomPips.Select(p => $"\t{p}: {PipReplacements[p]}").JoinWith("\n");
|
||||
|
||||
if (harvesterCustomPips.Any() && harvesterPipLocations.Any())
|
||||
if (harvesterCustomPips.Count > 0 && harvesterPipLocations.Count > 0)
|
||||
yield return "Review the following definitions:\n" +
|
||||
UpdateUtils.FormatMessageList(harvesterPipLocations) +
|
||||
"\nand, if required, add the following to the WithHarvesterPipsDecoration traits:\n" +
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
@@ -87,7 +86,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (locations.Any())
|
||||
if (locations.Count > 0)
|
||||
yield return "Please check and adjust the new auto-generated dimensions.\n" +
|
||||
UpdateUtils.FormatMessageList(locations);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (weaponsToUpdate.Any())
|
||||
if (weaponsToUpdate.Count > 0)
|
||||
yield return "Add a FlashPaletteEffectWarhead to the following weapons:\n" +
|
||||
UpdateUtils.FormatMessageList(weaponsToUpdate.Select(x => $"Weapon `{x.Item1}`, used by trait `{x.Item2}` on actor {x.Item3}"));
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (locations.Any())
|
||||
if (locations.Count > 0)
|
||||
yield return "The way that decorations are positioned relative to the selection box has changed.\n" +
|
||||
"Review the following definitions and define Margin properties as required:\n" +
|
||||
UpdateUtils.FormatMessageList(locations.Select(
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
@@ -26,7 +25,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (locations.Any())
|
||||
if (locations.Count > 0)
|
||||
yield return "UseClassicFacingFudge property on BodyOrientation was replaced with ClassicFacingBodyOrientation trait.\n" +
|
||||
"UseClassicFacingFudge for sequences was renamed to UseClassicFacings and moved to\n" +
|
||||
"Classic(TileSetSpecific)SpriteSequence loaders in Mods.Cnc.\n" +
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
" you will need to define a 'Facing' parameter on the 'Exit' trait of the host building. This change" +
|
||||
" does not affect the behaviour for landing on terrain which is governed by TurnToLand.";
|
||||
|
||||
if (turningAircraft.Any())
|
||||
if (turningAircraft.Count > 0)
|
||||
yield return message;
|
||||
|
||||
turningAircraft.Clear();
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
@@ -27,7 +26,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (locations.Any())
|
||||
if (locations.Count > 0)
|
||||
yield return "The *Palette fields have been removed from the *PlaceBuildingPreview traits.\n" +
|
||||
"You may wish to inspect the following definitions and define new Alpha or\n" +
|
||||
"LineBuildSegmentAlpha properties as appropriate to recreate transparency effects:\n" +
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
@@ -36,21 +35,21 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (resourceLayer.Nodes.Any())
|
||||
if (resourceLayer.Nodes.Count > 0)
|
||||
yield return "Add the following definitions to your ResourceLayer and EditorResourceLayer definitions:\n\t" +
|
||||
"RecalculateResourceDensity: true\n\t" +
|
||||
resourceLayer.ToLines("ResourceTypes").JoinWith("\n\t");
|
||||
|
||||
if (resourceLayer.Nodes.Any())
|
||||
if (resourceLayer.Nodes.Count > 0)
|
||||
yield return "Add the following definitions to your ResourceRenderer definition:\n\t" +
|
||||
resourceRenderer.ToLines("ResourceTypes").JoinWith("\n\t");
|
||||
|
||||
if (values.Nodes.Any())
|
||||
if (values.Nodes.Count > 0)
|
||||
yield return "Add the following definition to your ^BasePlayer definition:\n\t" +
|
||||
"PlayerResources:\n\t\t" +
|
||||
values.ToLines("ResourceValues").JoinWith("\n\t\t");
|
||||
|
||||
if (resourceLayer.Nodes.Any())
|
||||
if (resourceLayer.Nodes.Count > 0)
|
||||
yield return "Support for AllowUnderActors, AllowUnderBuildings, and AllowOnRamps have been removed.\n" +
|
||||
"You must define a custom ResourceLayer subclass if you want to customize the default behaviour.";
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (locations.Any())
|
||||
if (locations.Count > 0)
|
||||
yield return "Some actor(s) defined a MinDamage of neither 'Heavy' nor 'Undamaged' on SmokeTrailWhenDamaged before update.\n" +
|
||||
"Review the following definitions and add custom GrandConditionOnDamageState configs as required:\n" +
|
||||
UpdateUtils.FormatMessageList(locations.Select(
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
@@ -26,7 +25,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (locations.Any())
|
||||
if (locations.Count > 0)
|
||||
yield return "The shadow palette overrides have been removed from the following locations:\n" +
|
||||
UpdateUtils.FormatMessageList(locations) + "\n\n" +
|
||||
"You may wish to inspect and change these.";
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
@@ -24,7 +23,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (locations.Any())
|
||||
if (locations.Count > 0)
|
||||
yield return "You must define new Color fields on the following traits:\n" +
|
||||
UpdateUtils.FormatMessageList(locations);
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
var mi = property.Item2;
|
||||
var required = property.Item3;
|
||||
var hasDesc = mi.HasAttribute<DescAttribute>();
|
||||
var hasRequires = required.Any();
|
||||
var hasRequires = required.Length > 0;
|
||||
var isActivity = mi.HasAttribute<ScriptActorPropertyActivityAttribute>();
|
||||
|
||||
Console.Write($"| **{mi.LuaDocString()}**");
|
||||
@@ -157,7 +157,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
var mi = property.Item2;
|
||||
var required = property.Item3;
|
||||
var hasDesc = mi.HasAttribute<DescAttribute>();
|
||||
var hasRequires = required.Any();
|
||||
var hasRequires = required.Length > 0;
|
||||
var isActivity = mi.HasAttribute<ScriptActorPropertyActivityAttribute>();
|
||||
|
||||
Console.Write($"| **{mi.LuaDocString()}**");
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
}
|
||||
}
|
||||
|
||||
if (videos.Any())
|
||||
if (videos.Count > 0)
|
||||
{
|
||||
var worldNode = Map.RuleDefinitions.Nodes.FirstOrDefault(n => n.Key == "World");
|
||||
if (worldNode == null)
|
||||
@@ -311,21 +311,21 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
if (worldNode == null)
|
||||
worldNode = new MiniYamlNode("World", new MiniYaml("", new List<MiniYamlNode>()));
|
||||
|
||||
if (scorches.Any())
|
||||
if (scorches.Count > 0)
|
||||
{
|
||||
var initialScorches = new MiniYamlNode("InitialSmudges", new MiniYaml("", scorches));
|
||||
var smudgeLayer = new MiniYamlNode("SmudgeLayer@SCORCH", new MiniYaml("", new List<MiniYamlNode>() { initialScorches }));
|
||||
worldNode.Value.Nodes.Add(smudgeLayer);
|
||||
}
|
||||
|
||||
if (craters.Any())
|
||||
if (craters.Count > 0)
|
||||
{
|
||||
var initialCraters = new MiniYamlNode("InitialSmudges", new MiniYaml("", craters));
|
||||
var smudgeLayer = new MiniYamlNode("SmudgeLayer@CRATER", new MiniYaml("", new List<MiniYamlNode>() { initialCraters }));
|
||||
worldNode.Value.Nodes.Add(smudgeLayer);
|
||||
}
|
||||
|
||||
if (worldNode.Value.Nodes.Any() && !Map.RuleDefinitions.Nodes.Contains(worldNode))
|
||||
if (worldNode.Value.Nodes.Count > 0 && !Map.RuleDefinitions.Nodes.Contains(worldNode))
|
||||
Map.RuleDefinitions.Nodes.Add(worldNode);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
Console.WriteLine(" Individual Rules:");
|
||||
foreach (var kv in ruleGroups)
|
||||
{
|
||||
if (!kv.Value.Any())
|
||||
if (kv.Value.Count == 0)
|
||||
continue;
|
||||
|
||||
Console.WriteLine(" " + kv.Key + ":");
|
||||
@@ -130,7 +130,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
mapFiles.Save();
|
||||
Console.WriteLine("COMPLETE");
|
||||
|
||||
if (manualSteps.Any())
|
||||
if (manualSteps.Count > 0)
|
||||
{
|
||||
Console.WriteLine(" Manual changes are required to complete this update:");
|
||||
foreach (var manualStep in manualSteps)
|
||||
@@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
if (externalFilenames.Any())
|
||||
if (externalFilenames.Count > 0)
|
||||
{
|
||||
Console.WriteLine("The following shared yaml files referenced by the map have been ignored:");
|
||||
Console.WriteLine(UpdateUtils.FormatMessageList(externalFilenames));
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
Console.WriteLine(" Individual Rules:");
|
||||
foreach (var kv in ruleGroups)
|
||||
{
|
||||
if (!kv.Value.Any())
|
||||
if (kv.Value.Count == 0)
|
||||
continue;
|
||||
|
||||
Console.WriteLine(" " + kv.Key + ":");
|
||||
@@ -205,7 +205,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
var mapSteps = UpdateUtils.UpdateMap(modData, package, rule, out var mapFiles, mapExternalFilenames);
|
||||
allFiles.AddRange(mapFiles);
|
||||
|
||||
if (mapSteps.Any())
|
||||
if (mapSteps.Count > 0)
|
||||
manualSteps.Add("Map: " + package.Name + ":\n" + UpdateUtils.FormatMessageList(mapSteps));
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -237,7 +237,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
// Files are saved after each successful automated rule update
|
||||
allFiles.Save();
|
||||
|
||||
if (manualSteps.Any())
|
||||
if (manualSteps.Count > 0)
|
||||
{
|
||||
LogLine(logWriter, " Manual changes are required to complete this update:");
|
||||
LogLine(logWriter, UpdateUtils.FormatMessageList(manualSteps, 1));
|
||||
@@ -246,7 +246,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
LogLine(logWriter);
|
||||
}
|
||||
|
||||
if (externalFilenames.Any())
|
||||
if (externalFilenames.Count > 0)
|
||||
{
|
||||
LogLine(logWriter, "The following external mod files have been ignored:");
|
||||
LogLine(logWriter, UpdateUtils.FormatMessageList(externalFilenames));
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
if (projectile != null)
|
||||
firedBy.World.AddFrameEndTask(w => w.Add(projectile));
|
||||
|
||||
if (projectileArgs.Weapon.Report != null && projectileArgs.Weapon.Report.Any())
|
||||
if (projectileArgs.Weapon.Report != null && projectileArgs.Weapon.Report.Length > 0)
|
||||
Game.Sound.Play(SoundType.World, projectileArgs.Weapon.Report, firedBy.World, target.CenterPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
protected override void InitializePreviews()
|
||||
{
|
||||
Panel.RemoveChildren();
|
||||
if (!SelectedCategories.Any())
|
||||
if (SelectedCategories.Count == 0)
|
||||
return;
|
||||
|
||||
foreach (var a in allActors)
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
protected override void InitializePreviews()
|
||||
{
|
||||
Panel.RemoveChildren();
|
||||
if (!SelectedCategories.Any())
|
||||
if (SelectedCategories.Count == 0)
|
||||
return;
|
||||
|
||||
foreach (var t in allTemplates)
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
Delete(selectedSave);
|
||||
|
||||
if (!games.Any() && !isSavePanel)
|
||||
if (games.Count == 0 && !isSavePanel)
|
||||
{
|
||||
Ui.CloseWindow();
|
||||
onExit();
|
||||
@@ -150,7 +150,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
};
|
||||
|
||||
var deleteAllButton = panel.Get<ButtonWidget>("DELETE_ALL_BUTTON");
|
||||
deleteAllButton.IsDisabled = () => !games.Any();
|
||||
deleteAllButton.IsDisabled = () => games.Count == 0;
|
||||
deleteAllButton.OnClick = () =>
|
||||
{
|
||||
ConfirmationDialogs.ButtonPrompt(
|
||||
@@ -355,7 +355,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (!Directory.Exists(baseSavePath))
|
||||
return false;
|
||||
|
||||
return Directory.GetFiles(baseSavePath, "*.orasav", SearchOption.AllDirectories).Any();
|
||||
return Directory.GetFiles(baseSavePath, "*.orasav", SearchOption.AllDirectories).Length > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
}
|
||||
|
||||
var spectators = orderManager.LobbyInfo.Clients.Where(c => c.IsObserver).ToList();
|
||||
if (spectators.Any())
|
||||
if (spectators.Count > 0)
|
||||
{
|
||||
var spectatorHeader = ScrollItemWidget.Setup(teamTemplate, () => true, () => { });
|
||||
spectatorHeader.Get<LabelWidget>("TEAM").GetText = () => "Spectators";
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
||||
.ToList();
|
||||
|
||||
// If no BaseBuilding exist pick the first selectable Building.
|
||||
if (!bases.Any())
|
||||
if (bases.Count == 0)
|
||||
{
|
||||
var building = world.ActorsHavingTrait<Building>()
|
||||
.FirstOrDefault(a => a.Owner == player && a.Info.HasTraitInfo<SelectableInfo>());
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
||||
.Where(a => a.IsInWorld && a.Owner == player)
|
||||
.ToList();
|
||||
|
||||
if (!harvesters.Any())
|
||||
if (harvesters.Count == 0)
|
||||
return true;
|
||||
|
||||
var next = harvesters
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
||||
.OrderBy(f => f.TraitsImplementing<Production>().First(t => !t.IsTraitDisabled).Info.Produces.First())
|
||||
.ToList();
|
||||
|
||||
if (!facilities.Any())
|
||||
if (facilities.Count == 0)
|
||||
return true;
|
||||
|
||||
var next = facilities
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
||||
.Where(x => !x.IsDead && eligiblePlayers.Contains(x.Owner))
|
||||
.ToList();
|
||||
|
||||
if (!ownedActors.Any())
|
||||
if (ownedActors.Count == 0)
|
||||
return false;
|
||||
|
||||
// Get all the selected actors' selection classes
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
WidgetUtils.BindButtonIcon(button);
|
||||
|
||||
button.IsDisabled = () => { UpdateStateIfNecessary(); return !actorStances.Any(); };
|
||||
button.IsDisabled = () => { UpdateStateIfNecessary(); return actorStances.Length == 0; };
|
||||
button.IsHighlighted = () => actorStances.Any(
|
||||
at => !at.Trait.IsTraitDisabled && at.Trait.PredictedStance == stance);
|
||||
button.OnClick = () => SetSelectionStance(stance);
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
scrollPanel.AddChild(container);
|
||||
}
|
||||
|
||||
discAvailable = content.Packages.Values.Any(p => p.Sources.Any() && !p.IsInstalled());
|
||||
discAvailable = content.Packages.Values.Any(p => p.Sources.Length > 0 && !p.IsInstalled());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user