From 9d5d2ab493f6ad871ba81cde8900896d965f8770 Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Sat, 13 Jan 2024 20:59:33 +0000 Subject: [PATCH] RCS0056 - roslynator_max_line_length = 180 --- .editorconfig | 7 +++++ Directory.Build.props | 1 + OpenRA.Game/Graphics/Animation.cs | 9 ++++-- OpenRA.Game/Graphics/RgbaColorRenderer.cs | 3 +- OpenRA.Game/Graphics/SpriteCache.cs | 3 +- OpenRA.Game/Map/MapCache.cs | 10 ++++-- OpenRA.Game/Map/MapPreview.cs | 3 +- OpenRA.Game/MiniYaml.cs | 3 +- OpenRA.Game/Network/Order.cs | 3 +- OpenRA.Game/Renderer.cs | 3 +- OpenRA.Game/Server/PlayerMessageTracker.cs | 5 ++- OpenRA.Game/Support/ExceptionHandler.cs | 6 +++- OpenRA.Game/Support/VariableExpression.cs | 8 +++-- OpenRA.Game/WDist.cs | 3 +- .../Installer/ExtractMixSourceAction.cs | 8 +++-- OpenRA.Mods.Common/Activities/Air/Fly.cs | 4 ++- .../Activities/InstantRepair.cs | 4 ++- OpenRA.Mods.Common/Activities/Resupply.cs | 6 +++- .../Commands/DebugVisualizationCommands.cs | 17 +++++----- .../Graphics/ContrailRenderable.cs | 20 +++++++++--- .../SourceActions/CopySourceAction.cs | 8 +++-- .../SourceActions/ExtractBlastSourceAction.cs | 8 +++-- .../SourceActions/ExtractIscabSourceAction.cs | 4 ++- .../SourceActions/ExtractMscabSourceAction.cs | 4 ++- .../SourceActions/ExtractRawSourceAction.cs | 4 ++- OpenRA.Mods.Common/Lint/CheckActors.cs | 4 ++- OpenRA.Mods.Common/Lint/CheckSequences.cs | 3 +- .../Lint/CheckTranslationReference.cs | 5 ++- OpenRA.Mods.Common/Projectiles/AreaBeam.cs | 5 ++- OpenRA.Mods.Common/Projectiles/Bullet.cs | 5 ++- OpenRA.Mods.Common/Projectiles/InstantHit.cs | 5 ++- OpenRA.Mods.Common/Projectiles/LaserZap.cs | 5 ++- OpenRA.Mods.Common/Projectiles/Missile.cs | 5 ++- OpenRA.Mods.Common/Projectiles/Railgun.cs | 5 ++- OpenRA.Mods.Common/Terrain/TerrainInfo.cs | 6 ++-- OpenRA.Mods.Common/Traits/AutoCarryable.cs | 4 ++- .../BotModuleLogic/MinelayerBotModule.cs | 17 ++++++++-- .../GrantConditionOnDeployWithCharge.cs | 7 +++-- .../Conditions/ProximityExternalCondition.cs | 3 +- .../Traits/DockClientManager.cs | 4 ++- OpenRA.Mods.Common/Traits/DockHost.cs | 3 +- .../Traits/Palettes/PaletteFromGrayscale.cs | 4 ++- .../Player/ClassicParallelProductionQueue.cs | 4 ++- .../Traits/Render/WithAttackOverlay.cs | 3 +- .../Traits/Render/WithIdleOverlay.cs | 4 ++- .../Render/WithProductionDoorOverlay.cs | 3 +- .../Traits/Render/WithSwitchableOverlay.cs | 6 +++- .../Traits/World/ColorPickerManager.cs | 31 +++++++++++++++---- .../20210321/RenameContrailProperties.cs | 4 ++- .../UnhardcodeBaseBuilderBotModule.cs | 15 ++++++++- .../Rules/20210321/UnhardcodeSquadManager.cs | 15 ++++++++- ...CheckConditionalTraitInterfaceOverrides.cs | 4 ++- .../UtilityCommands/ExtractChromeStrings.cs | 12 +++++-- .../UtilityCommands/ExtractEmmyLuaAPI.cs | 6 ++-- .../Widgets/Logic/ConnectionLogic.cs | 7 +++-- .../Logic/Editor/MapEditorSelectionLogic.cs | 4 ++- .../Logic/Ingame/AddFactionSuffixLogic.cs | 3 +- .../Logic/Ingame/ObserverStatsLogic.cs | 18 ++++++++--- .../Widgets/Logic/Lobby/LobbyUtils.cs | 3 +- .../Widgets/Logic/Lobby/MapPreviewLogic.cs | 16 +++++++++- .../Logic/Settings/DisplaySettingsLogic.cs | 4 ++- .../Logic/Settings/HotkeysSettingsLogic.cs | 4 ++- .../Widgets/ObserverProductionIconsWidget.cs | 5 ++- .../ObserverSupportPowerIconsWidget.cs | 5 ++- .../Widgets/ProductionTabsWidget.cs | 8 +++-- .../D2kActorPreviewPlaceBuildingPreview.cs | 7 ++++- 66 files changed, 338 insertions(+), 97 deletions(-) diff --git a/.editorconfig b/.editorconfig index b75919d69a..c77c2564fa 100644 --- a/.editorconfig +++ b/.editorconfig @@ -976,8 +976,15 @@ dotnet_diagnostic.CA2259.severity = suggestion # TODO: Change to warning once us # We disable the rule category by setting severity to none. # Below we enable specific rules by setting severity to warning. +# Rules are listed below with any options available. +# Options are commented out if they match the defaults. dotnet_analyzer_diagnostic.category-roslynator.severity = none +# A line is too long. +dotnet_diagnostic.RCS0056.severity = warning +roslynator_max_line_length = 180 #140 +#roslynator_tab_length = 4 + # Remove redundant 'sealed' modifier. dotnet_diagnostic.RCS1034.severity = warning diff --git a/Directory.Build.props b/Directory.Build.props index 68744418df..06d2634799 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -56,5 +56,6 @@ + diff --git a/OpenRA.Game/Graphics/Animation.cs b/OpenRA.Game/Graphics/Animation.cs index c1565fad2f..a1d0c0b03b 100644 --- a/OpenRA.Game/Graphics/Animation.cs +++ b/OpenRA.Game/Graphics/Animation.cs @@ -58,13 +58,16 @@ namespace OpenRA.Graphics var tintModifiers = CurrentSequence.IgnoreWorldTint ? TintModifiers.IgnoreWorldTint : TintModifiers.None; var alpha = CurrentSequence.GetAlpha(CurrentFrame); var (image, rotation) = CurrentSequence.GetSpriteWithRotation(CurrentFrame, facingFunc()); - var imageRenderable = new SpriteRenderable(image, pos, offset, CurrentSequence.ZOffset + zOffset, palette, CurrentSequence.Scale, alpha, float3.Ones, tintModifiers, IsDecoration, - rotation); + var imageRenderable = new SpriteRenderable( + image, pos, offset, CurrentSequence.ZOffset + zOffset, palette, + CurrentSequence.Scale, alpha, float3.Ones, tintModifiers, IsDecoration, rotation); var shadow = CurrentSequence.GetShadow(CurrentFrame, facingFunc()); if (shadow != null) { - var shadowRenderable = new SpriteRenderable(shadow, pos, offset, CurrentSequence.ShadowZOffset + zOffset, palette, CurrentSequence.Scale, 1f, float3.Ones, tintModifiers, + var shadowRenderable = new SpriteRenderable( + shadow, pos, offset, CurrentSequence.ShadowZOffset + zOffset, palette, + CurrentSequence.Scale, 1f, float3.Ones, tintModifiers, true, rotation); return new IRenderable[] { shadowRenderable, imageRenderable }; } diff --git a/OpenRA.Game/Graphics/RgbaColorRenderer.cs b/OpenRA.Game/Graphics/RgbaColorRenderer.cs index d9a4436cb6..f2ceac5337 100644 --- a/OpenRA.Game/Graphics/RgbaColorRenderer.cs +++ b/OpenRA.Game/Graphics/RgbaColorRenderer.cs @@ -216,7 +216,8 @@ namespace OpenRA.Graphics parent.DrawRGBAQuad(vertices, blendMode); } - public void FillRect(in float3 a, in float3 b, in float3 c, in float3 d, Color topLeftColor, Color topRightColor, Color bottomRightColor, Color bottomLeftColor, BlendMode blendMode = BlendMode.Alpha) + public void FillRect(in float3 a, in float3 b, in float3 c, in float3 d, + Color topLeftColor, Color topRightColor, Color bottomRightColor, Color bottomLeftColor, BlendMode blendMode = BlendMode.Alpha) { vertices[0] = VertexWithColor(a + Offset, topLeftColor); vertices[1] = VertexWithColor(b + Offset, topRightColor); diff --git a/OpenRA.Game/Graphics/SpriteCache.cs b/OpenRA.Game/Graphics/SpriteCache.cs index 24e5f8cf77..f50858820f 100644 --- a/OpenRA.Game/Graphics/SpriteCache.cs +++ b/OpenRA.Game/Graphics/SpriteCache.cs @@ -45,7 +45,8 @@ namespace OpenRA.Graphics this.loaders = loaders; } - public int ReserveSprites(string filename, IEnumerable frames, MiniYamlNode.SourceLocation location, Func adjustFrame = null, bool premultiplied = false) + public int ReserveSprites(string filename, IEnumerable frames, MiniYamlNode.SourceLocation location, + Func adjustFrame = null, bool premultiplied = false) { var token = nextReservationToken++; spriteReservations[token] = (frames?.ToArray(), location, adjustFrame, premultiplied); diff --git a/OpenRA.Game/Map/MapCache.cs b/OpenRA.Game/Map/MapCache.cs index 05c8fcc170..a053ae2c32 100644 --- a/OpenRA.Game/Map/MapCache.cs +++ b/OpenRA.Game/Map/MapCache.cs @@ -410,10 +410,16 @@ namespace OpenRA { UpdateMaps(); var map = string.IsNullOrEmpty(initialUid) ? null : previews[initialUid]; - if (map == null || map.Status != MapStatus.Available || !map.Visibility.HasFlag(MapVisibility.Lobby) || (map.Class != MapClassification.System && map.Class != MapClassification.User)) + if (map == null || + map.Status != MapStatus.Available || + !map.Visibility.HasFlag(MapVisibility.Lobby) || + (map.Class != MapClassification.System && map.Class != MapClassification.User)) { var selected = previews.Values.Where(IsSuitableInitialMap).RandomOrDefault(random) ?? - previews.Values.FirstOrDefault(m => m.Status == MapStatus.Available && m.Visibility.HasFlag(MapVisibility.Lobby) && (m.Class == MapClassification.System || m.Class == MapClassification.User)); + previews.Values.FirstOrDefault(m => + m.Status == MapStatus.Available && + m.Visibility.HasFlag(MapVisibility.Lobby) && + (m.Class == MapClassification.System || m.Class == MapClassification.User)); return selected == null ? string.Empty : selected.Uid; } diff --git a/OpenRA.Game/Map/MapPreview.cs b/OpenRA.Game/Map/MapPreview.cs index 37c7e7cb84..5c39051340 100644 --- a/OpenRA.Game/Map/MapPreview.cs +++ b/OpenRA.Game/Map/MapPreview.cs @@ -339,7 +339,8 @@ namespace OpenRA }, null); } - public void UpdateFromMap(IReadOnlyPackage p, IReadOnlyPackage parent, MapClassification classification, string[] mapCompatibility, MapGridType gridType, IEnumerable> modDataRules) + public void UpdateFromMap(IReadOnlyPackage p, IReadOnlyPackage parent, MapClassification classification, + string[] mapCompatibility, MapGridType gridType, IEnumerable> modDataRules) { Dictionary yaml; using (var yamlStream = p.GetStream("map.yaml")) diff --git a/OpenRA.Game/MiniYaml.cs b/OpenRA.Game/MiniYaml.cs index ade6ade4b6..74f96f3f5f 100644 --- a/OpenRA.Game/MiniYaml.cs +++ b/OpenRA.Game/MiniYaml.cs @@ -463,7 +463,8 @@ namespace OpenRA } catch (ArgumentException) { - throw new YamlException($"{n.Location}: Parent type `{n.Value.Value}` was already inherited by this yaml tree at {inherited[n.Value.Value]} (note: may be from a derived tree)"); + throw new YamlException( + $"{n.Location}: Parent type `{n.Value.Value}` was already inherited by this yaml tree at {inherited[n.Value.Value]} (note: may be from a derived tree)"); } foreach (var r in ResolveInherits(parent, tree, inherited)) diff --git a/OpenRA.Game/Network/Order.cs b/OpenRA.Game/Network/Order.cs index 02be1b4d08..63d41e6d75 100644 --- a/OpenRA.Game/Network/Order.cs +++ b/OpenRA.Game/Network/Order.cs @@ -78,7 +78,8 @@ namespace OpenRA readonly Target target; readonly Target visualFeedbackTarget; - Order(string orderString, Actor subject, in Target target, string targetString, bool queued, Actor[] extraActors, CPos extraLocation, uint extraData, Actor[] groupedActors = null) + Order(string orderString, Actor subject, in Target target, string targetString, bool queued, + Actor[] extraActors, CPos extraLocation, uint extraData, Actor[] groupedActors = null) { OrderString = orderString ?? ""; Subject = subject; diff --git a/OpenRA.Game/Renderer.cs b/OpenRA.Game/Renderer.cs index 722bbb553c..c16351a857 100644 --- a/OpenRA.Game/Renderer.cs +++ b/OpenRA.Game/Renderer.cs @@ -337,7 +337,8 @@ namespace OpenRA // Render the compositor buffers to the screen // HACK / PERF: Fudge the coordinates to cover the actual window while keeping the buffer viewport parameters // This saves us two redundant (and expensive) SetViewportParams each frame - RgbaSpriteRenderer.DrawSprite(screenSprite, new float3(0, lastBufferSize.Height, 0), new float3(lastBufferSize.Width / screenSprite.Size.X, -lastBufferSize.Height / screenSprite.Size.Y, 1f)); + RgbaSpriteRenderer.DrawSprite(screenSprite, new float3(0, lastBufferSize.Height, 0), + new float3(lastBufferSize.Width / screenSprite.Size.X, -lastBufferSize.Height / screenSprite.Size.Y, 1f)); Flush(); Window.PumpInput(inputHandler); diff --git a/OpenRA.Game/Server/PlayerMessageTracker.cs b/OpenRA.Game/Server/PlayerMessageTracker.cs index e4dce54b84..3ce1528ef8 100644 --- a/OpenRA.Game/Server/PlayerMessageTracker.cs +++ b/OpenRA.Game/Server/PlayerMessageTracker.cs @@ -24,7 +24,10 @@ namespace OpenRA.Server readonly Action dispatchOrdersToClient; readonly Action> sendLocalizedMessageTo; - public PlayerMessageTracker(Server server, Action dispatchOrdersToClient, Action> sendLocalizedMessageTo) + public PlayerMessageTracker( + Server server, + Action dispatchOrdersToClient, + Action> sendLocalizedMessageTo) { this.server = server; this.dispatchOrdersToClient = dispatchOrdersToClient; diff --git a/OpenRA.Game/Support/ExceptionHandler.cs b/OpenRA.Game/Support/ExceptionHandler.cs index f030e2790b..87d1034fc5 100644 --- a/OpenRA.Game/Support/ExceptionHandler.cs +++ b/OpenRA.Game/Support/ExceptionHandler.cs @@ -44,7 +44,11 @@ namespace OpenRA Log.Write("exception", $"Date: {DateTime.UtcNow:u}"); Log.Write("exception", $"Operating System: {Platform.CurrentPlatform} ({Platform.CurrentArchitecture}, {Environment.OSVersion})"); Log.Write("exception", $"Runtime Version: {Platform.RuntimeVersion}"); - Log.Write("exception", $"Installed Language: {CultureInfo.InstalledUICulture.TwoLetterISOLanguageName} (Installed) {CultureInfo.CurrentCulture.TwoLetterISOLanguageName} (Current) {CultureInfo.CurrentUICulture.TwoLetterISOLanguageName} (Current UI)"); + Log.Write("exception", + "Installed Language: " + + $"{CultureInfo.InstalledUICulture.TwoLetterISOLanguageName} (Installed) " + + $"{CultureInfo.CurrentCulture.TwoLetterISOLanguageName} (Current) " + + $"{CultureInfo.CurrentUICulture.TwoLetterISOLanguageName} (Current UI)"); var rpt = BuildExceptionReport(ex).ToString(); Log.Write("exception", rpt); diff --git a/OpenRA.Game/Support/VariableExpression.cs b/OpenRA.Game/Support/VariableExpression.cs index 1cd2d0013f..0e5d335f83 100644 --- a/OpenRA.Game/Support/VariableExpression.cs +++ b/OpenRA.Game/Support/VariableExpression.cs @@ -629,7 +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}"); } } @@ -736,7 +737,10 @@ namespace OpenRA.Support return IfThenElse(expression, One, Zero); } - throw new InvalidProgramException($"Unable to convert ExpressionType.{Enum.GetValues()[(int)fromType]} to ExpressionType.{Enum.GetValues()[(int)toType]}"); + throw new InvalidProgramException( + "Unable to convert " + + $"ExpressionType.{Enum.GetValues()[(int)fromType]} to " + + $"ExpressionType.{Enum.GetValues()[(int)toType]}"); } public Expression Pop(ExpressionType type) diff --git a/OpenRA.Game/WDist.cs b/OpenRA.Game/WDist.cs index 4d0f319851..66180ca8ce 100644 --- a/OpenRA.Game/WDist.cs +++ b/OpenRA.Game/WDist.cs @@ -21,7 +21,8 @@ namespace OpenRA /// /// 1d world distance - 1024 units = 1 cell. /// - public readonly struct WDist : IComparable, IComparable, IEquatable, IScriptBindable, ILuaAdditionBinding, ILuaSubtractionBinding, ILuaEqualityBinding, ILuaTableBinding + public readonly struct WDist : IComparable, IComparable, IEquatable, + IScriptBindable, ILuaAdditionBinding, ILuaSubtractionBinding, ILuaEqualityBinding, ILuaTableBinding { public readonly int Length; public long LengthSquared => (long)Length * Length; diff --git a/OpenRA.Mods.Cnc/Installer/ExtractMixSourceAction.cs b/OpenRA.Mods.Cnc/Installer/ExtractMixSourceAction.cs index 5e2708413c..b8d01cbe7a 100644 --- a/OpenRA.Mods.Cnc/Installer/ExtractMixSourceAction.cs +++ b/OpenRA.Mods.Cnc/Installer/ExtractMixSourceAction.cs @@ -49,9 +49,13 @@ namespace OpenRA.Mods.Cnc.Installer Action onProgress = null; if (stream.Length < InstallFromSourceLogic.ShowPercentageThreshold) - updateMessage(TranslationProvider.GetString(InstallFromSourceLogic.Extracing, Translation.Arguments("filename", displayFilename))); + updateMessage(TranslationProvider.GetString( + InstallFromSourceLogic.Extracing, + Translation.Arguments("filename", displayFilename))); else - onProgress = b => updateMessage(TranslationProvider.GetString(InstallFromSourceLogic.ExtractingProgress, Translation.Arguments("filename", displayFilename, "progress", 100 * b / stream.Length))); + onProgress = b => updateMessage(TranslationProvider.GetString( + InstallFromSourceLogic.ExtractingProgress, + Translation.Arguments("filename", displayFilename, "progress", 100 * b / stream.Length))); using (var target = File.OpenWrite(targetPath)) { diff --git a/OpenRA.Mods.Common/Activities/Air/Fly.cs b/OpenRA.Mods.Common/Activities/Air/Fly.cs index c7063571bc..acdbb9a33d 100644 --- a/OpenRA.Mods.Common/Activities/Air/Fly.cs +++ b/OpenRA.Mods.Common/Activities/Air/Fly.cs @@ -204,7 +204,9 @@ namespace OpenRA.Mods.Common.Activities // HACK: Consider ourselves blocked if we have moved by less than 64 WDist in the last five ticks // Stop if we are blocked and close enough - if (previousPositions.Count == previousPositions.Capacity && (previousPositions.First() - previousPositions.Last()).LengthSquared < 4096 && delta.HorizontalLengthSquared <= nearEnough.LengthSquared) + if (previousPositions.Count == previousPositions.Capacity && + (previousPositions.First() - previousPositions.Last()).LengthSquared < 4096 && + delta.HorizontalLengthSquared <= nearEnough.LengthSquared) return true; // The next move would overshoot, so consider it close enough or set final position if we CanSlide diff --git a/OpenRA.Mods.Common/Activities/InstantRepair.cs b/OpenRA.Mods.Common/Activities/InstantRepair.cs index c415ed1434..87c3664590 100644 --- a/OpenRA.Mods.Common/Activities/InstantRepair.cs +++ b/OpenRA.Mods.Common/Activities/InstantRepair.cs @@ -38,7 +38,9 @@ namespace OpenRA.Mods.Common.Activities // Make sure we can still repair the target before entering // (but not before, because this may stop the actor in the middle of nowhere) var stance = self.Owner.RelationshipWith(enterActor.Owner); - if (enterHealth == null || enterHealth.DamageState == DamageState.Undamaged || enterInstantlyRepariable == null || enterInstantlyRepariable.IsTraitDisabled || !info.ValidRelationships.HasRelationship(stance)) + if (enterHealth == null || enterHealth.DamageState == DamageState.Undamaged || + enterInstantlyRepariable == null || enterInstantlyRepariable.IsTraitDisabled || + !info.ValidRelationships.HasRelationship(stance)) { Cancel(self, true); return false; diff --git a/OpenRA.Mods.Common/Activities/Resupply.cs b/OpenRA.Mods.Common/Activities/Resupply.cs index 4b67b57da4..60056d44eb 100644 --- a/OpenRA.Mods.Common/Activities/Resupply.cs +++ b/OpenRA.Mods.Common/Activities/Resupply.cs @@ -228,7 +228,11 @@ namespace OpenRA.Mods.Common.Activities { moveCooldownHelper.NotifyMoveQueued(); foreach (var cell in rp.Path) - QueueChild(new AttackMoveActivity(self, () => move.MoveTo(cell, 1, ignoreActor: repairableNear != null ? null : host.Actor, targetLineColor: aircraft.Info.TargetLineColor))); + QueueChild(new AttackMoveActivity(self, () => move.MoveTo( + cell, + 1, + ignoreActor: repairableNear != null ? null : host.Actor, + targetLineColor: aircraft.Info.TargetLineColor))); } else QueueChild(new TakeOff(self)); diff --git a/OpenRA.Mods.Common/Commands/DebugVisualizationCommands.cs b/OpenRA.Mods.Common/Commands/DebugVisualizationCommands.cs index 374eb49cb9..b2825c1218 100644 --- a/OpenRA.Mods.Common/Commands/DebugVisualizationCommands.cs +++ b/OpenRA.Mods.Common/Commands/DebugVisualizationCommands.cs @@ -38,14 +38,15 @@ namespace OpenRA.Mods.Common.Commands [TranslationReference] const string ActorTagsOverlayDescripition = "description-actor-tags-overlay"; - readonly IDictionary Handler)> commandHandlers = new Dictionary Handler)> - { - { "combat-geometry", (CombatGeometryDescription, CombatGeometry) }, - { "render-geometry", (RenderGeometryDescription, RenderGeometry) }, - { "screen-map", (ScreenMapOverlayDescription, ScreenMap) }, - { "depth-buffer", (DepthBufferDescription, DepthBuffer) }, - { "actor-tags", (ActorTagsOverlayDescripition, ActorTags) }, - }; + readonly IDictionary Handler)> commandHandlers = + new Dictionary Handler)> + { + { "combat-geometry", (CombatGeometryDescription, CombatGeometry) }, + { "render-geometry", (RenderGeometryDescription, RenderGeometry) }, + { "screen-map", (ScreenMapOverlayDescription, ScreenMap) }, + { "depth-buffer", (DepthBufferDescription, DepthBuffer) }, + { "actor-tags", (ActorTagsOverlayDescripition, ActorTags) }, + }; DebugVisualizations debugVis; DeveloperMode devMode; diff --git a/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs b/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs index b4ee1ecdb1..a8d4f39556 100644 --- a/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs +++ b/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs @@ -36,10 +36,15 @@ namespace OpenRA.Mods.Common.Graphics int length; readonly int skip; - public ContrailRenderable(World world, Actor owner, Color startcolor, bool usePlayerStartColor, Color endcolor, bool usePlayerEndColor, WDist startWidth, WDist endWidth, int length, int skip, int zOffset) - : this(world, owner, new WPos[length], startWidth, endWidth, 0, 0, skip, startcolor, usePlayerStartColor, endcolor, usePlayerEndColor, zOffset) { } + public ContrailRenderable( + World world, Actor owner, Color startcolor, bool usePlayerStartColor, Color endcolor, bool usePlayerEndColor, + WDist startWidth, WDist endWidth, int length, int skip, int zOffset) + : this(world, owner, new WPos[length], startWidth, endWidth, 0, 0, skip, + startcolor, usePlayerStartColor, endcolor, usePlayerEndColor, zOffset) + { } - ContrailRenderable(World world, Actor owner, WPos[] trail, WDist startWidth, WDist endWidth, int next, int length, int skip, Color startColor, bool usePlayerStartColor, Color endColor, bool usePlayerEndColor, int zOffset) + ContrailRenderable(World world, Actor owner, WPos[] trail, WDist startWidth, WDist endWidth, + int next, int length, int skip, Color startColor, bool usePlayerStartColor, Color endColor, bool usePlayerEndColor, int zOffset) { this.world = world; this.owner = owner; @@ -60,12 +65,17 @@ namespace OpenRA.Mods.Common.Graphics public int ZOffset { get; } public bool IsDecoration => true; - public IRenderable WithZOffset(int newOffset) { return new ContrailRenderable(world, owner, (WPos[])trail.Clone(), startWidth, endWidth, next, length, skip, startColor, usePlayerStartColor, endColor, usePlayerEndColor, newOffset); } + public IRenderable WithZOffset(int newOffset) => + new ContrailRenderable( + world, owner, (WPos[])trail.Clone(), startWidth, endWidth, next, + length, skip, startColor, usePlayerStartColor, endColor, usePlayerEndColor, newOffset); public IRenderable OffsetBy(in WVec vec) { // Lambdas can't use 'in' variables, so capture a copy for later var offset = vec; - return new ContrailRenderable(world, owner, trail.Select(pos => pos + offset).ToArray(), startWidth, endWidth, next, length, skip, startColor, usePlayerStartColor, endColor, usePlayerEndColor, ZOffset); + return new ContrailRenderable( + world, owner, trail.Select(pos => pos + offset).ToArray(), startWidth, endWidth, next, + length, skip, startColor, usePlayerStartColor, endColor, usePlayerEndColor, ZOffset); } public IRenderable AsDecoration() { return this; } diff --git a/OpenRA.Mods.Common/Installer/SourceActions/CopySourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/CopySourceAction.cs index 9a0dacf2bd..ff0e4160c0 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/CopySourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/CopySourceAction.cs @@ -44,9 +44,13 @@ namespace OpenRA.Mods.Common.Installer Action onProgress = null; if (length < InstallFromSourceLogic.ShowPercentageThreshold) - updateMessage(TranslationProvider.GetString(InstallFromSourceLogic.CopyingFilename, Translation.Arguments("filename", displayFilename))); + updateMessage(TranslationProvider.GetString( + InstallFromSourceLogic.CopyingFilename, + Translation.Arguments("filename", displayFilename))); else - onProgress = b => updateMessage(TranslationProvider.GetString(InstallFromSourceLogic.CopyingFilenameProgress, Translation.Arguments("filename", displayFilename, "progress", 100 * b / length))); + 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 3d9ca394ed..9460d672f4 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/ExtractBlastSourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/ExtractBlastSourceAction.cs @@ -66,9 +66,13 @@ namespace OpenRA.Mods.Common.Installer Action onProgress = null; if (length < InstallFromSourceLogic.ShowPercentageThreshold) - updateMessage(TranslationProvider.GetString(InstallFromSourceLogic.Extracing, Translation.Arguments("filename", displayFilename))); + updateMessage(TranslationProvider.GetString( + InstallFromSourceLogic.Extracing, + Translation.Arguments("filename", displayFilename))); else - onProgress = b => updateMessage(TranslationProvider.GetString(InstallFromSourceLogic.ExtractingProgress, Translation.Arguments("filename", displayFilename, "progress", 100 * b / length))); + onProgress = b => updateMessage(TranslationProvider.GetString( + InstallFromSourceLogic.ExtractingProgress, + Translation.Arguments("filename", displayFilename, "progress", 100 * b / length))); using (var target = File.OpenWrite(targetPath)) { diff --git a/OpenRA.Mods.Common/Installer/SourceActions/ExtractIscabSourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/ExtractIscabSourceAction.cs index 1a497bfae3..ac8842900d 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/ExtractIscabSourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/ExtractIscabSourceAction.cs @@ -62,7 +62,9 @@ namespace OpenRA.Mods.Common.Installer { Log.Write("install", $"Extracting {sourcePath} -> {targetPath}"); var displayFilename = Path.GetFileName(Path.GetFileName(targetPath)); - void OnProgress(int percent) => updateMessage(TranslationProvider.GetString(InstallFromSourceLogic.ExtractingProgress, Translation.Arguments("filename", displayFilename, "progress", percent))); + void OnProgress(int percent) => updateMessage(TranslationProvider.GetString( + InstallFromSourceLogic.ExtractingProgress, + Translation.Arguments("filename", displayFilename, "progress", percent))); reader.ExtractFile(node.Value.Value, target, OnProgress); } } diff --git a/OpenRA.Mods.Common/Installer/SourceActions/ExtractMscabSourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/ExtractMscabSourceAction.cs index eb8ee168e7..791e86cb7e 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/ExtractMscabSourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/ExtractMscabSourceAction.cs @@ -44,7 +44,9 @@ namespace OpenRA.Mods.Common.Installer { Log.Write("install", $"Extracting {sourcePath} -> {targetPath}"); var displayFilename = Path.GetFileName(Path.GetFileName(targetPath)); - void OnProgress(int percent) => updateMessage(TranslationProvider.GetString(InstallFromSourceLogic.ExtractingProgress, Translation.Arguments("filename", displayFilename, "progress", percent))); + void OnProgress(int percent) => updateMessage(TranslationProvider.GetString( + InstallFromSourceLogic.ExtractingProgress, + Translation.Arguments("filename", displayFilename, "progress", percent))); reader.ExtractFile(node.Value.Value, target, OnProgress); } } diff --git a/OpenRA.Mods.Common/Installer/SourceActions/ExtractRawSourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/ExtractRawSourceAction.cs index 4a237c28d6..dd7954b07a 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/ExtractRawSourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/ExtractRawSourceAction.cs @@ -61,7 +61,9 @@ namespace OpenRA.Mods.Common.Installer if (length < InstallFromSourceLogic.ShowPercentageThreshold) updateMessage(TranslationProvider.GetString(InstallFromSourceLogic.Extracing, Translation.Arguments("filename", displayFilename))); else - onProgress = b => updateMessage(TranslationProvider.GetString(InstallFromSourceLogic.ExtractingProgress, Translation.Arguments("filename", displayFilename, "progress", 100 * b / length))); + onProgress = b => updateMessage(TranslationProvider.GetString( + InstallFromSourceLogic.ExtractingProgress, + Translation.Arguments("filename", displayFilename, "progress", 100 * b / length))); using (var target = File.OpenWrite(targetPath)) { diff --git a/OpenRA.Mods.Common/Lint/CheckActors.cs b/OpenRA.Mods.Common/Lint/CheckActors.cs index 757347c014..59b0fa9c64 100644 --- a/OpenRA.Mods.Common/Lint/CheckActors.cs +++ b/OpenRA.Mods.Common/Lint/CheckActors.cs @@ -19,7 +19,9 @@ namespace OpenRA.Mods.Common.Lint { public void Run(Action emitError, Action emitWarning, ModData modData, Map map) { - var scriptBindings = Game.ModData.ObjectCreator.GetTypesImplementing().Select(t => Utility.GetCustomAttributes(t, true)[0].Name).ToHashSet(); + var scriptBindings = Game.ModData.ObjectCreator.GetTypesImplementing() + .Select(t => Utility.GetCustomAttributes(t, true)[0].Name) + .ToHashSet(); foreach (var actor in map.ActorDefinitions) { var name = actor.Value.Value; diff --git a/OpenRA.Mods.Common/Lint/CheckSequences.cs b/OpenRA.Mods.Common/Lint/CheckSequences.cs index 4da8b8cd4d..8a8262a203 100644 --- a/OpenRA.Mods.Common/Lint/CheckSequences.cs +++ b/OpenRA.Mods.Common/Lint/CheckSequences.cs @@ -96,7 +96,8 @@ 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}`."); + emitWarning( + $"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}`."); diff --git a/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs b/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs index 67cea55ecb..713795ee03 100644 --- a/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs +++ b/OpenRA.Mods.Common/Lint/CheckTranslationReference.cs @@ -245,7 +245,10 @@ namespace OpenRA.Mods.Common.Lint var resourceTypeTranslationReference = Utility.GetCustomAttributes(resourceTypeNameField, true)[0]; testedFields.Add(resourceTypeNameField); foreach (var resourceTypes in info.ResourceTypes) - usedKeys.Add(resourceTypes.Value.Name, resourceTypeTranslationReference, $"`{nameof(ResourceRendererInfo.ResourceTypeInfo)}.{nameof(ResourceRendererInfo.ResourceTypeInfo.Name)}`"); + usedKeys.Add( + resourceTypes.Value.Name, + resourceTypeTranslationReference, + $"`{nameof(ResourceRendererInfo.ResourceTypeInfo)}.{nameof(ResourceRendererInfo.ResourceTypeInfo.Name)}`"); } } diff --git a/OpenRA.Mods.Common/Projectiles/AreaBeam.cs b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs index edafecbcc9..f49d702e8c 100644 --- a/OpenRA.Mods.Common/Projectiles/AreaBeam.cs +++ b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs @@ -54,7 +54,10 @@ namespace OpenRA.Mods.Common.Projectiles [Desc("The maximum/constant/incremental inaccuracy used in conjunction with the InaccuracyType property.")] public readonly WDist Inaccuracy = WDist.Zero; - [Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' - scale from 0 to max with range, 'PerCellIncrement' - scale from 0 with range and 'Absolute' - use set value regardless of range.")] + [Desc("Controls the way inaccuracy is calculated. Possible values are " + + "'Maximum' - scale from 0 to max with range, " + + "'PerCellIncrement' - scale from 0 with range, " + + "'Absolute' - use set value regardless of range.")] public readonly InaccuracyType InaccuracyType = InaccuracyType.Maximum; [Desc("Can this projectile be blocked when hitting actors with an IBlocksProjectiles trait.")] diff --git a/OpenRA.Mods.Common/Projectiles/Bullet.cs b/OpenRA.Mods.Common/Projectiles/Bullet.cs index 643d5e4e69..c009c27196 100644 --- a/OpenRA.Mods.Common/Projectiles/Bullet.cs +++ b/OpenRA.Mods.Common/Projectiles/Bullet.cs @@ -30,7 +30,10 @@ namespace OpenRA.Mods.Common.Projectiles [Desc("The maximum/constant/incremental inaccuracy used in conjunction with the InaccuracyType property.")] public readonly WDist Inaccuracy = WDist.Zero; - [Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' - scale from 0 to max with range, 'PerCellIncrement' - scale from 0 with range and 'Absolute' - use set value regardless of range.")] + [Desc("Controls the way inaccuracy is calculated. Possible values are " + + "'Maximum' - scale from 0 to max with range, " + + "'PerCellIncrement' - scale from 0 with range, " + + "'Absolute' - use set value regardless of range.")] public readonly InaccuracyType InaccuracyType = InaccuracyType.Maximum; [Desc("Image to display.")] diff --git a/OpenRA.Mods.Common/Projectiles/InstantHit.cs b/OpenRA.Mods.Common/Projectiles/InstantHit.cs index e8030c5b2d..741f92aaa2 100644 --- a/OpenRA.Mods.Common/Projectiles/InstantHit.cs +++ b/OpenRA.Mods.Common/Projectiles/InstantHit.cs @@ -24,7 +24,10 @@ namespace OpenRA.Mods.Common.Projectiles [Desc("The maximum/constant/incremental inaccuracy used in conjunction with the InaccuracyType property.")] public readonly WDist Inaccuracy = WDist.Zero; - [Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' - scale from 0 to max with range, 'PerCellIncrement' - scale from 0 with range and 'Absolute' - use set value regardless of range.")] + [Desc("Controls the way inaccuracy is calculated. Possible values are " + + "'Maximum' - scale from 0 to max with range, " + + "'PerCellIncrement' - scale from 0 with range, " + + "'Absolute' - use set value regardless of range.")] public readonly InaccuracyType InaccuracyType = InaccuracyType.Maximum; [Desc("Projectile can be blocked.")] diff --git a/OpenRA.Mods.Common/Projectiles/LaserZap.cs b/OpenRA.Mods.Common/Projectiles/LaserZap.cs index ff7016aa4c..e40578555f 100644 --- a/OpenRA.Mods.Common/Projectiles/LaserZap.cs +++ b/OpenRA.Mods.Common/Projectiles/LaserZap.cs @@ -52,7 +52,10 @@ namespace OpenRA.Mods.Common.Projectiles [Desc("The maximum/constant/incremental inaccuracy used in conjunction with the InaccuracyType property.")] public readonly WDist Inaccuracy = WDist.Zero; - [Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' - scale from 0 to max with range, 'PerCellIncrement' - scale from 0 with range and 'Absolute' - use set value regardless of range.")] + [Desc("Controls the way inaccuracy is calculated. Possible values are " + + "'Maximum' - scale from 0 to max with range, " + + "'PerCellIncrement' - scale from 0 with range, " + + "'Absolute' - use set value regardless of range.")] public readonly InaccuracyType InaccuracyType = InaccuracyType.Maximum; [Desc("Beam can be blocked.")] diff --git a/OpenRA.Mods.Common/Projectiles/Missile.cs b/OpenRA.Mods.Common/Projectiles/Missile.cs index 1655688097..190fc76dc3 100644 --- a/OpenRA.Mods.Common/Projectiles/Missile.cs +++ b/OpenRA.Mods.Common/Projectiles/Missile.cs @@ -77,7 +77,10 @@ namespace OpenRA.Mods.Common.Projectiles [Desc("The maximum/constant/incremental inaccuracy used in conjunction with the InaccuracyType property.")] public readonly WDist Inaccuracy = WDist.Zero; - [Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' - scale from 0 to max with range, 'PerCellIncrement' - scale from 0 with range and 'Absolute' - use set value regardless of range.")] + [Desc("Controls the way inaccuracy is calculated. Possible values are " + + "'Maximum' - scale from 0 to max with range, " + + "'PerCellIncrement' - scale from 0 with range, " + + "'Absolute' - use set value regardless of range.")] public readonly InaccuracyType InaccuracyType = InaccuracyType.Absolute; [Desc("Inaccuracy override when successfully locked onto target. Defaults to Inaccuracy if negative.")] diff --git a/OpenRA.Mods.Common/Projectiles/Railgun.cs b/OpenRA.Mods.Common/Projectiles/Railgun.cs index 799d78ccfd..aaa7994345 100644 --- a/OpenRA.Mods.Common/Projectiles/Railgun.cs +++ b/OpenRA.Mods.Common/Projectiles/Railgun.cs @@ -28,7 +28,10 @@ namespace OpenRA.Mods.Common.Projectiles [Desc("The maximum/constant/incremental inaccuracy used in conjunction with the InaccuracyType property.")] public readonly WDist Inaccuracy = WDist.Zero; - [Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' - scale from 0 to max with range, 'PerCellIncrement' - scale from 0 with range and 'Absolute' - use set value regardless of range.")] + [Desc("Controls the way inaccuracy is calculated. Possible values are " + + "'Maximum' - scale from 0 to max with range, " + + "'PerCellIncrement' - scale from 0 with range, " + + "'Absolute' - use set value regardless of range.")] public readonly InaccuracyType InaccuracyType = InaccuracyType.Maximum; [Desc("Can this projectile be blocked when hitting actors with an IBlocksProjectiles trait.")] diff --git a/OpenRA.Mods.Common/Terrain/TerrainInfo.cs b/OpenRA.Mods.Common/Terrain/TerrainInfo.cs index f0a06344f0..98a0bf5d1a 100644 --- a/OpenRA.Mods.Common/Terrain/TerrainInfo.cs +++ b/OpenRA.Mods.Common/Terrain/TerrainInfo.cs @@ -45,10 +45,12 @@ namespace OpenRA.Mods.Common.Terrain foreach (var node in nodes) { if (!int.TryParse(node.Key, out var key)) - throw new YamlException($"Tileset `{terrainInfo.Id}` template `{Id}` defines a frame `{node.Key}` that is not a valid integer."); + throw new YamlException( + $"Tileset `{terrainInfo.Id}` template `{Id}` defines a frame `{node.Key}` that is not a valid integer."); 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."); + 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."); tileInfo[key] = LoadTileInfo(terrainInfo, node.Value); } diff --git a/OpenRA.Mods.Common/Traits/AutoCarryable.cs b/OpenRA.Mods.Common/Traits/AutoCarryable.cs index 0786d857b6..e59585cdf5 100644 --- a/OpenRA.Mods.Common/Traits/AutoCarryable.cs +++ b/OpenRA.Mods.Common/Traits/AutoCarryable.cs @@ -68,7 +68,9 @@ namespace OpenRA.Mods.Common.Traits // Inform all idle carriers var carriers = self.World.ActorsWithTrait() - .Where(c => c.Trait.State == Carryall.CarryallState.Idle && !c.Trait.IsTraitDisabled && c.Trait.EnableAutoCarry && !c.Actor.IsDead && c.Actor.Owner == self.Owner && c.Actor.IsInWorld) + .Where(c => + c.Trait.State == Carryall.CarryallState.Idle && !c.Trait.IsTraitDisabled && + c.Trait.EnableAutoCarry && !c.Actor.IsDead && c.Actor.Owner == self.Owner && c.Actor.IsInWorld) .OrderBy(p => (self.Location - p.Actor.Location).LengthSquared); // Enumerate idle carriers to find the first that is able to transport us diff --git a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/MinelayerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/MinelayerBotModule.cs index 84970b7219..25c6069193 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/MinelayerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/MinelayerBotModule.cs @@ -225,8 +225,21 @@ namespace OpenRA.Mods.Common.Traits } var vec = new CVec(Info.MineFieldRadius, Info.MineFieldRadius); - bot.QueueOrder(new Order("PlaceMinefield", null, Target.FromCell(world, minelayingPosition + vec), false, groupedActors: orderedActors.ToArray()) { ExtraLocation = minelayingPosition - vec }); - bot.QueueOrder(new Order("Move", null, Target.FromCell(world, orderedActors[0].Location), true, groupedActors: orderedActors.ToArray())); + bot.QueueOrder( + new Order( + "PlaceMinefield", + null, + Target.FromCell(world, minelayingPosition + vec), + false, + groupedActors: orderedActors.ToArray()) + { ExtraLocation = minelayingPosition - vec }); + bot.QueueOrder( + new Order( + "Move", + null, + Target.FromCell(world, orderedActors[0].Location), + true, + groupedActors: orderedActors.ToArray())); } else { diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeployWithCharge.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeployWithCharge.cs index 56aa10d729..2c15753b24 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeployWithCharge.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeployWithCharge.cs @@ -35,7 +35,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Cooldown (in ticks) to reach full charge.")] public readonly int ChargeDuration = 500; - [Desc("The ammount of charge that needs to be present for deploy to be issued. If set to -1, threshold is set to full charge. If activated without full charge " + nameof(ConditionDuration) + " is percentally smaller.")] + [Desc("The amount of charge that needs to be present for deploy to be issued. " + + "If set to -1, threshold is set to full charge. " + + "If activated without full charge " + nameof(ConditionDuration) + " is percentally smaller.")] public readonly int ChargeThreshhold = -1; [Desc("How long (in ticks) should the condition stay active?")] @@ -78,7 +80,8 @@ namespace OpenRA.Mods.Common.Traits } } - public class GrantConditionOnDeployWithCharge : PausableConditionalTrait, IIssueOrder, IResolveOrder, ITick, ISelectionBar, IOrderVoice, ISync, IIssueDeployOrder + public class GrantConditionOnDeployWithCharge : PausableConditionalTrait, + IIssueOrder, IResolveOrder, ITick, ISelectionBar, IOrderVoice, ISync, IIssueDeployOrder { [Sync] int chargeTick = 0; diff --git a/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs b/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs index c4c1377b0a..483b6d4e91 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs @@ -42,7 +42,8 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new ProximityExternalCondition(init.Self, this); } } - public class ProximityExternalCondition : ConditionalTrait, ITick, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyOtherProduction, INotifyProximityOwnerChanged + public class ProximityExternalCondition : ConditionalTrait, + ITick, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyOtherProduction, INotifyProximityOwnerChanged { readonly Actor self; diff --git a/OpenRA.Mods.Common/Traits/DockClientManager.cs b/OpenRA.Mods.Common/Traits/DockClientManager.cs index f471183ffd..1df540072a 100644 --- a/OpenRA.Mods.Common/Traits/DockClientManager.cs +++ b/OpenRA.Mods.Common/Traits/DockClientManager.cs @@ -322,7 +322,9 @@ namespace OpenRA.Mods.Common.Traits else { return docks - .OrderBy(dock => (clientActor.Location - clientActor.World.Map.CellContaining(dock.Trait.DockPosition)).LengthSquared + dock.Trait.ReservationCount * client.OccupancyCostModifier) + .OrderBy(dock => + (clientActor.Location - clientActor.World.Map.CellContaining(dock.Trait.DockPosition)).LengthSquared + + dock.Trait.ReservationCount * client.OccupancyCostModifier) .FirstOrDefault(); } diff --git a/OpenRA.Mods.Common/Traits/DockHost.cs b/OpenRA.Mods.Common/Traits/DockHost.cs index a6e177a47f..1638d22211 100644 --- a/OpenRA.Mods.Common/Traits/DockHost.cs +++ b/OpenRA.Mods.Common/Traits/DockHost.cs @@ -48,7 +48,8 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new DockHost(init.Self, this); } } - public class DockHost : ConditionalTrait, IDockHost, IDockHostDrag, ITick, INotifySold, INotifyCapture, INotifyOwnerChanged, ISync, INotifyKilled, INotifyActorDisposing + public class DockHost : ConditionalTrait, + IDockHost, IDockHostDrag, ITick, INotifySold, INotifyCapture, INotifyOwnerChanged, ISync, INotifyKilled, INotifyActorDisposing { readonly Actor self; diff --git a/OpenRA.Mods.Common/Traits/Palettes/PaletteFromGrayscale.cs b/OpenRA.Mods.Common/Traits/Palettes/PaletteFromGrayscale.cs index 886f35ec4d..55a09343c0 100644 --- a/OpenRA.Mods.Common/Traits/Palettes/PaletteFromGrayscale.cs +++ b/OpenRA.Mods.Common/Traits/Palettes/PaletteFromGrayscale.cs @@ -55,7 +55,9 @@ namespace OpenRA.Mods.Common.Traits if (info.Tileset != null && !string.Equals(info.Tileset, world.Map.Tileset, StringComparison.InvariantCultureIgnoreCase)) return; - wr.AddPalette(info.Name, new ImmutablePalette(Enumerable.Range(0, Palette.Size).Select(i => (i == info.TransparentIndex) ? 0 : Color.FromArgb(255, i, i, i).ToArgb())), info.AllowModifiers); + wr.AddPalette(info.Name, new ImmutablePalette( + Enumerable.Range(0, Palette.Size).Select(i => (i == info.TransparentIndex) ? 0 : Color.FromArgb(255, i, i, i).ToArgb())), + info.AllowModifiers); } } } diff --git a/OpenRA.Mods.Common/Traits/Player/ClassicParallelProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ClassicParallelProductionQueue.cs index 38f4f31b7f..39046d410b 100644 --- a/OpenRA.Mods.Common/Traits/Player/ClassicParallelProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ClassicParallelProductionQueue.cs @@ -219,7 +219,9 @@ namespace OpenRA.Mods.Common.Traits .GroupBy(i => i.Item) .ToList() .Count; - return item.RemainingTimeActual * parallelBuilds * info.ParallelPenaltyBuildTimeMultipliers[Math.Min(parallelBuilds - 1, info.ParallelPenaltyBuildTimeMultipliers.Length - 1)] / 100; + return item.RemainingTimeActual * + parallelBuilds * + info.ParallelPenaltyBuildTimeMultipliers[Math.Min(parallelBuilds - 1, info.ParallelPenaltyBuildTimeMultipliers.Length - 1)] / 100; } } } diff --git a/OpenRA.Mods.Common/Traits/Render/WithAttackOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithAttackOverlay.cs index 1fb9d9bfbe..896f464ed1 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithAttackOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithAttackOverlay.cs @@ -60,7 +60,8 @@ namespace OpenRA.Mods.Common.Traits.Render var body = init.Self.TraitOrDefault(); var facing = init.Self.TraitOrDefault(); - overlay = new Animation(init.World, renderSprites.GetImage(init.Self), facing == null ? () => WAngle.Zero : (body == null ? () => facing.Facing : () => body.QuantizeFacing(facing.Facing))) + overlay = new Animation(init.World, renderSprites.GetImage(init.Self), + facing == null ? () => WAngle.Zero : (body == null ? () => facing.Facing : () => body.QuantizeFacing(facing.Facing))) { IsDecoration = info.IsDecoration }; diff --git a/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs index a1b3fb10da..9bafb3a8dd 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs @@ -95,7 +95,9 @@ 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)), () => IsTraitPaused) + overlay = new Animation(self.World, image, + facing == null ? () => WAngle.Zero : (body == null ? () => facing.Facing : () => body.QuantizeFacing(facing.Facing)), + () => IsTraitPaused) { IsDecoration = info.IsDecoration }; diff --git a/OpenRA.Mods.Common/Traits/Render/WithProductionDoorOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithProductionDoorOverlay.cs index ede63dfb80..7165821233 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithProductionDoorOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithProductionDoorOverlay.cs @@ -18,7 +18,8 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Play an animation when a unit exits or blocks the exit after production finished.")] - sealed class WithProductionDoorOverlayInfo : ConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires, Requires, Requires + sealed class WithProductionDoorOverlayInfo : ConditionalTraitInfo, + IRenderActorPreviewSpritesInfo, Requires, Requires, Requires { [SequenceReference] public readonly string Sequence = "build-door"; diff --git a/OpenRA.Mods.Common/Traits/Render/WithSwitchableOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithSwitchableOverlay.cs index da347d4779..da3cccc756 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithSwitchableOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithSwitchableOverlay.cs @@ -137,7 +137,11 @@ namespace OpenRA.Mods.Common.Traits.Render var anim = new AnimationWithOffset(overlay, () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self.Orientation))), - () => IsTraitDisabled || (Info.SwitchingSequence == null && chargeSpeed != 0) || (Info.EnabledSequence == null && switchingLevel > Info.SwitchingLevel) || (Info.DisabledSequence == null && switchingLevel < 0), + () => + IsTraitDisabled || + (Info.SwitchingSequence == null && chargeSpeed != 0) || + (Info.EnabledSequence == null && switchingLevel > Info.SwitchingLevel) || + (Info.DisabledSequence == null && switchingLevel < 0), p => RenderUtils.ZOffsetFromCenter(self, p, 1)); rs.Add(anim, info.Palette, info.IsPlayerPalette); diff --git a/OpenRA.Mods.Common/Traits/World/ColorPickerManager.cs b/OpenRA.Mods.Common/Traits/World/ColorPickerManager.cs index feddec58ac..ee2568b3c4 100644 --- a/OpenRA.Mods.Common/Traits/World/ColorPickerManager.cs +++ b/OpenRA.Mods.Common/Traits/World/ColorPickerManager.cs @@ -82,7 +82,8 @@ namespace OpenRA.Mods.Common.Traits return false; } - Color MakeValid(float hue, float sat, float val, MersenneTwister random, IReadOnlyCollection terrainColors, IReadOnlyCollection playerColors, Action onError) + Color MakeValid(float hue, float sat, float val, MersenneTwister random, + IReadOnlyCollection terrainColors, IReadOnlyCollection playerColors, Action onError) { // Clamp saturation without triggering a warning // This can only happen due to rounding errors (common) or modified clients (rare) @@ -132,7 +133,10 @@ namespace OpenRA.Mods.Common.Traits Color[] IColorPickerManagerInfo.PresetColors => PresetColors; - Color IColorPickerManagerInfo.RandomPresetColor(MersenneTwister random, IReadOnlyCollection terrainColors, IReadOnlyCollection playerColors) + Color IColorPickerManagerInfo.RandomPresetColor( + MersenneTwister random, + IReadOnlyCollection terrainColors, + IReadOnlyCollection playerColors) { foreach (var color in PresetColors.Shuffle(random)) { @@ -148,13 +152,21 @@ namespace OpenRA.Mods.Common.Traits return MakeValid(randomHue, randomSat, randomVal, random, terrainColors, playerColors, null); } - Color IColorPickerManagerInfo.MakeValid(Color color, MersenneTwister random, IReadOnlyCollection terrainColors, IReadOnlyCollection playerColors, Action onError) + Color IColorPickerManagerInfo.MakeValid( + Color color, + MersenneTwister random, + IReadOnlyCollection terrainColors, + IReadOnlyCollection playerColors, + Action onError) { var (_, h, s, v) = color.ToAhsv(); return MakeValid(h, s, v, random, terrainColors, playerColors, onError); } - Color IColorPickerManagerInfo.RandomValidColor(MersenneTwister random, IReadOnlyCollection terrainColors, IReadOnlyCollection playerColors) + Color IColorPickerManagerInfo.RandomValidColor( + MersenneTwister random, + IReadOnlyCollection terrainColors, + IReadOnlyCollection playerColors) { var h = random.NextFloat(); var s = float2.Lerp(HsvSaturationRange[0], HsvSaturationRange[1], random.NextFloat()); @@ -162,7 +174,12 @@ namespace OpenRA.Mods.Common.Traits return MakeValid(h, s, v, random, terrainColors, playerColors, null); } - void IColorPickerManagerInfo.ShowColorDropDown(DropDownButtonWidget dropdownButton, Color initialColor, string initialFaction, WorldRenderer worldRenderer, Action onExit) + void IColorPickerManagerInfo.ShowColorDropDown( + DropDownButtonWidget dropdownButton, + Color initialColor, + string initialFaction, + WorldRenderer worldRenderer, + Action onExit) { dropdownButton.RemovePanel(); @@ -177,7 +194,9 @@ namespace OpenRA.Mods.Common.Traits if (initialFaction == null || !FactionPreviewActors.TryGetValue(initialFaction, out var actorType)) { if (PreviewActor == null) - throw new YamlException($"{nameof(ColorPickerManager)} does not define a preview actor" + (initialFaction == null ? "." : $"for faction {initialFaction}.")); + throw new YamlException( + $"{nameof(ColorPickerManager)} does not define a preview actor" + + (initialFaction == null ? "." : $" for faction {initialFaction}.")); actorType = PreviewActor; } diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/RenameContrailProperties.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/RenameContrailProperties.cs index 35f2c285bd..907d6331db 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/RenameContrailProperties.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/RenameContrailProperties.cs @@ -18,7 +18,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules { public override string Name => "Rename contrail color properties"; - public override string Description => "Rename contrail color properties `Color` to `StartColor` and `UsePlayerColor` to `StartColorUsePlayerColor` in traits and weapons to account for added `EndColor` functionality"; + public override string Description => + "Rename contrail color properties `Color` to `StartColor` and `UsePlayerColor` to `StartColorUsePlayerColor` " + + "in traits and weapons to account for added `EndColor` functionality"; public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNodeBuilder actorNode) { diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeBaseBuilderBotModule.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeBaseBuilderBotModule.cs index d07e5ec69a..ccbb86e44d 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeBaseBuilderBotModule.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeBaseBuilderBotModule.cs @@ -19,7 +19,20 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules MiniYamlNodeBuilder defences; // Excludes AttackBomber and AttackTDGunboatTurreted as actors with these AttackBase traits aren't supposed to be controlled. - readonly string[] attackBase = { "AttackLeap", "AttackPopupTurreted", "AttackAircraft", "AttackTesla", "AttackCharges", "AttackFollow", "AttackTurreted", "AttackFrontal", "AttackGarrisoned", "AttackOmni", "AttackSwallow" }; + readonly string[] attackBase = + { + "AttackLeap", + "AttackPopupTurreted", + "AttackAircraft", + "AttackTesla", + "AttackCharges", + "AttackFollow", + "AttackTurreted", + "AttackFrontal", + "AttackGarrisoned", + "AttackOmni", + "AttackSwallow" + }; readonly string[] buildings = { "Building", "EnergyWall", "D2kBuilding" }; bool anyAdded; diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeSquadManager.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeSquadManager.cs index 83efc3360e..5bc62d7554 100644 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeSquadManager.cs +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/UnhardcodeSquadManager.cs @@ -19,7 +19,20 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules readonly List addNodes = new(); // Excludes AttackBomber and AttackTDGunboatTurreted as actors with these AttackBase traits aren't supposed to be controlled. - readonly string[] attackBase = { "AttackLeap", "AttackPopupTurreted", "AttackAircraft", "AttackTesla", "AttackCharges", "AttackFollow", "AttackTurreted", "AttackFrontal", "AttackGarrisoned", "AttackOmni", "AttackSwallow" }; + readonly string[] attackBase = + { + "AttackLeap", + "AttackPopupTurreted", + "AttackAircraft", + "AttackTesla", + "AttackCharges", + "AttackFollow", + "AttackTurreted", + "AttackFrontal", + "AttackGarrisoned", + "AttackOmni", + "AttackSwallow" + }; readonly string[] vipsNames = { "Harvester", "BaseBuilding" }; readonly string[] buildings = { "Building", "EnergyWall", "D2kBuilding" }; readonly string[] excludedBuildings = { "LineBuild", "Plug" }; diff --git a/OpenRA.Mods.Common/UtilityCommands/CheckConditionalTraitInterfaceOverrides.cs b/OpenRA.Mods.Common/UtilityCommands/CheckConditionalTraitInterfaceOverrides.cs index 41ad5fd8c5..0fe1a3986c 100644 --- a/OpenRA.Mods.Common/UtilityCommands/CheckConditionalTraitInterfaceOverrides.cs +++ b/OpenRA.Mods.Common/UtilityCommands/CheckConditionalTraitInterfaceOverrides.cs @@ -52,7 +52,9 @@ namespace OpenRA.Mods.Common.UtilityCommands if (!IsConditionalTrait(t)) continue; - var overridesCreated = t.GetMethod($"{interfaceType.FullName}.{methodName}", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly) != null; + var overridesCreated = t.GetMethod( + $"{interfaceType.FullName}.{methodName}", + BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly) != null; if (overridesCreated) { Console.WriteLine("{0} must override ConditionalTrait's {1} method instead of implementing {2} directly", t.Name, methodName, interfaceType.Name); diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractChromeStrings.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractChromeStrings.cs index a816b57693..eabc49aa58 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractChromeStrings.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractChromeStrings.cs @@ -314,8 +314,16 @@ namespace OpenRA.Mods.Common.UtilityCommands public static void FindUntranslatedStringFields(ModData modData) { var types = modData.ObjectCreator.GetTypes(); - foreach (var (type, fields) in types.Where(t => t.Name.EndsWith("Widget", StringComparison.InvariantCulture) && t.IsSubclassOf(typeof(Widget))).ToDictionary(t => t.Name[..^6], - t => t.GetFields().Where(f => f.Name != "Id" && f.IsPublic && f.FieldType == typeof(string) && !f.HasAttribute()).Distinct().Select(f => f.Name).ToList())) + foreach (var (type, fields) in types + .Where(t => t.Name.EndsWith("Widget", StringComparison.InvariantCulture) && t.IsSubclassOf(typeof(Widget))) + .ToDictionary( + t => t.Name[..^6], + t => t + .GetFields() + .Where(f => f.Name != "Id" && f.IsPublic && f.FieldType == typeof(string) && !f.HasAttribute()) + .Distinct() + .Select(f => f.Name) + .ToList())) if (fields.Count > 0) Console.WriteLine($"{type}Widget:\n {string.Join("\n ", fields)}"); } diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs index e6e35ac7e0..ac4e1c988c 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ExtractEmmyLuaAPI.cs @@ -336,10 +336,12 @@ namespace OpenRA.Mods.Common.UtilityCommands } if (isActivity) - Console.WriteLine($"{new string(' ', indentation * 4)}--- *Queued Activity*"); + Console.WriteLine( + $"{new string(' ', indentation * 4)}--- *Queued Activity*"); if (requiredTraits.Length != 0) - Console.WriteLine($"{new string(' ', indentation * 4)}--- **Requires {(requiredTraits.Length == 1 ? "Trait" : "Traits")}:** {requiredTraits.Select(GetDocumentationUrl).JoinWith(", ")}"); + Console.WriteLine( + $"{new string(' ', indentation * 4)}--- **Requires {(requiredTraits.Length == 1 ? "Trait" : "Traits")}:** {requiredTraits.Select(GetDocumentationUrl).JoinWith(", ")}"); } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/ConnectionLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ConnectionLogic.cs index 25a5335878..8c29067c4c 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ConnectionLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ConnectionLogic.cs @@ -103,7 +103,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic bool passwordOffsetAdjusted; [ObjectCreator.UseCtor] - public ConnectionFailedLogic(Widget widget, ModData modData, OrderManager orderManager, NetworkConnection connection, string password, Action onAbort, Action onQuit, Action onRetry) + public ConnectionFailedLogic(Widget widget, ModData modData, OrderManager orderManager, + NetworkConnection connection, string password, Action onAbort, Action onQuit, Action onRetry) { var panel = widget; var abortButton = panel.Get("ABORT_BUTTON"); @@ -133,7 +134,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic widget.Get("CONNECTING_DESC").GetText = () => connectingDescText; var connectionError = widget.Get("CONNECTION_ERROR"); - var connectionErrorText = orderManager.ServerError != null ? TranslationProvider.GetString(orderManager.ServerError) : connection.ErrorMessage ?? TranslationProvider.GetString(UnknownError); + var connectionErrorText = orderManager.ServerError != null + ? TranslationProvider.GetString(orderManager.ServerError) + : connection.ErrorMessage ?? TranslationProvider.GetString(UnknownError); connectionError.GetText = () => connectionErrorText; var panelTitle = widget.Get("TITLE"); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorSelectionLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorSelectionLogic.cs index d2c73a3d2e..4a0da84c17 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorSelectionLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorSelectionLogic.cs @@ -156,7 +156,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic var diagonalLength = Math.Round(Math.Sqrt(Math.Pow(selectionSize.X, 2) + Math.Pow(selectionSize.Y, 2)), 3); var resourceValueInRegion = editorResourceLayer.CalculateRegionValue(selectedRegion); - var areaSelectionLabel = $"{TranslationProvider.GetString(AreaSelection)} ({DimensionsAsString(selectionSize)}) {PositionAsString(selectedRegion.TopLeft)} : {PositionAsString(selectedRegion.BottomRight)}"; + var areaSelectionLabel = + $"{TranslationProvider.GetString(AreaSelection)} ({DimensionsAsString(selectionSize)}) " + + $"{PositionAsString(selectedRegion.TopLeft)} : {PositionAsString(selectedRegion.BottomRight)}"; AreaEditTitle.GetText = () => areaSelectionLabel; DiagonalLabel.GetText = () => $"{diagonalLength}"; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/AddFactionSuffixLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/AddFactionSuffixLogic.cs index c51162732a..78e72c6f50 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/AddFactionSuffixLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/AddFactionSuffixLogic.cs @@ -51,7 +51,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic ptw.Background += suffix; } else - throw new InvalidOperationException("AddFactionSuffixLogic only supports ButtonWidget, ImageWidget, BackgroundWidget, TextFieldWidget, ScrollPanelWidget and ProductionTabsWidget"); + throw new InvalidOperationException( + "AddFactionSuffixLogic only supports ButtonWidget, ImageWidget, BackgroundWidget, TextFieldWidget, ScrollPanelWidget and ProductionTabsWidget"); } } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs index 3579595627..57bf407a32 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs @@ -24,7 +24,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic { public enum ObserverStatsPanel { None, Basic, Economy, Production, SupportPowers, Combat, Army, Graph, ArmyGraph } - [ChromeLogicArgsHotkeys("StatisticsBasicKey", "StatisticsEconomyKey", "StatisticsProductionKey", "StatisticsSupportPowersKey", "StatisticsCombatKey", "StatisticsArmyKey", "StatisticsGraphKey", + [ChromeLogicArgsHotkeys( + "StatisticsBasicKey", + "StatisticsEconomyKey", + "StatisticsProductionKey", + "StatisticsSupportPowersKey", + "StatisticsCombatKey", + "StatisticsArmyKey", + "StatisticsGraphKey", "StatisticsArmyGraphKey")] public class ObserverStatsLogic : ChromeLogic { @@ -450,15 +457,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic template.Get("ASSETS").GetText = () => assetsText.Update(stats.AssetsValue); var harvesters = template.Get("HARVESTERS"); - harvesters.GetText = () => world.ActorsWithTrait().Count(a => a.Actor.Owner == player && !a.Actor.IsDead && !a.Trait.IsTraitDisabled).ToString(NumberFormatInfo.CurrentInfo); + harvesters.GetText = () => world.ActorsWithTrait() + .Count(a => a.Actor.Owner == player && !a.Actor.IsDead && !a.Trait.IsTraitDisabled).ToString(NumberFormatInfo.CurrentInfo); var carryalls = template.GetOrNull("CARRYALLS"); if (carryalls != null) - carryalls.GetText = () => world.ActorsWithTrait().Count(a => a.Actor.Owner == player && !a.Actor.IsDead).ToString(NumberFormatInfo.CurrentInfo); + carryalls.GetText = () => world.ActorsWithTrait() + .Count(a => a.Actor.Owner == player && !a.Actor.IsDead).ToString(NumberFormatInfo.CurrentInfo); var derricks = template.GetOrNull("DERRICKS"); if (derricks != null) - derricks.GetText = () => world.ActorsHavingTrait().Count(a => a.Owner == player && !a.IsDead).ToString(NumberFormatInfo.CurrentInfo); + derricks.GetText = () => world.ActorsHavingTrait() + .Count(a => a.Owner == player && !a.IsDead).ToString(NumberFormatInfo.CurrentInfo); return template; } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs index 30569efb1d..572c9a1de7 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs @@ -521,7 +521,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic }; } - public static void SetupEditableColorWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, WorldRenderer worldRenderer, IColorPickerManagerInfo colorManager) + public static void SetupEditableColorWidget(Widget parent, Session.Slot s, Session.Client c, + OrderManager orderManager, WorldRenderer worldRenderer, IColorPickerManagerInfo colorManager) { var colorDropdown = parent.Get("COLOR"); colorDropdown.IsDisabled = () => (s != null && s.LockColor) || orderManager.LocalClient.IsReady; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs index eb98604c6a..5d9faae63f 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs @@ -41,7 +41,21 @@ namespace OpenRA.Mods.Common.Widgets.Logic readonly Dictionary previewWidgets = new(); readonly Func<(MapPreview Map, Session.MapStatus Status)> getMap; - enum PreviewStatus { Unknown, Playable, Incompatible, Validating, DownloadAvailable, Searching, Downloading, DownloadError, Unavailable, UpdateAvailable, UpdateDownloadAvailable } + enum PreviewStatus + { + Unknown, + Playable, + Incompatible, + Validating, + DownloadAvailable, + Searching, + Downloading, + DownloadError, + Unavailable, + UpdateAvailable, + UpdateDownloadAvailable, + } + PreviewStatus currentStatus; bool blink; int blinkTick; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Settings/DisplaySettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Settings/DisplaySettingsLogic.cs index 37e1fa031f..ade63ee9aa 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Settings/DisplaySettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Settings/DisplaySettingsLogic.cs @@ -97,7 +97,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic } [ObjectCreator.UseCtor] - public DisplaySettingsLogic(Action>, Func> registerPanel, string panelID, string label, ModData modData, WorldRenderer worldRenderer) + public DisplaySettingsLogic( + Action>, Func> registerPanel, + string panelID, string label, ModData modData, WorldRenderer worldRenderer) { this.worldRenderer = worldRenderer; this.modData = modData; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs index 154fd98546..b8d85b4a39 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs @@ -50,7 +50,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic static HotkeysSettingsLogic() { } [ObjectCreator.UseCtor] - public HotkeysSettingsLogic(Action>, Func> registerPanel, string panelID, string label, ModData modData, Dictionary logicArgs) + public HotkeysSettingsLogic( + Action>, Func> registerPanel, + string panelID, string label, ModData modData, Dictionary logicArgs) { this.modData = modData; this.logicArgs = logicArgs; diff --git a/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs b/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs index 30916eb91d..29e38c0389 100644 --- a/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ObserverProductionIconsWidget.cs @@ -256,7 +256,10 @@ namespace OpenRA.Mods.Common.Widgets return; } - if (TooltipIcon != null && productionIconsBounds.Count > lastIconIdx && productionIcons[lastIconIdx].Actor == TooltipIcon.Actor && productionIconsBounds[lastIconIdx].Contains(Viewport.LastMousePos)) + if (TooltipIcon != null && + productionIconsBounds.Count > lastIconIdx && + productionIcons[lastIconIdx].Actor == TooltipIcon.Actor && + productionIconsBounds[lastIconIdx].Contains(Viewport.LastMousePos)) return; for (var i = 0; i < productionIconsBounds.Count; i++) diff --git a/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs b/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs index a6afbc4fb7..ba595238fe 100644 --- a/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ObserverSupportPowerIconsWidget.cs @@ -175,7 +175,10 @@ namespace OpenRA.Mods.Common.Widgets return; } - if (TooltipIcon != null && lastIconIdx < supportPowerIconsBounds.Count && supportPowerIconsIcons[lastIconIdx].Power == TooltipIcon.Power && supportPowerIconsBounds[lastIconIdx].Contains(Viewport.LastMousePos)) + if (TooltipIcon != null && + lastIconIdx < supportPowerIconsBounds.Count && + supportPowerIconsIcons[lastIconIdx].Power == TooltipIcon.Power && + supportPowerIconsBounds[lastIconIdx].Contains(Viewport.LastMousePos)) return; for (var i = 0; i < supportPowerIconsBounds.Count; i++) diff --git a/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs index e1f3e83e3f..e81758f76c 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs @@ -201,11 +201,15 @@ namespace OpenRA.Mods.Common.Widgets var leftArrowImage = getLeftArrowImage.Update((leftDisabled, leftPressed, leftHover, false, false)); WidgetUtils.DrawSprite(leftArrowImage, - new float2(leftButtonRect.Left + (int)((leftButtonRect.Width - leftArrowImage.Size.X) / 2), leftButtonRect.Top + (int)((leftButtonRect.Height - leftArrowImage.Size.Y) / 2))); + new float2( + leftButtonRect.Left + (int)((leftButtonRect.Width - leftArrowImage.Size.X) / 2), + leftButtonRect.Top + (int)((leftButtonRect.Height - leftArrowImage.Size.Y) / 2))); var rightArrowImage = getRightArrowImage.Update((rightDisabled, rightPressed, rightHover, false, false)); WidgetUtils.DrawSprite(rightArrowImage, - new float2(rightButtonRect.Left + (int)((rightButtonRect.Width - rightArrowImage.Size.X) / 2), rightButtonRect.Top + (int)((rightButtonRect.Height - rightArrowImage.Size.Y) / 2))); + new float2( + rightButtonRect.Left + (int)((rightButtonRect.Width - rightArrowImage.Size.X) / 2), + rightButtonRect.Top + (int)((rightButtonRect.Height - rightArrowImage.Size.Y) / 2))); // Draw tab buttons Game.Renderer.EnableScissor(new Rectangle(leftButtonRect.Right, rb.Y + 1, rightButtonRect.Left - leftButtonRect.Right - 1, rb.Height)); diff --git a/OpenRA.Mods.D2k/Traits/Buildings/D2kActorPreviewPlaceBuildingPreview.cs b/OpenRA.Mods.D2k/Traits/Buildings/D2kActorPreviewPlaceBuildingPreview.cs index bb4fb54f12..939cf44f4e 100644 --- a/OpenRA.Mods.D2k/Traits/Buildings/D2kActorPreviewPlaceBuildingPreview.cs +++ b/OpenRA.Mods.D2k/Traits/Buildings/D2kActorPreviewPlaceBuildingPreview.cs @@ -105,7 +105,12 @@ namespace OpenRA.Mods.D2k.Traits if ((c.Value & filter) == 0) continue; - var isUnsafe = checkUnsafeTiles && wr.World.Map.Contains(c.Key) && candidateSafeTiles.Contains(c.Key) && info.UnsafeTerrainTypes.Contains(wr.World.Map.GetTerrainInfo(c.Key).Type); + var isUnsafe = + checkUnsafeTiles && + wr.World.Map.Contains(c.Key) && + candidateSafeTiles.Contains(c.Key) && + info.UnsafeTerrainTypes.Contains(wr.World.Map.GetTerrainInfo(c.Key).Type); + var tile = (c.Value & PlaceBuildingCellType.Invalid) != 0 ? blockedTile : isUnsafe ? unsafeTile : validTile; var sequenceAlpha = (c.Value & PlaceBuildingCellType.Invalid) != 0 ? blockedAlpha : isUnsafe ? unsafeAlpha : validAlpha;