.Any(), .Count() -> .Count or .Length
This commit is contained in:
committed by
atlimit8
parent
6eb4fe8980
commit
79f321cb44
@@ -564,7 +564,7 @@ namespace OpenRA
|
|||||||
fli.Field.SetValue(self, val);
|
fli.Field.SetValue(self, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (missing.Any())
|
if (missing.Count > 0)
|
||||||
throw new MissingFieldsException(missing.ToArray());
|
throw new MissingFieldsException(missing.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ namespace OpenRA
|
|||||||
OptionalDependencies = OptionalPrerequisitesOf(i).ToList()
|
OptionalDependencies = OptionalPrerequisitesOf(i).ToList()
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
var resolved = source.Where(s => !s.Dependencies.Any() && !s.OptionalDependencies.Any()).ToList();
|
var resolved = source.Where(s => s.Dependencies.Count == 0 && s.OptionalDependencies.Count == 0).ToList();
|
||||||
var unresolved = source.Except(resolved);
|
var unresolved = source.Except(resolved);
|
||||||
|
|
||||||
var testResolve = new Func<Type, Type, bool>((a, b) => a == b || a.IsAssignableFrom(b));
|
var testResolve = new Func<Type, Type, bool>((a, b) => a == b || a.IsAssignableFrom(b));
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
static bool AnyCustomYaml(MiniYaml yaml)
|
static bool AnyCustomYaml(MiniYaml yaml)
|
||||||
{
|
{
|
||||||
return yaml != null && (yaml.Value != null || yaml.Nodes.Any());
|
return yaml != null && (yaml.Value != null || yaml.Nodes.Count > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool AnyFlaggedTraits(ModData modData, List<MiniYamlNode> actors)
|
static bool AnyFlaggedTraits(ModData modData, List<MiniYamlNode> actors)
|
||||||
|
|||||||
@@ -223,7 +223,8 @@ namespace OpenRA.Graphics
|
|||||||
ShadowAmbient, ShadowDiffuse, shadowPalette.TextureMidIndex, normals.TextureMidIndex);
|
ShadowAmbient, ShadowDiffuse, shadowPalette.TextureMidIndex, normals.TextureMidIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
|
||||||
var screenLightVector = Util.MatrixVectorMultiply(invShadowTransform, ZVector);
|
var screenLightVector = Util.MatrixVectorMultiply(invShadowTransform, ZVector);
|
||||||
screenLightVector = Util.MatrixVectorMultiply(cameraTransform, screenLightVector);
|
screenLightVector = Util.MatrixVectorMultiply(cameraTransform, screenLightVector);
|
||||||
|
|||||||
@@ -130,13 +130,13 @@ namespace OpenRA
|
|||||||
if (type == Type.NodeList)
|
if (type == Type.NodeList)
|
||||||
{
|
{
|
||||||
var listValue = (List<MiniYamlNode>)value;
|
var listValue = (List<MiniYamlNode>)value;
|
||||||
if (required || listValue.Any())
|
if (required || listValue.Count > 0)
|
||||||
nodes.Add(new MiniYamlNode(key, null, listValue));
|
nodes.Add(new MiniYamlNode(key, null, listValue));
|
||||||
}
|
}
|
||||||
else if (type == Type.MiniYaml)
|
else if (type == Type.MiniYaml)
|
||||||
{
|
{
|
||||||
var yamlValue = (MiniYaml)value;
|
var yamlValue = (MiniYaml)value;
|
||||||
if (required || (yamlValue != null && (yamlValue.Value != null || yamlValue.Nodes.Any())))
|
if (required || (yamlValue != null && (yamlValue.Value != null || yamlValue.Nodes.Count > 0)))
|
||||||
nodes.Add(new MiniYamlNode(key, yamlValue));
|
nodes.Add(new MiniYamlNode(key, yamlValue));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -521,7 +521,7 @@ namespace OpenRA
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
temp = new MPos(temp.U, temp.V - 1);
|
temp = new MPos(temp.U, temp.V - 1);
|
||||||
if (!inverseCellProjection.Contains(temp) || inverseCellProjection[temp].Any())
|
if (!inverseCellProjection.Contains(temp) || inverseCellProjection[temp].Count > 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
projectedHeight[temp] = height;
|
projectedHeight[temp] = height;
|
||||||
@@ -534,7 +534,7 @@ namespace OpenRA
|
|||||||
while (inverseCellProjection.Contains((MPos)puv))
|
while (inverseCellProjection.Contains((MPos)puv))
|
||||||
{
|
{
|
||||||
var inverse = inverseCellProjection[(MPos)puv];
|
var inverse = inverseCellProjection[(MPos)puv];
|
||||||
if (inverse.Any())
|
if (inverse.Count > 0)
|
||||||
{
|
{
|
||||||
// The original games treat the top of cliffs the same way as the bottom
|
// The original games treat the top of cliffs the same way as the bottom
|
||||||
// This information isn't stored in the map data, so query the offset from the tileset
|
// This information isn't stored in the map data, so query the offset from the tileset
|
||||||
@@ -725,10 +725,10 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
var allTop = Unproject(new PPos(x, Bounds.Top));
|
var allTop = Unproject(new PPos(x, Bounds.Top));
|
||||||
var allBottom = Unproject(new PPos(x, Bounds.Bottom));
|
var allBottom = Unproject(new PPos(x, Bounds.Bottom));
|
||||||
if (allTop.Any())
|
if (allTop.Count > 0)
|
||||||
top = Math.Min(top, allTop.MinBy(uv => uv.V).V);
|
top = Math.Min(top, allTop.MinBy(uv => uv.V).V);
|
||||||
|
|
||||||
if (allBottom.Any())
|
if (allBottom.Count > 0)
|
||||||
bottom = Math.Max(bottom, allBottom.MaxBy(uv => uv.V).V);
|
bottom = Math.Max(bottom, allBottom.MaxBy(uv => uv.V).V);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1135,7 +1135,7 @@ namespace OpenRA
|
|||||||
// Project this guessed cell and take the first available cell
|
// Project this guessed cell and take the first available cell
|
||||||
// If it is projected outside the layer, then make another guess.
|
// If it is projected outside the layer, then make another guess.
|
||||||
var allProjected = ProjectedCellsCovering(uv);
|
var allProjected = ProjectedCellsCovering(uv);
|
||||||
var projected = allProjected.Any() ? allProjected.First()
|
var projected = allProjected.Length > 0 ? allProjected.First()
|
||||||
: new PPos(uv.U, uv.V.Clamp(Bounds.Top, Bounds.Bottom));
|
: new PPos(uv.U, uv.V.Clamp(Bounds.Top, Bounds.Bottom));
|
||||||
|
|
||||||
// Clamp the projected cell to the map area
|
// Clamp the projected cell to the map area
|
||||||
@@ -1145,7 +1145,7 @@ namespace OpenRA
|
|||||||
// This may fail if the projected cell covered a cliff or another feature
|
// This may fail if the projected cell covered a cliff or another feature
|
||||||
// where there is a large change in terrain height.
|
// where there is a large change in terrain height.
|
||||||
var unProjected = Unproject(projected);
|
var unProjected = Unproject(projected);
|
||||||
if (!unProjected.Any())
|
if (unProjected.Count == 0)
|
||||||
{
|
{
|
||||||
// Adjust V until we find a cell that works
|
// Adjust V until we find a cell that works
|
||||||
for (var x = 2; x <= 2 * Grid.MaximumTerrainHeight; x++)
|
for (var x = 2; x <= 2 * Grid.MaximumTerrainHeight; x++)
|
||||||
@@ -1156,12 +1156,12 @@ namespace OpenRA
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
unProjected = Unproject(test);
|
unProjected = Unproject(test);
|
||||||
if (unProjected.Any())
|
if (unProjected.Count > 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This shouldn't happen. But if it does, return the original value and hope the caller doesn't explode.
|
// This shouldn't happen. But if it does, return the original value and hope the caller doesn't explode.
|
||||||
if (!unProjected.Any())
|
if (unProjected.Count == 0)
|
||||||
{
|
{
|
||||||
Log.Write("debug", "Failed to clamp map cell {0} to map bounds", uv);
|
Log.Write("debug", "Failed to clamp map cell {0} to map bounds", uv);
|
||||||
return uv;
|
return uv;
|
||||||
@@ -1187,7 +1187,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
cells = Unproject(new PPos(u, v));
|
cells = Unproject(new PPos(u, v));
|
||||||
}
|
}
|
||||||
while (!cells.Any());
|
while (cells.Count == 0);
|
||||||
|
|
||||||
return cells.Random(rand).ToCPos(Grid.Type);
|
return cells.Random(rand).ToCPos(Grid.Type);
|
||||||
}
|
}
|
||||||
@@ -1202,7 +1202,7 @@ namespace OpenRA
|
|||||||
var allProjected = ProjectedCellsCovering(uv);
|
var allProjected = ProjectedCellsCovering(uv);
|
||||||
|
|
||||||
PPos edge;
|
PPos edge;
|
||||||
if (allProjected.Any())
|
if (allProjected.Length > 0)
|
||||||
{
|
{
|
||||||
var puv = allProjected.First();
|
var puv = allProjected.First();
|
||||||
var horizontalBound = ((puv.U - Bounds.Left) < Bounds.Width / 2) ? Bounds.Left : Bounds.Right;
|
var horizontalBound = ((puv.U - Bounds.Left) < Bounds.Width / 2) ? Bounds.Left : Bounds.Right;
|
||||||
@@ -1217,7 +1217,7 @@ namespace OpenRA
|
|||||||
edge = new PPos(Bounds.Left, Bounds.Top);
|
edge = new PPos(Bounds.Left, Bounds.Top);
|
||||||
|
|
||||||
var unProjected = Unproject(edge);
|
var unProjected = Unproject(edge);
|
||||||
if (!unProjected.Any())
|
if (unProjected.Count == 0)
|
||||||
{
|
{
|
||||||
// Adjust V until we find a cell that works
|
// Adjust V until we find a cell that works
|
||||||
for (var x = 2; x <= 2 * Grid.MaximumTerrainHeight; x++)
|
for (var x = 2; x <= 2 * Grid.MaximumTerrainHeight; x++)
|
||||||
@@ -1228,12 +1228,12 @@ namespace OpenRA
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
unProjected = Unproject(test);
|
unProjected = Unproject(test);
|
||||||
if (unProjected.Any())
|
if (unProjected.Count > 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This shouldn't happen. But if it does, return the original value and hope the caller doesn't explode.
|
// This shouldn't happen. But if it does, return the original value and hope the caller doesn't explode.
|
||||||
if (!unProjected.Any())
|
if (unProjected.Count == 0)
|
||||||
{
|
{
|
||||||
Log.Write("debug", "Failed to find closest edge for map cell {0}", uv);
|
Log.Write("debug", "Failed to find closest edge for map cell {0}", uv);
|
||||||
return uv;
|
return uv;
|
||||||
@@ -1256,22 +1256,22 @@ namespace OpenRA
|
|||||||
for (var u = Bounds.Left; u < Bounds.Right; u++)
|
for (var u = Bounds.Left; u < Bounds.Right; u++)
|
||||||
{
|
{
|
||||||
unProjected = Unproject(new PPos(u, Bounds.Top));
|
unProjected = Unproject(new PPos(u, Bounds.Top));
|
||||||
if (unProjected.Any())
|
if (unProjected.Count > 0)
|
||||||
edgeCells.Add(unProjected.MinBy(x => x.V).ToCPos(Grid.Type));
|
edgeCells.Add(unProjected.MinBy(x => x.V).ToCPos(Grid.Type));
|
||||||
|
|
||||||
unProjected = Unproject(new PPos(u, bottom));
|
unProjected = Unproject(new PPos(u, bottom));
|
||||||
if (unProjected.Any())
|
if (unProjected.Count > 0)
|
||||||
edgeCells.Add(unProjected.MaxBy(x => x.V).ToCPos(Grid.Type));
|
edgeCells.Add(unProjected.MaxBy(x => x.V).ToCPos(Grid.Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var v = Bounds.Top; v < Bounds.Bottom; v++)
|
for (var v = Bounds.Top; v < Bounds.Bottom; v++)
|
||||||
{
|
{
|
||||||
unProjected = Unproject(new PPos(Bounds.Left, v));
|
unProjected = Unproject(new PPos(Bounds.Left, v));
|
||||||
if (unProjected.Any())
|
if (unProjected.Count > 0)
|
||||||
edgeCells.Add((v == bottom ? unProjected.MaxBy(x => x.V) : unProjected.MinBy(x => x.V)).ToCPos(Grid.Type));
|
edgeCells.Add((v == bottom ? unProjected.MaxBy(x => x.V) : unProjected.MinBy(x => x.V)).ToCPos(Grid.Type));
|
||||||
|
|
||||||
unProjected = Unproject(new PPos(Bounds.Right - 1, v));
|
unProjected = Unproject(new PPos(Bounds.Right - 1, v));
|
||||||
if (unProjected.Any())
|
if (unProjected.Count > 0)
|
||||||
edgeCells.Add((v == bottom ? unProjected.MaxBy(x => x.V) : unProjected.MinBy(x => x.V)).ToCPos(Grid.Type));
|
edgeCells.Add((v == bottom ? unProjected.MaxBy(x => x.V) : unProjected.MinBy(x => x.V)).ToCPos(Grid.Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
|
|
||||||
var sources = files.Select(s => MiniYaml.FromStream(fileSystem.Open(s), s).Where(IsLoadableRuleDefinition).ToList());
|
var sources = files.Select(s => MiniYaml.FromStream(fileSystem.Open(s), s).Where(IsLoadableRuleDefinition).ToList());
|
||||||
if (RuleDefinitions.Nodes.Any())
|
if (RuleDefinitions.Nodes.Count > 0)
|
||||||
sources = sources.Append(RuleDefinitions.Nodes.Where(IsLoadableRuleDefinition).ToList());
|
sources = sources.Append(RuleDefinitions.Nodes.Where(IsLoadableRuleDefinition).ToList());
|
||||||
|
|
||||||
var yamlNodes = MiniYaml.Merge(sources);
|
var yamlNodes = MiniYaml.Merge(sources);
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
|
|
||||||
var yaml = files.Select(s => FromStream(fileSystem.Open(s), s));
|
var yaml = files.Select(s => FromStream(fileSystem.Open(s), s));
|
||||||
if (mapRules != null && mapRules.Nodes.Any())
|
if (mapRules != null && mapRules.Nodes.Count > 0)
|
||||||
yaml = yaml.Append(mapRules.Nodes);
|
yaml = yaml.Append(mapRules.Nodes);
|
||||||
|
|
||||||
return Merge(yaml);
|
return Merge(yaml);
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ namespace OpenRA.Network
|
|||||||
ModWebsite = manifest.Metadata.Website;
|
ModWebsite = manifest.Metadata.Website;
|
||||||
ModIcon32 = manifest.Metadata.WebIcon32;
|
ModIcon32 = manifest.Metadata.WebIcon32;
|
||||||
Protected = !string.IsNullOrEmpty(server.Settings.Password);
|
Protected = !string.IsNullOrEmpty(server.Settings.Password);
|
||||||
Authentication = server.Settings.RequireAuthentication || server.Settings.ProfileIDWhitelist.Any();
|
Authentication = server.Settings.RequireAuthentication || server.Settings.ProfileIDWhitelist.Length > 0;
|
||||||
Clients = server.LobbyInfo.Clients.Select(c => new GameClient(c)).ToArray();
|
Clients = server.LobbyInfo.Clients.Select(c => new GameClient(c)).ToArray();
|
||||||
DisabledSpawnPoints = server.LobbyInfo.DisabledSpawnPoints?.ToArray() ?? Array.Empty<int>();
|
DisabledSpawnPoints = server.LobbyInfo.DisabledSpawnPoints?.ToArray() ?? Array.Empty<int>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ namespace OpenRA.Network
|
|||||||
var properties = type.GetProperties(Flags).Where(pi => pi.HasAttribute<SyncAttribute>());
|
var properties = type.GetProperties(Flags).Where(pi => pi.HasAttribute<SyncAttribute>());
|
||||||
|
|
||||||
foreach (var prop in properties)
|
foreach (var prop in properties)
|
||||||
if (!prop.CanRead || prop.GetIndexParameters().Any())
|
if (!prop.CanRead || prop.GetIndexParameters().Length > 0)
|
||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
"Properties using the Sync attribute must be readable and must not use index parameters.\n" +
|
"Properties using the Sync attribute must be readable and must not use index parameters.\n" +
|
||||||
"Invalid Property: " + prop.DeclaringType.FullName + "." + prop.Name);
|
"Invalid Property: " + prop.DeclaringType.FullName + "." + prop.Name);
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace OpenRA
|
|||||||
?? selectableFactions.Random(playerRandom);
|
?? selectableFactions.Random(playerRandom);
|
||||||
|
|
||||||
// Don't loop infinite
|
// Don't loop infinite
|
||||||
for (var i = 0; i <= 10 && selected.RandomFactionMembers.Any(); i++)
|
for (var i = 0; i <= 10 && selected.RandomFactionMembers.Count > 0; i++)
|
||||||
{
|
{
|
||||||
var faction = selected.RandomFactionMembers.Random(playerRandom);
|
var faction = selected.RandomFactionMembers.Random(playerRandom);
|
||||||
selected = selectableFactions.FirstOrDefault(f => f.InternalName == faction);
|
selected = selectableFactions.FirstOrDefault(f => f.InternalName == faction);
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ namespace OpenRA
|
|||||||
public void EnableScissor(Rectangle rect)
|
public void EnableScissor(Rectangle rect)
|
||||||
{
|
{
|
||||||
// Must remain inside the current scissor rect
|
// Must remain inside the current scissor rect
|
||||||
if (scissorState.Any())
|
if (scissorState.Count > 0)
|
||||||
rect = Rectangle.Intersect(rect, scissorState.Peek());
|
rect = Rectangle.Intersect(rect, scissorState.Peek());
|
||||||
|
|
||||||
Flush();
|
Flush();
|
||||||
@@ -405,7 +405,7 @@ namespace OpenRA
|
|||||||
if (renderType == RenderType.World)
|
if (renderType == RenderType.World)
|
||||||
{
|
{
|
||||||
// Restore previous scissor rect
|
// Restore previous scissor rect
|
||||||
if (scissorState.Any())
|
if (scissorState.Count > 0)
|
||||||
{
|
{
|
||||||
var rect = scissorState.Peek();
|
var rect = scissorState.Peek();
|
||||||
var r = Rectangle.FromLTRB(
|
var r = Rectangle.FromLTRB(
|
||||||
@@ -421,7 +421,7 @@ namespace OpenRA
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Restore previous scissor rect
|
// Restore previous scissor rect
|
||||||
if (scissorState.Any())
|
if (scissorState.Count > 0)
|
||||||
{
|
{
|
||||||
var rect = scissorState.Peek();
|
var rect = scissorState.Peek();
|
||||||
Context.EnableScissor(rect.X, rect.Y, rect.Width, rect.Height);
|
Context.EnableScissor(rect.X, rect.Y, rect.Width, rect.Height);
|
||||||
|
|||||||
@@ -635,9 +635,9 @@ namespace OpenRA.Server
|
|||||||
|
|
||||||
events.Add(new CallbackEvent(() =>
|
events.Add(new CallbackEvent(() =>
|
||||||
{
|
{
|
||||||
var notAuthenticated = Type == ServerType.Dedicated && profile == null && (Settings.RequireAuthentication || Settings.ProfileIDWhitelist.Any());
|
var notAuthenticated = Type == ServerType.Dedicated && profile == null && (Settings.RequireAuthentication || Settings.ProfileIDWhitelist.Length > 0);
|
||||||
var blacklisted = Type == ServerType.Dedicated && profile != null && Settings.ProfileIDBlacklist.Contains(profile.ProfileID);
|
var blacklisted = Type == ServerType.Dedicated && profile != null && Settings.ProfileIDBlacklist.Contains(profile.ProfileID);
|
||||||
var notWhitelisted = Type == ServerType.Dedicated && Settings.ProfileIDWhitelist.Any() &&
|
var notWhitelisted = Type == ServerType.Dedicated && Settings.ProfileIDWhitelist.Length > 0 &&
|
||||||
(profile == null || !Settings.ProfileIDWhitelist.Contains(profile.ProfileID));
|
(profile == null || !Settings.ProfileIDWhitelist.Contains(profile.ProfileID));
|
||||||
|
|
||||||
if (notAuthenticated)
|
if (notAuthenticated)
|
||||||
@@ -663,7 +663,7 @@ namespace OpenRA.Server
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Type == ServerType.Dedicated && (Settings.RequireAuthentication || Settings.ProfileIDWhitelist.Any()))
|
if (Type == ServerType.Dedicated && (Settings.RequireAuthentication || Settings.ProfileIDWhitelist.Length > 0))
|
||||||
{
|
{
|
||||||
Log.Write("server", $"Rejected connection from {newConn.EndPoint}; Not authenticated.");
|
Log.Write("server", $"Rejected connection from {newConn.EndPoint}; Not authenticated.");
|
||||||
SendOrderTo(newConn, "ServerError", RequiresForumAccount);
|
SendOrderTo(newConn, "ServerError", RequiresForumAccount);
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ namespace OpenRA.Support
|
|||||||
|
|
||||||
public static AssemblyLoadContextBuilder AddDependencyContext(this AssemblyLoadContextBuilder builder, DependencyContext dependencyContext)
|
public static AssemblyLoadContextBuilder AddDependencyContext(this AssemblyLoadContextBuilder builder, DependencyContext dependencyContext)
|
||||||
{
|
{
|
||||||
var ridGraph = dependencyContext.RuntimeGraph.Any()
|
var ridGraph = dependencyContext.RuntimeGraph.Count > 0
|
||||||
? dependencyContext.RuntimeGraph
|
? dependencyContext.RuntimeGraph
|
||||||
: DependencyContext.Default.RuntimeGraph;
|
: DependencyContext.Default.RuntimeGraph;
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ namespace OpenRA.Traits
|
|||||||
return Renderables;
|
return Renderables;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasRenderables => !Shrouded && Renderables.Any();
|
public bool HasRenderables => !Shrouded && Renderables.Length > 0;
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
void ITick.Tick(Actor self)
|
void ITick.Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (shakeEffects.Any())
|
if (shakeEffects.Count > 0)
|
||||||
{
|
{
|
||||||
worldRenderer.Viewport.Scroll(GetScrollOffset(), true);
|
worldRenderer.Viewport.Scroll(GetScrollOffset(), true);
|
||||||
shakeEffects.RemoveAll(t => t.ExpiryTime == ticks);
|
shakeEffects.RemoveAll(t => t.ExpiryTime == ticks);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public Translation(string language, string[] translations, IReadOnlyFileSystem fileSystem)
|
public Translation(string language, string[] translations, IReadOnlyFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
if (translations == null || !translations.Any())
|
if (translations == null || translations.Length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
messageContexts = GetMessageContext(language, translations, fileSystem).ToList();
|
messageContexts = GetMessageContext(language, translations, fileSystem).ToList();
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
public void PostInit(WidgetArgs args)
|
public void PostInit(WidgetArgs args)
|
||||||
{
|
{
|
||||||
if (!Logic.Any())
|
if (Logic.Length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
args["widget"] = this;
|
args["widget"] = this;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.GameRules;
|
using OpenRA.GameRules;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
@@ -42,7 +41,7 @@ namespace OpenRA.Mods.Cnc.Effects
|
|||||||
entryAnimation = new Animation(world, entryEffect);
|
entryAnimation = new Animation(world, entryEffect);
|
||||||
entryAnimation.PlayThen(entrySequence, () => Finish(world));
|
entryAnimation.PlayThen(entrySequence, () => Finish(world));
|
||||||
|
|
||||||
if (weapon.Report != null && weapon.Report.Any())
|
if (weapon.Report != null && weapon.Report.Length > 0)
|
||||||
Game.Sound.Play(SoundType.World, weapon.Report, world, launchPos);
|
Game.Sound.Play(SoundType.World, weapon.Report, world, launchPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.GameRules;
|
using OpenRA.GameRules;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
@@ -38,7 +37,7 @@ namespace OpenRA.Mods.Cnc.Effects
|
|||||||
anim = new Animation(world, effect);
|
anim = new Animation(world, effect);
|
||||||
anim.PlayThen(sequence, () => Finish(world));
|
anim.PlayThen(sequence, () => Finish(world));
|
||||||
|
|
||||||
if (weapon.Report != null && weapon.Report.Any())
|
if (weapon.Report != null && weapon.Report.Length > 0)
|
||||||
Game.Sound.Play(SoundType.World, weapon.Report, world, launchPos);
|
Game.Sound.Play(SoundType.World, weapon.Report, world, launchPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
{
|
{
|
||||||
minelayers.Clear();
|
minelayers.Clear();
|
||||||
minelayers.AddRange(selected.Where(s => !s.IsDead && s.Info.HasTraitInfo<MinelayerInfo>()));
|
minelayers.AddRange(selected.Where(s => !s.IsDead && s.Info.HasTraitInfo<MinelayerInfo>()));
|
||||||
if (!minelayers.Any())
|
if (minelayers.Count == 0)
|
||||||
world.CancelInputMode();
|
world.CancelInputMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
|||||||
// HACK: We don't have an efficient way to know when the preview
|
// HACK: We don't have an efficient way to know when the preview
|
||||||
// bounds change, so assume that we need to update the screen map
|
// bounds change, so assume that we need to update the screen map
|
||||||
// (only) when the facing changes
|
// (only) when the facing changes
|
||||||
if (facing.Facing != cachedFacing && previews.Any())
|
if (facing.Facing != cachedFacing && previews.Count > 0)
|
||||||
{
|
{
|
||||||
self.World.ScreenMap.AddOrUpdate(self);
|
self.World.ScreenMap.AddOrUpdate(self);
|
||||||
cachedFacing = facing.Facing;
|
cachedFacing = facing.Facing;
|
||||||
|
|||||||
@@ -634,7 +634,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
|||||||
lightingNodes.Add(new MiniYamlNode(node.Value, FieldSaver.FormatValue(val)));
|
lightingNodes.Add(new MiniYamlNode(node.Value, FieldSaver.FormatValue(val)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lightingNodes.Any())
|
if (lightingNodes.Count > 0)
|
||||||
{
|
{
|
||||||
map.RuleDefinitions.Nodes.Add(new MiniYamlNode("^BaseWorld", new MiniYaml("", new List<MiniYamlNode>()
|
map.RuleDefinitions.Nodes.Add(new MiniYamlNode("^BaseWorld", new MiniYaml("", new List<MiniYamlNode>()
|
||||||
{
|
{
|
||||||
@@ -674,7 +674,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lightingNodes.Any())
|
if (lightingNodes.Count > 0)
|
||||||
{
|
{
|
||||||
map.RuleDefinitions.Nodes.Add(new MiniYamlNode(lamp, new MiniYaml("", new List<MiniYamlNode>()
|
map.RuleDefinitions.Nodes.Add(new MiniYamlNode(lamp, new MiniYaml("", new List<MiniYamlNode>()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
searchCells.Add(cell);
|
searchCells.Add(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!searchCells.Any())
|
if (searchCells.Count == 0)
|
||||||
return PathFinder.NoPath;
|
return PathFinder.NoPath;
|
||||||
|
|
||||||
var path = Mobile.PathFinder.FindUnitPathToTargetCell(self, searchCells, loc, check);
|
var path = Mobile.PathFinder.FindUnitPathToTargetCell(self, searchCells, loc, check);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
unitCost = valued != null ? valued.Cost : 0;
|
unitCost = valued != null ? valued.Cost : 0;
|
||||||
|
|
||||||
var cannotRepairAtHost = health == null || health.DamageState == DamageState.Undamaged
|
var cannotRepairAtHost = health == null || health.DamageState == DamageState.Undamaged
|
||||||
|| !allRepairsUnits.Any()
|
|| allRepairsUnits.Length == 0
|
||||||
|| ((repairable == null || !repairable.Info.RepairActors.Contains(host.Info.Name))
|
|| ((repairable == null || !repairable.Info.RepairActors.Contains(host.Info.Name))
|
||||||
&& (repairableNear == null || !repairableNear.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
|
// 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 typeNames = FieldLoader.GetValue<string[]>(node.Key, node.Value.Value);
|
||||||
var checkArgKeys = new List<string>();
|
var checkArgKeys = new List<string>();
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
var ios = actorInfo.Value.TraitInfoOrDefault<IOccupySpaceInfo>();
|
var ios = actorInfo.Value.TraitInfoOrDefault<IOccupySpaceInfo>();
|
||||||
if (ios == null)
|
if (ios == null)
|
||||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType()}` but has no IOccupySpace traits!");
|
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!");
|
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType()}` but does not have any footprint cells!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Server;
|
using OpenRA.Server;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Lint
|
namespace OpenRA.Mods.Common.Lint
|
||||||
@@ -38,7 +37,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
if (title == null)
|
if (title == null)
|
||||||
emitError("Map does not define a valid title.");
|
emitError("Map does not define a valid title.");
|
||||||
|
|
||||||
if (!categories.Any())
|
if (categories.Length == 0)
|
||||||
emitError("Map does not define any categories.");
|
emitError("Map does not define any categories.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
if (player.OwnsWorld)
|
if (player.OwnsWorld)
|
||||||
{
|
{
|
||||||
worldOwnerFound = true;
|
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.");
|
emitWarning($"The player {player.Name} owning the world should not have any allies or enemies.");
|
||||||
|
|
||||||
if (player.Playable)
|
if (player.Playable)
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
using OpenRA.Server;
|
using OpenRA.Server;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
@@ -41,7 +40,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
|
|
||||||
if (ios == null)
|
if (ios == null)
|
||||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{rsi.GetType()}` but has no IOccupySpace traits!");
|
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!");
|
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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.FileSystem;
|
using OpenRA.FileSystem;
|
||||||
using OpenRA.Server;
|
using OpenRA.Server;
|
||||||
|
|
||||||
@@ -53,7 +52,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
// Removals can never define children or values
|
// Removals can never define children or values
|
||||||
if (t.Key.StartsWith("-", StringComparison.Ordinal))
|
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.");
|
emitError($"{t.Location} {t.Key} defines child nodes, which are not valid for removals.");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(t.Value.Value))
|
if (!string.IsNullOrEmpty(t.Value.Value))
|
||||||
@@ -65,7 +64,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
var traitName = NormalizeName(t.Key);
|
var traitName = NormalizeName(t.Key);
|
||||||
|
|
||||||
// Inherits can never define children
|
// 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.");
|
emitError($"{t.Location} defines child nodes, which are not valid for Inherits.");
|
||||||
continue;
|
continue;
|
||||||
@@ -91,7 +90,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
foreach (var f in mapFiles)
|
foreach (var f in mapFiles)
|
||||||
CheckActors(MiniYaml.FromStream(fileSystem.Open(f), f), emitError, modData);
|
CheckActors(MiniYaml.FromStream(fileSystem.Open(f), f), emitError, modData);
|
||||||
|
|
||||||
if (ruleDefinitions.Nodes.Any())
|
if (ruleDefinitions.Nodes.Count > 0)
|
||||||
CheckActors(ruleDefinitions.Nodes, emitError, modData);
|
CheckActors(ruleDefinitions.Nodes, emitError, modData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.FileSystem;
|
using OpenRA.FileSystem;
|
||||||
using OpenRA.GameRules;
|
using OpenRA.GameRules;
|
||||||
using OpenRA.Server;
|
using OpenRA.Server;
|
||||||
@@ -55,7 +54,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
// Removals can never define children or values
|
// Removals can never define children or values
|
||||||
if (field.Key.StartsWith("-", StringComparison.Ordinal))
|
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.");
|
emitError($"{field.Location} {field.Key} defines child nodes, which is not valid for removals.");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(field.Value.Value))
|
if (!string.IsNullOrEmpty(field.Value.Value))
|
||||||
@@ -108,7 +107,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
foreach (var f in mapFiles)
|
foreach (var f in mapFiles)
|
||||||
CheckWeapons(MiniYaml.FromStream(fileSystem.Open(f), f), emitError, emitWarning, modData);
|
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);
|
CheckWeapons(weaponDefinitions.Nodes, emitError, emitWarning, modData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
|
|
||||||
if (!isLaunched)
|
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);
|
Game.Sound.Play(SoundType.World, weapon.Report, world, pos);
|
||||||
|
|
||||||
if (anim != null)
|
if (anim != null)
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
group.Remove(m);
|
group.Remove(m);
|
||||||
if (!group.Any())
|
if (group.Count == 0)
|
||||||
using (f)
|
using (f)
|
||||||
f.Call();
|
f.Call();
|
||||||
}
|
}
|
||||||
@@ -218,7 +218,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
if (!group.Remove(m))
|
if (!group.Remove(m))
|
||||||
return;
|
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
|
// Functions can only be .Call()ed once, so operate on a copy so we can reuse it later
|
||||||
var temp = (LuaFunction)f.CopyReference();
|
var temp = (LuaFunction)f.CopyReference();
|
||||||
@@ -304,7 +304,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
if (!group.Remove(m))
|
if (!group.Remove(m))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!group.Any())
|
if (group.Count == 0)
|
||||||
using (f)
|
using (f)
|
||||||
f.Call().Dispose();
|
f.Call().Dispose();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,10 +134,10 @@ namespace OpenRA.Mods.Common.Terrain
|
|||||||
if (terrainInfo.IgnoreTileSpriteOffsets)
|
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));
|
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;
|
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
|
// 1x1px transparent tile
|
||||||
|
|||||||
@@ -1012,13 +1012,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
Order IIssueDeployOrder.IssueDeployOrder(Actor self, bool queued)
|
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 null;
|
||||||
|
|
||||||
return new Order("ReturnToBase", self, queued);
|
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)
|
public string VoicePhraseForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
@@ -1043,7 +1043,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
case "Scatter":
|
case "Scatter":
|
||||||
return Info.Voice;
|
return Info.Voice;
|
||||||
case "ReturnToBase":
|
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;
|
default: return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1123,7 +1123,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
else if (orderString == "ReturnToBase")
|
else if (orderString == "ReturnToBase")
|
||||||
{
|
{
|
||||||
// Do nothing if not rearmable and don't restart activity every time deploy hotkey is triggered
|
// 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;
|
return;
|
||||||
|
|
||||||
if (!order.Queued)
|
if (!order.Queued)
|
||||||
|
|||||||
@@ -330,10 +330,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (projectile != null)
|
if (projectile != null)
|
||||||
self.World.Add(projectile);
|
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);
|
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);
|
Game.Sound.Play(SoundType.World, args.Weapon.StartBurstReport, self.World, self.CenterPosition);
|
||||||
|
|
||||||
foreach (var na in notifyAttacks)
|
foreach (var na in notifyAttacks)
|
||||||
@@ -359,7 +359,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
FireDelay = Util.ApplyPercentageModifiers(Weapon.ReloadDelay, modifiers);
|
FireDelay = Util.ApplyPercentageModifiers(Weapon.ReloadDelay, modifiers);
|
||||||
Burst = Weapon.Burst;
|
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));
|
ScheduleDelayedAction(Weapon.AfterFireSoundDelay, Burst, (burst) => Game.Sound.Play(SoundType.World, Weapon.AfterFireSound, self.World, self.CenterPosition));
|
||||||
|
|
||||||
foreach (var nbc in notifyBurstComplete)
|
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)))
|
.Where(Exts.IsTraitEnabled).Where(t => t.ValidRelationships.HasRelationship(a.Owner.RelationshipWith(owner)))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (!blockers.Any())
|
if (blockers.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var hitPos = WorldExtensions.MinimumPointLineProjection(start, end, a.CenterPosition);
|
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.
|
// Require at least one refinery, unless we can't build it.
|
||||||
public bool HasAdequateRefineryCount =>
|
public bool HasAdequateRefineryCount =>
|
||||||
!Info.RefineryTypes.Any() ||
|
Info.RefineryTypes.Count == 0 ||
|
||||||
AIUtils.CountBuildingByCommonName(Info.RefineryTypes, player) >= MinimumRefineryCount ||
|
AIUtils.CountBuildingByCommonName(Info.RefineryTypes, player) >= MinimumRefineryCount ||
|
||||||
AIUtils.CountBuildingByCommonName(Info.PowerTypes, player) == 0 ||
|
AIUtils.CountBuildingByCommonName(Info.PowerTypes, player) == 0 ||
|
||||||
AIUtils.CountBuildingByCommonName(Info.ConstructionYardTypes, player) == 0;
|
AIUtils.CountBuildingByCommonName(Info.ConstructionYardTypes, player) == 0;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
this.category = category;
|
this.category = category;
|
||||||
failRetryTicks = baseBuilder.Info.StructureProductionResumeDelay;
|
failRetryTicks = baseBuilder.Info.StructureProductionResumeDelay;
|
||||||
minimumExcessPower = baseBuilder.Info.MinimumExcessPower;
|
minimumExcessPower = baseBuilder.Info.MinimumExcessPower;
|
||||||
if (!baseBuilder.Info.NavalProductionTypes.Any())
|
if (baseBuilder.Info.NavalProductionTypes.Count == 0)
|
||||||
waterState = WaterCheck.DontCheck;
|
waterState = WaterCheck.DontCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
playerBuildings = world.ActorsHavingTrait<Building>().Where(a => a.Owner == player).ToArray();
|
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);
|
minimumExcessPower = (baseBuilder.Info.MinimumExcessPower + excessPowerBonus).Clamp(baseBuilder.Info.MinimumExcessPower, baseBuilder.Info.MaximumExcessPower);
|
||||||
|
|
||||||
var active = false;
|
var active = false;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
void QueueCaptureOrders(IBot bot)
|
void QueueCaptureOrders(IBot bot)
|
||||||
{
|
{
|
||||||
if (!Info.CapturingActorTypes.Any() || player.WinState != WinState.Undefined)
|
if (Info.CapturingActorTypes.Count == 0 || player.WinState != WinState.Undefined)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
activeCapturers.RemoveAll(unitCannotBeOrderedOrIsIdle);
|
activeCapturers.RemoveAll(unitCannotBeOrderedOrIsIdle);
|
||||||
@@ -151,7 +151,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
.OrderByDescending(target => target.GetSellValue())
|
.OrderByDescending(target => target.GetSellValue())
|
||||||
.Take(maximumCaptureTargetOptions);
|
.Take(maximumCaptureTargetOptions);
|
||||||
|
|
||||||
if (Info.CapturableActorTypes.Any())
|
if (Info.CapturableActorTypes.Count > 0)
|
||||||
capturableTargetOptions = capturableTargetOptions.Where(target => Info.CapturableActorTypes.Contains(target.Info.Name.ToLowerInvariant()));
|
capturableTargetOptions = capturableTargetOptions.Where(target => Info.CapturableActorTypes.Contains(target.Info.Name.ToLowerInvariant()));
|
||||||
|
|
||||||
if (!capturableTargetOptions.Any())
|
if (!capturableTargetOptions.Any())
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
// Less harvesters than refineries - build a new harvester
|
// Less harvesters than refineries - build a new harvester
|
||||||
var unitBuilder = requestUnitProduction.FirstOrDefault(Exts.IsTraitEnabled);
|
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 harvInfo = AIUtils.GetInfoByCommonName(Info.HarvesterTypes, player);
|
||||||
var harvCountTooLow = AIUtils.CountActorByCommonName(Info.HarvesterTypes, player) < AIUtils.CountBuildingByCommonName(Info.RefineryTypes, 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>()
|
.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();
|
&& !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;
|
return;
|
||||||
|
|
||||||
foreach (var b in allEnemyBaseBuilder)
|
foreach (var b in allEnemyBaseBuilder)
|
||||||
@@ -328,7 +328,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
if (AttackOrFleeFuzzy.Rush.CanAttack(ownUnits, enemies))
|
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);
|
var rush = GetSquadOfType(SquadType.Rush);
|
||||||
if (rush == null)
|
if (rush == null)
|
||||||
rush = RegisterNewSquad(bot, SquadType.Rush, target);
|
rush = RegisterNewSquad(bot, SquadType.Rush, target);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
FuzzyStateMachine.Update(this);
|
FuzzyStateMachine.Update(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsValid => Units.Any();
|
public bool IsValid => Units.Count > 0;
|
||||||
|
|
||||||
public Actor TargetActor
|
public Actor TargetActor
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
var unitsAroundPos = owner.World.FindActorsInCircle(loc, WDist.FromCells(dangerRadius))
|
var unitsAroundPos = owner.World.FindActorsInCircle(loc, WDist.FromCells(dangerRadius))
|
||||||
.Where(owner.SquadManager.IsPreferredEnemyUnit).ToList();
|
.Where(owner.SquadManager.IsPreferredEnemyUnit).ToList();
|
||||||
|
|
||||||
if (!unitsAroundPos.Any())
|
if (unitsAroundPos.Count == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (CountAntiAirUnits(unitsAroundPos) * MissileUnitMultiplier < owner.Units.Count)
|
if (CountAntiAirUnits(unitsAroundPos) * MissileUnitMultiplier < owner.Units.Count)
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
var step = NextNeighbourStep(seed, processed).ToList();
|
var step = NextNeighbourStep(seed, processed).ToList();
|
||||||
if (!step.Any())
|
if (step.Count == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
foreach (var s in step)
|
foreach (var s in step)
|
||||||
@@ -230,7 +230,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!segments.Any())
|
if (segments.Count == 0)
|
||||||
return DamageState.Undamaged;
|
return DamageState.Undamaged;
|
||||||
|
|
||||||
return segments.Values.Max(s => s.DamageState);
|
return segments.Values.Max(s => s.DamageState);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
float ISelectionBar.GetValue()
|
float ISelectionBar.GetValue()
|
||||||
{
|
{
|
||||||
if (IsTraitDisabled || !progress.Any())
|
if (IsTraitDisabled || progress.Count == 0)
|
||||||
return 0f;
|
return 0f;
|
||||||
|
|
||||||
return progress.Values.Max(p => (float)p.Current / p.Total);
|
return progress.Values.Max(p => (float)p.Current / p.Total);
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (enterMobile != null && enterMobile.IsMovingBetweenCells)
|
if (enterMobile != null && enterMobile.IsMovingBetweenCells)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (progressWatchers.Any() || targetManager.progressWatchers.Any())
|
if (progressWatchers.Length > 0 || targetManager.progressWatchers.Length > 0)
|
||||||
{
|
{
|
||||||
currentTargetTotal = captures.Info.CaptureDelay;
|
currentTargetTotal = captures.Info.CaptureDelay;
|
||||||
if (move != null && captures.Info.ConsumedByCapture)
|
if (move != null && captures.Info.ConsumedByCapture)
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
aircraft = self.TraitOrDefault<Aircraft>();
|
aircraft = self.TraitOrDefault<Aircraft>();
|
||||||
|
|
||||||
if (cargo.Any())
|
if (cargo.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (var c in cargo)
|
foreach (var c in cargo)
|
||||||
if (Info.PassengerConditions.TryGetValue(c.Info.Name, out var passengerCondition))
|
if (Info.PassengerConditions.TryGetValue(c.Info.Name, out var passengerCondition))
|
||||||
@@ -350,10 +350,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var p = passenger.Trait<Passenger>();
|
var p = passenger.Trait<Passenger>();
|
||||||
p.Transport = null;
|
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());
|
self.RevokeCondition(passengerToken.Pop());
|
||||||
|
|
||||||
if (loadedTokens.Any())
|
if (loadedTokens.Count > 0)
|
||||||
self.RevokeCondition(loadedTokens.Pop());
|
self.RevokeCondition(loadedTokens.Pop());
|
||||||
|
|
||||||
return passenger;
|
return passenger;
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (!IsValidTerrain(self.Location))
|
if (!IsValidTerrain(self.Location))
|
||||||
return;
|
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);
|
Game.Sound.Play(SoundType.World, Info.DeploySounds, self.World, self.CenterPosition);
|
||||||
|
|
||||||
// Revoke condition that is applied while undeployed.
|
// 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.
|
// 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.
|
// Alternatively, play the deploy animation and then grant the condition.
|
||||||
if (!notify.Any())
|
if (notify.Length == 0)
|
||||||
OnDeployCompleted();
|
OnDeployCompleted();
|
||||||
else
|
else
|
||||||
foreach (var n in notify)
|
foreach (var n in notify)
|
||||||
@@ -285,7 +285,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (!init && deployState != DeployState.Deployed)
|
if (!init && deployState != DeployState.Deployed)
|
||||||
return;
|
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);
|
Game.Sound.Play(SoundType.World, Info.UndeploySounds, self.World, self.CenterPosition);
|
||||||
|
|
||||||
if (!init)
|
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.
|
// 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.
|
// Alternatively, play the undeploy animation and then grant the condition.
|
||||||
if (!notify.Any())
|
if (notify.Length == 0)
|
||||||
OnUndeployCompleted();
|
OnUndeployCompleted();
|
||||||
else
|
else
|
||||||
foreach (var n in notify)
|
foreach (var n in notify)
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
@@ -50,13 +49,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
void INotifyAddedToWorld.AddedToWorld(Actor self)
|
void INotifyAddedToWorld.AddedToWorld(Actor self)
|
||||||
{
|
{
|
||||||
if (info.Prerequisites.Any())
|
if (info.Prerequisites.Length > 0)
|
||||||
globalManager.Register(self, this, info.Prerequisites);
|
globalManager.Register(self, this, info.Prerequisites);
|
||||||
}
|
}
|
||||||
|
|
||||||
void INotifyRemovedFromWorld.RemovedFromWorld(Actor self)
|
void INotifyRemovedFromWorld.RemovedFromWorld(Actor self)
|
||||||
{
|
{
|
||||||
if (info.Prerequisites.Any())
|
if (info.Prerequisites.Length > 0)
|
||||||
globalManager.Unregister(self, this, info.Prerequisites);
|
globalManager.Unregister(self, this, info.Prerequisites);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
void INotifyProduction.UnitProduced(Actor self, Actor other, CPos exit)
|
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;
|
return;
|
||||||
|
|
||||||
if (token == Actor.InvalidConditionToken)
|
if (token == Actor.InvalidConditionToken)
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits.Conditions
|
namespace OpenRA.Mods.Common.Traits.Conditions
|
||||||
@@ -36,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits.Conditions
|
|||||||
|
|
||||||
void INotifyCreated.Created(Actor self)
|
void INotifyCreated.Created(Actor self)
|
||||||
{
|
{
|
||||||
if (!info.Conditions.Any())
|
if (info.Conditions.Length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var condition = info.Conditions.Random(self.World.SharedRandom);
|
var condition = info.Conditions.Random(self.World.SharedRandom);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (Info.ExcludedActorTypes.Contains(collector.Info.Name))
|
if (Info.ExcludedActorTypes.Contains(collector.Info.Name))
|
||||||
return 0;
|
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 0;
|
||||||
|
|
||||||
return GetSelectionShares(collector);
|
return GetSelectionShares(collector);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (collector.Owner.NonCombatant)
|
if (collector.Owner.NonCombatant)
|
||||||
return false;
|
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;
|
return false;
|
||||||
|
|
||||||
if (!info.ValidTargets.Overlaps(collector.GetEnabledTargetTypes()))
|
if (!info.ValidTargets.Overlaps(collector.GetEnabledTargetTypes()))
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
this.self = self;
|
this.self = self;
|
||||||
this.info = info;
|
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'.");
|
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)
|
if (collector.Owner.NonCombatant)
|
||||||
return false;
|
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;
|
return false;
|
||||||
|
|
||||||
foreach (var unit in info.Units)
|
foreach (var unit in info.Units)
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var source = Info.DamageSource == DamageSource.Self ? self : e.Attacker;
|
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);
|
Game.Sound.Play(SoundType.World, weapon.Report, self.World, self.CenterPosition);
|
||||||
|
|
||||||
if (Info.Type == ExplosionType.Footprint && buildingInfo != null)
|
if (Info.Type == ExplosionType.Footprint && buildingInfo != null)
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
@@ -30,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
int IProductionCostModifierInfo.GetProductionCostModifier(TechTree techTree, string queue)
|
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 Multiplier;
|
||||||
|
|
||||||
return 100;
|
return 100;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
@@ -30,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
int IProductionTimeModifierInfo.GetProductionTimeModifier(TechTree techTree, string queue)
|
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 Multiplier;
|
||||||
|
|
||||||
return 100;
|
return 100;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var list = upgradables[key];
|
var list = upgradables[key];
|
||||||
|
|
||||||
list.RemoveAll(x => x.Actor == actor && x.GrantConditionOnPrerequisite == u);
|
list.RemoveAll(x => x.Actor == actor && x.GrantConditionOnPrerequisite == u);
|
||||||
if (!list.Any())
|
if (list.Count == 0)
|
||||||
{
|
{
|
||||||
upgradables.Remove(key);
|
upgradables.Remove(key);
|
||||||
techTree.Remove(key);
|
techTree.Remove(key);
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
.SelectMany(r => r.ReplaceableTypes)
|
.SelectMany(r => r.ReplaceableTypes)
|
||||||
.ToHashSet();
|
.ToHashSet();
|
||||||
|
|
||||||
if (replaceableTypes.Any())
|
if (replaceableTypes.Count > 0)
|
||||||
foreach (var t in buildingInfo.Tiles(targetLocation))
|
foreach (var t in buildingInfo.Tiles(targetLocation))
|
||||||
foreach (var a in self.World.ActorMap.GetActorsAt(t))
|
foreach (var a in self.World.ActorMap.GetActorsAt(t))
|
||||||
if (a.TraitsImplementing<Replaceable>().Any(r => !r.IsTraitDisabled && r.Info.Types.Overlaps(replaceableTypes)))
|
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)
|
.SelectMany(r => r.ReplaceableTypes)
|
||||||
.ToHashSet();
|
.ToHashSet();
|
||||||
|
|
||||||
if (replaceableSegments.Any())
|
if (replaceableSegments.Count > 0)
|
||||||
foreach (var a in self.World.ActorMap.GetActorsAt(t.Cell))
|
foreach (var a in self.World.ActorMap.GetActorsAt(t.Cell))
|
||||||
if (a.TraitsImplementing<Replaceable>().Any(r => !r.IsTraitDisabled && r.Info.Types.Overlaps(replaceableSegments)))
|
if (a.TraitsImplementing<Replaceable>().Any(r => !r.IsTraitDisabled && r.Info.Types.Overlaps(replaceableSegments)))
|
||||||
self.World.Remove(a);
|
self.World.Remove(a);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
var startingCash = SelectableCash.ToDictionary(c => c.ToString(), c => "$" + c.ToString());
|
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,
|
yield return new LobbyOption("startingcash", DefaultCashDropdownLabel, DefaultCashDropdownDescription, DefaultCashDropdownVisible, DefaultCashDropdownDisplayOrder,
|
||||||
startingCash, DefaultCash.ToString(), DefaultCashDropdownLocked);
|
startingCash, DefaultCash.ToString(), DefaultCashDropdownLocked);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
Info = info;
|
Info = info;
|
||||||
|
|
||||||
Faction = init.GetValue<FactionInit, string>(self.Owner.Faction.InternalName);
|
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;
|
Enabled = IsValidFaction;
|
||||||
|
|
||||||
allProducibles = Producible.Where(a => a.Value.Buildable || a.Value.Visible).Select(a => a.Key);
|
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)
|
if (!Info.Sticky)
|
||||||
{
|
{
|
||||||
Faction = self.Owner.Faction.InternalName;
|
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
|
// Regenerate the producibles and tech tree state
|
||||||
@@ -274,7 +274,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public virtual IEnumerable<ActorInfo> AllItems()
|
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>();
|
return Enumerable.Empty<ActorInfo>();
|
||||||
if (developerMode.AllTech)
|
if (developerMode.AllTech)
|
||||||
return Producible.Keys;
|
return Producible.Keys;
|
||||||
@@ -284,7 +284,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public virtual IEnumerable<ActorInfo> BuildableItems()
|
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>();
|
return Enumerable.Empty<ActorInfo>();
|
||||||
if (!Enabled)
|
if (!Enabled)
|
||||||
return Enumerable.Empty<ActorInfo>();
|
return Enumerable.Empty<ActorInfo>();
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
@@ -93,10 +92,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (IsTraitDisabled)
|
if (IsTraitDisabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Info.Factions.Any())
|
if (Info.Factions.Count > 0)
|
||||||
enabled = Info.Factions.Contains(faction);
|
enabled = Info.Factions.Contains(faction);
|
||||||
|
|
||||||
if (Info.RequiresPrerequisites.Any() && enabled)
|
if (Info.RequiresPrerequisites.Length > 0 && enabled)
|
||||||
enabled = techTree.HasPrerequisites(Info.RequiresPrerequisites);
|
enabled = techTree.HasPrerequisites(Info.RequiresPrerequisites);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
IEnumerable<EditorActorOption> IEditorActorOptions.ActorOptions(ActorInfo ai, World world)
|
IEnumerable<EditorActorOption> IEditorActorOptions.ActorOptions(ActorInfo ai, World world)
|
||||||
{
|
{
|
||||||
if (!EditorOptions.Any())
|
if (EditorOptions.Count == 0)
|
||||||
yield break;
|
yield break;
|
||||||
|
|
||||||
// Make sure the no-plug option is always available
|
// 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)
|
public static bool AcceptsOrder(this Actor self, string orderString)
|
||||||
{
|
{
|
||||||
var rejectsOrdersTraits = self.TraitsImplementing<RejectsOrders>().Where(Exts.IsTraitEnabled).ToArray();
|
var rejectsOrdersTraits = self.TraitsImplementing<RejectsOrders>().Where(Exts.IsTraitEnabled).ToArray();
|
||||||
if (!rejectsOrdersTraits.Any())
|
if (rejectsOrdersTraits.Length == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var reject = rejectsOrdersTraits.SelectMany(t => t.Reject);
|
var reject = rejectsOrdersTraits.SelectMany(t => t.Reject);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Mods.Common.Effects;
|
using OpenRA.Mods.Common.Effects;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
@@ -125,7 +124,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
if (++offset >= Info.Offsets.Length)
|
if (++offset >= Info.Offsets.Length)
|
||||||
offset = 0;
|
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;
|
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)
|
public WithAmmoPipsDecoration(Actor self, WithAmmoPipsDecorationInfo info)
|
||||||
: base(self, info)
|
: base(self, info)
|
||||||
{
|
{
|
||||||
if (info.AmmoPools.Any())
|
if (info.AmmoPools.Length > 0)
|
||||||
ammo = self.TraitsImplementing<AmmoPool>()
|
ammo = self.TraitsImplementing<AmmoPool>()
|
||||||
.Where(ap => info.AmmoPools.Contains(ap.Info.Name))
|
.Where(ap => info.AmmoPools.Contains(ap.Info.Name))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|||||||
@@ -106,11 +106,11 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
var bDestroyed = bridgeInfo.BOffset != CVec.Zero && NeighbourIsDestroyed(bridgeInfo.BOffset);
|
var bDestroyed = bridgeInfo.BOffset != CVec.Zero && NeighbourIsDestroyed(bridgeInfo.BOffset);
|
||||||
|
|
||||||
var sequence = DefaultAnimation.CurrentSequence.Name;
|
var sequence = DefaultAnimation.CurrentSequence.Name;
|
||||||
if (aDestroyed && bDestroyed && bridgeInfo.ABDestroyedSequences.Any())
|
if (aDestroyed && bDestroyed && bridgeInfo.ABDestroyedSequences.Length > 0)
|
||||||
sequence = bridgeInfo.ABDestroyedSequences.Random(Game.CosmeticRandom);
|
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);
|
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);
|
sequence = bridgeInfo.BDestroyedSequences.Random(Game.CosmeticRandom);
|
||||||
else
|
else
|
||||||
sequence = bridgeInfo.Sequences.Random(Game.CosmeticRandom);
|
sequence = bridgeInfo.Sequences.Random(Game.CosmeticRandom);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Mods.Common.Graphics;
|
using OpenRA.Mods.Common.Graphics;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
@@ -59,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
|
|
||||||
var rs = self.Trait<RenderSprites>();
|
var rs = self.Trait<RenderSprites>();
|
||||||
var image = rs.GetImage(self);
|
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 = new Animation(self.World, images.Random(Game.CosmeticRandom));
|
||||||
anim.Play(info.IdleSequence);
|
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 bRamp = bridgeInfo.BOffset != CVec.Zero && RampExists(self, bridgeInfo.BOffset);
|
||||||
|
|
||||||
var sequence = DefaultAnimation.CurrentSequence.Name;
|
var sequence = DefaultAnimation.CurrentSequence.Name;
|
||||||
if (aRamp && bRamp && bridgeInfo.ABRampSequences.Any())
|
if (aRamp && bRamp && bridgeInfo.ABRampSequences.Length > 0)
|
||||||
sequence = bridgeInfo.ABRampSequences.Random(Game.CosmeticRandom);
|
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);
|
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);
|
sequence = bridgeInfo.BRampSequences.Random(Game.CosmeticRandom);
|
||||||
|
|
||||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, sequence));
|
DefaultAnimation.PlayRepeating(NormalizeSequence(self, sequence));
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
if (self.World.FogObscures(self))
|
if (self.World.FogObscures(self))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (blinkPattern != null && blinkPattern.Any())
|
if (blinkPattern != null && blinkPattern.Length > 0)
|
||||||
{
|
{
|
||||||
var i = (self.World.WorldTick / Info.BlinkInterval) % blinkPattern.Length;
|
var i = (self.World.WorldTick / Info.BlinkInterval) % blinkPattern.Length;
|
||||||
if (blinkPattern[i] != BlinkState.On)
|
if (blinkPattern[i] != BlinkState.On)
|
||||||
|
|||||||
@@ -77,15 +77,15 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
// Per-actor production
|
// Per-actor production
|
||||||
queues = self.TraitsImplementing<ProductionQueue>()
|
queues = self.TraitsImplementing<ProductionQueue>()
|
||||||
.Where(q => productionInfos.Any(p => p.Produces.Contains(q.Info.Type)))
|
.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();
|
.ToArray();
|
||||||
|
|
||||||
if (!queues.Any())
|
if (queues.Length == 0)
|
||||||
{
|
{
|
||||||
// Player-wide production
|
// Player-wide production
|
||||||
queues = self.Owner.PlayerActor.TraitsImplementing<ProductionQueue>()
|
queues = self.Owner.PlayerActor.TraitsImplementing<ProductionQueue>()
|
||||||
.Where(q => productionInfos.Any(p => p.Produces.Contains(q.Info.Type)))
|
.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();
|
.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits.Sound
|
namespace OpenRA.Mods.Common.Traits.Sound
|
||||||
@@ -43,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
|
|||||||
|
|
||||||
void PlaySound(Actor self)
|
void PlaySound(Actor self)
|
||||||
{
|
{
|
||||||
if (info.Sounds.Any())
|
if (info.Sounds.Length > 0)
|
||||||
Game.Sound.Play(SoundType.World, info.Sounds, self.World, self.CenterPosition);
|
Game.Sound.Play(SoundType.World, info.Sounds, self.World, self.CenterPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.GameRules;
|
using OpenRA.GameRules;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Mods.Common.Effects;
|
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 object Create(ActorInitializer init) { return new NukePower(init.Self, this); }
|
||||||
public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
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.");
|
throw new YamlException("At least one entry in TrailSequences must be defined when TrailImage is defined.");
|
||||||
|
|
||||||
var weaponToLower = (MissileWeapon ?? string.Empty).ToLowerInvariant();
|
var weaponToLower = (MissileWeapon ?? string.Empty).ToLowerInvariant();
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
Powers.Add(key, t.CreateInstance(key, this));
|
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.Add(key, t.Info.Prerequisites, 0, this);
|
||||||
TechTree.Update();
|
TechTree.Update();
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (IsTraitDisabled)
|
if (IsTraitDisabled)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!cloaks.Any() || (!viewer.IsDead && viewer.Info.HasTraitInfo<IgnoresCloakInfo>()))
|
if (cloaks.Length == 0 || (!viewer.IsDead && viewer.Info.HasTraitInfo<IgnoresCloakInfo>()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return cloaks.All(c => c.IsTraitDisabled || c.IsVisible(self, viewer.Owner));
|
return cloaks.All(c => c.IsTraitDisabled || c.IsVisible(self, viewer.Owner));
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (projectile != null)
|
if (projectile != null)
|
||||||
self.World.Add(projectile);
|
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);
|
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)
|
Actor GetRandomSpawnPoint(World world, Support.MersenneTwister random)
|
||||||
{
|
{
|
||||||
var spawnPointActors = world.ActorsWithTrait<ActorSpawner>()
|
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();
|
.ToArray();
|
||||||
|
|
||||||
return spawnPointActors.Any() ? spawnPointActors.Random(random).Actor : null;
|
return spawnPointActors.Length > 0 ? spawnPointActors.Random(random).Actor : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DecreaseActorCount()
|
public void DecreaseActorCount()
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var terrainLinear = terrainColors.Select(c => c.ToLinear()).ToList();
|
var terrainLinear = terrainColors.Select(c => c.ToLinear()).ToList();
|
||||||
var playerLinear = playerColors.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))
|
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++)
|
for (var i = 0; i < controlGroups.Length; i++)
|
||||||
{
|
{
|
||||||
var cg = controlGroups[i];
|
var cg = controlGroups[i];
|
||||||
if (cg.Any())
|
if (cg.Count > 0)
|
||||||
{
|
{
|
||||||
var actorIds = cg.Select(a => a.ActorID).ToArray();
|
var actorIds = cg.Select(a => a.ActorID).ToArray();
|
||||||
groups.Add(new MiniYamlNode(i.ToString(), FieldSaver.FormatValue(actorIds)));
|
groups.Add(new MiniYamlNode(i.ToString(), FieldSaver.FormatValue(actorIds)));
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
Team = client.Team,
|
Team = client.Team,
|
||||||
Handicap = client.Handicap,
|
Handicap = client.Handicap,
|
||||||
SpawnPoint = resolvedSpawnPoint,
|
SpawnPoint = resolvedSpawnPoint,
|
||||||
IsRandomFaction = clientFaction.RandomFactionMembers.Any(),
|
IsRandomFaction = clientFaction.RandomFactionMembers.Count > 0,
|
||||||
IsRandomSpawnPoint = client.SpawnPoint == 0,
|
IsRandomSpawnPoint = client.SpawnPoint == 0,
|
||||||
Fingerprint = client.Fingerprint,
|
Fingerprint = client.Fingerprint,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var toProcess = new Stack<ushort>();
|
var toProcess = new Stack<ushort>();
|
||||||
toProcess.Push(d1);
|
toProcess.Push(d1);
|
||||||
|
|
||||||
while (toProcess.Any())
|
while (toProcess.Count > 0)
|
||||||
{
|
{
|
||||||
var current = toProcess.Pop();
|
var current = toProcess.Pop();
|
||||||
if (!transientConnections.ContainsKey(current))
|
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
|
// Fallback to the actor's CenterPosition for the ActorMap if it has no Footprint
|
||||||
var footprint = preview.Footprint.Select(kv => kv.Key).ToArray();
|
var footprint = preview.Footprint.Select(kv => kv.Key).ToArray();
|
||||||
if (!footprint.Any())
|
if (footprint.Length == 0)
|
||||||
footprint = new[] { worldRenderer.World.Map.CellContaining(preview.CenterPosition) };
|
footprint = new[] { worldRenderer.World.Map.CellContaining(preview.CenterPosition) };
|
||||||
|
|
||||||
foreach (var cell in footprint)
|
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
|
// Fallback to the actor's CenterPosition for the ActorMap if it has no Footprint
|
||||||
var footprint = preview.Footprint.Select(kv => kv.Key).ToArray();
|
var footprint = preview.Footprint.Select(kv => kv.Key).ToArray();
|
||||||
if (!footprint.Any())
|
if (footprint.Length == 0)
|
||||||
footprint = new[] { worldRenderer.World.Map.CellContaining(preview.CenterPosition) };
|
footprint = new[] { worldRenderer.World.Map.CellContaining(preview.CenterPosition) };
|
||||||
|
|
||||||
foreach (var cell in footprint)
|
foreach (var cell in footprint)
|
||||||
@@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
list.Remove(preview);
|
list.Remove(preview);
|
||||||
|
|
||||||
if (!list.Any())
|
if (list.Count == 0)
|
||||||
cellMap.Remove(cell);
|
cellMap.Remove(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
var map = worldRenderer.World.Map;
|
var map = worldRenderer.World.Map;
|
||||||
var previews = PreviewsAt(cell).ToList();
|
var previews = PreviewsAt(cell).ToList();
|
||||||
if (!previews.Any())
|
if (previews.Count == 0)
|
||||||
return map.Grid.DefaultSubCell;
|
return map.Grid.DefaultSubCell;
|
||||||
|
|
||||||
for (var i = (byte)SubCell.First; i < map.Grid.SubCellOffsets.Length; i++)
|
for (var i = (byte)SubCell.First; i < map.Grid.SubCellOffsets.Length; i++)
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Mods.Common.Pathfinder;
|
using OpenRA.Mods.Common.Pathfinder;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
@@ -79,7 +78,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
var terrainType = map.GetTerrainInfo(cell).Type;
|
var terrainType = map.GetTerrainInfo(cell).Type;
|
||||||
var jli = (JumpjetLocomotorInfo)li;
|
var jli = (JumpjetLocomotorInfo)li;
|
||||||
if (!jli.JumpjetTransitionTerrainTypes.Contains(terrainType) && jli.JumpjetTransitionTerrainTypes.Any())
|
if (!jli.JumpjetTransitionTerrainTypes.Contains(terrainType) && jli.JumpjetTransitionTerrainTypes.Count > 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (jli.JumpjetTransitionOnRamps)
|
if (jli.JumpjetTransitionOnRamps)
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var techLevels = map.PlayerActorInfo.TraitInfos<ProvidesTechPrerequisiteInfo>()
|
var techLevels = map.PlayerActorInfo.TraitInfos<ProvidesTechPrerequisiteInfo>()
|
||||||
.ToDictionary(t => t.Id, t => t.Name);
|
.ToDictionary(t => t.Id, t => t.Name);
|
||||||
|
|
||||||
if (techLevels.Any())
|
if (techLevels.Count > 0)
|
||||||
yield return new LobbyOption("techlevel", TechLevelDropdownLabel, TechLevelDropdownDescription, TechLevelDropdownVisible, TechLevelDropdownDisplayOrder,
|
yield return new LobbyOption("techlevel", TechLevelDropdownLabel, TechLevelDropdownDescription, TechLevelDropdownVisible, TechLevelDropdownDisplayOrder,
|
||||||
techLevels, TechLevel, TechLevelDropdownLocked);
|
techLevels, TechLevel, TechLevelDropdownLocked);
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
random = playlist.Shuffle(Game.CosmeticRandom).ToArray();
|
random = playlist.Shuffle(Game.CosmeticRandom).ToArray();
|
||||||
IsMusicAvailable = playlist.Any();
|
IsMusicAvailable = playlist.Length > 0;
|
||||||
AllowMuteBackgroundMusic = info.AllowMuteBackgroundMusic;
|
AllowMuteBackgroundMusic = info.AllowMuteBackgroundMusic;
|
||||||
|
|
||||||
if (SongExists(info.BackgroundMusic))
|
if (SongExists(info.BackgroundMusic))
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
Info = info;
|
Info = info;
|
||||||
world = self.World;
|
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 sequenceProvider = world.Map.Rules.Sequences;
|
||||||
var types = sequenceProvider.Sequences(Info.Sequence);
|
var types = sequenceProvider.Sequences(Info.Sequence);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
foreach (var t in map.WorldActorInfo.TraitInfos<StartingUnitsInfo>())
|
foreach (var t in map.WorldActorInfo.TraitInfos<StartingUnitsInfo>())
|
||||||
startingUnits[t.Class] = t.ClassName;
|
startingUnits[t.Class] = t.ClassName;
|
||||||
|
|
||||||
if (startingUnits.Any())
|
if (startingUnits.Count > 0)
|
||||||
yield return new LobbyOption("startingunits", DropdownLabel, DropdownDescription, DropdownVisible, DropdownDisplayOrder,
|
yield return new LobbyOption("startingunits", DropdownLabel, DropdownDescription, DropdownVisible, DropdownDisplayOrder,
|
||||||
startingUnits, StartingUnitsClass, DropdownLocked);
|
startingUnits, StartingUnitsClass, DropdownLocked);
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!unitGroup.SupportActors.Any())
|
if (unitGroup.SupportActors.Length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var supportSpawnCells = w.Map.FindTilesInAnnulus(p.HomeLocation, unitGroup.InnerSupportRadius + 1, unitGroup.OuterSupportRadius);
|
var supportSpawnCells = w.Map.FindTilesInAnnulus(p.HomeLocation, unitGroup.InnerSupportRadius + 1, unitGroup.OuterSupportRadius);
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Mods.Common.Pathfinder;
|
using OpenRA.Mods.Common.Pathfinder;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
@@ -77,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
bool ValidTransitionCell(CPos cell, SubterraneanLocomotorInfo sli)
|
bool ValidTransitionCell(CPos cell, SubterraneanLocomotorInfo sli)
|
||||||
{
|
{
|
||||||
var terrainType = map.GetTerrainInfo(cell).Type;
|
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;
|
return false;
|
||||||
|
|
||||||
if (sli.SubterraneanTransitionOnRamps)
|
if (sli.SubterraneanTransitionOnRamps)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
|
|
||||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||||
{
|
{
|
||||||
if (locations.Any())
|
if (locations.Count > 0)
|
||||||
yield return "[D2k]ResourceRenderer has been added.\n" +
|
yield return "[D2k]ResourceRenderer has been added.\n" +
|
||||||
"You need to adjust the field RenderTypes on trait [D2k]ResourceRenderer\n" +
|
"You need to adjust the field RenderTypes on trait [D2k]ResourceRenderer\n" +
|
||||||
"on the following actors:\n" +
|
"on the following actors:\n" +
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
|
|
||||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||||
{
|
{
|
||||||
if (weaponsToUpdate.Any())
|
if (weaponsToUpdate.Count > 0)
|
||||||
yield return "Add a ScreenShakeWarhead to the following weapons:\n" +
|
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}"));
|
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)
|
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" +
|
yield return "Region-specific image overrides are no longer supported. The following definitions must be replaced:\n" +
|
||||||
UpdateUtils.FormatMessageList(overrideLocations);
|
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" +
|
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" +
|
"You may wish to define PanelRegion/PanelSides manually to reduce duplication:\n" +
|
||||||
UpdateUtils.FormatMessageList(panelLocations);
|
UpdateUtils.FormatMessageList(panelLocations);
|
||||||
@@ -186,7 +186,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
// Reformat region as a list
|
// Reformat region as a list
|
||||||
regionsNode.AddNode(n.Key, n.NodeValue<int[]>());
|
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})");
|
overrideLocations.Add($"{chromeProviderNode.Key}.{n.Key} ({chromeProviderNode.Location.Filename})");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +199,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
if (!ExtractPanelDefinition(chromeProviderNode, regionsNode))
|
if (!ExtractPanelDefinition(chromeProviderNode, regionsNode))
|
||||||
panelLocations.Add($"{chromeProviderNode.Key} ({chromeProviderNode.Location.Filename})");
|
panelLocations.Add($"{chromeProviderNode.Key} ({chromeProviderNode.Location.Filename})");
|
||||||
|
|
||||||
if (regionsNode.Value.Nodes.Any())
|
if (regionsNode.Value.Nodes.Count > 0)
|
||||||
chromeProviderNode.AddNode(regionsNode);
|
chromeProviderNode.AddNode(regionsNode);
|
||||||
|
|
||||||
yield break;
|
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"
|
+ "You may have to define it manually now in the following places:\n"
|
||||||
+ UpdateUtils.FormatMessageList(missingActorTypes.Select(n => n.Item1 + " (" + n.Item2 + ")"));
|
+ UpdateUtils.FormatMessageList(missingActorTypes.Select(n => n.Item1 + " (" + n.Item2 + ")"));
|
||||||
|
|
||||||
if (missingActorTypes.Any())
|
if (missingActorTypes.Count > 0)
|
||||||
yield return message;
|
yield return message;
|
||||||
|
|
||||||
missingActorTypes.Clear();
|
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"
|
+ "You may have to set it manually now in the following places:\n"
|
||||||
+ UpdateUtils.FormatMessageList(nonVTOLs.Select(n => n.Item1 + " (" + n.Item2 + ")"));
|
+ UpdateUtils.FormatMessageList(nonVTOLs.Select(n => n.Item1 + " (" + n.Item2 + ")"));
|
||||||
|
|
||||||
if (nonVTOLs.Any())
|
if (nonVTOLs.Count > 0)
|
||||||
yield return message;
|
yield return message;
|
||||||
|
|
||||||
nonVTOLs.Clear();
|
nonVTOLs.Clear();
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||||
{
|
{
|
||||||
@@ -27,7 +26,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
|
|
||||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
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" +
|
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" +
|
"You must manually define TakeCover with a negative ProneTime and use\n" +
|
||||||
"GrantConditionOnDamageState/-Health with 'GrantPermanently: true'\n" +
|
"GrantConditionOnDamageState/-Health with 'GrantPermanently: true'\n" +
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||||
{
|
{
|
||||||
@@ -24,7 +23,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
|
|
||||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
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" +
|
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" +
|
"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" +
|
"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)
|
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" +
|
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" +
|
"You should review the following definitions and manually define the Image and Palette properties as required:\n" +
|
||||||
UpdateUtils.FormatMessageList(locations);
|
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" +
|
yield return "Some passenger types define custom cargo pips. Review the following definitions:\n" +
|
||||||
UpdateUtils.FormatMessageList(cargoPipLocations) +
|
UpdateUtils.FormatMessageList(cargoPipLocations) +
|
||||||
"\nand, if required, add the following to the WithCargoPipsDecoration traits:\n" +
|
"\nand, if required, add the following to the WithCargoPipsDecoration traits:\n" +
|
||||||
"CustomPipSequences:\n" + cargoCustomPips.Select(p => $"\t{p}: {PipReplacements[p]}").JoinWith("\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" +
|
yield return "Review the following definitions:\n" +
|
||||||
UpdateUtils.FormatMessageList(harvesterPipLocations) +
|
UpdateUtils.FormatMessageList(harvesterPipLocations) +
|
||||||
"\nand, if required, add the following to the WithHarvesterPipsDecoration traits:\n" +
|
"\nand, if required, add the following to the WithHarvesterPipsDecoration traits:\n" +
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||||
{
|
{
|
||||||
@@ -87,7 +86,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
|
|
||||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
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" +
|
yield return "Please check and adjust the new auto-generated dimensions.\n" +
|
||||||
UpdateUtils.FormatMessageList(locations);
|
UpdateUtils.FormatMessageList(locations);
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
|
|
||||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||||
{
|
{
|
||||||
if (weaponsToUpdate.Any())
|
if (weaponsToUpdate.Count > 0)
|
||||||
yield return "Add a FlashPaletteEffectWarhead to the following weapons:\n" +
|
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}"));
|
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)
|
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" +
|
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" +
|
"Review the following definitions and define Margin properties as required:\n" +
|
||||||
UpdateUtils.FormatMessageList(locations.Select(
|
UpdateUtils.FormatMessageList(locations.Select(
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user