From 233aa77405c91a10751a25b58b834ae1f4283d62 Mon Sep 17 00:00:00 2001 From: Mustafa Alperen Seki Date: Fri, 15 Mar 2024 20:47:19 +0300 Subject: [PATCH] More style fixes. --- .../Widgets/Logic/Ingame/ObserverStatsRVLogic.cs | 2 +- .../Widgets/Logic/Ingame/ObserverStatsSPLogic.cs | 2 +- OpenRA.Mods.AS/Projectiles/WarheadTrailProjectile.cs | 4 ++-- .../Traits/BotModules/CaptureManagerBotASModule.cs | 2 +- .../Traits/BotModules/SupportPowerBotASModule.cs | 2 +- OpenRA.Mods.AS/Warheads/FireFragmentWarhead.cs | 2 +- OpenRA.Mods.Common/Projectiles/GravityBomb.cs | 12 +----------- OpenRA.Mods.Common/Projectiles/Missile.cs | 2 +- 8 files changed, 9 insertions(+), 19 deletions(-) diff --git a/OpenRA.Mods.AS/Duplicates/Widgets/Logic/Ingame/ObserverStatsRVLogic.cs b/OpenRA.Mods.AS/Duplicates/Widgets/Logic/Ingame/ObserverStatsRVLogic.cs index 9fc47b32a700..c634b347beeb 100644 --- a/OpenRA.Mods.AS/Duplicates/Widgets/Logic/Ingame/ObserverStatsRVLogic.cs +++ b/OpenRA.Mods.AS/Duplicates/Widgets/Logic/Ingame/ObserverStatsRVLogic.cs @@ -183,7 +183,7 @@ StatsDropDownOption CreateStatsOption(string title, ObserverStatsRVPanel panel, var statsDropDownOptions = new StatsDropDownOption[] { - new StatsDropDownOption + new() { Title = TranslationProvider.GetString(InformationNone), IsSelected = () => activePanel == ObserverStatsRVPanel.None, diff --git a/OpenRA.Mods.AS/Duplicates/Widgets/Logic/Ingame/ObserverStatsSPLogic.cs b/OpenRA.Mods.AS/Duplicates/Widgets/Logic/Ingame/ObserverStatsSPLogic.cs index e10f77bdfc71..ecfdad885af4 100644 --- a/OpenRA.Mods.AS/Duplicates/Widgets/Logic/Ingame/ObserverStatsSPLogic.cs +++ b/OpenRA.Mods.AS/Duplicates/Widgets/Logic/Ingame/ObserverStatsSPLogic.cs @@ -175,7 +175,7 @@ StatsDropDownOption CreateStatsOption(string title, ObserverStatsSPPanel panel, var statsDropDownOptions = new StatsDropDownOption[] { - new StatsDropDownOption + new() { Title = TranslationProvider.GetString(InformationNone), IsSelected = () => activePanel == ObserverStatsSPPanel.None, diff --git a/OpenRA.Mods.AS/Projectiles/WarheadTrailProjectile.cs b/OpenRA.Mods.AS/Projectiles/WarheadTrailProjectile.cs index 4d335a0156f3..b8e424846b89 100644 --- a/OpenRA.Mods.AS/Projectiles/WarheadTrailProjectile.cs +++ b/OpenRA.Mods.AS/Projectiles/WarheadTrailProjectile.cs @@ -29,10 +29,10 @@ public enum FireMode public class WarheadTrailProjectileInfo : IProjectileInfo, IRulesetLoaded { [Desc("Warhead explosion offsets")] - public readonly WVec[] Offsets = { new WVec(0, 1, 0) }; + public readonly WVec[] Offsets = { new(0, 1, 0) }; [Desc("Projectile speed in WDist / tick, two values indicate variable velocity.")] - public readonly WDist[] Speed = { new WDist(17) }; + public readonly WDist[] Speed = { new(17) }; [Desc("Maximum inaccuracy offset.")] public readonly WDist Inaccuracy = WDist.Zero; diff --git a/OpenRA.Mods.AS/Traits/BotModules/CaptureManagerBotASModule.cs b/OpenRA.Mods.AS/Traits/BotModules/CaptureManagerBotASModule.cs index 5248757ecbb2..b208c954a702 100644 --- a/OpenRA.Mods.AS/Traits/BotModules/CaptureManagerBotASModule.cs +++ b/OpenRA.Mods.AS/Traits/BotModules/CaptureManagerBotASModule.cs @@ -228,7 +228,7 @@ List IGameSaveTraitData.IssueTraitData(Actor self) return new List() { - new MiniYamlNode("InitialBaseCenter", FieldSaver.FormatValue(initialBaseCenter)) + new("InitialBaseCenter", FieldSaver.FormatValue(initialBaseCenter)) }; } diff --git a/OpenRA.Mods.AS/Traits/BotModules/SupportPowerBotASModule.cs b/OpenRA.Mods.AS/Traits/BotModules/SupportPowerBotASModule.cs index 10fbc001ba5f..4855721c58af 100644 --- a/OpenRA.Mods.AS/Traits/BotModules/SupportPowerBotASModule.cs +++ b/OpenRA.Mods.AS/Traits/BotModules/SupportPowerBotASModule.cs @@ -165,7 +165,7 @@ List IGameSaveTraitData.IssueTraitData(Actor self) return new List() { - new MiniYamlNode("WaitingPowers", "", waitingPowersNodes) + new("WaitingPowers", "", waitingPowersNodes) }; } diff --git a/OpenRA.Mods.AS/Warheads/FireFragmentWarhead.cs b/OpenRA.Mods.AS/Warheads/FireFragmentWarhead.cs index 9e9e26503fec..4fd32d402fbd 100644 --- a/OpenRA.Mods.AS/Warheads/FireFragmentWarhead.cs +++ b/OpenRA.Mods.AS/Warheads/FireFragmentWarhead.cs @@ -28,7 +28,7 @@ public class FireFragmentWarhead : WarheadAS, IRulesetLoaded public readonly int Chance = 100; [Desc("Target offsets relative to warhead explosion.")] - public readonly WVec[] Offsets = { new WVec(0, 0, 0) }; + public readonly WVec[] Offsets = { new(0, 0, 0) }; [Desc("If set, Offset's Z value will be used as absolute height instead of explosion height.")] public readonly bool UseZOffsetAsAbsoluteHeight = false; diff --git a/OpenRA.Mods.Common/Projectiles/GravityBomb.cs b/OpenRA.Mods.Common/Projectiles/GravityBomb.cs index b35baaf2c419..5bf5b9990cea 100644 --- a/OpenRA.Mods.Common/Projectiles/GravityBomb.cs +++ b/OpenRA.Mods.Common/Projectiles/GravityBomb.cs @@ -101,7 +101,7 @@ public void Tick(World world) pos += velocity; velocity += acceleration; - if (info.PointDefenseTypes.Any()) + if (!info.PointDefenseTypes.IsEmpty) { var shouldExplode = world.ActorsWithTrait().Any(x => x.Trait.Destroy(pos, args.SourceActor.Owner, info.PointDefenseTypes)); if (shouldExplode) @@ -132,16 +132,6 @@ public void Tick(World world) args.Weapon.Impact(Target.FromPos(pos), warheadArgs); } - if (info.PointDefenseTypes.Any()) - { - var shouldExplode = world.ActorsWithTrait().Any(x => x.Trait.Destroy(pos, args.SourceActor.Owner, info.PointDefenseTypes)); - if (shouldExplode) - { - args.Weapon.Impact(Target.FromPos(pos), new WarheadArgs(args)); - world.AddFrameEndTask(w => w.Remove(this)); - } - } - anim?.Tick(); } diff --git a/OpenRA.Mods.Common/Projectiles/Missile.cs b/OpenRA.Mods.Common/Projectiles/Missile.cs index 9a7da24e4db4..1022a7a6115a 100644 --- a/OpenRA.Mods.Common/Projectiles/Missile.cs +++ b/OpenRA.Mods.Common/Projectiles/Missile.cs @@ -889,7 +889,7 @@ public void Tick(World world) pos = blockedPos; shouldExplode = true; } - else if (info.PointDefenseTypes.Any() && world.ActorsWithTrait().Any(a => a.Trait.Destroy(pos, args.SourceActor.Owner, info.PointDefenseTypes))) + else if (!info.PointDefenseTypes.IsEmpty && world.ActorsWithTrait().Any(a => a.Trait.Destroy(pos, args.SourceActor.Owner, info.PointDefenseTypes))) { shouldExplode = true; }