diff --git a/.editorconfig b/.editorconfig index c77c2564fa..09e538b6bd 100644 --- a/.editorconfig +++ b/.editorconfig @@ -982,7 +982,7 @@ dotnet_analyzer_diagnostic.category-roslynator.severity = none # A line is too long. dotnet_diagnostic.RCS0056.severity = warning -roslynator_max_line_length = 180 #140 +roslynator_max_line_length = 160 #140 #roslynator_tab_length = 4 # Remove redundant 'sealed' modifier. diff --git a/OpenRA.Game/CVec.cs b/OpenRA.Game/CVec.cs index 343e14595c..c1676fa413 100644 --- a/OpenRA.Game/CVec.cs +++ b/OpenRA.Game/CVec.cs @@ -17,7 +17,8 @@ using OpenRA.Scripting; namespace OpenRA { - public readonly struct CVec : IScriptBindable, ILuaAdditionBinding, ILuaSubtractionBinding, ILuaUnaryMinusBinding, ILuaEqualityBinding, ILuaTableBinding, IEquatable + public readonly struct CVec : IScriptBindable, + ILuaAdditionBinding, ILuaSubtractionBinding, ILuaUnaryMinusBinding, ILuaEqualityBinding, ILuaTableBinding, IEquatable { public readonly int X, Y; diff --git a/OpenRA.Game/FileSystem/FileSystem.cs b/OpenRA.Game/FileSystem/FileSystem.cs index c6b7f9260c..0b17496d69 100644 --- a/OpenRA.Game/FileSystem/FileSystem.cs +++ b/OpenRA.Game/FileSystem/FileSystem.cs @@ -324,7 +324,8 @@ namespace OpenRA.FileSystem if (name == ".") continue; - resolved = Directory.GetFileSystemEntries(resolved).FirstOrDefault(e => e.Equals(Path.Combine(resolved, name), StringComparison.InvariantCultureIgnoreCase)); + resolved = Directory.GetFileSystemEntries(resolved) + .FirstOrDefault(e => e.Equals(Path.Combine(resolved, name), StringComparison.InvariantCultureIgnoreCase)); if (resolved == null) return null; diff --git a/OpenRA.Game/Graphics/ChromeProvider.cs b/OpenRA.Game/Graphics/ChromeProvider.cs index 165bc16b22..49e6f95c93 100644 --- a/OpenRA.Game/Graphics/ChromeProvider.cs +++ b/OpenRA.Game/Graphics/ChromeProvider.cs @@ -228,7 +228,11 @@ namespace OpenRA.Graphics (PanelSides.Bottom | PanelSides.Right, new Rectangle(pr[0] + pr[2] + pr[4], pr[1] + pr[3] + pr[5], pr[6], pr[7])) }; - sprites = sides.Select(x => ps.HasSide(x.PanelSides) ? new Sprite(sheetDensity.Sheet, sheetDensity.Density * x.Bounds, TextureChannel.RGBA, 1f / sheetDensity.Density) : null) + sprites = sides + .Select(x => + ps.HasSide(x.PanelSides) + ? new Sprite(sheetDensity.Sheet, sheetDensity.Density * x.Bounds, TextureChannel.RGBA, 1f / sheetDensity.Density) + : null) .ToArray(); } else diff --git a/OpenRA.Game/Graphics/PlatformInterfaces.cs b/OpenRA.Game/Graphics/PlatformInterfaces.cs index f11fa66fe6..f9aa7c5f89 100644 --- a/OpenRA.Game/Graphics/PlatformInterfaces.cs +++ b/OpenRA.Game/Graphics/PlatformInterfaces.cs @@ -25,7 +25,8 @@ namespace OpenRA public interface IPlatform { - IPlatformWindow CreateWindow(Size size, WindowMode windowMode, float scaleModifier, int vertexBatchSize, int indexBatchSize, int videoDisplay, GLProfile profile); + IPlatformWindow CreateWindow( + Size size, WindowMode windowMode, float scaleModifier, int vertexBatchSize, int indexBatchSize, int videoDisplay, GLProfile profile); ISoundEngine CreateSound(string device); IFont CreateFont(byte[] data); } diff --git a/OpenRA.Game/Graphics/SheetBuilder.cs b/OpenRA.Game/Graphics/SheetBuilder.cs index f1389aefb8..78dfb5f8e4 100644 --- a/OpenRA.Game/Graphics/SheetBuilder.cs +++ b/OpenRA.Game/Graphics/SheetBuilder.cs @@ -142,7 +142,9 @@ namespace OpenRA.Graphics p = int2.Zero; } - var rect = new Sprite(Current, new Rectangle(p.X + margin, p.Y + margin, imageSize.Width, imageSize.Height), zRamp, spriteOffset, CurrentChannel, BlendMode.Alpha, scale); + var rect = new Sprite( + Current, new Rectangle(p.X + margin, p.Y + margin, imageSize.Width, imageSize.Height), + zRamp, spriteOffset, CurrentChannel, BlendMode.Alpha, scale); p += new int2(imageSize.Width + margin, 0); return rect; diff --git a/OpenRA.Game/Graphics/SpriteCache.cs b/OpenRA.Game/Graphics/SpriteCache.cs index f50858820f..13d1677c3a 100644 --- a/OpenRA.Game/Graphics/SpriteCache.cs +++ b/OpenRA.Game/Graphics/SpriteCache.cs @@ -24,7 +24,9 @@ namespace OpenRA.Graphics readonly ISpriteLoader[] loaders; readonly IReadOnlyFileSystem fileSystem; - readonly Dictionary AdjustFrame, bool Premultiplied)> spriteReservations = new(); + readonly Dictionary< + int, + (int[] Frames, MiniYamlNode.SourceLocation Location, Func AdjustFrame, bool Premultiplied)> spriteReservations = new(); readonly Dictionary> reservationsByFilename = new(); readonly Dictionary resolvedSprites = new(); @@ -33,7 +35,8 @@ namespace OpenRA.Graphics int nextReservationToken = 1; - public SpriteCache(IReadOnlyFileSystem fileSystem, ISpriteLoader[] loaders, int bgraSheetSize, int indexedSheetSize, int bgraSheetMargin = 1, int indexedSheetMargin = 1) + public SpriteCache( + IReadOnlyFileSystem fileSystem, ISpriteLoader[] loaders, int bgraSheetSize, int indexedSheetSize, int bgraSheetMargin = 1, int indexedSheetMargin = 1) { SheetBuilders = new Dictionary { diff --git a/OpenRA.Game/Graphics/UISpriteRenderable.cs b/OpenRA.Game/Graphics/UISpriteRenderable.cs index e9faf42028..9df9f7be83 100644 --- a/OpenRA.Game/Graphics/UISpriteRenderable.cs +++ b/OpenRA.Game/Graphics/UISpriteRenderable.cs @@ -21,7 +21,8 @@ namespace OpenRA.Graphics readonly float alpha; readonly float rotation = 0f; - public UISpriteRenderable(Sprite sprite, WPos effectiveWorldPos, int2 screenPos, int zOffset, PaletteReference palette, float scale = 1f, float alpha = 1f, float rotation = 0f) + public UISpriteRenderable(Sprite sprite, WPos effectiveWorldPos, int2 screenPos, int zOffset, PaletteReference palette, + float scale = 1f, float alpha = 1f, float rotation = 0f) { this.sprite = sprite; Pos = effectiveWorldPos; @@ -47,7 +48,8 @@ namespace OpenRA.Graphics public PaletteReference Palette { get; } public int ZOffset { get; } - public IPalettedRenderable WithPalette(PaletteReference newPalette) { return new UISpriteRenderable(sprite, Pos, screenPos, ZOffset, newPalette, scale, alpha, rotation); } + public IPalettedRenderable WithPalette(PaletteReference newPalette) => + new UISpriteRenderable(sprite, Pos, screenPos, ZOffset, newPalette, scale, alpha, rotation); public IRenderable WithZOffset(int newOffset) { return this; } public IRenderable OffsetBy(in WVec vec) { return this; } public IRenderable AsDecoration() { return this; } diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs index 7d57c384ed..74c5f48990 100644 --- a/OpenRA.Game/Graphics/Viewport.cs +++ b/OpenRA.Game/Graphics/Viewport.cs @@ -215,7 +215,9 @@ namespace OpenRA.Graphics MinZoom = CalculateMinimumZoom(range.X, range.Y) * viewportSizes.DefaultScale; } - MaxZoom = Math.Min(MinZoom * viewportSizes.MaxZoomScale, Game.Renderer.NativeResolution.Height * viewportSizes.DefaultScale / viewportSizes.MaxZoomWindowHeight); + MaxZoom = Math.Min( + MinZoom * viewportSizes.MaxZoomScale, + Game.Renderer.NativeResolution.Height * viewportSizes.DefaultScale / viewportSizes.MaxZoomWindowHeight); if (unlockMinZoom) { diff --git a/OpenRA.Game/Map/MapCache.cs b/OpenRA.Game/Map/MapCache.cs index a053ae2c32..451b5c7630 100644 --- a/OpenRA.Game/Map/MapCache.cs +++ b/OpenRA.Game/Map/MapCache.cs @@ -140,7 +140,8 @@ namespace OpenRA LoadMapInternal(map, package, classification, mapGrid, oldMap, null); } - void LoadMapInternal(string map, IReadOnlyPackage package, MapClassification classification, MapGrid mapGrid, string oldMap, IEnumerable> modDataRules) + void LoadMapInternal(string map, IReadOnlyPackage package, MapClassification classification, MapGrid mapGrid, string oldMap, + IEnumerable> modDataRules) { IReadOnlyPackage mapPackage = null; try @@ -226,7 +227,8 @@ namespace OpenRA yield return mapPackage; } - public void QueryRemoteMapDetails(string repositoryUrl, IEnumerable uids, Action mapDetailsReceived = null, Action mapQueryFailed = null) + public void QueryRemoteMapDetails(string repositoryUrl, IEnumerable uids, + Action mapDetailsReceived = null, Action mapQueryFailed = null) { var queryUids = uids.Distinct() .Where(uid => uid != null) diff --git a/OpenRA.Game/Map/MapPreview.cs b/OpenRA.Game/Map/MapPreview.cs index 5c39051340..8251f34560 100644 --- a/OpenRA.Game/Map/MapPreview.cs +++ b/OpenRA.Game/Map/MapPreview.cs @@ -148,8 +148,14 @@ namespace OpenRA sources = sources.Append(RuleDefinitions.Nodes.Where(IsLoadableRuleDefinition).ToList()); var yamlNodes = MiniYaml.Merge(sources); - WorldActorInfo = new ActorInfo(modData.ObjectCreator, "world", yamlNodes.First(n => string.Equals(n.Key, "world", StringComparison.InvariantCultureIgnoreCase)).Value); - PlayerActorInfo = new ActorInfo(modData.ObjectCreator, "player", yamlNodes.First(n => string.Equals(n.Key, "player", StringComparison.InvariantCultureIgnoreCase)).Value); + WorldActorInfo = new ActorInfo( + modData.ObjectCreator, + "world", + yamlNodes.First(n => string.Equals(n.Key, "world", StringComparison.InvariantCultureIgnoreCase)).Value); + PlayerActorInfo = new ActorInfo( + modData.ObjectCreator, + "player", + yamlNodes.First(n => string.Equals(n.Key, "player", StringComparison.InvariantCultureIgnoreCase)).Value); return; } } diff --git a/OpenRA.Game/MiniYaml.cs b/OpenRA.Game/MiniYaml.cs index 74f96f3f5f..63613fef36 100644 --- a/OpenRA.Game/MiniYaml.cs +++ b/OpenRA.Game/MiniYaml.cs @@ -444,7 +444,8 @@ namespace OpenRA existingNodes.Add(overrideNode.WithValue(value)); } - static List ResolveInherits(MiniYaml node, Dictionary tree, ImmutableDictionary inherited) + static List ResolveInherits( + MiniYaml node, Dictionary tree, ImmutableDictionary inherited) { var resolved = new List(node.Nodes.Length); var resolvedKeys = new HashSet(node.Nodes.Length); diff --git a/OpenRA.Game/Network/Order.cs b/OpenRA.Game/Network/Order.cs index 63d41e6d75..399fa515cd 100644 --- a/OpenRA.Game/Network/Order.cs +++ b/OpenRA.Game/Network/Order.cs @@ -271,7 +271,15 @@ namespace OpenRA public static Order FromGroupedOrder(Order grouped, Actor subject) { - return new Order(grouped.OrderString, subject, grouped.Target, grouped.TargetString, grouped.Queued, grouped.ExtraActors, grouped.ExtraLocation, grouped.ExtraData); + return new Order( + grouped.OrderString, + subject, + grouped.Target, + grouped.TargetString, + grouped.Queued, + grouped.ExtraActors, + grouped.ExtraLocation, + grouped.ExtraData); } public static Order Command(string text) diff --git a/OpenRA.Game/Platform.cs b/OpenRA.Game/Platform.cs index d8e7c78622..bb0c3248ac 100644 --- a/OpenRA.Game/Platform.cs +++ b/OpenRA.Game/Platform.cs @@ -203,7 +203,8 @@ namespace OpenRA default: { - modernUserSupportPath = legacyUserSupportPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), ".openra") + Path.DirectorySeparatorChar; + modernUserSupportPath = legacyUserSupportPath = + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), ".openra") + Path.DirectorySeparatorChar; systemSupportPath = "/var/games/openra/"; break; } diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index ee6e576170..7336c7dc6f 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -97,7 +97,8 @@ namespace OpenRA } } - public static FactionInfo ResolveFaction(string factionName, IEnumerable factionInfos, MersenneTwister playerRandom, bool requireSelectable = true) + public static FactionInfo ResolveFaction( + string factionName, IEnumerable factionInfos, MersenneTwister playerRandom, bool requireSelectable = true) { var selectableFactions = factionInfos .Where(f => !requireSelectable || f.Selectable) diff --git a/OpenRA.Game/Primitives/Polygon.cs b/OpenRA.Game/Primitives/Polygon.cs index 9a370c1994..be4cdec2c6 100644 --- a/OpenRA.Game/Primitives/Polygon.cs +++ b/OpenRA.Game/Primitives/Polygon.cs @@ -66,7 +66,9 @@ namespace OpenRA.Primitives public bool IntersectsWith(Rectangle rect) { - var intersectsBoundingRect = BoundingRect.Left < rect.Right && BoundingRect.Right > rect.Left && BoundingRect.Top < rect.Bottom && BoundingRect.Bottom > rect.Top; + var intersectsBoundingRect = + BoundingRect.Left < rect.Right && BoundingRect.Right > rect.Left && + BoundingRect.Top < rect.Bottom && BoundingRect.Bottom > rect.Top; if (isRectangle) return intersectsBoundingRect; @@ -75,11 +77,13 @@ namespace OpenRA.Primitives return false; // Easy case 2: Rect and bounding box intersect in a cross shape - if ((rect.Left <= BoundingRect.Left && rect.Right >= BoundingRect.Right) || (rect.Top <= BoundingRect.Top && rect.Bottom >= BoundingRect.Bottom)) + if ((rect.Left <= BoundingRect.Left && rect.Right >= BoundingRect.Right) || + (rect.Top <= BoundingRect.Top && rect.Bottom >= BoundingRect.Bottom)) return true; // Easy case 3: Corner of rect is inside the polygon - if (Vertices.PolygonContains(rect.TopLeft) || Vertices.PolygonContains(rect.TopRight) || Vertices.PolygonContains(rect.BottomLeft) || Vertices.PolygonContains(rect.BottomRight)) + if (Vertices.PolygonContains(rect.TopLeft) || Vertices.PolygonContains(rect.TopRight) || + Vertices.PolygonContains(rect.BottomLeft) || Vertices.PolygonContains(rect.BottomRight)) return true; // Easy case 4: Polygon vertex is inside rect diff --git a/OpenRA.Game/Renderer.cs b/OpenRA.Game/Renderer.cs index c16351a857..73b5863bc8 100644 --- a/OpenRA.Game/Renderer.cs +++ b/OpenRA.Game/Renderer.cs @@ -289,7 +289,10 @@ namespace OpenRA screenBuffer.Bind(); var scale = Window.EffectiveWindowScale; - var bufferScale = new float3((int)(screenSprite.Bounds.Width / scale) / worldSprite.Size.X, (int)(-screenSprite.Bounds.Height / scale) / worldSprite.Size.Y, 1f); + var bufferScale = new float3( + (int)(screenSprite.Bounds.Width / scale) / worldSprite.Size.X, + (int)(-screenSprite.Bounds.Height / scale) / worldSprite.Size.Y, + 1f); SpriteRenderer.SetAntialiasingPixelsPerTexel(Window.SurfaceSize.Height * 1f / worldSprite.Bounds.Height); RgbaSpriteRenderer.DrawSprite(worldSprite, float3.Zero, bufferScale); diff --git a/OpenRA.Game/Scripting/ScriptPlayerInterface.cs b/OpenRA.Game/Scripting/ScriptPlayerInterface.cs index 489e82ad3f..305a29c7c2 100644 --- a/OpenRA.Game/Scripting/ScriptPlayerInterface.cs +++ b/OpenRA.Game/Scripting/ScriptPlayerInterface.cs @@ -15,8 +15,10 @@ namespace OpenRA.Scripting { readonly Player player; - protected override string DuplicateKeyError(string memberName) { return $"Player '{player.PlayerName}' defines the command '{memberName}' on multiple traits"; } - protected override string MemberNotFoundError(string memberName) { return $"Player '{player.PlayerName}' does not define a property '{memberName}'"; } + protected override string DuplicateKeyError(string memberName) => + $"Player '{player.PlayerName}' defines the command '{memberName}' on multiple traits"; + protected override string MemberNotFoundError(string memberName) => + $"Player '{player.PlayerName}' does not define a property '{memberName}'"; public ScriptPlayerInterface(ScriptContext context, Player player) : base(context) diff --git a/OpenRA.Game/Support/VariableExpression.cs b/OpenRA.Game/Support/VariableExpression.cs index 0e5d335f83..74bba59da1 100644 --- a/OpenRA.Game/Support/VariableExpression.cs +++ b/OpenRA.Game/Support/VariableExpression.cs @@ -629,8 +629,8 @@ namespace OpenRA.Support if (lastToken.RightOperand == token.LeftOperand) { if (lastToken.RightOperand) - throw new InvalidDataException( - $"Missing value or sub-expression or there is an extra operator `{lastToken.Symbol}` at index {lastToken.Index} or `{token.Symbol}` at index {token.Index}"); + throw new InvalidDataException("Missing value or sub-expression or there is an extra operator " + + $"`{lastToken.Symbol}` at index {lastToken.Index} or `{token.Symbol}` at index {token.Index}"); throw new InvalidDataException($"Missing binary operation before `{token.Symbol}` at index {token.Index}"); } } @@ -937,7 +937,9 @@ namespace OpenRA.Support } default: - throw new InvalidProgramException($"ConditionExpression.Compiler.Compile() is missing an expression builder for TokenType.{Enum.GetValues()[(int)t.Type]}"); + throw new InvalidProgramException( + "ConditionExpression.Compiler.Compile() is missing an expression builder for " + + $"TokenType.{Enum.GetValues()[(int)t.Type]}"); } } diff --git a/OpenRA.Game/WAngle.cs b/OpenRA.Game/WAngle.cs index f2ca6ccbd7..7b97e21018 100644 --- a/OpenRA.Game/WAngle.cs +++ b/OpenRA.Game/WAngle.cs @@ -222,23 +222,31 @@ namespace OpenRA public LuaValue Add(LuaRuntime runtime, LuaValue left, LuaValue right) { if (!left.TryGetClrValue(out WAngle a)) - throw new LuaException($"Attempted to call WAngle.Add(WAngle, WAngle) with invalid arguments ({left.WrappedClrType().Name}, {right.WrappedClrType().Name})"); + throw new LuaException( + "Attempted to call WAngle.Add(WAngle, WAngle) with invalid arguments " + + $"({left.WrappedClrType().Name}, {right.WrappedClrType().Name})"); if (right.TryGetClrValue(out WAngle b)) return new LuaCustomClrObject(a + b); - throw new LuaException($"Attempted to call WAngle.Add(WAngle, WAngle) with invalid arguments ({left.WrappedClrType().Name}, {right.WrappedClrType().Name})"); + throw new LuaException( + "Attempted to call WAngle.Add(WAngle, WAngle) with invalid arguments " + + $"({left.WrappedClrType().Name}, {right.WrappedClrType().Name})"); } public LuaValue Subtract(LuaRuntime runtime, LuaValue left, LuaValue right) { if (!left.TryGetClrValue(out WAngle a)) - throw new LuaException($"Attempted to call WAngle.Subtract(WAngle, WAngle) with invalid arguments ({left.WrappedClrType().Name}, {right.WrappedClrType().Name})"); + throw new LuaException( + "Attempted to call WAngle.Subtract(WAngle, WAngle) with invalid arguments " + + $"({left.WrappedClrType().Name}, {right.WrappedClrType().Name})"); if (right.TryGetClrValue(out WAngle b)) return new LuaCustomClrObject(a - b); - throw new LuaException($"Attempted to call WAngle.Subtract(WAngle, WAngle) with invalid arguments ({left.WrappedClrType().Name}, {right.WrappedClrType().Name})"); + throw new LuaException( + "Attempted to call WAngle.Subtract(WAngle, WAngle) with invalid arguments " + + $"({left.WrappedClrType().Name}, {right.WrappedClrType().Name})"); } public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right) diff --git a/OpenRA.Game/WVec.cs b/OpenRA.Game/WVec.cs index ab9de7152d..b403d9d5f7 100644 --- a/OpenRA.Game/WVec.cs +++ b/OpenRA.Game/WVec.cs @@ -17,7 +17,8 @@ using OpenRA.Support; namespace OpenRA { - public readonly struct WVec : IScriptBindable, ILuaAdditionBinding, ILuaSubtractionBinding, ILuaUnaryMinusBinding, ILuaEqualityBinding, ILuaTableBinding, IEquatable + public readonly struct WVec : IScriptBindable, + ILuaAdditionBinding, ILuaSubtractionBinding, ILuaUnaryMinusBinding, ILuaEqualityBinding, ILuaTableBinding, IEquatable { public readonly int X, Y, Z; diff --git a/OpenRA.Mods.Cnc/Graphics/ClassicSpriteSequence.cs b/OpenRA.Mods.Cnc/Graphics/ClassicSpriteSequence.cs index 2117a3b777..70e456acdd 100644 --- a/OpenRA.Mods.Cnc/Graphics/ClassicSpriteSequence.cs +++ b/OpenRA.Mods.Cnc/Graphics/ClassicSpriteSequence.cs @@ -20,7 +20,8 @@ namespace OpenRA.Mods.Cnc.Graphics public ClassicSpriteSequenceLoader(ModData modData) : base(modData) { } - public override ISpriteSequence CreateSequence(ModData modData, string tileset, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults) + public override ISpriteSequence CreateSequence( + ModData modData, string tileset, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults) { return new ClassicSpriteSequence(cache, this, image, sequence, data, defaults); } diff --git a/OpenRA.Mods.Cnc/Graphics/ClassicTilesetSpecificSpriteSequence.cs b/OpenRA.Mods.Cnc/Graphics/ClassicTilesetSpecificSpriteSequence.cs index 16340441a5..64b05f143d 100644 --- a/OpenRA.Mods.Cnc/Graphics/ClassicTilesetSpecificSpriteSequence.cs +++ b/OpenRA.Mods.Cnc/Graphics/ClassicTilesetSpecificSpriteSequence.cs @@ -21,7 +21,8 @@ namespace OpenRA.Mods.Cnc.Graphics public ClassicTilesetSpecificSpriteSequenceLoader(ModData modData) : base(modData) { } - public override ISpriteSequence CreateSequence(ModData modData, string tileset, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults) + public override ISpriteSequence CreateSequence( + ModData modData, string tileset, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults) { return new ClassicTilesetSpecificSpriteSequence(cache, this, image, sequence, data, defaults); } diff --git a/OpenRA.Mods.Cnc/Graphics/TeslaZapRenderable.cs b/OpenRA.Mods.Cnc/Graphics/TeslaZapRenderable.cs index 8c53f979ae..1df9d28b55 100644 --- a/OpenRA.Mods.Cnc/Graphics/TeslaZapRenderable.cs +++ b/OpenRA.Mods.Cnc/Graphics/TeslaZapRenderable.cs @@ -41,7 +41,11 @@ namespace OpenRA.Mods.Cnc.Graphics readonly WVec cachedLength; IEnumerable cache; - public TeslaZapRenderable(WPos pos, int zOffset, in WVec length, string image, string brightSequence, int brightZaps, string dimSequence, int dimZaps, string palette) + public TeslaZapRenderable( + WPos pos, int zOffset, in WVec length, string image, + string brightSequence, int brightZaps, + string dimSequence, int dimZaps, + string palette) { Pos = pos; ZOffset = zOffset; @@ -68,8 +72,10 @@ namespace OpenRA.Mods.Cnc.Graphics return new TeslaZapRenderable(Pos, ZOffset, length, image, brightSequence, brightZaps, dimSequence, dimZaps, palette); } - public IRenderable WithZOffset(int newOffset) { return new TeslaZapRenderable(Pos, ZOffset, length, image, brightSequence, brightZaps, dimSequence, dimZaps, palette); } - public IRenderable OffsetBy(in WVec vec) { return new TeslaZapRenderable(Pos + vec, ZOffset, length, image, brightSequence, brightZaps, dimSequence, dimZaps, palette); } + public IRenderable WithZOffset(int newOffset) => + new TeslaZapRenderable(Pos, ZOffset, length, image, brightSequence, brightZaps, dimSequence, dimZaps, palette); + public IRenderable OffsetBy(in WVec vec) => + new TeslaZapRenderable(Pos + vec, ZOffset, length, image, brightSequence, brightZaps, dimSequence, dimZaps, palette); public IRenderable AsDecoration() { return this; } public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; } diff --git a/OpenRA.Mods.Cnc/Installer/ExtractMixSourceAction.cs b/OpenRA.Mods.Cnc/Installer/ExtractMixSourceAction.cs index b8d01cbe7a..4f69d7f7c8 100644 --- a/OpenRA.Mods.Cnc/Installer/ExtractMixSourceAction.cs +++ b/OpenRA.Mods.Cnc/Installer/ExtractMixSourceAction.cs @@ -25,7 +25,9 @@ namespace OpenRA.Mods.Cnc.Installer public void RunActionOnSource(MiniYaml actionYaml, string path, ModData modData, List extracted, Action updateMessage) { // Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected source path - var sourcePath = actionYaml.Value.StartsWith('^') ? Platform.ResolvePath(actionYaml.Value) : FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value)); + var sourcePath = actionYaml.Value.StartsWith('^') + ? Platform.ResolvePath(actionYaml.Value) + : FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value)); using (var source = File.OpenRead(sourcePath)) { diff --git a/OpenRA.Mods.Cnc/Traits/Attack/AttackTesla.cs b/OpenRA.Mods.Cnc/Traits/Attack/AttackTesla.cs index 498a9eb400..260aa41f2e 100644 --- a/OpenRA.Mods.Cnc/Traits/Attack/AttackTesla.cs +++ b/OpenRA.Mods.Cnc/Traits/Attack/AttackTesla.cs @@ -78,7 +78,8 @@ namespace OpenRA.Mods.Cnc.Traits void INotifyAttack.PreparingAttack(Actor self, in Target target, Armament a, Barrel barrel) { } - public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null) + public override Activity GetAttackActivity( + Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null) { return new ChargeAttack(this, newTarget, forceAttack, targetLineColor); } diff --git a/OpenRA.Mods.Cnc/Traits/MadTank.cs b/OpenRA.Mods.Cnc/Traits/MadTank.cs index ea65f6c43c..f6ef6cce9a 100644 --- a/OpenRA.Mods.Cnc/Traits/MadTank.cs +++ b/OpenRA.Mods.Cnc/Traits/MadTank.cs @@ -102,7 +102,9 @@ namespace OpenRA.Mods.Cnc.Traits { get { - yield return new TargetTypeOrderTargeter(new BitSet("DetonateAttack"), "DetonateAttack", 5, info.AttackCursor, true, false) { ForceAttack = false }; + yield return + new TargetTypeOrderTargeter(new BitSet("DetonateAttack"), "DetonateAttack", 5, info.AttackCursor, true, false) + { ForceAttack = false }; if (!initiated) yield return new DeployOrderTargeter("Detonate", 5, () => info.DeployCursor); diff --git a/OpenRA.Mods.Cnc/Traits/Render/WithVoxelBarrel.cs b/OpenRA.Mods.Cnc/Traits/Render/WithVoxelBarrel.cs index cc65439f8b..ff6bc56574 100644 --- a/OpenRA.Mods.Cnc/Traits/Render/WithVoxelBarrel.cs +++ b/OpenRA.Mods.Cnc/Traits/Render/WithVoxelBarrel.cs @@ -19,7 +19,8 @@ using OpenRA.Traits; namespace OpenRA.Mods.Cnc.Traits.Render { - public class WithVoxelBarrelInfo : ConditionalTraitInfo, IRenderActorPreviewVoxelsInfo, Requires, Requires, Requires + public class WithVoxelBarrelInfo : ConditionalTraitInfo, + IRenderActorPreviewVoxelsInfo, Requires, Requires, Requires { [Desc("Voxel sequence name to use")] public readonly string Sequence = "barrel"; diff --git a/OpenRA.Mods.Cnc/Traits/Render/WithVoxelWalkerBody.cs b/OpenRA.Mods.Cnc/Traits/Render/WithVoxelWalkerBody.cs index 4f4f9bf284..d672b56f02 100644 --- a/OpenRA.Mods.Cnc/Traits/Render/WithVoxelWalkerBody.cs +++ b/OpenRA.Mods.Cnc/Traits/Render/WithVoxelWalkerBody.cs @@ -19,7 +19,8 @@ using OpenRA.Traits; namespace OpenRA.Mods.Cnc.Traits.Render { - public class WithVoxelWalkerBodyInfo : PausableConditionalTraitInfo, IRenderActorPreviewVoxelsInfo, Requires, Requires, Requires + public class WithVoxelWalkerBodyInfo : PausableConditionalTraitInfo, + IRenderActorPreviewVoxelsInfo, Requires, Requires, Requires { public readonly string Sequence = "idle"; diff --git a/OpenRA.Mods.Cnc/Traits/SupportPowers/ChronoshiftPower.cs b/OpenRA.Mods.Cnc/Traits/SupportPowers/ChronoshiftPower.cs index 926d6c6d79..ac6e9222eb 100644 --- a/OpenRA.Mods.Cnc/Traits/SupportPowers/ChronoshiftPower.cs +++ b/OpenRA.Mods.Cnc/Traits/SupportPowers/ChronoshiftPower.cs @@ -209,7 +209,8 @@ namespace OpenRA.Mods.Cnc.Traits var tiles = power.CellsMatching(xy, footprint, dimensions); var palette = wr.Palette(((ChronoshiftPowerInfo)power.Info).TargetOverlayPalette); foreach (var t in tiles) - yield return new SpriteRenderable(tile, wr.World.Map.CenterOfCell(t), WVec.Zero, -511, palette, 1f, alpha, float3.Ones, TintModifiers.IgnoreWorldTint, true); + yield return new SpriteRenderable( + tile, wr.World.Map.CenterOfCell(t), WVec.Zero, -511, palette, 1f, alpha, float3.Ones, TintModifiers.IgnoreWorldTint, true); } protected override string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi) @@ -310,7 +311,8 @@ namespace OpenRA.Mods.Cnc.Traits var isValid = manager.Self.Owner.Shroud.IsExplored(t + delta); var tile = isValid ? validTile : invalidTile; var alpha = isValid ? validAlpha : invalidAlpha; - yield return new SpriteRenderable(tile, wr.World.Map.CenterOfCell(t + delta), WVec.Zero, -511, palette, 1f, alpha, float3.Ones, TintModifiers.IgnoreWorldTint, true); + yield return new SpriteRenderable( + tile, wr.World.Map.CenterOfCell(t + delta), WVec.Zero, -511, palette, 1f, alpha, float3.Ones, TintModifiers.IgnoreWorldTint, true); } // Unit previews @@ -323,7 +325,8 @@ namespace OpenRA.Mods.Cnc.Traits unit.Trait().CanChronoshiftTo(unit, targetCell); var tile = canEnter ? validTile : invalidTile; var alpha = canEnter ? validAlpha : invalidAlpha; - yield return new SpriteRenderable(tile, wr.World.Map.CenterOfCell(targetCell), WVec.Zero, -511, palette, 1f, alpha, float3.Ones, TintModifiers.IgnoreWorldTint, true); + yield return new SpriteRenderable( + tile, wr.World.Map.CenterOfCell(targetCell), WVec.Zero, -511, palette, 1f, alpha, float3.Ones, TintModifiers.IgnoreWorldTint, true); } var offset = world.Map.CenterOfCell(xy) - world.Map.CenterOfCell(sourceLocation); @@ -353,7 +356,8 @@ namespace OpenRA.Mods.Cnc.Traits // Source tiles foreach (var t in power.CellsMatching(sourceLocation, footprint, dimensions)) - yield return new SpriteRenderable(sourceTile, wr.World.Map.CenterOfCell(t), WVec.Zero, -511, palette, 1f, sourceAlpha, float3.Ones, TintModifiers.IgnoreWorldTint, true); + yield return new SpriteRenderable( + sourceTile, wr.World.Map.CenterOfCell(t), WVec.Zero, -511, palette, 1f, sourceAlpha, float3.Ones, TintModifiers.IgnoreWorldTint, true); } bool IsValidTarget(CPos xy) diff --git a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs index 4d13a24802..bcf2621e7b 100644 --- a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs +++ b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs @@ -47,7 +47,8 @@ namespace OpenRA.Mods.Cnc.Traits bool IOccupySpaceInfo.SharesCell => false; // Used to determine if actor can spawn - public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All) + public bool CanEnterCell(World world, Actor self, CPos cell, + SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All) { return world.Map.Contains(cell); } diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportGen2MapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportGen2MapCommand.cs index 9c53033b55..ce07d84a65 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/ImportGen2MapCommand.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportGen2MapCommand.cs @@ -447,7 +447,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands } } - protected virtual bool TryHandleOverlayToActorInner(CPos cell, byte[] overlayPack, CellLayer overlayIndex, byte overlayType, out ActorReference actorReference) + protected virtual bool TryHandleOverlayToActorInner( + CPos cell, byte[] overlayPack, CellLayer overlayIndex, byte overlayType, out ActorReference actorReference) { actorReference = null; if (!OverlayToActor.TryGetValue(overlayType, out var actorType)) diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianSunMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianSunMapCommand.cs index 5ad615dd4e..4b74a24d34 100644 --- a/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianSunMapCommand.cs +++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianSunMapCommand.cs @@ -267,7 +267,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands #region Method overrides - protected override bool TryHandleOverlayToActorInner(CPos cell, byte[] overlayPack, CellLayer overlayIndex, byte overlayType, out ActorReference actorReference) + protected override bool TryHandleOverlayToActorInner( + CPos cell, byte[] overlayPack, CellLayer overlayIndex, byte overlayType, out ActorReference actorReference) { actorReference = null; if (!OverlayToActor.TryGetValue(overlayType, out var actorType)) diff --git a/OpenRA.Mods.Common/Activities/Move/Move.cs b/OpenRA.Mods.Common/Activities/Move/Move.cs index d19e461baf..b3e52e92d6 100644 --- a/OpenRA.Mods.Common/Activities/Move/Move.cs +++ b/OpenRA.Mods.Common/Activities/Move/Move.cs @@ -516,9 +516,13 @@ namespace OpenRA.Mods.Common.Activities sealed class MoveFirstHalf : MovePart { - public MoveFirstHalf(Move move, WPos from, WPos to, WAngle fromFacing, WAngle toFacing, + public MoveFirstHalf( + Move move, WPos from, WPos to, WAngle fromFacing, WAngle toFacing, WRot? fromTerrainOrientation, WRot? toTerrainOrientation, int terrainOrientationMargin, int carryoverProgress, bool shouldArc, bool movingOnGroundLayer) - : base(move, from, to, fromFacing, toFacing, fromTerrainOrientation, toTerrainOrientation, terrainOrientationMargin, carryoverProgress, shouldArc, movingOnGroundLayer) { } + : base( + move, from, to, fromFacing, toFacing, + fromTerrainOrientation, toTerrainOrientation, terrainOrientationMargin, carryoverProgress, shouldArc, movingOnGroundLayer) + { } bool IsTurn(Actor self, Mobile mobile, CPos nextCell, Map map) { @@ -599,9 +603,13 @@ namespace OpenRA.Mods.Common.Activities sealed class MoveSecondHalf : MovePart { - public MoveSecondHalf(Move move, WPos from, WPos to, WAngle fromFacing, WAngle toFacing, + public MoveSecondHalf( + Move move, WPos from, WPos to, WAngle fromFacing, WAngle toFacing, WRot? fromTerrainOrientation, WRot? toTerrainOrientation, int terrainOrientationMargin, int carryoverProgress, bool shouldArc, bool movingOnGroundLayer) - : base(move, from, to, fromFacing, toFacing, fromTerrainOrientation, toTerrainOrientation, terrainOrientationMargin, carryoverProgress, shouldArc, movingOnGroundLayer) { } + : base( + move, from, to, fromFacing, toFacing, + fromTerrainOrientation, toTerrainOrientation, terrainOrientationMargin, carryoverProgress, shouldArc, movingOnGroundLayer) + { } protected override MovePart OnComplete(Actor self, Mobile mobile, Move parent) { diff --git a/OpenRA.Mods.Common/FileFormats/WavReader.cs b/OpenRA.Mods.Common/FileFormats/WavReader.cs index b664631fd7..fc3e3c1bdf 100644 --- a/OpenRA.Mods.Common/FileFormats/WavReader.cs +++ b/OpenRA.Mods.Common/FileFormats/WavReader.cs @@ -253,7 +253,14 @@ namespace OpenRA.Mods.Common.FileFormats WriteSample(DecodeNibble((short)((bytecode >> 4) & 0x0F), bpred[0], ref chanIdelta[0], ref s1[0], ref s2[0]), data); // Decode the second nibble, for stereo this will be the right channel - WriteSample(DecodeNibble((short)(bytecode & 0x0F), bpred[channelNumber], ref chanIdelta[channelNumber], ref s1[channelNumber], ref s2[channelNumber]), data); + WriteSample( + DecodeNibble( + (short)(bytecode & 0x0F), + bpred[channelNumber], + ref chanIdelta[channelNumber], + ref s1[channelNumber], + ref s2[channelNumber]), + data); } return ++currentBlock >= numBlocks; diff --git a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs index 6f99ed794a..88ad097f56 100644 --- a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs +++ b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs @@ -36,7 +36,8 @@ namespace OpenRA.Mods.Common.Graphics IndexedSheetSize = FieldLoader.GetValue("IndexedSheetSize", yaml.Value); } - public virtual ISpriteSequence CreateSequence(ModData modData, string tileset, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults) + public virtual ISpriteSequence CreateSequence( + ModData modData, string tileset, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults) { return new DefaultSpriteSequence(cache, this, image, sequence, data, defaults); } @@ -44,7 +45,8 @@ namespace OpenRA.Mods.Common.Graphics int ISpriteSequenceLoader.BgraSheetSize => BgraSheetSize; int ISpriteSequenceLoader.IndexedSheetSize => IndexedSheetSize; - IReadOnlyDictionary ISpriteSequenceLoader.ParseSequences(ModData modData, string tileset, SpriteCache cache, MiniYamlNode imageNode) + IReadOnlyDictionary ISpriteSequenceLoader.ParseSequences( + ModData modData, string tileset, SpriteCache cache, MiniYamlNode imageNode) { var sequences = new Dictionary(); var node = imageNode.Value.NodeWithKeyOrDefault("Defaults"); @@ -135,7 +137,9 @@ namespace OpenRA.Mods.Common.Graphics [Desc("The number of facings that are provided by sprite frames. Use negative values to rotate counter-clockwise.")] protected static readonly SpriteSequenceField Facings = new(nameof(Facings), 1); - [Desc("The total number of facings for the sequence. If >Facings, the closest facing sprite will be rotated to match. Use negative values to rotate counter-clockwise.")] + [Desc("The total number of facings for the sequence. " + + "If >Facings, the closest facing sprite will be rotated to match. " + + "Use negative values to rotate counter-clockwise.")] protected static readonly SpriteSequenceField InterpolatedFacings = new(nameof(InterpolatedFacings), null); [Desc("Time (in milliseconds at default game speed) to wait until playing the next frame in the animation.")] @@ -302,7 +306,8 @@ namespace OpenRA.Mods.Common.Graphics return Rectangle.FromLTRB(left, top, right, bottom); } - protected static List CalculateFrameIndices(int start, int? length, int stride, int facings, int[] frames, bool transpose, bool reverseFacings, int shadowStart) + protected static List CalculateFrameIndices( + int start, int? length, int stride, int facings, int[] frames, bool transpose, bool reverseFacings, int shadowStart) { // Request all frames if (length == null) @@ -411,10 +416,17 @@ namespace OpenRA.Mods.Common.Graphics // Facings must be an integer factor of 1024 (i.e. 1024 / facings is an integer) to allow the frames to be // mapped uniformly over the full rotation range. This implies that it is a power of 2. if (facings == 0 || facings > 1024 || !Exts.IsPowerOf2(facings)) - throw new YamlException($"{facingsLocation}: {Facings.Key} must be within the (positive or negative) range of 1 to 1024, and a power of 2."); + throw new YamlException( + $"{facingsLocation}: {Facings.Key} must be within the (positive or negative) range of 1 to 1024, and a power of 2."); - if (interpolatedFacings != null && (interpolatedFacings < 2 || interpolatedFacings <= facings || interpolatedFacings > 1024 || !Exts.IsPowerOf2(interpolatedFacings.Value))) - throw new YamlException($"{interpolatedFacingsLocation}: {InterpolatedFacings.Key} must be greater than {Facings.Key}, within the range of 2 to 1024, and a power of 2."); + if (interpolatedFacings != null && + (interpolatedFacings < 2 || + interpolatedFacings <= facings || + interpolatedFacings > 1024 || + !Exts.IsPowerOf2(interpolatedFacings.Value))) + throw new YamlException( + $"{interpolatedFacingsLocation}: {InterpolatedFacings.Key} must be greater than {Facings.Key}, " + + "within the range of 2 to 1024, and a power of 2."); if (length != null && length <= 0) throw new YamlException($"{lengthLocation}: {Length.Key} must be positive."); diff --git a/OpenRA.Mods.Common/Graphics/TilesetSpecificSpriteSequence.cs b/OpenRA.Mods.Common/Graphics/TilesetSpecificSpriteSequence.cs index 9395048e72..d975f151f9 100644 --- a/OpenRA.Mods.Common/Graphics/TilesetSpecificSpriteSequence.cs +++ b/OpenRA.Mods.Common/Graphics/TilesetSpecificSpriteSequence.cs @@ -20,7 +20,8 @@ namespace OpenRA.Mods.Common.Graphics public TilesetSpecificSpriteSequenceLoader(ModData modData) : base(modData) { } - public override ISpriteSequence CreateSequence(ModData modData, string tileSet, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults) + public override ISpriteSequence CreateSequence( + ModData modData, string tileSet, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults) { return new TilesetSpecificSpriteSequence(cache, this, image, sequence, data, defaults); } diff --git a/OpenRA.Mods.Common/Installer/SourceActions/CopySourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/CopySourceAction.cs index ff0e4160c0..ff04c424f2 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/CopySourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/CopySourceAction.cs @@ -48,8 +48,8 @@ namespace OpenRA.Mods.Common.Installer InstallFromSourceLogic.CopyingFilename, Translation.Arguments("filename", displayFilename))); else - onProgress = b => updateMessage( - TranslationProvider.GetString(InstallFromSourceLogic.CopyingFilenameProgress, + onProgress = b => updateMessage(TranslationProvider.GetString( + InstallFromSourceLogic.CopyingFilenameProgress, Translation.Arguments("filename", displayFilename, "progress", 100 * b / length))); InstallerUtils.CopyStream(source, target, length, onProgress); diff --git a/OpenRA.Mods.Common/Installer/SourceActions/ExtractBlastSourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/ExtractBlastSourceAction.cs index 9460d672f4..bfcb49b26d 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/ExtractBlastSourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/ExtractBlastSourceAction.cs @@ -23,7 +23,9 @@ namespace OpenRA.Mods.Common.Installer public void RunActionOnSource(MiniYaml actionYaml, string path, ModData modData, List extracted, Action updateMessage) { // Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected source path - var sourcePath = actionYaml.Value.StartsWith('^') ? Platform.ResolvePath(actionYaml.Value) : FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value)); + var sourcePath = actionYaml.Value.StartsWith('^') + ? Platform.ResolvePath(actionYaml.Value) + : FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value)); using (var source = File.OpenRead(sourcePath)) { diff --git a/OpenRA.Mods.Common/Installer/SourceActions/ExtractIscabSourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/ExtractIscabSourceAction.cs index ac8842900d..360727d71e 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/ExtractIscabSourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/ExtractIscabSourceAction.cs @@ -23,7 +23,9 @@ namespace OpenRA.Mods.Common.Installer public void RunActionOnSource(MiniYaml actionYaml, string path, ModData modData, List extracted, Action updateMessage) { // Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected source path - var sourcePath = actionYaml.Value.StartsWith('^') ? Platform.ResolvePath(actionYaml.Value) : FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value)); + var sourcePath = actionYaml.Value.StartsWith('^') + ? Platform.ResolvePath(actionYaml.Value) + : FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value)); var volumeNode = actionYaml.NodeWithKeyOrDefault("Volumes"); if (volumeNode == null) diff --git a/OpenRA.Mods.Common/Installer/SourceActions/ExtractMscabSourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/ExtractMscabSourceAction.cs index 791e86cb7e..b5cc6b8d37 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/ExtractMscabSourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/ExtractMscabSourceAction.cs @@ -23,7 +23,9 @@ namespace OpenRA.Mods.Common.Installer public void RunActionOnSource(MiniYaml actionYaml, string path, ModData modData, List extracted, Action updateMessage) { // Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected source path - var sourcePath = actionYaml.Value.StartsWith('^') ? Platform.ResolvePath(actionYaml.Value) : FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value)); + var sourcePath = actionYaml.Value.StartsWith('^') + ? Platform.ResolvePath(actionYaml.Value) + : FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value)); using (var source = File.OpenRead(sourcePath)) { diff --git a/OpenRA.Mods.Common/Installer/SourceActions/ExtractRawSourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/ExtractRawSourceAction.cs index dd7954b07a..84ec9b996c 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/ExtractRawSourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/ExtractRawSourceAction.cs @@ -22,7 +22,9 @@ namespace OpenRA.Mods.Common.Installer public void RunActionOnSource(MiniYaml actionYaml, string path, ModData modData, List extracted, Action updateMessage) { // Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected source path - var sourcePath = actionYaml.Value.StartsWith('^') ? Platform.ResolvePath(actionYaml.Value) : FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value)); + var sourcePath = actionYaml.Value.StartsWith('^') + ? Platform.ResolvePath(actionYaml.Value) + : FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value)); using (var source = File.OpenRead(sourcePath)) { diff --git a/OpenRA.Mods.Common/Installer/SourceActions/ExtractZipSourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/ExtractZipSourceAction.cs index 876bd7fa11..dda10d42e4 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/ExtractZipSourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/ExtractZipSourceAction.cs @@ -49,7 +49,9 @@ namespace OpenRA.Mods.Common.Installer using (var targetStream = File.OpenWrite(targetPath)) sourceStream.CopyTo(targetStream); - updateMessage(TranslationProvider.GetString(InstallFromSourceLogic.ExtractingProgress, Translation.Arguments("filename", displayFilename, "progress", 100))); + updateMessage(TranslationProvider.GetString( + InstallFromSourceLogic.ExtractingProgress, + Translation.Arguments("filename", displayFilename, "progress", 100))); extracted.Add(targetPath); } diff --git a/OpenRA.Mods.Common/Installer/SourceResolvers/SteamSourceResolver.cs b/OpenRA.Mods.Common/Installer/SourceResolvers/SteamSourceResolver.cs index 56de4f01ab..91a6136c6b 100644 --- a/OpenRA.Mods.Common/Installer/SourceResolvers/SteamSourceResolver.cs +++ b/OpenRA.Mods.Common/Installer/SourceResolvers/SteamSourceResolver.cs @@ -85,16 +85,29 @@ namespace OpenRA.Mods.Common.Installer } case PlatformType.OSX: - candidatePaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Application Support", "Steam")); + candidatePaths.Add(Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), + "Library", + "Application Support", + "Steam")); break; case PlatformType.Linux: // Direct distro install - candidatePaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".steam", "root")); + candidatePaths.Add(Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), + ".steam", + "root")); // Flatpak installed via Flathub - candidatePaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".var", "app", "com.valvesoftware.Steam", ".steam", "root")); + candidatePaths.Add(Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), + ".var", + "app", + "com.valvesoftware.Steam", + ".steam", + "root")); break; } diff --git a/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs b/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs index 54524b4fd8..afea0a09c1 100644 --- a/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs +++ b/OpenRA.Mods.Common/Lint/CheckChromeHotkeys.cs @@ -64,8 +64,15 @@ namespace OpenRA.Mods.Common.Lint } } - static void CheckInner(ModData modData, string[] namedKeys, (string Widget, string Field)[] checkWidgetFields, Dictionary> customLintMethods, - IEnumerable nodes, string filename, MiniYamlNode parent, Action emitError) + static void CheckInner( + ModData modData, + string[] namedKeys, + (string Widget, string Field)[] checkWidgetFields, + Dictionary> customLintMethods, + IEnumerable nodes, + string filename, + MiniYamlNode parent, + Action emitError) { foreach (var node in nodes) { diff --git a/OpenRA.Mods.Common/Lint/CheckDefaultVisibility.cs b/OpenRA.Mods.Common/Lint/CheckDefaultVisibility.cs index d45da21cf2..07daf7548c 100644 --- a/OpenRA.Mods.Common/Lint/CheckDefaultVisibility.cs +++ b/OpenRA.Mods.Common/Lint/CheckDefaultVisibility.cs @@ -42,7 +42,9 @@ namespace OpenRA.Mods.Common.Lint if (count == 0) emitError($"Actor type `{actorInfo.Key}` does not define a default visibility type."); else if (count > 1) - emitError($"Actor type `{actorInfo.Key}` defines multiple default visibility types: {string.Join(", ", visibilityTypes.Select(vis => vis.GetType().Name))}."); + emitError( + $"Actor type `{actorInfo.Key}` defines multiple default visibility types: " + + $"{string.Join(", ", visibilityTypes.Select(vis => vis.GetType().Name))}."); else { var vis = actorInfo.Value.TraitInfoOrDefault(); @@ -50,9 +52,13 @@ namespace OpenRA.Mods.Common.Lint { var ios = actorInfo.Value.TraitInfoOrDefault(); if (ios == null) - emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType().Name}` but has no IOccupySpace traits."); + emitError( + $"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType().Name}` " + + "but has no IOccupySpace traits."); else if (ios.OccupiedCells(actorInfo.Value, CPos.Zero).Count == 0) - emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType().Name}` but does not have any footprint cells."); + emitError( + $"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType().Name}` " + + "but does not have any footprint cells."); } } } diff --git a/OpenRA.Mods.Common/Lint/CheckPlayers.cs b/OpenRA.Mods.Common/Lint/CheckPlayers.cs index 848c042ebf..37ddb33e68 100644 --- a/OpenRA.Mods.Common/Lint/CheckPlayers.cs +++ b/OpenRA.Mods.Common/Lint/CheckPlayers.cs @@ -38,7 +38,8 @@ namespace OpenRA.Mods.Common.Lint Run(emitError, emitWarning, map.Players, map.Visibility, map.WorldActorInfo, map.SpawnPoints); } - static void Run(Action emitError, Action emitWarning, MapPlayers players, MapVisibility visibility, ActorInfo worldActorInfo, CPos[] spawnPoints) + static void Run(Action emitError, Action emitWarning, + MapPlayers players, MapVisibility visibility, ActorInfo worldActorInfo, CPos[] spawnPoints) { if (players.Players.Count > 64) emitError("Defining more than 64 players is not allowed."); diff --git a/OpenRA.Mods.Common/Lint/CheckSequences.cs b/OpenRA.Mods.Common/Lint/CheckSequences.cs index 8a8262a203..8f8067c874 100644 --- a/OpenRA.Mods.Common/Lint/CheckSequences.cs +++ b/OpenRA.Mods.Common/Lint/CheckSequences.cs @@ -97,10 +97,13 @@ namespace OpenRA.Mods.Common.Lint // TODO: Remove prefixed sequence references and instead use explicit lists of lintable references. if (!sequences.Sequences(i).Any(s => s.StartsWith(sequence, StringComparison.Ordinal))) emitWarning( - $"Actor type `{actorInfo.Value.Name}` trait `{traitName}` field `{field.Name}` defines a prefix `{sequence}` that does not match any sequences on image `{i}`."); + $"Actor type `{actorInfo.Value.Name}` trait `{traitName}` field `{field.Name}` " + + $"defines a prefix `{sequence}` that does not match any sequences on image `{i}`."); } else if (!sequences.HasSequence(i, sequence)) - emitError($"Actor type `{actorInfo.Value.Name}` trait `{traitName}` field `{field.Name}` references an undefined sequence `{sequence}` on image `{i}`."); + emitError( + $"Actor type `{actorInfo.Value.Name}` trait `{traitName}` field `{field.Name}` " + + $"references an undefined sequence `{sequence}` on image `{i}`."); } } } @@ -145,10 +148,14 @@ namespace OpenRA.Mods.Common.Lint { // TODO: Remove prefixed sequence references and instead use explicit lists of lintable references. if (!sequences.Sequences(image).Any(s => s.StartsWith(sequence, StringComparison.Ordinal))) - emitWarning($"Weapon type `{weaponInfo.Key}` projectile field `{field.Name}` defines a prefix `{sequence}` that does not match any sequences on image `{image}`."); + emitWarning( + $"Weapon type `{weaponInfo.Key}` projectile field `{field.Name}` " + + $"defines a prefix `{sequence}` that does not match any sequences on image `{image}`."); } else if (!sequences.HasSequence(image, sequence)) - emitError($"Weapon type `{weaponInfo.Key}` projectile field `{field.Name}` references an undefined sequence `{sequence}` on image `{image}`."); + emitError( + $"Weapon type `{weaponInfo.Key}` projectile field `{field.Name}` " + + $"references an undefined sequence `{sequence}` on image `{image}`."); } } } diff --git a/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs b/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs index 713795ee03..ccb21c8d72 100644 --- a/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs +++ b/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs @@ -209,7 +209,9 @@ namespace OpenRA.Mods.Common.Lint { var userInterface = typeof(UserInterfaceGlobal).GetCustomAttribute().Name; const string Translate = nameof(UserInterfaceGlobal.Translate); - emitWarning($"{context} calls {userInterface}.{Translate} with key `{key}` and translate args passed as `{variable}`. Inline the args at the callsite for lint analysis."); + emitWarning( + $"{context} calls {userInterface}.{Translate} with key `{key}` and translate args passed as `{variable}`." + + "Inline the args at the callsite for lint analysis."); } } } diff --git a/OpenRA.Mods.Common/Lint/LintExts.cs b/OpenRA.Mods.Common/Lint/LintExts.cs index 5803dad879..728713fb35 100644 --- a/OpenRA.Mods.Common/Lint/LintExts.cs +++ b/OpenRA.Mods.Common/Lint/LintExts.cs @@ -63,7 +63,9 @@ namespace OpenRA.Mods.Common.Lint "BooleanExpression", "IntegerExpression" }; - throw new InvalidOperationException($"Bad type for reference on `{ruleInfo.GetType().Name}.{fieldInfo.Name}`. Supported types: {supportedTypes.JoinWith(", ")}."); + throw new InvalidOperationException( + $"Bad type for reference on `{ruleInfo.GetType().Name}.{fieldInfo.Name}`. " + + $"Supported types: {supportedTypes.JoinWith(", ")}."); } public static IEnumerable GetPropertyValues(object ruleInfo, PropertyInfo propertyInfo, @@ -108,7 +110,9 @@ namespace OpenRA.Mods.Common.Lint "BooleanExpression", "IntegerExpression" }; - throw new InvalidOperationException($"Bad type for reference on `{ruleInfo.GetType().Name}.{propertyInfo.Name}`. Supported types: {supportedTypes.JoinWith(", ")}."); + throw new InvalidOperationException( + $"Bad type for reference on `{ruleInfo.GetType().Name}.{propertyInfo.Name}`." + + $"Supported types: {supportedTypes.JoinWith(", ")}."); } } } diff --git a/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs b/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs index 29069742e1..7e9f22ca00 100644 --- a/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs +++ b/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs @@ -294,7 +294,12 @@ namespace OpenRA.Mods.Common.Orders { var isCloseEnough = buildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, actorInfo, topLeft); foreach (var t in buildingInfo.Tiles(topLeft)) - footprint.Add(t, MakeCellType(isCloseEnough && world.IsCellBuildable(t, actorInfo, buildingInfo) && (resourceLayer == null || resourceLayer.GetResource(t).Type == null))); + footprint.Add( + t, + MakeCellType( + isCloseEnough && + world.IsCellBuildable(t, actorInfo, buildingInfo) && + (resourceLayer == null || resourceLayer.GetResource(t).Type == null))); } return preview?.Render(wr, topLeft, footprint) ?? Enumerable.Empty(); diff --git a/OpenRA.Mods.Common/Orders/UnitOrderGenerator.cs b/OpenRA.Mods.Common/Orders/UnitOrderGenerator.cs index 93e2b1cd32..d24077a52e 100644 --- a/OpenRA.Mods.Common/Orders/UnitOrderGenerator.cs +++ b/OpenRA.Mods.Common/Orders/UnitOrderGenerator.cs @@ -99,7 +99,10 @@ namespace OpenRA.Mods.Common.Orders public virtual bool InputOverridesSelection(World world, int2 xy, MouseInput mi) { var actor = world.ScreenMap.ActorsAtMouse(xy) - .Where(a => !a.Actor.IsDead && a.Actor.Info.HasTraitInfo() && (a.Actor.Owner.IsAlliedWith(world.RenderPlayer) || !world.FogObscures(a.Actor))) + .Where(a => + !a.Actor.IsDead && + a.Actor.Info.HasTraitInfo() && + (a.Actor.Owner.IsAlliedWith(world.RenderPlayer) || !world.FogObscures(a.Actor))) .WithHighestSelectionPriority(xy, mi.Modifiers); if (actor == null) diff --git a/OpenRA.Mods.Common/Projectiles/InstantHit.cs b/OpenRA.Mods.Common/Projectiles/InstantHit.cs index 741f92aaa2..1c2cd119c2 100644 --- a/OpenRA.Mods.Common/Projectiles/InstantHit.cs +++ b/OpenRA.Mods.Common/Projectiles/InstantHit.cs @@ -75,7 +75,8 @@ namespace OpenRA.Mods.Common.Projectiles target = Target.FromPos(args.PassiveTarget); // Check for blocking actors - if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween(world, args.SourceActor.Owner, args.Source, target.CenterPosition, info.Width, out var blockedPos)) + if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween( + world, args.SourceActor.Owner, args.Source, target.CenterPosition, info.Width, out var blockedPos)) target = Target.FromPos(blockedPos); var warheadArgs = new WarheadArgs(args) diff --git a/OpenRA.Mods.Common/Scripting/Global/UserInterfaceGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/UserInterfaceGlobal.cs index be097f9824..e5bff665a0 100644 --- a/OpenRA.Mods.Common/Scripting/Global/UserInterfaceGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/UserInterfaceGlobal.cs @@ -45,7 +45,9 @@ namespace OpenRA.Mods.Common.Scripting.Global using (kv.Value) { if (!kv.Key.TryGetClrValue(out var variable) || !kv.Value.TryGetClrValue(out var value)) - throw new LuaException($"Translation arguments requires a table of [\"string\"]=value pairs. Received {kv.Key.WrappedClrType().Name},{kv.Value.WrappedClrType().Name}"); + throw new LuaException( + "Translation arguments requires a table of [\"string\"]=value pairs. " + + $"Received {kv.Key.WrappedClrType().Name},{kv.Value.WrappedClrType().Name}"); argumentDictionary.Add(variable, value); } diff --git a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs index ca68d18acd..cdc27e4d19 100644 --- a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs @@ -165,33 +165,34 @@ namespace OpenRA.Mods.Common.Server [TranslationReference] const string VoteKickDisabled = "notification-vote-kick-disabled"; - readonly IDictionary> commandHandlers = new Dictionary> - { - { "state", State }, - { "startgame", StartGame }, - { "slot", Slot }, - { "allow_spectators", AllowSpectators }, - { "spectate", Specate }, - { "slot_close", SlotClose }, - { "slot_open", SlotOpen }, - { "slot_bot", SlotBot }, - { "map", Map }, - { "option", Option }, - { "reset_options", ResetOptions }, - { "assignteams", AssignTeams }, - { "kick", Kick }, - { "vote_kick", VoteKick }, - { "make_admin", MakeAdmin }, - { "make_spectator", MakeSpectator }, - { "name", Name }, - { "faction", Faction }, - { "team", Team }, - { "handicap", Handicap }, - { "spawn", Spawn }, - { "clear_spawn", ClearPlayerSpawn }, - { "color", PlayerColor }, - { "sync_lobby", SyncLobby } - }; + readonly IDictionary> commandHandlers = + new Dictionary> + { + { "state", State }, + { "startgame", StartGame }, + { "slot", Slot }, + { "allow_spectators", AllowSpectators }, + { "spectate", Specate }, + { "slot_close", SlotClose }, + { "slot_open", SlotOpen }, + { "slot_bot", SlotBot }, + { "map", Map }, + { "option", Option }, + { "reset_options", ResetOptions }, + { "assignteams", AssignTeams }, + { "kick", Kick }, + { "vote_kick", VoteKick }, + { "make_admin", MakeAdmin }, + { "make_spectator", MakeSpectator }, + { "name", Name }, + { "faction", Faction }, + { "team", Team }, + { "handicap", Handicap }, + { "spawn", Spawn }, + { "clear_spawn", ClearPlayerSpawn }, + { "color", PlayerColor }, + { "sync_lobby", SyncLobby } + }; static bool ValidateSlotCommand(S server, Connection conn, Session.Client client, string arg, bool requiresHost) { diff --git a/OpenRA.Mods.Common/Terrain/TerrainInfo.cs b/OpenRA.Mods.Common/Terrain/TerrainInfo.cs index 98a0bf5d1a..e1163834ea 100644 --- a/OpenRA.Mods.Common/Terrain/TerrainInfo.cs +++ b/OpenRA.Mods.Common/Terrain/TerrainInfo.cs @@ -50,7 +50,8 @@ namespace OpenRA.Mods.Common.Terrain if (key < 0 || key >= tileInfo.Length) throw new YamlException( - $"Tileset `{terrainInfo.Id}` template `{Id}` references frame {key}, but only [0..{tileInfo.Length - 1}] are valid for a {Size.X}x{Size.Y} Size template."); + $"Tileset `{terrainInfo.Id}` template `{Id}` references frame {key}, " + + $"but only [0..{tileInfo.Length - 1}] are valid for a {Size.X}x{Size.Y} Size template."); tileInfo[key] = LoadTileInfo(terrainInfo, node.Value); } diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index 7a019c4fcb..f594390780 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -190,12 +190,14 @@ namespace OpenRA.Mods.Common.Traits yield return new FacingInit(PreviewFacing); } - public IReadOnlyDictionary OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any) { return new Dictionary(); } + public IReadOnlyDictionary OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any) => + new Dictionary(); bool IOccupySpaceInfo.SharesCell => false; // Used to determine if an aircraft can spawn landed - public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All) + public bool CanEnterCell(World world, Actor self, CPos cell, + SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All) { if (!world.Map.Contains(cell)) return false; diff --git a/OpenRA.Mods.Common/Traits/Air/AttackAircraft.cs b/OpenRA.Mods.Common/Traits/Air/AttackAircraft.cs index c84d5b7a2c..71536ae763 100644 --- a/OpenRA.Mods.Common/Traits/Air/AttackAircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/AttackAircraft.cs @@ -27,7 +27,9 @@ namespace OpenRA.Mods.Common.Traits "Strafe: Perform a fixed-length attack run on the target.")] public readonly AirAttackType AttackType = AirAttackType.Default; - [Desc("Distance the strafing aircraft makes to a target before turning for another pass. When set to WDist.Zero this defaults to the maximum armament range.")] + [Desc( + "Distance the strafing aircraft makes to a target before turning for another pass. " + + "When set to WDist.Zero this defaults to the maximum armament range.")] public readonly WDist StrafeRunLength = WDist.Zero; public override object Create(ActorInitializer init) { return new AttackAircraft(init.Self, this); } @@ -45,7 +47,8 @@ namespace OpenRA.Mods.Common.Traits aircraftInfo = self.Info.TraitInfo(); } - public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null) + public override Activity GetAttackActivity( + Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null) { return new FlyAttack(self, source, newTarget, forceAttack, targetLineColor); } diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs index dbf6929d48..99c6dd9642 100644 --- a/OpenRA.Mods.Common/Traits/Armament.cs +++ b/OpenRA.Mods.Common/Traits/Armament.cs @@ -380,7 +380,10 @@ namespace OpenRA.Mods.Common.Traits Burst = Weapon.Burst; 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) nbc.FiredBurst(self, target, this); diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs index d38c325525..f1640bee4e 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs @@ -226,7 +226,8 @@ namespace OpenRA.Mods.Common.Traits return order.OrderString == attackOrderName || order.OrderString == forceAttackOrderName ? Info.Voice : null; } - public abstract Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null); + public abstract Activity GetAttackActivity( + Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null); public bool HasAnyValidWeapons(in Target t, bool checkForCenterTargetingWeapons = false, bool reloadingIsInvalid = false) { diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs b/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs index 7d9b49a404..5aec629a3f 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs @@ -159,7 +159,8 @@ namespace OpenRA.Mods.Common.Traits base.Tick(self); } - public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null) + public override Activity GetAttackActivity( + Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null) { // HACK: Manually set force attacking if we persisted an opportunity target that required force attacking if (opportunityTargetIsPersistentTarget && opportunityForceAttack && newTarget == OpportunityTarget) diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackFrontal.cs b/OpenRA.Mods.Common/Traits/Attack/AttackFrontal.cs index 1902c8d748..c52b1c375d 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackFrontal.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackFrontal.cs @@ -39,7 +39,8 @@ namespace OpenRA.Mods.Common.Traits return TargetInFiringArc(self, target, Info.FacingTolerance); } - public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null) + public override Activity GetAttackActivity( + Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null) { return new Activities.Attack(self, newTarget, allowMove, forceAttack, targetLineColor); } diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackOmni.cs b/OpenRA.Mods.Common/Traits/Attack/AttackOmni.cs index c87ef23e40..f618dd1017 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackOmni.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackOmni.cs @@ -26,7 +26,8 @@ namespace OpenRA.Mods.Common.Traits public AttackOmni(Actor self, AttackOmniInfo info) : base(self, info) { } - public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null) + public override Activity GetAttackActivity( + Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null) { return new SetTarget(this, newTarget, allowMove, forceAttack, targetLineColor); } diff --git a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs index 9f207fcc5e..0acbc22c93 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs @@ -100,8 +100,12 @@ namespace OpenRA.Mods.Common.Traits return; playerBuildings = world.ActorsHavingTrait().Where(a => a.Owner == player).ToArray(); - var excessPowerBonus = baseBuilder.Info.ExcessPowerIncrement * (playerBuildings.Length / baseBuilder.Info.ExcessPowerIncreaseThreshold.Clamp(1, int.MaxValue)); - minimumExcessPower = (baseBuilder.Info.MinimumExcessPower + excessPowerBonus).Clamp(baseBuilder.Info.MinimumExcessPower, baseBuilder.Info.MaximumExcessPower); + var 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); // PERF: Queue only one actor at a time per category itemQueuedThisTick = false; @@ -344,7 +348,9 @@ namespace OpenRA.Mods.Common.Traits var buildingVariantInfo = actorInfo.TraitInfoOrDefault(); var variants = buildingVariantInfo?.Actors ?? Array.Empty(); - var count = playerBuildings.Count(a => a.Info.Name == name || variants.Contains(a.Info.Name)) + (baseBuilder.BuildingsBeingProduced.TryGetValue(name, out var num) ? num : 0); + var count = playerBuildings.Count(a => + a.Info.Name == name || variants.Contains(a.Info.Name)) + + (baseBuilder.BuildingsBeingProduced.TryGetValue(name, out var num) ? num : 0); // Do we want to build this structure? if (count * 100 > frac.Value * playerBuildings.Length) diff --git a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/MinelayerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/MinelayerBotModule.cs index 25c6069193..933c4b9910 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/MinelayerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/MinelayerBotModule.cs @@ -148,7 +148,8 @@ namespace OpenRA.Mods.Common.Traits foreach (var minelayer in minelayers) { - var cells = pathFinder.FindPathToTargetCell(minelayer.Actor, new[] { minelayer.Actor.Location }, enemy.Location, BlockedByActor.Immovable, laneBias: false); + var cells = pathFinder.FindPathToTargetCell( + minelayer.Actor, new[] { minelayer.Actor.Location }, enemy.Location, BlockedByActor.Immovable, laneBias: false); if (cells != null && cells.Count != 0) { AIUtils.BotDebug($"{player}: try find a location to lay mine."); @@ -192,7 +193,8 @@ namespace OpenRA.Mods.Common.Traits foreach (var minelayer in minelayers) { - var cells = pathFinder.FindPathToTargetCell(minelayer.Actor, new[] { minelayer.Actor.Location }, minelayingPosition, BlockedByActor.Immovable, laneBias: false); + var cells = pathFinder.FindPathToTargetCell( + minelayer.Actor, new[] { minelayer.Actor.Location }, minelayingPosition, BlockedByActor.Immovable, laneBias: false); if (cells != null && cells.Count != 0) { orderedActors.Add(minelayer.Actor); diff --git a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs index 0ecfb5f5eb..7184b4a430 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs @@ -24,10 +24,16 @@ namespace OpenRA.Mods.Common.Traits [Desc("What support power does this decision apply to?")] public readonly string OrderName = "AirstrikePowerInfoOrder"; - [Desc("What is the coarse scan radius of this power?", "For finding the general target area, before doing a detail scan", "Should be 10 or more to avoid lag")] + [Desc( + "What is the coarse scan radius of this power?", + "For finding the general target area, before doing a detail scan", + "Should be 10 or more to avoid lag")] public readonly int CoarseScanRadius = 20; - [Desc("What is the fine scan radius of this power?", "For doing a detailed scan in the general target area.", "Minimum is 1")] + [Desc( + "What is the fine scan radius of this power?", + "For doing a detailed scan in the general target area.", + "Minimum is 1")] public readonly int FineScanRadius = 2; [FieldLoader.LoadUsing(nameof(LoadConsiderations))] diff --git a/OpenRA.Mods.Common/Traits/BotModules/SupportPowerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/SupportPowerBotModule.cs index a6c3398573..be43996aa4 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/SupportPowerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/SupportPowerBotModule.cs @@ -111,7 +111,9 @@ namespace OpenRA.Mods.Common.Traits waitingPowers[sp] += 10; // Note: SelectDirectionalTarget uses uint.MaxValue in ExtraData to indicate that the player did not pick a direction. - bot.QueueOrder(new Order(sp.Key, supportPowerManager.Self, Target.FromCell(world, attackLocation.Value), false) { SuppressVisualFeedback = true, ExtraData = uint.MaxValue }); + bot.QueueOrder( + new Order(sp.Key, supportPowerManager.Self, Target.FromCell(world, attackLocation.Value), false) + { SuppressVisualFeedback = true, ExtraData = uint.MaxValue }); } } diff --git a/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs index 0b8ea8f034..ca9ea03e18 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/UnitBuilderBotModule.cs @@ -23,7 +23,8 @@ namespace OpenRA.Mods.Common.Traits // Reason: If this is less than SquadSize, the bot might get stuck between not producing more units due to this, // but also not creating squads since there aren't enough idle units. [Desc("If > 0, only produce units as long as there are less than this amount of units idling inside the base.", - "Beware: if it is less than squad size, e.g. the `SquadSize` from `SquadManagerBotModule`, the bot might get stuck as there aren't enough idle units to create squad.")] + "Beware: if it is less than squad size, e.g. the `SquadSize` from `SquadManagerBotModule`, " + + "the bot might get stuck as there aren't enough idle units to create squad.")] public readonly int IdleBaseUnitsMaximum = -1; [Desc("Production queues AI uses for producing units.")] diff --git a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoDockClientManager.cs b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoDockClientManager.cs index f4d2388394..6e7600bff0 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoDockClientManager.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoDockClientManager.cs @@ -140,7 +140,8 @@ namespace OpenRA.Mods.Common.Traits if (Info.RequiresForceMove && !forceEnter) return false; - return !IsTraitDisabled && target.TraitsImplementing().Any(host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType))); + return !IsTraitDisabled && target.TraitsImplementing().Any( + host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType))); } /// Clone of . @@ -150,7 +151,8 @@ namespace OpenRA.Mods.Common.Traits if (Info.RequiresForceMove && !forceEnter) return false; - return !IsTraitDisabled && target.TraitsImplementing().Any(host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType, forceEnter))); + return !IsTraitDisabled && target.TraitsImplementing().Any( + host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType, forceEnter))); } /// Clone of . @@ -159,7 +161,8 @@ namespace OpenRA.Mods.Common.Traits if (!(self.CurrentActivity is Transform || transforms.Any(t => !t.IsTraitDisabled && !t.IsTraitPaused))) return false; - return !IsTraitDisabled && target.TraitsImplementing().Any(host => dockClients.Any(client => client.CanDockAt(target, host, forceEnter, true))); + return !IsTraitDisabled && target.TraitsImplementing().Any( + host => dockClients.Any(client => client.CanDockAt(target, host, forceEnter, true))); } } } diff --git a/OpenRA.Mods.Common/Traits/Cargo.cs b/OpenRA.Mods.Common/Traits/Cargo.cs index 7f748b74df..c35ba2d1cf 100644 --- a/OpenRA.Mods.Common/Traits/Cargo.cs +++ b/OpenRA.Mods.Common/Traits/Cargo.cs @@ -411,7 +411,9 @@ namespace OpenRA.Mods.Common.Traits void INotifyKilled.Killed(Actor self, AttackInfo e) { // IsAtGroundLevel contains Map.Contains(self.Location) check. - if (Info.EjectOnDeath && self.IsAtGroundLevel() && (!checkTerrainType || Info.UnloadTerrainTypes.Contains(self.World.Map.GetTerrainInfo(self.Location).Type))) + if (Info.EjectOnDeath && + self.IsAtGroundLevel() && + (!checkTerrainType || Info.UnloadTerrainTypes.Contains(self.World.Map.GetTerrainInfo(self.Location).Type))) { while (!IsEmpty()) { diff --git a/OpenRA.Mods.Common/Traits/Cloak.cs b/OpenRA.Mods.Common/Traits/Cloak.cs index 05f71412c7..4a2640f12a 100644 --- a/OpenRA.Mods.Common/Traits/Cloak.cs +++ b/OpenRA.Mods.Common/Traits/Cloak.cs @@ -50,7 +50,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Measured in game ticks.")] public readonly int CloakDelay = 30; - [Desc("Events leading to the actor getting uncloaked. Possible values are: Attack, Move, Unload, Infiltrate, Demolish, Dock, Damage, Heal, SelfHeal and SupportPower.", + [Desc( + "Events leading to the actor getting uncloaked. " + + "Possible values are: Attack, Move, Unload, Infiltrate, Demolish, Dock, Damage, Heal, SelfHeal and SupportPower.", "'Dock' is triggered when docking to a refinery or resupplying.", "'SupportPower' is triggered when using a support power.")] public readonly UncloakType UncloakOn = UncloakType.Attack @@ -108,7 +110,8 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new Cloak(this); } } - public class Cloak : PausableConditionalTrait, IRenderModifier, INotifyDamage, INotifyUnloadCargo, INotifyLoadCargo, INotifyDemolition, INotifyInfiltration, + public class Cloak : PausableConditionalTrait, + IRenderModifier, INotifyDamage, INotifyUnloadCargo, INotifyLoadCargo, INotifyDemolition, INotifyInfiltration, INotifyAttack, ITick, IVisibilityModifier, IRadarColorModifier, INotifyDockClient, INotifySupportPower { readonly float3 cloakedColor; diff --git a/OpenRA.Mods.Common/Traits/Crates/Crate.cs b/OpenRA.Mods.Common/Traits/Crates/Crate.cs index 7391a7818d..6ba5cccc96 100644 --- a/OpenRA.Mods.Common/Traits/Crates/Crate.cs +++ b/OpenRA.Mods.Common/Traits/Crates/Crate.cs @@ -39,7 +39,8 @@ namespace OpenRA.Mods.Common.Traits bool IOccupySpaceInfo.SharesCell => false; - public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All) + public bool CanEnterCell(World world, Actor self, CPos cell, + SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All) { // Since crates don't share cells and GetAvailableSubCell only returns SubCell.Full or SubCell.Invalid, we ignore the subCell parameter return GetAvailableSubCell(world, cell, ignoreActor, check) != SubCell.Invalid; diff --git a/OpenRA.Mods.Common/Traits/Crates/GiveUnitCrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/GiveUnitCrateAction.cs index 68ff26d5c2..71464a5858 100644 --- a/OpenRA.Mods.Common/Traits/Crates/GiveUnitCrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/GiveUnitCrateAction.cs @@ -45,7 +45,9 @@ namespace OpenRA.Mods.Common.Traits this.self = self; this.info = info; 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'."); } public bool CanGiveTo(Actor collector) diff --git a/OpenRA.Mods.Common/Traits/DeliversExperience.cs b/OpenRA.Mods.Common/Traits/DeliversExperience.cs index 4a238b0943..36186bc630 100644 --- a/OpenRA.Mods.Common/Traits/DeliversExperience.cs +++ b/OpenRA.Mods.Common/Traits/DeliversExperience.cs @@ -17,7 +17,8 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - [Desc("This actor can grant experience levels equal to it's own current level via entering to other actors with the `" + nameof(AcceptsDeliveredExperience) + "` trait.")] + [Desc("This actor can grant experience levels equal to it's own current level " + + "via entering to other actors with the `" + nameof(AcceptsDeliveredExperience) + "` trait.")] sealed class DeliversExperienceInfo : TraitInfo, Requires { [Desc("The amount of experience the donating player receives.")] diff --git a/OpenRA.Mods.Common/Traits/DockClientBase.cs b/OpenRA.Mods.Common/Traits/DockClientBase.cs index 3472056e4a..01040e6527 100644 --- a/OpenRA.Mods.Common/Traits/DockClientBase.cs +++ b/OpenRA.Mods.Common/Traits/DockClientBase.cs @@ -42,7 +42,9 @@ namespace OpenRA.Mods.Common.Traits public virtual bool CanDockAt(Actor hostActor, IDockHost host, bool forceEnter = false, bool ignoreOccupancy = false) { - return (forceEnter || self.Owner.IsAlliedWith(hostActor.Owner)) && IsDockingPossible(host.GetDockType, forceEnter) && host.IsDockingPossible(self, this, ignoreOccupancy); + return (forceEnter || self.Owner.IsAlliedWith(hostActor.Owner)) && + IsDockingPossible(host.GetDockType, forceEnter) && + host.IsDockingPossible(self, this, ignoreOccupancy); } public virtual void OnDockStarted(Actor self, Actor hostActor, IDockHost host) { } diff --git a/OpenRA.Mods.Common/Traits/DockClientManager.cs b/OpenRA.Mods.Common/Traits/DockClientManager.cs index 1df540072a..783704914d 100644 --- a/OpenRA.Mods.Common/Traits/DockClientManager.cs +++ b/OpenRA.Mods.Common/Traits/DockClientManager.cs @@ -240,26 +240,30 @@ namespace OpenRA.Mods.Common.Traits /// Does this contain at least one enabled with maching . public bool DockingPossible(Actor target) { - return !IsTraitDisabled && target.TraitsImplementing().Any(host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType))); + return !IsTraitDisabled && target.TraitsImplementing().Any( + host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType))); } /// Does this contain at least one enabled with maching . public bool DockingPossible(Actor target, TargetModifiers modifiers) { var forceEnter = modifiers.HasModifier(TargetModifiers.ForceMove); - return !IsTraitDisabled && target.TraitsImplementing().Any(host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType, forceEnter))); + return !IsTraitDisabled && target.TraitsImplementing().Any( + host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType, forceEnter))); } /// Can we dock to this . public bool CanDockAt(Actor hostActor, IDockHost host, bool forceEnter = false, bool ignoreOccupancy = false) { - return !IsTraitDisabled && dockClients.Any(client => client.CanDockAt(hostActor, host, forceEnter, ignoreOccupancy)); + return !IsTraitDisabled && dockClients.Any( + client => client.CanDockAt(hostActor, host, forceEnter, ignoreOccupancy)); } /// Can we dock to this . public bool CanDockAt(Actor target, bool forceEnter = false, bool ignoreOccupancy = false) { - return !IsTraitDisabled && target.TraitsImplementing().Any(host => dockClients.Any(client => client.CanDockAt(target, host, forceEnter, ignoreOccupancy))); + return !IsTraitDisabled && target.TraitsImplementing().Any( + host => dockClients.Any(client => client.CanDockAt(target, host, forceEnter, ignoreOccupancy))); } /// Find the closest viable . @@ -268,7 +272,9 @@ namespace OpenRA.Mods.Common.Traits { var clients = type.IsEmpty ? dockClients : AvailableDockClients(type); return self.World.ActorsWithTrait() - .Where(host => host.Trait != ignore && clients.Any(client => client.CanDockAt(host.Actor, host.Trait, forceEnter, ignoreOccupancy))) + .Where(host => + host.Trait != ignore && + clients.Any(client => client.CanDockAt(host.Actor, host.Trait, forceEnter, ignoreOccupancy))) .ClosestDock(self, this); } diff --git a/OpenRA.Mods.Common/Traits/DockHost.cs b/OpenRA.Mods.Common/Traits/DockHost.cs index 1638d22211..a3d9943baa 100644 --- a/OpenRA.Mods.Common/Traits/DockHost.cs +++ b/OpenRA.Mods.Common/Traits/DockHost.cs @@ -133,7 +133,8 @@ namespace OpenRA.Mods.Common.Traits OnDockCompleted(self, dockedClientActor, dockedClient); } - public virtual bool QueueMoveActivity(Activity moveToDockActivity, Actor self, Actor clientActor, DockClientManager client, MoveCooldownHelper moveCooldownHelper) + public virtual bool QueueMoveActivity( + Activity moveToDockActivity, Actor self, Actor clientActor, DockClientManager client, MoveCooldownHelper moveCooldownHelper) { var move = clientActor.Trait(); diff --git a/OpenRA.Mods.Common/Traits/GivesBounty.cs b/OpenRA.Mods.Common/Traits/GivesBounty.cs index 779092dc39..a3701e488f 100644 --- a/OpenRA.Mods.Common/Traits/GivesBounty.cs +++ b/OpenRA.Mods.Common/Traits/GivesBounty.cs @@ -72,7 +72,8 @@ namespace OpenRA.Mods.Common.Traits var displayedBounty = GetDisplayedBountyValue(self); if (Info.ShowBounty && self.IsInWorld && displayedBounty != 0 && e.Attacker.Owner.IsAlliedWith(self.World.RenderPlayer)) - e.Attacker.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, e.Attacker.OwnerColor(), FloatingText.FormatCashTick(displayedBounty), 30))); + e.Attacker.World.AddFrameEndTask( + w => w.Add(new FloatingText(self.CenterPosition, e.Attacker.OwnerColor(), FloatingText.FormatCashTick(displayedBounty), 30))); e.Attacker.Owner.PlayerActor.Trait().ChangeCash(GetBountyValue(self)); } diff --git a/OpenRA.Mods.Common/Traits/Husk.cs b/OpenRA.Mods.Common/Traits/Husk.cs index ed80b6da0c..da42c3c3b3 100644 --- a/OpenRA.Mods.Common/Traits/Husk.cs +++ b/OpenRA.Mods.Common/Traits/Husk.cs @@ -47,7 +47,8 @@ namespace OpenRA.Mods.Common.Traits bool IOccupySpaceInfo.SharesCell => false; - public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All) + public bool CanEnterCell(World world, Actor self, CPos cell, + SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All) { // IPositionable*Info*.CanEnterCell is only ever used for things like exiting production facilities, // all places relevant for husks check IPositionable.CanEnterCell instead, so we can safely set this to true. diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index 68a1b3e809..b1a4e057bd 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -127,7 +127,8 @@ namespace OpenRA.Mods.Common.Traits /// /// Note: If the target has any free subcell, the value of is ignored. /// - public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All) + public bool CanEnterCell(World world, Actor self, CPos cell, + SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All) { // PERF: Avoid repeated trait queries on the hot path locomotor ??= world.WorldActor.TraitsImplementing() diff --git a/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs b/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs index f3582be2ac..4e325b70dd 100644 --- a/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs +++ b/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs @@ -26,7 +26,8 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new FrozenUnderFog(init, this); } } - public class FrozenUnderFog : ICreatesFrozenActors, IRenderModifier, IDefaultVisibility, ITickRender, ISync, INotifyCreated, INotifyOwnerChanged, INotifyActorDisposing + public class FrozenUnderFog : ICreatesFrozenActors, IRenderModifier, IDefaultVisibility, + ITickRender, ISync, INotifyCreated, INotifyOwnerChanged, INotifyActorDisposing { [Sync] public int VisibilityHash; diff --git a/OpenRA.Mods.Common/Traits/Palettes/IndexedPlayerPalette.cs b/OpenRA.Mods.Common/Traits/Palettes/IndexedPlayerPalette.cs index 245e1cc687..50031bde87 100644 --- a/OpenRA.Mods.Common/Traits/Palettes/IndexedPlayerPalette.cs +++ b/OpenRA.Mods.Common/Traits/Palettes/IndexedPlayerPalette.cs @@ -63,7 +63,9 @@ namespace OpenRA.Mods.Common.Traits ImmutablePalette pal; if (info.PlayerIndex.TryGetValue(playerName, out var remap)) - pal = new ImmutablePalette(basePalette, new IndexedColorRemap(basePalette, info.RemapIndex.Length == 0 ? Enumerable.Range(0, 256).ToArray() : info.RemapIndex, remap)); + pal = new ImmutablePalette( + basePalette, + new IndexedColorRemap(basePalette, info.RemapIndex.Length == 0 ? Enumerable.Range(0, 256).ToArray() : info.RemapIndex, remap)); else pal = new ImmutablePalette(basePalette); diff --git a/OpenRA.Mods.Common/Traits/Passenger.cs b/OpenRA.Mods.Common/Traits/Passenger.cs index fb5f6dc999..d1793f7911 100644 --- a/OpenRA.Mods.Common/Traits/Passenger.cs +++ b/OpenRA.Mods.Common/Traits/Passenger.cs @@ -61,7 +61,8 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new Passenger(this); } } - public class Passenger : IIssueOrder, IResolveOrder, IOrderVoice, INotifyRemovedFromWorld, INotifyEnteredCargo, INotifyExitedCargo, INotifyKilled, IObservesVariables + public class Passenger : IIssueOrder, IResolveOrder, IOrderVoice, + INotifyRemovedFromWorld, INotifyEnteredCargo, INotifyExitedCargo, INotifyKilled, IObservesVariables { public readonly PassengerInfo Info; public Actor Transport; diff --git a/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs b/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs index 3e6580b496..4b80f68b77 100644 --- a/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs +++ b/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs @@ -66,7 +66,8 @@ namespace OpenRA.Mods.Common.Traits IEnumerable ILobbyOptions.LobbyOptions(MapPreview map) { - yield return new LobbyBooleanOption(map, "cheats", CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked); + yield return new LobbyBooleanOption(map, "cheats", + CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked); } public override object Create(ActorInitializer init) { return new DeveloperMode(this); } diff --git a/OpenRA.Mods.Common/Traits/Player/ModularBot.cs b/OpenRA.Mods.Common/Traits/Player/ModularBot.cs index bdc7f2e574..83d857d00c 100644 --- a/OpenRA.Mods.Common/Traits/Player/ModularBot.cs +++ b/OpenRA.Mods.Common/Traits/Player/ModularBot.cs @@ -28,7 +28,8 @@ namespace OpenRA.Mods.Common.Traits [Desc("Human-readable name this bot uses.")] public readonly string Name = "Unnamed Bot"; - [Desc("Minimum portion of pending orders to issue each tick (e.g. 5 issues at least 1/5th of all pending orders). Excess orders remain queued for subsequent ticks.")] + [Desc("Minimum portion of pending orders to issue each tick (e.g. 5 issues at least 1/5th of all pending orders). " + + "Excess orders remain queued for subsequent ticks.")] public readonly int MinOrderQuotientPerTick = 5; string IBotInfo.Type => Type; diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs b/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs index 2e6bf78bb8..36ffbf6e7a 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs @@ -66,7 +66,8 @@ namespace OpenRA.Mods.Common.Traits var startingCash = SelectableCash.ToDictionary(c => c.ToStringInvariant(), c => "$" + c.ToString(NumberFormatInfo.CurrentInfo)); if (startingCash.Count > 0) - yield return new LobbyOption(map, "startingcash", DefaultCashDropdownLabel, DefaultCashDropdownDescription, DefaultCashDropdownVisible, DefaultCashDropdownDisplayOrder, + yield return new LobbyOption(map, "startingcash", + DefaultCashDropdownLabel, DefaultCashDropdownDescription, DefaultCashDropdownVisible, DefaultCashDropdownDisplayOrder, startingCash, DefaultCash.ToStringInvariant(), DefaultCashDropdownLocked); } diff --git a/OpenRA.Mods.Common/Traits/ProximityCapturableBase.cs b/OpenRA.Mods.Common/Traits/ProximityCapturableBase.cs index 7e0eb7605d..e333b9b671 100644 --- a/OpenRA.Mods.Common/Traits/ProximityCapturableBase.cs +++ b/OpenRA.Mods.Common/Traits/ProximityCapturableBase.cs @@ -41,7 +41,8 @@ namespace OpenRA.Mods.Common.Traits { var pci = rules.Actors[SystemActors.Player].TraitInfoOrDefault(); if (pci == null) - throw new YamlException(nameof(ProximityCapturableBase) + " requires the `" + nameof(Player) + "` actor to have the " + nameof(ProximityCaptor) + " trait."); + throw new YamlException( + nameof(ProximityCapturableBase) + " requires the `" + nameof(Player) + "` actor to have the " + nameof(ProximityCaptor) + " trait."); } public abstract override object Create(ActorInitializer init); diff --git a/OpenRA.Mods.Common/Traits/Render/WithParachute.cs b/OpenRA.Mods.Common/Traits/Render/WithParachute.cs index e2210d4447..cce94336df 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithParachute.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithParachute.cs @@ -182,7 +182,10 @@ namespace OpenRA.Mods.Common.Traits.Render var palette = wr.Palette(info.Palette); var alpha = shadow.CurrentSequence.GetAlpha(shadow.CurrentFrame); var tintModifiers = shadow.CurrentSequence.IgnoreWorldTint ? TintModifiers.ReplaceColor | TintModifiers.IgnoreWorldTint : TintModifiers.ReplaceColor; - return new IRenderable[] { new SpriteRenderable(shadow.Image, pos, info.ShadowOffset, info.ShadowZOffset, palette, 1, shadowAlpha * alpha, shadowColor, tintModifiers, true) }; + return new IRenderable[] + { + new SpriteRenderable(shadow.Image, pos, info.ShadowOffset, info.ShadowZOffset, palette, 1, shadowAlpha * alpha, shadowColor, tintModifiers, true) + }; } IEnumerable IRender.ScreenBounds(Actor self, WorldRenderer wr) diff --git a/OpenRA.Mods.Common/Traits/Render/WithSwitchableOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithSwitchableOverlay.cs index da3cccc756..7c10895cb1 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithSwitchableOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithSwitchableOverlay.cs @@ -18,7 +18,8 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Renders a decorative animation on units and buildings. Overlay switching controlled by " + nameof(PauseOnCondition) + ".")] - public class WithSwitchableOverlayInfo : PausableConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires, Requires + public class WithSwitchableOverlayInfo : PausableConditionalTraitInfo, + IRenderActorPreviewSpritesInfo, Requires, Requires { [Desc("Image used for this decoration. Defaults to the actor's type.")] public readonly string Image = null; @@ -123,7 +124,11 @@ namespace OpenRA.Mods.Common.Traits.Render var facing = self.TraitOrDefault(); var image = info.Image ?? rs.GetImage(self); - overlay = new Animation(self.World, image, facing == null ? () => WAngle.Zero : (body == null ? () => facing.Facing : () => body.QuantizeFacing(facing.Facing)), () => false) + overlay = new Animation( + self.World, + image, + facing == null ? () => WAngle.Zero : (body == null ? () => facing.Facing : () => body.QuantizeFacing(facing.Facing)), + () => false) { IsDecoration = info.IsDecoration }; diff --git a/OpenRA.Mods.Common/Traits/RepairsBridges.cs b/OpenRA.Mods.Common/Traits/RepairsBridges.cs index 2a878ecb3d..3528b0e2f5 100644 --- a/OpenRA.Mods.Common/Traits/RepairsBridges.cs +++ b/OpenRA.Mods.Common/Traits/RepairsBridges.cs @@ -111,7 +111,9 @@ namespace OpenRA.Mods.Common.Traits else return; - self.QueueActivity(order.Queued, new RepairBridge(self, order.Target, info.EnterBehaviour, info.RepairNotification, info.RepairTextNotification, info.TargetLineColor)); + self.QueueActivity( + order.Queued, + new RepairBridge(self, order.Target, info.EnterBehaviour, info.RepairNotification, info.RepairTextNotification, info.TargetLineColor)); self.ShowTargetLines(); } } diff --git a/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs b/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs index 1c100ae473..4afbf47380 100644 --- a/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs +++ b/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs @@ -81,7 +81,8 @@ namespace OpenRA.Mods.Common.Traits IEnumerable ILobbyOptions.LobbyOptions(MapPreview map) { - yield return new LobbyBooleanOption(map, "crates", CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked); + yield return new LobbyBooleanOption(map, "crates", + CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked); } public override object Create(ActorInitializer init) { return new CrateSpawner(init.Self, this); } diff --git a/OpenRA.Mods.Common/Traits/World/Locomotor.cs b/OpenRA.Mods.Common/Traits/World/Locomotor.cs index 4f5c06ea0b..632072b113 100644 --- a/OpenRA.Mods.Common/Traits/World/Locomotor.cs +++ b/OpenRA.Mods.Common/Traits/World/Locomotor.cs @@ -206,7 +206,8 @@ namespace OpenRA.Mods.Common.Traits return terrainInfos[index].Speed; } - public short MovementCostToEnterCell(Actor actor, CPos destNode, BlockedByActor check, Actor ignoreActor, bool ignoreSelf = false, SubCell subCell = SubCell.FullCell) + public short MovementCostToEnterCell( + Actor actor, CPos destNode, BlockedByActor check, Actor ignoreActor, bool ignoreSelf = false, SubCell subCell = SubCell.FullCell) { var cellCost = MovementCostForCell(destNode); @@ -217,7 +218,8 @@ namespace OpenRA.Mods.Common.Traits return cellCost; } - public short MovementCostToEnterCell(Actor actor, CPos srcNode, CPos destNode, BlockedByActor check, Actor ignoreActor, bool ignoreSelf = false) + public short MovementCostToEnterCell( + Actor actor, CPos srcNode, CPos destNode, BlockedByActor check, Actor ignoreActor, bool ignoreSelf = false) { var cellCost = MovementCostForCell(destNode, srcNode); diff --git a/OpenRA.Mods.Common/Traits/World/MapCreeps.cs b/OpenRA.Mods.Common/Traits/World/MapCreeps.cs index ced7d8a233..68a5692d0b 100644 --- a/OpenRA.Mods.Common/Traits/World/MapCreeps.cs +++ b/OpenRA.Mods.Common/Traits/World/MapCreeps.cs @@ -40,7 +40,8 @@ namespace OpenRA.Mods.Common.Traits IEnumerable ILobbyOptions.LobbyOptions(MapPreview map) { - yield return new LobbyBooleanOption(map, "creeps", CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked); + yield return new LobbyBooleanOption(map, "creeps", + CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked); } public override object Create(ActorInitializer init) { return new MapCreeps(this); } diff --git a/OpenRA.Mods.Common/Traits/World/MapOptions.cs b/OpenRA.Mods.Common/Traits/World/MapOptions.cs index e28207df80..88dcbec94d 100644 --- a/OpenRA.Mods.Common/Traits/World/MapOptions.cs +++ b/OpenRA.Mods.Common/Traits/World/MapOptions.cs @@ -81,14 +81,16 @@ namespace OpenRA.Mods.Common.Traits IEnumerable ILobbyOptions.LobbyOptions(MapPreview map) { - yield return new LobbyBooleanOption(map, "shortgame", ShortGameCheckboxLabel, ShortGameCheckboxDescription, + yield return new LobbyBooleanOption(map, "shortgame", + ShortGameCheckboxLabel, ShortGameCheckboxDescription, ShortGameCheckboxVisible, ShortGameCheckboxDisplayOrder, ShortGameCheckboxEnabled, ShortGameCheckboxLocked); var techLevels = map.PlayerActorInfo.TraitInfos() .ToDictionary(t => t.Id, t => map.GetLocalisedString(t.Name)); if (techLevels.Count > 0) - yield return new LobbyOption(map, "techlevel", TechLevelDropdownLabel, TechLevelDropdownDescription, TechLevelDropdownVisible, TechLevelDropdownDisplayOrder, + yield return new LobbyOption(map, "techlevel", + TechLevelDropdownLabel, TechLevelDropdownDescription, TechLevelDropdownVisible, TechLevelDropdownDisplayOrder, techLevels, TechLevel, TechLevelDropdownLocked); var gameSpeeds = Game.ModData.Manifest.Get(); diff --git a/OpenRA.Mods.Common/Traits/World/OrderEffects.cs b/OpenRA.Mods.Common/Traits/World/OrderEffects.cs index 605a0bbcd6..ea1486bf95 100644 --- a/OpenRA.Mods.Common/Traits/World/OrderEffects.cs +++ b/OpenRA.Mods.Common/Traits/World/OrderEffects.cs @@ -95,7 +95,8 @@ namespace OpenRA.Mods.Common.Traits case TargetType.Terrain: { - world.AddFrameEndTask(w => w.Add(new SpriteAnnotation(target.CenterPosition, world, info.TerrainFlashImage, info.TerrainFlashSequence, info.TerrainFlashPalette))); + world.AddFrameEndTask(w => w.Add(new SpriteAnnotation( + target.CenterPosition, world, info.TerrainFlashImage, info.TerrainFlashSequence, info.TerrainFlashPalette))); return true; } diff --git a/OpenRA.Mods.Common/Traits/World/SpawnStartingUnits.cs b/OpenRA.Mods.Common/Traits/World/SpawnStartingUnits.cs index a781408cf4..1c27807a4e 100644 --- a/OpenRA.Mods.Common/Traits/World/SpawnStartingUnits.cs +++ b/OpenRA.Mods.Common/Traits/World/SpawnStartingUnits.cs @@ -19,7 +19,8 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [TraitLocation(SystemActors.World)] - [Desc("Spawn base actor at the spawnpoint and support units in an annulus around the base actor. Both are defined at MPStartUnits. Attach this to the world actor.")] + [Desc("Spawn base actor at the spawnpoint and support units in an annulus around the base actor. " + + "Both are defined at MPStartUnits. Attach this to the world actor.")] public class SpawnStartingUnitsInfo : TraitInfo, Requires, NotBefore, ILobbyOptions { public readonly string StartingUnitsClass = "none"; diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index d52e56215e..c1bb12da2e 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -377,7 +377,8 @@ namespace OpenRA.Mods.Common.Traits Color[] PresetColors { get; } Color RandomPresetColor(MersenneTwister random, IReadOnlyCollection terrainColors, IReadOnlyCollection playerColors); Color RandomValidColor(MersenneTwister random, IReadOnlyCollection terrainColors, IReadOnlyCollection playerColors); - Color MakeValid(Color color, MersenneTwister random, IReadOnlyCollection terrainColors, IReadOnlyCollection playerColors, Action onError = null); + Color MakeValid( + Color color, MersenneTwister random, IReadOnlyCollection terrainColors, IReadOnlyCollection playerColors, Action onError = null); void ShowColorDropDown(DropDownButtonWidget dropdownButton, Color initialColor, string initialFaction, WorldRenderer worldRenderer, Action onExit); } @@ -876,7 +877,8 @@ namespace OpenRA.Mods.Common.Traits public interface IPositionableInfo : IOccupySpaceInfo { - bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All); + bool CanEnterCell(World world, Actor self, CPos cell, + SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All); } public interface IPositionable : IOccupySpace @@ -885,7 +887,8 @@ namespace OpenRA.Mods.Common.Traits bool IsLeavingCell(CPos location, SubCell subCell = SubCell.Any); bool CanEnterCell(CPos location, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All); SubCell GetValidSubCell(SubCell preferred = SubCell.Any); - SubCell GetAvailableSubCell(CPos location, SubCell preferredSubCell = SubCell.Any, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All); + SubCell GetAvailableSubCell(CPos location, + SubCell preferredSubCell = SubCell.Any, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All); void SetPosition(Actor self, CPos cell, SubCell subCell = SubCell.Any); void SetPosition(Actor self, WPos pos); void SetCenterPosition(Actor self, WPos pos); diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/AttackFrontalFacingTolerance.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/AttackFrontalFacingTolerance.cs index 9116c2e90e..a14dcbbaa0 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/AttackFrontalFacingTolerance.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/AttackFrontalFacingTolerance.cs @@ -17,7 +17,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public override string Name => "Adds the old default value for AttackFrontal's FacingTolerance."; - public override string Description => "The tolerance for the attack angle was defined twice on AttackFrontal. This override has to be defined in the rules now."; + public override string Description => + "The tolerance for the attack angle was defined twice on AttackFrontal. " + + "This override has to be defined in the rules now."; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNodeBuilder actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/ReplaceResourceValueModifiers.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/ReplaceResourceValueModifiers.cs index 721d2288df..a382a1d201 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/ReplaceResourceValueModifiers.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/ReplaceResourceValueModifiers.cs @@ -17,7 +17,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public override string Name => "HarvesterResourceMultiplier and RefineryResourceMultiplier replaced with ResourceValueMultiplier."; - public override string Description => "The HarvesterResourceMultiplier trait has been removed, and the RefineryResourceMultiplier trait renamed to ResourceValueMultiplier."; + public override string Description => + "The HarvesterResourceMultiplier trait has been removed, " + + "and the RefineryResourceMultiplier trait renamed to ResourceValueMultiplier."; bool notified; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNodeBuilder actorNode) diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20230225/RemoveExperienceFromInfiltrates.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20230225/RemoveExperienceFromInfiltrates.cs index 3da522e061..ae30b77dad 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20230225/RemoveExperienceFromInfiltrates.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20230225/RemoveExperienceFromInfiltrates.cs @@ -17,7 +17,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public override string Name => "Removes PlayerExperience property from Infiltrates."; - public override string Description => "Infiltrates property PlayerExperience was removed, it was replaced by adding PlayerExperience to all InfiltrateFor* Traits."; + public override string Description => + "Infiltrates property PlayerExperience was removed, " + + "it was replaced by adding PlayerExperience to all InfiltrateFor* Traits."; readonly List locations = new(); diff --git a/OpenRA.Mods.Common/UpdateRules/UpdateUtils.cs b/OpenRA.Mods.Common/UpdateRules/UpdateUtils.cs index 6c817d067f..0cbfc25d0e 100644 --- a/OpenRA.Mods.Common/UpdateRules/UpdateUtils.cs +++ b/OpenRA.Mods.Common/UpdateRules/UpdateUtils.cs @@ -35,7 +35,12 @@ namespace OpenRA.Mods.Common.UpdateRules continue; } - yaml.Add(((IReadWritePackage)package, name, MiniYaml.FromStream(package.GetStream(name), $"{package.Name}:{name}", false).ConvertAll(n => new MiniYamlNodeBuilder(n)))); + yaml.Add( + ((IReadWritePackage)package, + name, + MiniYaml + .FromStream(package.GetStream(name), $"{package.Name}:{name}", false) + .ConvertAll(n => new MiniYamlNodeBuilder(n)))); } return yaml; @@ -68,7 +73,12 @@ namespace OpenRA.Mods.Common.UpdateRules { // Ignore any files that aren't in the map bundle if (!filename.Contains('|') && mapPackage.Contains(filename)) - fileSet.Add((mapPackage, filename, MiniYaml.FromStream(mapPackage.GetStream(filename), $"{mapPackage.Name}:{filename}", false).ConvertAll(n => new MiniYamlNodeBuilder(n)))); + fileSet.Add(( + mapPackage, + filename, + MiniYaml + .FromStream(mapPackage.GetStream(filename), $"{mapPackage.Name}:{filename}", false) + .ConvertAll(n => new MiniYamlNodeBuilder(n)))); else if (modData.ModFiles.Exists(filename)) externalFilenames.Add(filename); } @@ -159,7 +169,8 @@ namespace OpenRA.Mods.Common.UpdateRules return manualSteps; } - public static List LoadMapYaml(IReadOnlyFileSystem fileSystem, IReadOnlyPackage mapPackage, IEnumerable files, MiniYamlBuilder mapNode) + public static List LoadMapYaml( + IReadOnlyFileSystem fileSystem, IReadOnlyPackage mapPackage, IEnumerable files, MiniYamlBuilder mapNode) { var yaml = files.Select(s => MiniYaml.FromStream(fileSystem.Open(s), s)).ToList(); @@ -357,7 +368,8 @@ namespace OpenRA.Mods.Common.UpdateRules } /// Renames a yaml key preserving any @suffix. - public static void RenameKey(this MiniYamlNodeBuilder node, string newKey, bool preserveSuffix = true, bool includeRemovals = true) + public static void RenameKey( + this MiniYamlNodeBuilder node, string newKey, bool preserveSuffix = true, bool includeRemovals = true) { var prefix = includeRemovals && node.IsRemoval() ? "-" : ""; var split = node.Key.IndexOf('@'); @@ -398,7 +410,8 @@ namespace OpenRA.Mods.Common.UpdateRules fromNode.Value.Nodes.Remove(node); } - public static void MoveAndRenameNode(this MiniYamlNodeBuilder node, + public static void MoveAndRenameNode( + this MiniYamlNodeBuilder node, MiniYamlNodeBuilder fromNode, MiniYamlNodeBuilder toNode, string newKey, bool preserveSuffix = true, bool includeRemovals = true) { node.RenameKey(newKey, preserveSuffix, includeRemovals); @@ -406,13 +419,15 @@ namespace OpenRA.Mods.Common.UpdateRules } /// Removes children with keys equal to [match] or [match]@[arbitrary suffix]. - public static int RemoveNodes(this MiniYamlNodeBuilder node, string match, bool ignoreSuffix = true, bool includeRemovals = true) + public static int RemoveNodes( + this MiniYamlNodeBuilder node, string match, bool ignoreSuffix = true, bool includeRemovals = true) { return node.Value.Nodes.RemoveAll(n => n.KeyMatches(match, ignoreSuffix, includeRemovals)); } /// Returns true if the node is of the form [match] or [match]@[arbitrary suffix]. - public static bool KeyMatches(this MiniYamlNodeBuilder node, string match, bool ignoreSuffix = true, bool includeRemovals = true) + public static bool KeyMatches( + this MiniYamlNodeBuilder node, string match, bool ignoreSuffix = true, bool includeRemovals = true) { if (node.Key == null) return false; @@ -430,7 +445,8 @@ namespace OpenRA.Mods.Common.UpdateRules } /// Returns true if the node is of the form [match], [match]@[arbitrary suffix] or [arbitrary suffix]@[match]. - public static bool KeyContains(this MiniYamlNodeBuilder node, string match, bool ignoreSuffix = true, bool includeRemovals = true) + public static bool KeyContains( + this MiniYamlNodeBuilder node, string match, bool ignoreSuffix = true, bool includeRemovals = true) { if (node.Key == null) return false; @@ -445,23 +461,27 @@ namespace OpenRA.Mods.Common.UpdateRules } /// Returns children with keys equal to [match] or [match]@[arbitrary suffix]. - public static IEnumerable ChildrenMatching(this MiniYamlNodeBuilder node, string match, bool ignoreSuffix = true, bool includeRemovals = true) + public static IEnumerable ChildrenMatching( + this MiniYamlNodeBuilder node, string match, bool ignoreSuffix = true, bool includeRemovals = true) { return node.Value.Nodes.Where(n => n.KeyMatches(match, ignoreSuffix, includeRemovals)); } /// Returns children whose keys contain 'match' (optionally in the suffix). - public static IEnumerable ChildrenContaining(this MiniYamlNodeBuilder node, string match, bool ignoreSuffix = true, bool includeRemovals = true) + public static IEnumerable ChildrenContaining( + this MiniYamlNodeBuilder node, string match, bool ignoreSuffix = true, bool includeRemovals = true) { return node.Value.Nodes.Where(n => n.KeyContains(match, ignoreSuffix, includeRemovals)); } - public static MiniYamlNodeBuilder LastChildMatching(this MiniYamlNodeBuilder node, string match, bool includeRemovals = true) + public static MiniYamlNodeBuilder LastChildMatching( + this MiniYamlNodeBuilder node, string match, bool includeRemovals = true) { return node.ChildrenMatching(match, includeRemovals: includeRemovals).LastOrDefault(); } - public static void RenameChildrenMatching(this MiniYamlNodeBuilder node, string match, string newKey, bool preserveSuffix = true, bool includeRemovals = true) + public static void RenameChildrenMatching( + this MiniYamlNodeBuilder node, string match, string newKey, bool preserveSuffix = true, bool includeRemovals = true) { var matching = node.ChildrenMatching(match); foreach (var m in matching) diff --git a/OpenRA.Mods.Common/UtilityCommands/DebugChromeRegions.cs b/OpenRA.Mods.Common/UtilityCommands/DebugChromeRegions.cs index 68b0d7c536..038500cb79 100644 --- a/OpenRA.Mods.Common/UtilityCommands/DebugChromeRegions.cs +++ b/OpenRA.Mods.Common/UtilityCommands/DebugChromeRegions.cs @@ -74,7 +74,10 @@ namespace OpenRA.Mods.Common.UtilityCommands } } - var output = HtmlTemplate.JoinWith("\n").FormatInvariant(zoom, Convert.ToBase64String(modData.ModFiles.Open(image).ReadAllBytes()), "[" + regions.JoinWith(",") + "]"); + var output = HtmlTemplate.JoinWith("\n").FormatInvariant( + zoom, + Convert.ToBase64String(modData.ModFiles.Open(image).ReadAllBytes()), + "[" + regions.JoinWith(",") + "]"); var outputPath = Path.ChangeExtension(image, ".html"); File.WriteAllLines(outputPath, new[] { output }); Console.WriteLine("Saved {0}", outputPath); diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractChromeStrings.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractChromeStrings.cs index eabc49aa58..5431033e46 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractChromeStrings.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractChromeStrings.cs @@ -244,7 +244,8 @@ namespace OpenRA.Mods.Common.UtilityCommands .ToLowerInvariant(); } - static void FromChromeLayout(MiniYamlNodeBuilder node, Dictionary translatables, string container, ref List translations) + static void FromChromeLayout( + MiniYamlNodeBuilder node, Dictionary translatables, string container, ref List translations) { var nodeSplit = node.Key.Split('@'); var nodeType = nodeSplit[0]; diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs index ac4e1c988c..7a3e0b41c8 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs @@ -68,7 +68,9 @@ namespace OpenRA.Mods.Common.UtilityCommands static void WriteDiagnosticsDisabling() { - Console.WriteLine("--- This file only lists function \"signatures\", causing Lua Diagnostics errors: \"Annotations specify that a return value is required here.\""); + Console.WriteLine( + "--- This file only lists function \"signatures\", causing Lua Diagnostics errors: " + + "\"Annotations specify that a return value is required here.\""); Console.WriteLine("--- and Lua Diagnostics warnings \"Unused local\" for the functions' parameters."); Console.WriteLine("--- Disable those specific errors for the entire file."); Console.WriteLine("---@diagnostic disable: missing-return"); @@ -341,7 +343,8 @@ namespace OpenRA.Mods.Common.UtilityCommands if (requiredTraits.Length != 0) Console.WriteLine( - $"{new string(' ', indentation * 4)}--- **Requires {(requiredTraits.Length == 1 ? "Trait" : "Traits")}:** {requiredTraits.Select(GetDocumentationUrl).JoinWith(", ")}"); + $"{new string(' ', indentation * 4)}--- **Requires {(requiredTraits.Length == 1 ? "Trait" : "Traits")}:** " + + $"{requiredTraits.Select(GetDocumentationUrl).JoinWith(", ")}"); } } diff --git a/OpenRA.Mods.Common/Warheads/Warhead.cs b/OpenRA.Mods.Common/Warheads/Warhead.cs index bd44bfa015..35a225fe98 100644 --- a/OpenRA.Mods.Common/Warheads/Warhead.cs +++ b/OpenRA.Mods.Common/Warheads/Warhead.cs @@ -38,7 +38,10 @@ namespace OpenRA.Mods.Common.Warheads [Desc("Can this warhead affect the actor that fired it.")] public readonly bool AffectsParent = false; - [Desc("If impact is above this altitude, warheads that would affect terrain ignore terrain target types (and either do nothing or perform their own checks).")] + [Desc( + "If impact is above this altitude, " + + "warheads that would affect terrain ignore terrain target types " + + "(and either do nothing or perform their own checks).")] public readonly WDist AirThreshold = new(128); [Desc("Delay in ticks before applying the warhead effect.", "0 = instant (old model).")] diff --git a/OpenRA.Mods.Common/Widgets/CheckboxWidget.cs b/OpenRA.Mods.Common/Widgets/CheckboxWidget.cs index 3f4bb7f238..f0f125d68d 100644 --- a/OpenRA.Mods.Common/Widgets/CheckboxWidget.cs +++ b/OpenRA.Mods.Common/Widgets/CheckboxWidget.cs @@ -78,7 +78,11 @@ namespace OpenRA.Mods.Common.Widgets var checkmarkImage = getCheckmarkImageCache .Update((GetCheckmark(), IsChecked())) .Update((disabled, Depressed, hover, false, IsHighlighted())); - WidgetUtils.DrawSprite(checkmarkImage, new float2(rect.Right - (int)((rect.Height + checkmarkImage.Size.X) / 2), rect.Top + (int)((rect.Height - checkmarkImage.Size.Y) / 2))); + WidgetUtils.DrawSprite( + checkmarkImage, + new float2( + rect.Right - (int)((rect.Height + checkmarkImage.Size.X) / 2), + rect.Top + (int)((rect.Height - checkmarkImage.Size.Y) / 2))); } public override Widget Clone() { return new CheckboxWidget(this); } diff --git a/OpenRA.Mods.Common/Widgets/DropDownButtonWidget.cs b/OpenRA.Mods.Common/Widgets/DropDownButtonWidget.cs index 36e74c8c5b..aa52825639 100644 --- a/OpenRA.Mods.Common/Widgets/DropDownButtonWidget.cs +++ b/OpenRA.Mods.Common/Widgets/DropDownButtonWidget.cs @@ -58,13 +58,20 @@ namespace OpenRA.Mods.Common.Widgets getMarkerImage ??= WidgetUtils.GetCachedStatefulImage(Decorations, DecorationMarker); var arrowImage = getMarkerImage.Update((isDisabled, Depressed, isHover, false, IsHighlighted())); - WidgetUtils.DrawSprite(arrowImage, stateOffset + new float2(rb.Right - (int)((rb.Height + arrowImage.Size.X) / 2), rb.Top + (int)((rb.Height - arrowImage.Size.Y) / 2))); + WidgetUtils.DrawSprite( + arrowImage, + stateOffset + new float2( + rb.Right - (int)((rb.Height + arrowImage.Size.X) / 2), + rb.Top + (int)((rb.Height - arrowImage.Size.Y) / 2))); getSeparatorImage ??= WidgetUtils.GetCachedStatefulImage(Separators, SeparatorImage); var separatorImage = getSeparatorImage.Update((isDisabled, Depressed, isHover, false, IsHighlighted())); if (separatorImage != null) - WidgetUtils.DrawSprite(separatorImage, stateOffset + new float2(-3, 0) + new float2(rb.Right - rb.Height + 4, rb.Top + (int)((rb.Height - separatorImage.Size.Y) / 2))); + WidgetUtils.DrawSprite( + separatorImage, + stateOffset + new float2(-3, 0) + new float2(rb.Right - rb.Height + 4, + rb.Top + (int)((rb.Height - separatorImage.Size.Y) / 2))); } public override Widget Clone() { return new DropDownButtonWidget(this); } @@ -138,7 +145,8 @@ namespace OpenRA.Mods.Common.Widgets (panel as ScrollPanelWidget)?.ScrollToSelectedItem(); } - public void ShowDropDown(string panelTemplate, int maxHeight, IEnumerable options, Func setupItem) + public void ShowDropDown( + string panelTemplate, int maxHeight, IEnumerable options, Func setupItem) { var substitutions = new Dictionary() { { "DROPDOWN_WIDTH", Bounds.Width } }; var panel = (ScrollPanelWidget)Ui.LoadWidget(panelTemplate, null, new WidgetArgs() { { "substitutions", substitutions } }); @@ -160,7 +168,8 @@ namespace OpenRA.Mods.Common.Widgets AttachPanel(panel); } - public void ShowDropDown(string panelTemplate, int height, Dictionary> groups, Func setupItem) + public void ShowDropDown( + string panelTemplate, int height, Dictionary> groups, Func setupItem) { var substitutions = new Dictionary() { { "DROPDOWN_WIDTH", Bounds.Width } }; var panel = (ScrollPanelWidget)Ui.LoadWidget(panelTemplate, null, new WidgetArgs() { { "substitutions", substitutions } }); diff --git a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs index 4110686cec..816e73748c 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs @@ -471,11 +471,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic item.IsVisible = () => { - var allowed = (assetTypesToDisplay.HasFlag(AssetType.Sprite) && allowedSpriteExtensions.Any(ext => filepath.EndsWith(ext, true, CultureInfo.InvariantCulture))) - || (assetTypesToDisplay.HasFlag(AssetType.Model) && allowedModelExtensions.Any(ext => filepath.EndsWith(ext, true, CultureInfo.InvariantCulture))) - || (assetTypesToDisplay.HasFlag(AssetType.Audio) && allowedAudioExtensions.Any(ext => filepath.EndsWith(ext, true, CultureInfo.InvariantCulture))) - || (assetTypesToDisplay.HasFlag(AssetType.Video) && allowedVideoExtensions.Any(ext => filepath.EndsWith(ext, true, CultureInfo.InvariantCulture))) - || (assetTypesToDisplay.HasFlag(AssetType.Unknown) && !allowedExtensions.Any(ext => filepath.EndsWith(ext, true, CultureInfo.InvariantCulture))); + var allowed = + (assetTypesToDisplay.HasFlag(AssetType.Sprite) + && allowedSpriteExtensions.Any(ext => filepath.EndsWith(ext, true, CultureInfo.InvariantCulture))) + || (assetTypesToDisplay.HasFlag(AssetType.Model) + && allowedModelExtensions.Any(ext => filepath.EndsWith(ext, true, CultureInfo.InvariantCulture))) + || (assetTypesToDisplay.HasFlag(AssetType.Audio) + && allowedAudioExtensions.Any(ext => filepath.EndsWith(ext, true, CultureInfo.InvariantCulture))) + || (assetTypesToDisplay.HasFlag(AssetType.Video) + && allowedVideoExtensions.Any(ext => filepath.EndsWith(ext, true, CultureInfo.InvariantCulture))) + || (assetTypesToDisplay.HasFlag(AssetType.Unknown) + && !allowedExtensions.Any(ext => filepath.EndsWith(ext, true, CultureInfo.InvariantCulture))); if (assetVisByName.TryGetValue(filepath, out var visible)) return visible && allowed; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs index 6f1b3cebaa..87ca226ea8 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs @@ -87,7 +87,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic const string VoteKickVoteCancel = "dialog-vote-kick.vote-cancel"; [ObjectCreator.UseCtor] - public GameInfoStatsLogic(Widget widget, ModData modData, World world, OrderManager orderManager, WorldRenderer worldRenderer, Action hideMenu, Action closeMenu) + public GameInfoStatsLogic(Widget widget, ModData modData, World world, + OrderManager orderManager, WorldRenderer worldRenderer, Action hideMenu, Action closeMenu) { var player = world.LocalPlayer; var playerPanel = widget.Get("PLAYER_LIST"); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs index c89e23c475..66d8f64b4c 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs @@ -135,7 +135,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic var timeText = formatBuildTime.Update(buildTime * timeModifier / 100); timeLabel.GetText = () => timeText; - timeLabel.TextColor = (pm != null && pm.PowerState != PowerState.Normal && tooltipIcon.ProductionQueue.Info.LowPowerModifier > 100) ? Color.Red : Color.White; + timeLabel.TextColor = + (pm != null && pm.PowerState != PowerState.Normal && tooltipIcon.ProductionQueue.Info.LowPowerModifier > 100) + ? Color.Red + : Color.White; var timeSize = font.Measure(timeText); var costText = cost.ToString(NumberFormatInfo.CurrentInfo); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/SupportPowerTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/SupportPowerTooltipLogic.cs index 203834f700..9b4e1b8417 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/SupportPowerTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/SupportPowerTooltipLogic.cs @@ -19,7 +19,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic public class SupportPowerTooltipLogic : ChromeLogic { [ObjectCreator.UseCtor] - public SupportPowerTooltipLogic(Widget widget, TooltipContainerWidget tooltipContainer, Func getTooltipIcon, World world) + public SupportPowerTooltipLogic(Widget widget, TooltipContainerWidget tooltipContainer, + Func getTooltipIcon, World world) { widget.IsVisible = () => getTooltipIcon() != null && getTooltipIcon().Power.Info != null; var nameLabel = widget.Get("NAME"); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentPromptLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentPromptLogic.cs index 9fcdbebcca..127b48506a 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentPromptLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentPromptLogic.cs @@ -40,7 +40,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic var panel = widget.Get("CONTENT_PROMPT_PANEL"); var headerTemplate = panel.Get("HEADER_TEMPLATE"); - var headerLines = !string.IsNullOrEmpty(content.InstallPromptMessage) ? content.InstallPromptMessage.Replace("\\n", "\n").Split('\n') : Array.Empty(); + var headerLines = + !string.IsNullOrEmpty(content.InstallPromptMessage) + ? content.InstallPromptMessage.Replace("\\n", "\n").Split('\n') + : Array.Empty(); var headerHeight = 0; foreach (var l in headerLines) { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index 07dab3745a..ef94ebf8a7 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -592,7 +592,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic panel = PanelType.Players; var chatWasEnabled = chatEnabled; - chatEnabled = worldRenderer.World.IsReplay || (Game.RunTime >= TextNotificationsManager.ChatDisabledUntil && TextNotificationsManager.ChatDisabledUntil != uint.MaxValue); + chatEnabled = + worldRenderer.World.IsReplay || + (Game.RunTime >= TextNotificationsManager.ChatDisabledUntil && TextNotificationsManager.ChatDisabledUntil != uint.MaxValue); if (chatEnabled && !chatWasEnabled) { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs index 572c9a1de7..8ddca8d643 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs @@ -284,7 +284,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic static void SetSpawnPoint(OrderManager orderManager, Session.Client playerToMove, int selectedSpawnPoint) { - var owned = orderManager.LobbyInfo.Clients.Any(c => c.SpawnPoint == selectedSpawnPoint) || orderManager.LobbyInfo.DisabledSpawnPoints.Contains(selectedSpawnPoint); + var owned = + orderManager.LobbyInfo.Clients.Any(c => c.SpawnPoint == selectedSpawnPoint) || + orderManager.LobbyInfo.DisabledSpawnPoints.Contains(selectedSpawnPoint); if (selectedSpawnPoint == 0 || !owned) orderManager.IssueOrder(Order.Command($"spawn {(playerToMove ?? orderManager.LocalClient).Index} {selectedSpawnPoint}")); } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs index 5d9faae63f..75b0ca0028 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs @@ -205,17 +205,28 @@ namespace OpenRA.Mods.Common.Widgets.Logic var previewSmall = SetupMapPreview(widget.Get("MAP_SMALL")); // Widgets to be made visible. - previewWidgets[PreviewStatus.Unknown] = new Widget[] { previewLarge }; - previewWidgets[PreviewStatus.Playable] = new Widget[] { previewLarge, SetupAuthorAndMapType(widget.Get("MAP_AVAILABLE")) }; - previewWidgets[PreviewStatus.Incompatible] = new Widget[] { previewLarge, widget.Get("MAP_INCOMPATIBLE") }; - previewWidgets[PreviewStatus.Validating] = new Widget[] { previewSmall, widget.Get("MAP_VALIDATING") }; - previewWidgets[PreviewStatus.UpdateAvailable] = new Widget[] { previewSmall, widget.Get("MAP_UPDATE_AVAILABLE"), updateButton }; - previewWidgets[PreviewStatus.DownloadAvailable] = new Widget[] { previewSmall, SetUpInstallButton(SetupAuthorAndMapType(widget.Get("MAP_DOWNLOAD_AVAILABLE"))) }; - previewWidgets[PreviewStatus.UpdateDownloadAvailable] = new Widget[] { previewSmall, SetUpInstallButton(widget.Get("MAP_UPDATE_DOWNLOAD_AVAILABLE")), updateButton }; - previewWidgets[PreviewStatus.Searching] = new Widget[] { previewSmall, widget.Get("MAP_SEARCHING") }; - previewWidgets[PreviewStatus.Downloading] = new Widget[] { previewSmall, SetUpDownloadProgress(widget.Get("MAP_DOWNLOADING")) }; - previewWidgets[PreviewStatus.Unavailable] = new Widget[] { previewSmall, widget.Get("MAP_UNAVAILABLE"), retryButton }; - previewWidgets[PreviewStatus.DownloadError] = new Widget[] { previewSmall, widget.Get("MAP_ERROR"), retryButton }; + previewWidgets[PreviewStatus.Unknown] = + new Widget[] { previewLarge }; + previewWidgets[PreviewStatus.Playable] = + new Widget[] { previewLarge, SetupAuthorAndMapType(widget.Get("MAP_AVAILABLE")) }; + previewWidgets[PreviewStatus.Incompatible] = + new Widget[] { previewLarge, widget.Get("MAP_INCOMPATIBLE") }; + previewWidgets[PreviewStatus.Validating] = + new Widget[] { previewSmall, widget.Get("MAP_VALIDATING") }; + previewWidgets[PreviewStatus.UpdateAvailable] = + new Widget[] { previewSmall, widget.Get("MAP_UPDATE_AVAILABLE"), updateButton }; + previewWidgets[PreviewStatus.DownloadAvailable] = + new Widget[] { previewSmall, SetUpInstallButton(SetupAuthorAndMapType(widget.Get("MAP_DOWNLOAD_AVAILABLE"))) }; + previewWidgets[PreviewStatus.UpdateDownloadAvailable] = + new Widget[] { previewSmall, SetUpInstallButton(widget.Get("MAP_UPDATE_DOWNLOAD_AVAILABLE")), updateButton }; + previewWidgets[PreviewStatus.Searching] = + new Widget[] { previewSmall, widget.Get("MAP_SEARCHING") }; + previewWidgets[PreviewStatus.Downloading] = + new Widget[] { previewSmall, SetUpDownloadProgress(widget.Get("MAP_DOWNLOADING")) }; + previewWidgets[PreviewStatus.Unavailable] = + new Widget[] { previewSmall, widget.Get("MAP_UNAVAILABLE"), retryButton }; + previewWidgets[PreviewStatus.DownloadError] = + new Widget[] { previewSmall, widget.Get("MAP_ERROR"), retryButton }; // Hide all widgets. foreach (var preview in previewWidgets) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/SpawnSelectorTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/SpawnSelectorTooltipLogic.cs index cdaca3a1cb..771362f7fa 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/SpawnSelectorTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/SpawnSelectorTooltipLogic.cs @@ -29,7 +29,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic readonly CachedTransform teamMessage; [ObjectCreator.UseCtor] - public SpawnSelectorTooltipLogic(Widget widget, ModData modData, TooltipContainerWidget tooltipContainer, MapPreviewWidget preview, bool showUnoccupiedSpawnpoints) + public SpawnSelectorTooltipLogic(Widget widget, ModData modData, + TooltipContainerWidget tooltipContainer, MapPreviewWidget preview, bool showUnoccupiedSpawnpoints) { var showTooltip = true; widget.IsVisible = () => preview.TooltipSpawnIndex != -1 && showTooltip; diff --git a/OpenRA.Mods.Common/Widgets/Logic/ReplayUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/ReplayUtils.cs index 0ceb30501a..6039161609 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ReplayUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ReplayUtils.cs @@ -72,7 +72,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic static bool IncompatibleReplayDialog(string text, Dictionary textArguments, ModData modData, Action onCancel) { - ConfirmationDialogs.ButtonPrompt(modData, IncompatibleReplayTitle, text, textArguments: textArguments, onCancel: onCancel, cancelText: IncompatibleReplayAccept); + ConfirmationDialogs.ButtonPrompt( + modData, IncompatibleReplayTitle, text, textArguments: textArguments, onCancel: onCancel, cancelText: IncompatibleReplayAccept); return false; } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs index c757074efc..350712991d 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs @@ -70,7 +70,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic var settings = Game.Settings; - map = modData.MapCache[modData.MapCache.ChooseInitialMap(modData.MapCache.PickLastModifiedMap(MapVisibility.Lobby) ?? Game.Settings.Server.Map, Game.CosmeticRandom)]; + map = modData.MapCache[ + modData.MapCache.ChooseInitialMap( + modData.MapCache.PickLastModifiedMap(MapVisibility.Lobby) ?? Game.Settings.Server.Map, + Game.CosmeticRandom)]; Ui.LoadWidget("MAP_PREVIEW", panel.Get("MAP_PREVIEW_ROOT"), new WidgetArgs { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Settings/AudioSettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Settings/AudioSettingsLogic.cs index f2bf3d3550..ce31770756 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Settings/AudioSettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Settings/AudioSettingsLogic.cs @@ -32,7 +32,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic } [ObjectCreator.UseCtor] - public AudioSettingsLogic(Action>, Func> registerPanel, string panelID, string label, WorldRenderer worldRenderer) + public AudioSettingsLogic( + Action>, Func> registerPanel, + string panelID, + string label, + WorldRenderer worldRenderer) { this.worldRenderer = worldRenderer; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs index b8d85b4a39..1485a9c837 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs @@ -276,7 +276,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic duplicateHotkeyDefinition = modData.Hotkeys.GetFirstDuplicate(selectedHotkeyDefinition, hotkeyEntryWidget.Key); isHotkeyValid = duplicateHotkeyDefinition == null || selectedHotkeyDefinition.Readonly; - isHotkeyDefault = hotkeyEntryWidget.Key == selectedHotkeyDefinition.Default || (!hotkeyEntryWidget.Key.IsValid() && !selectedHotkeyDefinition.Default.IsValid()); + isHotkeyDefault = + hotkeyEntryWidget.Key == selectedHotkeyDefinition.Default || + (!hotkeyEntryWidget.Key.IsValid() && !selectedHotkeyDefinition.Default.IsValid()); if (isHotkeyValid) { diff --git a/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs b/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs index 57bf3fe222..a8156027d8 100644 --- a/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs +++ b/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs @@ -212,7 +212,13 @@ namespace OpenRA.Mods.Common.Widgets } if (occupied) - WidgetUtils.FillEllipseWithColor(new Rectangle(pos.X - offset.X + 1, pos.Y - offset.Y + 1, (int)sprite.Size.X - 2, (int)sprite.Size.Y - 2), occupant.Color); + WidgetUtils.FillEllipseWithColor( + new Rectangle( + pos.X - offset.X + 1, + pos.Y - offset.Y + 1, + (int)sprite.Size.X - 2, + (int)sprite.Size.Y - 2), + occupant.Color); WidgetUtils.DrawSprite(sprite, pos - offset); diff --git a/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs b/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs index 29e38c0389..50966d2f97 100644 --- a/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs @@ -269,7 +269,9 @@ namespace OpenRA.Mods.Common.Widgets lastIconIdx = i; TooltipIcon = productionIcons[i]; - currentTooltipToken = tooltipContainer.Value.SetTooltip(TooltipTemplate, new WidgetArgs { { "player", GetPlayer() }, { "getTooltipIcon", GetTooltipIcon } }); + currentTooltipToken = tooltipContainer.Value.SetTooltip( + TooltipTemplate, + new WidgetArgs { { "player", GetPlayer() }, { "getTooltipIcon", GetTooltipIcon } }); return; } diff --git a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs index 9f4be6e8c5..592c68da24 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs @@ -336,7 +336,8 @@ namespace OpenRA.Mods.Common.Widgets if (buildable != null) { - if (CurrentQueue.Info.PayUpFront && currentQueue.GetProductionCost(buildable) > CurrentQueue.Actor.Owner.PlayerActor.Trait().GetCashAndResources()) + if (CurrentQueue.Info.PayUpFront && + currentQueue.GetProductionCost(buildable) > CurrentQueue.Actor.Owner.PlayerActor.Trait().GetCashAndResources()) return false; Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Sounds", ClickSound, null); diff --git a/OpenRA.Mods.Common/Widgets/SelectionUtils.cs b/OpenRA.Mods.Common/Widgets/SelectionUtils.cs index d17919fc8f..5666319d01 100644 --- a/OpenRA.Mods.Common/Widgets/SelectionUtils.cs +++ b/OpenRA.Mods.Common/Widgets/SelectionUtils.cs @@ -20,18 +20,21 @@ namespace OpenRA.Mods.Common.Widgets { public static class SelectionUtils { - public static IEnumerable SelectActorsOnScreen(World world, WorldRenderer wr, IEnumerable selectionClasses, IEnumerable players) + public static IEnumerable SelectActorsOnScreen( + World world, WorldRenderer wr, IEnumerable selectionClasses, IEnumerable players) { var actors = world.ScreenMap.ActorsInMouseBox(wr.Viewport.TopLeft, wr.Viewport.BottomRight).Select(a => a.Actor); return SelectActorsByOwnerAndSelectionClass(actors, players, selectionClasses); } - public static IEnumerable SelectActorsInWorld(World world, IEnumerable selectionClasses, IEnumerable players) + public static IEnumerable SelectActorsInWorld( + World world, IEnumerable selectionClasses, IEnumerable players) { return SelectActorsByOwnerAndSelectionClass(world.Actors.Where(a => a.IsInWorld), players, selectionClasses); } - public static IEnumerable SelectActorsByOwnerAndSelectionClass(IEnumerable actors, IEnumerable owners, IEnumerable selectionClasses) + public static IEnumerable SelectActorsByOwnerAndSelectionClass( + IEnumerable actors, IEnumerable owners, IEnumerable selectionClasses) { return actors.Where(a => { diff --git a/OpenRA.Mods.Common/Widgets/WidgetUtils.cs b/OpenRA.Mods.Common/Widgets/WidgetUtils.cs index 4cd449df5c..3ceaa541e1 100644 --- a/OpenRA.Mods.Common/Widgets/WidgetUtils.cs +++ b/OpenRA.Mods.Common/Widgets/WidgetUtils.cs @@ -20,7 +20,8 @@ namespace OpenRA.Mods.Common.Widgets { public static class WidgetUtils { - public static string GetStatefulImageName(string baseName, bool disabled = false, bool pressed = false, bool hover = false, bool focused = false) + public static string GetStatefulImageName( + string baseName, bool disabled = false, bool pressed = false, bool hover = false, bool focused = false) { var suffix = disabled ? "-disabled" : focused ? "-focused" : @@ -31,7 +32,8 @@ namespace OpenRA.Mods.Common.Widgets return baseName + suffix; } - public static CachedTransform<(bool Disabled, bool Pressed, bool Hover, bool Focused, bool Highlighted), Sprite> GetCachedStatefulImage(string collection, string imageName) + public static CachedTransform<(bool Disabled, bool Pressed, bool Hover, bool Focused, bool Highlighted), Sprite> + GetCachedStatefulImage(string collection, string imageName) { return new CachedTransform<(bool, bool, bool, bool, bool), Sprite>( ((bool Disabled, bool Pressed, bool Hover, bool Focused, bool Highlighted) args) => @@ -43,7 +45,8 @@ namespace OpenRA.Mods.Common.Widgets } // TODO: refactor buttons and related UI to use this function - public static CachedTransform<(bool Disabled, bool Pressed, bool Hover, bool Focused, bool Highlighted), Sprite[]> GetCachedStatefulPanelImages(string collection) + public static CachedTransform<(bool Disabled, bool Pressed, bool Hover, bool Focused, bool Highlighted), Sprite[]> + GetCachedStatefulPanelImages(string collection) { return new CachedTransform<(bool, bool, bool, bool, bool), Sprite[]>( ((bool Disabled, bool Pressed, bool Hover, bool Focused, bool Highlighted) args) => diff --git a/OpenRA.Mods.Common/WorldExtensions.cs b/OpenRA.Mods.Common/WorldExtensions.cs index 77aff2e5e7..1a7add10ba 100644 --- a/OpenRA.Mods.Common/WorldExtensions.cs +++ b/OpenRA.Mods.Common/WorldExtensions.cs @@ -25,7 +25,8 @@ namespace OpenRA.Mods.Common /// is used to define locations around each actor in /// of which one must be reachable. /// - public static IEnumerable<(Actor Actor, WVec[] ReachableOffsets)> WithPathFrom(this IEnumerable actors, Actor sourceActor, Func targetOffsets) + public static IEnumerable<(Actor Actor, WVec[] ReachableOffsets)> WithPathFrom( + this IEnumerable actors, Actor sourceActor, Func targetOffsets) { if (sourceActor.Info.HasTraitInfo()) return actors.Select(a => (a, targetOffsets(a))); @@ -66,7 +67,8 @@ namespace OpenRA.Mods.Common /// is used to define locations around each actor in /// of which one must be reachable. /// - public static Actor ClosestToWithPathFrom(this IEnumerable actors, Actor sourceActor, Func targetOffsets = null) + public static Actor ClosestToWithPathFrom( + this IEnumerable actors, Actor sourceActor, Func targetOffsets = null) { return actors .WithPathFrom(sourceActor, targetOffsets ?? (_ => new[] { WVec.Zero })) @@ -178,7 +180,8 @@ namespace OpenRA.Mods.Common /// target of a path from the actor, returns the nearest by comparing the . /// Only terrain is taken into account, i.e. as if was given. /// - public static Actor ClosestToWithPathToAny(this IEnumerable actors, World world, Func targetPositions) + public static Actor ClosestToWithPathToAny( + this IEnumerable actors, World world, Func targetPositions) { return actors .WithPathToAny(world, targetPositions) @@ -206,7 +209,8 @@ namespace OpenRA.Mods.Common /// If set, only considers the size of actors that have an /// trait which may improve search performance. However does NOT filter the returned actors on this trait. /// A list of all the actors intersected by the line. - public static IEnumerable FindActorsOnLine(this World world, WPos lineStart, WPos lineEnd, WDist lineWidth, bool onlyBlockers = false) + public static IEnumerable FindActorsOnLine( + this World world, WPos lineStart, WPos lineEnd, WDist lineWidth, bool onlyBlockers = false) { // This line intersection check is done by first just finding all actors within a square that starts at the source, and ends at the target. // Then we iterate over this list, and find all actors for which their health radius is at least within lineWidth of the line. diff --git a/OpenRA.Mods.D2k/Activities/SwallowActor.cs b/OpenRA.Mods.D2k/Activities/SwallowActor.cs index eafed0080f..86d528a4b3 100644 --- a/OpenRA.Mods.D2k/Activities/SwallowActor.cs +++ b/OpenRA.Mods.D2k/Activities/SwallowActor.cs @@ -80,7 +80,8 @@ namespace OpenRA.Mods.D2k.Activities Game.Sound.Play(SoundType.World, swallow.Info.WormAttackSound, self.CenterPosition); foreach (var player in affectedPlayers) - self.World.AddFrameEndTask(w => w.Add(new MapNotificationEffect(player, "Speech", swallow.Info.WormAttackNotification, 25, true, attackPosition, Color.Red))); + self.World.AddFrameEndTask(w => w.Add( + new MapNotificationEffect(player, "Speech", swallow.Info.WormAttackNotification, 25, true, attackPosition, Color.Red))); if (affectedPlayers.Contains(self.World.LocalPlayer)) TextNotificationsManager.AddTransientLine(self.World.LocalPlayer, swallow.Info.WormAttackTextNotification); diff --git a/OpenRA.Mods.D2k/Graphics/D2kSpriteSequence.cs b/OpenRA.Mods.D2k/Graphics/D2kSpriteSequence.cs index caf4b5517e..3f46eef378 100644 --- a/OpenRA.Mods.D2k/Graphics/D2kSpriteSequence.cs +++ b/OpenRA.Mods.D2k/Graphics/D2kSpriteSequence.cs @@ -23,7 +23,8 @@ namespace OpenRA.Mods.Cnc.Graphics public D2kSpriteSequenceLoader(ModData modData) : base(modData) { } - public override ISpriteSequence CreateSequence(ModData modData, string tileset, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults) + public override ISpriteSequence CreateSequence( + ModData modData, string tileset, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults) { return new D2kSpriteSequence(cache, this, image, sequence, data, defaults); } diff --git a/OpenRA.Platforms.Default/DefaultPlatform.cs b/OpenRA.Platforms.Default/DefaultPlatform.cs index 5c7bc2780e..94f0c19b9e 100644 --- a/OpenRA.Platforms.Default/DefaultPlatform.cs +++ b/OpenRA.Platforms.Default/DefaultPlatform.cs @@ -16,7 +16,8 @@ namespace OpenRA.Platforms.Default { public class DefaultPlatform : IPlatform { - public IPlatformWindow CreateWindow(Size size, WindowMode windowMode, float scaleModifier, int vertexBatchSize, int indexBatchSize, int videoDisplay, GLProfile profile) + public IPlatformWindow CreateWindow( + Size size, WindowMode windowMode, float scaleModifier, int vertexBatchSize, int indexBatchSize, int videoDisplay, GLProfile profile) { return new Sdl2PlatformWindow(size, windowMode, scaleModifier, vertexBatchSize, indexBatchSize, videoDisplay, profile); }