From 858d782af1a8ae7c3bd452344ff461943e678a4f Mon Sep 17 00:00:00 2001 From: Gustas <37534529+PunkPun@users.noreply.github.com> Date: Tue, 11 Oct 2022 17:28:58 +0300 Subject: [PATCH] Simplify 'default' expression (IDE0034) --- .editorconfig | 3 +++ OpenRA.Game/Actor.cs | 2 +- OpenRA.Game/Exts.cs | 10 +++++----- OpenRA.Game/LocalPlayerProfile.cs | 2 +- OpenRA.Game/Map/CellLayer.cs | 4 ++-- OpenRA.Game/MiniYaml.cs | 2 +- OpenRA.Game/ObjectCreator.cs | 2 +- OpenRA.Game/Player.cs | 4 ++-- OpenRA.Game/Primitives/TypeDictionary.cs | 2 +- OpenRA.Game/Scripting/ScriptTypes.cs | 2 +- OpenRA.Game/Sound/Sound.cs | 2 +- OpenRA.Game/Traits/Target.cs | 2 +- OpenRA.Game/Traits/TraitsInterfaces.cs | 2 +- OpenRA.Game/Widgets/ChromeMetrics.cs | 2 +- OpenRA.Game/Widgets/Widget.cs | 2 +- OpenRA.Game/World.cs | 4 ++-- OpenRA.Mods.Cnc/Activities/Teleport.cs | 2 +- .../Traits/Buildings/ClonesProducedUnits.cs | 2 +- OpenRA.Mods.Cnc/Traits/Chronoshiftable.cs | 2 +- OpenRA.Mods.Cnc/Traits/Cloneable.cs | 2 +- OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs | 2 +- .../Traits/Infiltration/InfiltrateForCash.cs | 2 +- .../Traits/Infiltration/InfiltrateForDecoration.cs | 2 +- .../Traits/Infiltration/InfiltrateForExploration.cs | 2 +- .../Traits/Infiltration/InfiltrateForPowerOutage.cs | 2 +- .../Traits/Infiltration/InfiltrateForSupportPower.cs | 2 +- .../Infiltration/InfiltrateForSupportPowerReset.cs | 2 +- .../Traits/Infiltration/InfiltrateForTransform.cs | 2 +- OpenRA.Mods.Cnc/Traits/Infiltration/Infiltrates.cs | 2 +- OpenRA.Mods.Cnc/Traits/MadTank.cs | 2 +- OpenRA.Mods.Cnc/Traits/Mine.cs | 6 +++--- OpenRA.Mods.Common/Traits/Air/Aircraft.cs | 4 ++-- OpenRA.Mods.Common/Traits/AppearsOnMapPreview.cs | 2 +- .../Traits/BotModules/SquadManagerBotModule.cs | 2 +- OpenRA.Mods.Common/Traits/Buildings/Bridge.cs | 2 +- .../Traits/Buildings/GroundLevelBridge.cs | 2 +- .../Traits/Buildings/RepairableBuilding.cs | 2 +- OpenRA.Mods.Common/Traits/Capturable.cs | 2 +- OpenRA.Mods.Common/Traits/CaptureManager.cs | 2 +- OpenRA.Mods.Common/Traits/Captures.cs | 4 ++-- OpenRA.Mods.Common/Traits/ChangesHealth.cs | 2 +- .../Traits/Crates/HealActorsCrateAction.cs | 2 +- OpenRA.Mods.Common/Traits/Crushable.cs | 3 +-- OpenRA.Mods.Common/Traits/DamagedByTerrain.cs | 2 +- OpenRA.Mods.Common/Traits/Demolition.cs | 2 +- OpenRA.Mods.Common/Traits/EngineerRepair.cs | 2 +- OpenRA.Mods.Common/Traits/EngineerRepairable.cs | 2 +- OpenRA.Mods.Common/Traits/Explodes.cs | 2 +- OpenRA.Mods.Common/Traits/GivesBounty.cs | 2 +- OpenRA.Mods.Common/Traits/GivesCashOnCapture.cs | 2 +- OpenRA.Mods.Common/Traits/HitShape.cs | 2 +- OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs | 2 +- OpenRA.Mods.Common/Traits/KillsSelf.cs | 2 +- OpenRA.Mods.Common/Traits/OwnerLostAction.cs | 2 +- OpenRA.Mods.Common/Traits/Parachutable.cs | 2 +- OpenRA.Mods.Common/Traits/ProximityCaptor.cs | 2 +- OpenRA.Mods.Common/Traits/Render/WithDamageOverlay.cs | 2 +- OpenRA.Mods.Common/Traits/RepairsUnits.cs | 2 +- OpenRA.Mods.Common/Traits/RevealOnDeath.cs | 2 +- OpenRA.Mods.Common/Traits/ShakeOnDeath.cs | 2 +- OpenRA.Mods.Common/Traits/Sound/DeathSounds.cs | 2 +- .../Traits/Sound/SoundOnDamageTransition.cs | 2 +- OpenRA.Mods.Common/Traits/TransformCrusherOnCrush.cs | 2 +- OpenRA.Mods.Common/Traits/TransformOnCapture.cs | 2 +- OpenRA.Mods.Common/Traits/World/Locomotor.cs | 10 +++++----- OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs | 2 +- OpenRA.Mods.Common/Warheads/DamageWarhead.cs | 2 +- OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs | 8 ++++---- OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs | 2 +- OpenRA.Mods.D2k/Traits/Buildings/D2kBuilding.cs | 2 +- 70 files changed, 90 insertions(+), 88 deletions(-) diff --git a/.editorconfig b/.editorconfig index b50db22e9b..9902b623b4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -135,6 +135,9 @@ dotnet_diagnostic.IDE0017.severity = warning # Collection initialization can be simplified dotnet_diagnostic.IDE0028.severity = warning +# Simplify 'default' expression +dotnet_diagnostic.IDE0034.severity = warning + # Modifiers are not ordered. dotnet_diagnostic.IDE0036.severity = warning diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index 0f307bd16e..f29b1aad87 100644 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -481,7 +481,7 @@ namespace OpenRA health.InflictDamage(this, attacker, damage, false); } - public void Kill(Actor attacker, BitSet damageTypes = default(BitSet)) + public void Kill(Actor attacker, BitSet damageTypes = default) { if (Disposed || health == null) return; diff --git a/OpenRA.Game/Exts.cs b/OpenRA.Game/Exts.cs index f199e57dcc..da09d912a4 100644 --- a/OpenRA.Game/Exts.cs +++ b/OpenRA.Game/Exts.cs @@ -155,7 +155,7 @@ namespace OpenRA if (throws) throw new ArgumentException("Collection must not be empty.", nameof(ts)); else - return default(T); + return default; } else return xs.ElementAt(r.Next(xs.Count)); @@ -232,7 +232,7 @@ namespace OpenRA if (throws) throw new ArgumentException("Collection must not be empty.", nameof(ts)); else - return default(T); + return default; t = e.Current; u = selector(t); while (e.MoveNext()) @@ -525,7 +525,7 @@ namespace OpenRA if (t.IsTraitEnabled()) return t; - return default(T); + return default; } public static T FirstEnabledTraitOrDefault(this T[] ts) @@ -535,7 +535,7 @@ namespace OpenRA if (t.IsTraitEnabled()) return t; - return default(T); + return default; } public static LineSplitEnumerator SplitLines(this string str, char separator) @@ -596,7 +596,7 @@ namespace OpenRA if (values.Any(x => !names.Contains(x))) { - value = default(T); + value = default; return false; } diff --git a/OpenRA.Game/LocalPlayerProfile.cs b/OpenRA.Game/LocalPlayerProfile.cs index 48a5300fe5..68df20e2d3 100644 --- a/OpenRA.Game/LocalPlayerProfile.cs +++ b/OpenRA.Game/LocalPlayerProfile.cs @@ -157,7 +157,7 @@ namespace OpenRA } innerState = LinkState.Uninitialized; - parameters = default(RSAParameters); + parameters = default; innerFingerprint = null; innerData = null; } diff --git a/OpenRA.Game/Map/CellLayer.cs b/OpenRA.Game/Map/CellLayer.cs index 5f61df39c1..b0616c040b 100644 --- a/OpenRA.Game/Map/CellLayer.cs +++ b/OpenRA.Game/Map/CellLayer.cs @@ -105,7 +105,7 @@ namespace OpenRA // so we pre-filter these to avoid returning the wrong result if (GridType == MapGridType.RectangularIsometric && cell.X < cell.Y) { - value = default(T); + value = default; return false; } @@ -116,7 +116,7 @@ namespace OpenRA return true; } - value = default(T); + value = default; return false; } diff --git a/OpenRA.Game/MiniYaml.cs b/OpenRA.Game/MiniYaml.cs index f5ae65cbf2..4a2d1bfc25 100644 --- a/OpenRA.Game/MiniYaml.cs +++ b/OpenRA.Game/MiniYaml.cs @@ -327,7 +327,7 @@ namespace OpenRA { var inherited = new Dictionary { - { kv.Key, default(MiniYamlNode.SourceLocation) } + { kv.Key, default } }; var children = ResolveInherits(kv.Value, tree, inherited); diff --git a/OpenRA.Game/ObjectCreator.cs b/OpenRA.Game/ObjectCreator.cs index ebee9257cd..d454773fa4 100644 --- a/OpenRA.Game/ObjectCreator.cs +++ b/OpenRA.Game/ObjectCreator.cs @@ -112,7 +112,7 @@ namespace OpenRA else throw new InvalidOperationException($"Cannot locate type: {className}"); - return default(T); + return default; } var ctor = ctorCache[type]; diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index ffbc24104b..5b8f92b0bb 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -87,8 +87,8 @@ namespace OpenRA // Each player is identified with a unique bit in the set // Cache masks for the player's index and ally/enemy player indices for performance. public LongBitSet PlayerMask; - public LongBitSet AlliedPlayersMask = default(LongBitSet); - public LongBitSet EnemyPlayersMask = default(LongBitSet); + public LongBitSet AlliedPlayersMask = default; + public LongBitSet EnemyPlayersMask = default; public bool UnlockedRenderPlayer { diff --git a/OpenRA.Game/Primitives/TypeDictionary.cs b/OpenRA.Game/Primitives/TypeDictionary.cs index 1e9925793a..e785294c8d 100644 --- a/OpenRA.Game/Primitives/TypeDictionary.cs +++ b/OpenRA.Game/Primitives/TypeDictionary.cs @@ -55,7 +55,7 @@ namespace OpenRA.Primitives { var result = Get(typeof(T), false); if (result == null) - return default(T); + return default; return (T)result; } diff --git a/OpenRA.Game/Scripting/ScriptTypes.cs b/OpenRA.Game/Scripting/ScriptTypes.cs index f1fd214d7c..50602a802b 100644 --- a/OpenRA.Game/Scripting/ScriptTypes.cs +++ b/OpenRA.Game/Scripting/ScriptTypes.cs @@ -27,7 +27,7 @@ namespace OpenRA.Scripting public static bool TryGetClrValue(this LuaValue value, out T clrObject) { var ret = value.TryGetClrValue(typeof(T), out object temp); - clrObject = ret ? (T)temp : default(T); + clrObject = ret ? (T)temp : default; return ret; } diff --git a/OpenRA.Game/Sound/Sound.cs b/OpenRA.Game/Sound/Sound.cs index 46f2f8828c..41d399f6ed 100644 --- a/OpenRA.Game/Sound/Sound.cs +++ b/OpenRA.Game/Sound/Sound.cs @@ -62,7 +62,7 @@ namespace OpenRA if (!fileSystem.Exists(filename)) { Log.Write("sound", "LoadSound, file does not exist: {0}", filename); - return default(T); + return default; } using (var stream = fileSystem.Open(filename)) diff --git a/OpenRA.Game/Traits/Target.cs b/OpenRA.Game/Traits/Target.cs index 8a9fcb1a92..f61584cb18 100644 --- a/OpenRA.Game/Traits/Target.cs +++ b/OpenRA.Game/Traits/Target.cs @@ -19,7 +19,7 @@ namespace OpenRA.Traits public readonly struct Target { public static readonly Target[] None = Array.Empty(); - public static readonly Target Invalid = default(Target); + public static readonly Target Invalid = default; readonly TargetType type; readonly Actor actor; diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 70d4d02774..42a9ae4204 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -98,7 +98,7 @@ namespace OpenRA.Traits public Damage(int damage) { Value = damage; - DamageTypes = default(BitSet); + DamageTypes = default; } } diff --git a/OpenRA.Game/Widgets/ChromeMetrics.cs b/OpenRA.Game/Widgets/ChromeMetrics.cs index c5a2214900..1b8e924370 100644 --- a/OpenRA.Game/Widgets/ChromeMetrics.cs +++ b/OpenRA.Game/Widgets/ChromeMetrics.cs @@ -37,7 +37,7 @@ namespace OpenRA.Widgets { if (!data.TryGetValue(key, out var s)) { - result = default(T); + result = default; return false; } diff --git a/OpenRA.Game/Widgets/Widget.cs b/OpenRA.Game/Widgets/Widget.cs index 2f19e0a150..088bc673f0 100644 --- a/OpenRA.Game/Widgets/Widget.cs +++ b/OpenRA.Game/Widgets/Widget.cs @@ -340,7 +340,7 @@ namespace OpenRA.Widgets void ForceYieldMouseFocus() { - if (Ui.MouseFocusWidget == this && !YieldMouseFocus(default(MouseInput))) + if (Ui.MouseFocusWidget == this && !YieldMouseFocus(default)) Ui.MouseFocusWidget = null; } diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index 8089b41b1c..f5046252cf 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -50,8 +50,8 @@ namespace OpenRA public readonly MersenneTwister SharedRandom; public readonly MersenneTwister LocalRandom; public readonly IModelCache ModelCache; - public LongBitSet AllPlayersMask = default(LongBitSet); - public readonly LongBitSet NoPlayersMask = default(LongBitSet); + public LongBitSet AllPlayersMask = default; + public readonly LongBitSet NoPlayersMask = default; public Player[] Players = Array.Empty(); diff --git a/OpenRA.Mods.Cnc/Activities/Teleport.cs b/OpenRA.Mods.Cnc/Activities/Teleport.cs index 69cb667841..c7e8a9d494 100644 --- a/OpenRA.Mods.Cnc/Activities/Teleport.cs +++ b/OpenRA.Mods.Cnc/Activities/Teleport.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Cnc.Activities public Teleport(Actor teleporter, CPos destination, int? maximumDistance, bool killCargo, bool screenFlash, string sound, bool interruptable = true, - bool killOnFailure = false, BitSet killDamageTypes = default(BitSet)) + bool killOnFailure = false, BitSet killDamageTypes = default) { var max = teleporter.World.Map.Grid.MaximumTileSearchRange; if (maximumDistance > max) diff --git a/OpenRA.Mods.Cnc/Traits/Buildings/ClonesProducedUnits.cs b/OpenRA.Mods.Cnc/Traits/Buildings/ClonesProducedUnits.cs index 1ac21352e3..04da46e0d8 100644 --- a/OpenRA.Mods.Cnc/Traits/Buildings/ClonesProducedUnits.cs +++ b/OpenRA.Mods.Cnc/Traits/Buildings/ClonesProducedUnits.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Cnc.Traits { [FieldLoader.Require] [Desc("Uses the \"Cloneable\" trait to determine whether or not we should clone a produced unit.")] - public readonly BitSet CloneableTypes = default(BitSet); + public readonly BitSet CloneableTypes = default; [FieldLoader.Require] [Desc("e.g. Infantry, Vehicles, Aircraft, Buildings")] diff --git a/OpenRA.Mods.Cnc/Traits/Chronoshiftable.cs b/OpenRA.Mods.Cnc/Traits/Chronoshiftable.cs index e2b05f1d87..b0ad7aef4b 100644 --- a/OpenRA.Mods.Cnc/Traits/Chronoshiftable.cs +++ b/OpenRA.Mods.Cnc/Traits/Chronoshiftable.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Cnc.Traits [Desc("Types of damage that this trait causes to self when 'ExplodeInstead' is true", "or the return-to-origin is blocked. Leave empty for no damage types.")] - public readonly BitSet DamageTypes = default(BitSet); + public readonly BitSet DamageTypes = default; public readonly string ChronoshiftSound = "chrono2.aud"; diff --git a/OpenRA.Mods.Cnc/Traits/Cloneable.cs b/OpenRA.Mods.Cnc/Traits/Cloneable.cs index 69e6706e5c..ad8ba5704a 100644 --- a/OpenRA.Mods.Cnc/Traits/Cloneable.cs +++ b/OpenRA.Mods.Cnc/Traits/Cloneable.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Cnc.Traits { [FieldLoader.Require] [Desc("This unit's cloneable type is:")] - public readonly BitSet Types = default(BitSet); + public readonly BitSet Types = default; } public class Cloneable { } diff --git a/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs b/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs index d9fe7bef77..0b1fb996cc 100644 --- a/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs +++ b/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs @@ -40,7 +40,7 @@ namespace OpenRA.Mods.Cnc.Traits public readonly int Damage = 1000; [Desc("Apply the damage using these damagetypes.")] - public readonly BitSet DamageTypes = default(BitSet); + public readonly BitSet DamageTypes = default; [ConsumedConditionReference] [Desc("Boolean expression defining the condition under which to teleport a replacement actor instead of triggering the vortex.")] diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForCash.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForCash.cs index 96793b44cd..4a4b7b70fe 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForCash.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForCash.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Cnc.Traits class InfiltrateForCashInfo : TraitInfo { [Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")] - public readonly BitSet Types = default(BitSet); + public readonly BitSet Types = default; [Desc("Percentage of the victim's resources that will be stolen.")] public readonly int Percentage = 100; diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForDecoration.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForDecoration.cs index 240e9934bd..a58d58a31c 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForDecoration.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForDecoration.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Cnc.Traits class InfiltrateForDecorationInfo : WithDecorationInfo { [Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")] - public readonly BitSet Types = default(BitSet); + public readonly BitSet Types = default; public override object Create(ActorInitializer init) { return new InfiltrateForDecoration(init.Self, this); } } diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs index 95e5976482..a9bf96b40b 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Cnc.Traits class InfiltrateForExplorationInfo : TraitInfo { [Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")] - public readonly BitSet Types = default(BitSet); + public readonly BitSet Types = default; [NotificationReference("Speech")] [Desc("Sound the victim will hear when they get sabotaged.")] diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForPowerOutage.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForPowerOutage.cs index 3a94e96857..d2f5356a8c 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForPowerOutage.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForPowerOutage.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Cnc.Traits class InfiltrateForPowerOutageInfo : TraitInfo { [Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")] - public readonly BitSet Types = default(BitSet); + public readonly BitSet Types = default; [Desc("Measured in ticks.")] public readonly int Duration = 500; diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPower.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPower.cs index cad3d53794..96e770aece 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPower.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPower.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Cnc.Traits public readonly string Proxy = null; [Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")] - public readonly BitSet Types = default(BitSet); + public readonly BitSet Types = default; [NotificationReference("Speech")] [Desc("Sound the victim will hear when technology gets stolen.")] diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPowerReset.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPowerReset.cs index 23912d93e1..bc5471797d 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPowerReset.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPowerReset.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Cnc.Traits class InfiltrateForSupportPowerResetInfo : TraitInfo { [Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")] - public readonly BitSet Types = default(BitSet); + public readonly BitSet Types = default; [NotificationReference("Speech")] [Desc("Sound the victim will hear when they get sabotaged.")] diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForTransform.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForTransform.cs index 165348a63c..14ec71200d 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForTransform.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForTransform.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits public readonly bool SkipMakeAnims = true; [Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")] - public readonly BitSet Types = default(BitSet); + public readonly BitSet Types = default; public override object Create(ActorInitializer init) { return new InfiltrateForTransform(init, this); } } diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/Infiltrates.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/Infiltrates.cs index 3c6f6578f6..aa9bfbe7f4 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/Infiltrates.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/Infiltrates.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Cnc.Traits public class InfiltratesInfo : ConditionalTraitInfo { [Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")] - public readonly BitSet Types = default(BitSet); + public readonly BitSet Types = default; [VoiceReference] public readonly string Voice = "Action"; diff --git a/OpenRA.Mods.Cnc/Traits/MadTank.cs b/OpenRA.Mods.Cnc/Traits/MadTank.cs index b103640ce8..50b87455d5 100644 --- a/OpenRA.Mods.Cnc/Traits/MadTank.cs +++ b/OpenRA.Mods.Cnc/Traits/MadTank.cs @@ -59,7 +59,7 @@ namespace OpenRA.Mods.Cnc.Traits public WeaponInfo DetonationWeaponInfo { get; private set; } [Desc("Types of damage that this trait causes to self while self-destructing. Leave empty for no damage types.")] - public readonly BitSet DamageTypes = default(BitSet); + public readonly BitSet DamageTypes = default; [CursorReference] [Desc("Cursor to display when targeting.")] diff --git a/OpenRA.Mods.Cnc/Traits/Mine.cs b/OpenRA.Mods.Cnc/Traits/Mine.cs index b9fa7d61cb..db88888d7a 100644 --- a/OpenRA.Mods.Cnc/Traits/Mine.cs +++ b/OpenRA.Mods.Cnc/Traits/Mine.cs @@ -17,10 +17,10 @@ namespace OpenRA.Mods.Cnc.Traits { class MineInfo : TraitInfo { - public readonly BitSet CrushClasses = default(BitSet); + public readonly BitSet CrushClasses = default; public readonly bool AvoidFriendly = true; public readonly bool BlockFriendly = true; - public readonly BitSet DetonateClasses = default(BitSet); + public readonly BitSet DetonateClasses = default; public override object Create(ActorInitializer init) { return new Mine(this); } } @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Cnc.Traits if (mobile != null && !info.DetonateClasses.Overlaps(mobile.Info.LocomotorInfo.Crushes)) return; - self.Kill(crusher, mobile != null ? mobile.Info.LocomotorInfo.CrushDamageTypes : default(BitSet)); + self.Kill(crusher, mobile != null ? mobile.Info.LocomotorInfo.CrushDamageTypes : default); } bool ICrushable.CrushableBy(Actor self, Actor crusher, BitSet crushClasses) diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index ba4b6823c5..13362c8d5c 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -86,10 +86,10 @@ namespace OpenRA.Mods.Common.Traits public readonly bool MoveIntoShroud = true; [Desc("e.g. crate, wall, infantry")] - public readonly BitSet Crushes = default(BitSet); + public readonly BitSet Crushes = default; [Desc("Types of damage that are caused while crushing. Leave empty for no damage types.")] - public readonly BitSet CrushDamageTypes = default(BitSet); + public readonly BitSet CrushDamageTypes = default; [VoiceReference] public readonly string Voice = "Action"; diff --git a/OpenRA.Mods.Common/Traits/AppearsOnMapPreview.cs b/OpenRA.Mods.Common/Traits/AppearsOnMapPreview.cs index 9830e64a10..8521725f10 100644 --- a/OpenRA.Mods.Common/Traits/AppearsOnMapPreview.cs +++ b/OpenRA.Mods.Common/Traits/AppearsOnMapPreview.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits public class AppearsOnMapPreviewInfo : TraitInfo, IMapPreviewSignatureInfo, Requires { [Desc("Use this color to render the actor, instead of owner player color.")] - public readonly Color Color = default(Color); + public readonly Color Color = default; [Desc("Use this terrain color to render the actor, instead of owner player color.", "Overrides `Color` if both set.")] diff --git a/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs index c3dadd3a87..bc0caaa7f0 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs @@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int ProtectionScanRadius = 8; [Desc("Enemy target types to never target.")] - public readonly BitSet IgnoredEnemyTargetTypes = default(BitSet); + public readonly BitSet IgnoredEnemyTargetTypes = default; public override void RulesetLoaded(Ruleset rules, ActorInfo ai) { diff --git a/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs b/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs index 6710563d21..43dcdae4c4 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs @@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits public WeaponInfo DemolishWeaponInfo { get; private set; } [Desc("Types of damage that this bridge causes to units over/in path of it while being destroyed/repaired. Leave empty for no damage types.")] - public readonly BitSet DamageTypes = default(BitSet); + public readonly BitSet DamageTypes = default; public override object Create(ActorInitializer init) { return new Bridge(init.Self, this); } diff --git a/OpenRA.Mods.Common/Traits/Buildings/GroundLevelBridge.cs b/OpenRA.Mods.Common/Traits/Buildings/GroundLevelBridge.cs index af60e69a81..fba2e7bdae 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/GroundLevelBridge.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/GroundLevelBridge.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits public WeaponInfo DemolishWeaponInfo { get; private set; } [Desc("Types of damage that this bridge causes to units over/in path of it while being destroyed/repaired. Leave empty for no damage types.")] - public readonly BitSet DamageTypes = default(BitSet); + public readonly BitSet DamageTypes = default; public void RulesetLoaded(Ruleset rules, ActorInfo ai) { diff --git a/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs b/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs index 97f2ff34c1..4cde54c52a 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int RepairStep = 7; [Desc("Damage types used for the repair.")] - public readonly BitSet RepairDamageTypes = default(BitSet); + public readonly BitSet RepairDamageTypes = default; [Desc("The percentage repair bonus applied with increasing numbers of repairers.")] public readonly int[] RepairBonuses = { 100, 150, 175, 200, 220, 240, 260, 280, 300 }; diff --git a/OpenRA.Mods.Common/Traits/Capturable.cs b/OpenRA.Mods.Common/Traits/Capturable.cs index 94274272b1..14483c162e 100644 --- a/OpenRA.Mods.Common/Traits/Capturable.cs +++ b/OpenRA.Mods.Common/Traits/Capturable.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits { [FieldLoader.Require] [Desc("CaptureTypes (from the Captures trait) that are able to capture this.")] - public readonly BitSet Types = default(BitSet); + public readonly BitSet Types = default; [Desc("What player relationships the target's owner needs to be captured by this actor.")] public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Neutral | PlayerRelationship.Enemy; diff --git a/OpenRA.Mods.Common/Traits/CaptureManager.cs b/OpenRA.Mods.Common/Traits/CaptureManager.cs index 5bd1880fd6..b5de017ae8 100644 --- a/OpenRA.Mods.Common/Traits/CaptureManager.cs +++ b/OpenRA.Mods.Common/Traits/CaptureManager.cs @@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Traits public void RefreshCapturable() { - allyCapturableTypes = neutralCapturableTypes = enemyCapturableTypes = default(BitSet); + allyCapturableTypes = neutralCapturableTypes = enemyCapturableTypes = default; foreach (var c in enabledCapturable) { if (c.Info.ValidRelationships.HasRelationship(PlayerRelationship.Ally)) diff --git a/OpenRA.Mods.Common/Traits/Captures.cs b/OpenRA.Mods.Common/Traits/Captures.cs index 10815615c7..a1f78e0419 100644 --- a/OpenRA.Mods.Common/Traits/Captures.cs +++ b/OpenRA.Mods.Common/Traits/Captures.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits { [FieldLoader.Require] [Desc("Types of actors that it can capture, as long as the type also exists in the Capturable Type: trait.")] - public readonly BitSet CaptureTypes = default(BitSet); + public readonly BitSet CaptureTypes = default; [Desc("Targets with health above this percentage will be sabotaged instead of captured.", "Set to 0 to disable sabotaging.")] @@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int SabotageHPRemoval = 50; [Desc("Damage types that applied with the sabotage damage.")] - public readonly BitSet SabotageDamageTypes = default(BitSet); + public readonly BitSet SabotageDamageTypes = default; [Desc("Delay (in ticks) that to wait next to the target before initiating the capture.")] public readonly int CaptureDelay = 0; diff --git a/OpenRA.Mods.Common/Traits/ChangesHealth.cs b/OpenRA.Mods.Common/Traits/ChangesHealth.cs index 893e21bbaa..e55bcf77f1 100644 --- a/OpenRA.Mods.Common/Traits/ChangesHealth.cs +++ b/OpenRA.Mods.Common/Traits/ChangesHealth.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int DamageCooldown = 0; [Desc("Apply the health change when encountering these damage types.")] - public readonly BitSet DamageTypes = default(BitSet); + public readonly BitSet DamageTypes = default; public override object Create(ActorInitializer init) { return new ChangesHealth(init.Self, this); } } diff --git a/OpenRA.Mods.Common/Traits/Crates/HealActorsCrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/HealActorsCrateAction.cs index 025d9fdecb..ee7c938ae2 100644 --- a/OpenRA.Mods.Common/Traits/Crates/HealActorsCrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/HealActorsCrateAction.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits class HealActorsCrateActionInfo : CrateActionInfo { [Desc("The target type(s) of the actors this crate action will heal. Leave empty to heal all actors.")] - public readonly BitSet TargetTypes = default(BitSet); + public readonly BitSet TargetTypes = default; public override object Create(ActorInitializer init) { return new HealActorsCrateAction(init.Self, this); } } diff --git a/OpenRA.Mods.Common/Traits/Crushable.cs b/OpenRA.Mods.Common/Traits/Crushable.cs index 315d8792ce..e1c1c2a810 100644 --- a/OpenRA.Mods.Common/Traits/Crushable.cs +++ b/OpenRA.Mods.Common/Traits/Crushable.cs @@ -10,7 +10,6 @@ #endregion using OpenRA.Primitives; -using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { @@ -57,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits Game.Sound.Play(SoundType.World, Info.CrushSound, crusher.CenterPosition); var crusherMobile = crusher.TraitOrDefault(); - self.Kill(crusher, crusherMobile != null ? crusherMobile.Info.LocomotorInfo.CrushDamageTypes : default(BitSet)); + self.Kill(crusher, crusherMobile != null ? crusherMobile.Info.LocomotorInfo.CrushDamageTypes : default); } bool ICrushable.CrushableBy(Actor self, Actor crusher, BitSet crushClasses) diff --git a/OpenRA.Mods.Common/Traits/DamagedByTerrain.cs b/OpenRA.Mods.Common/Traits/DamagedByTerrain.cs index 0618ee47b3..700fd319a8 100644 --- a/OpenRA.Mods.Common/Traits/DamagedByTerrain.cs +++ b/OpenRA.Mods.Common/Traits/DamagedByTerrain.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int DamageInterval = 0; [Desc("Apply the damage using these damagetypes.")] - public readonly BitSet DamageTypes = default(BitSet); + public readonly BitSet DamageTypes = default; [FieldLoader.Require] [Desc("Terrain types where the actor will take damage.")] diff --git a/OpenRA.Mods.Common/Traits/Demolition.cs b/OpenRA.Mods.Common/Traits/Demolition.cs index 124b58bcac..ab5e43c065 100644 --- a/OpenRA.Mods.Common/Traits/Demolition.cs +++ b/OpenRA.Mods.Common/Traits/Demolition.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits public readonly EnterBehaviour EnterBehaviour = EnterBehaviour.Exit; [Desc("Types of damage that this trait causes. Leave empty for no damage types.")] - public readonly BitSet DamageTypes = default(BitSet); + public readonly BitSet DamageTypes = default; [VoiceReference] [Desc("Voice string when planting explosive charges.")] diff --git a/OpenRA.Mods.Common/Traits/EngineerRepair.cs b/OpenRA.Mods.Common/Traits/EngineerRepair.cs index 3b00cad855..bc81b925a6 100644 --- a/OpenRA.Mods.Common/Traits/EngineerRepair.cs +++ b/OpenRA.Mods.Common/Traits/EngineerRepair.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits public class EngineerRepairInfo : ConditionalTraitInfo { [Desc("Uses the \"EngineerRepairable\" trait to determine repairability.")] - public readonly BitSet Types = default(BitSet); + public readonly BitSet Types = default; [VoiceReference] public readonly string Voice = "Action"; diff --git a/OpenRA.Mods.Common/Traits/EngineerRepairable.cs b/OpenRA.Mods.Common/Traits/EngineerRepairable.cs index bfc70cad76..2885ca40ed 100644 --- a/OpenRA.Mods.Common/Traits/EngineerRepairable.cs +++ b/OpenRA.Mods.Common/Traits/EngineerRepairable.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits public class EngineerRepairableInfo : ConditionalTraitInfo { [Desc("Actors with these Types under EngineerRepair trait can repair me.")] - public readonly BitSet Types = default(BitSet); + public readonly BitSet Types = default; public override object Create(ActorInitializer init) { return new EngineerRepairable(this); } } diff --git a/OpenRA.Mods.Common/Traits/Explodes.cs b/OpenRA.Mods.Common/Traits/Explodes.cs index 3fb3522ecd..e66fa29811 100644 --- a/OpenRA.Mods.Common/Traits/Explodes.cs +++ b/OpenRA.Mods.Common/Traits/Explodes.cs @@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int DamageThreshold = 0; [Desc("DeathType(s) that trigger the explosion. Leave empty to always trigger an explosion.")] - public readonly BitSet DeathTypes = default(BitSet); + public readonly BitSet DeathTypes = default; [Desc("Who is counted as source of damage for explosion.", "Possible values are Self and Killer.")] diff --git a/OpenRA.Mods.Common/Traits/GivesBounty.cs b/OpenRA.Mods.Common/Traits/GivesBounty.cs index cd6d15a41e..08785244fd 100644 --- a/OpenRA.Mods.Common/Traits/GivesBounty.cs +++ b/OpenRA.Mods.Common/Traits/GivesBounty.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("DeathTypes for which a bounty should be granted.", "Use an empty list (the default) to allow all DeathTypes.")] - public readonly BitSet DeathTypes = default(BitSet); + public readonly BitSet DeathTypes = default; public override object Create(ActorInitializer init) { return new GivesBounty(this); } } diff --git a/OpenRA.Mods.Common/Traits/GivesCashOnCapture.cs b/OpenRA.Mods.Common/Traits/GivesCashOnCapture.cs index a92c684750..235b4baca7 100644 --- a/OpenRA.Mods.Common/Traits/GivesCashOnCapture.cs +++ b/OpenRA.Mods.Common/Traits/GivesCashOnCapture.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int Amount = 0; [Desc("Award cash only if the capturer's CaptureTypes overlap with these types. Leave empty to allow all types.")] - public readonly BitSet CaptureTypes = default(BitSet); + public readonly BitSet CaptureTypes = default; public override object Create(ActorInitializer init) { return new GivesCashOnCapture(this); } } diff --git a/OpenRA.Mods.Common/Traits/HitShape.cs b/OpenRA.Mods.Common/Traits/HitShape.cs index 8c7f9950cf..c41230e00c 100644 --- a/OpenRA.Mods.Common/Traits/HitShape.cs +++ b/OpenRA.Mods.Common/Traits/HitShape.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Defines which Armor types apply when the actor receives damage to this HitShape.", "If none specified, all armor types the actor has are valid.")] - public readonly BitSet ArmorTypes = default(BitSet); + public readonly BitSet ArmorTypes = default; [FieldLoader.LoadUsing(nameof(LoadShape))] [Desc("Engine comes with support for `Circle`, `Capsule`, `Polygon` and `Rectangle`. Defaults to `Circle` when left empty.")] diff --git a/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs b/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs index 6888a0ab96..a177363264 100644 --- a/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs +++ b/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Damage types that trigger prone state. Defined on the warheads.", "If Duration is negative (permanent), you can leave this empty to trigger prone state immediately.")] - public readonly BitSet DamageTriggers = default(BitSet); + public readonly BitSet DamageTriggers = default; [Desc("Damage modifiers for each damage type (defined on the warheads) while the unit is prone.")] public readonly Dictionary DamageModifiers = new Dictionary(); diff --git a/OpenRA.Mods.Common/Traits/KillsSelf.cs b/OpenRA.Mods.Common/Traits/KillsSelf.cs index 67057bb4a7..82138e2950 100644 --- a/OpenRA.Mods.Common/Traits/KillsSelf.cs +++ b/OpenRA.Mods.Common/Traits/KillsSelf.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int[] Delay = { 0 }; [Desc("Types of damage that this trait causes. Leave empty for no damage types.")] - public readonly BitSet DamageTypes = default(BitSet); + public readonly BitSet DamageTypes = default; [GrantedConditionReference] [Desc("The condition to grant moments before suiciding.")] diff --git a/OpenRA.Mods.Common/Traits/OwnerLostAction.cs b/OpenRA.Mods.Common/Traits/OwnerLostAction.cs index fdd8ce9df0..e70cb30113 100644 --- a/OpenRA.Mods.Common/Traits/OwnerLostAction.cs +++ b/OpenRA.Mods.Common/Traits/OwnerLostAction.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string Owner = "Neutral"; [Desc("The deathtypes used when 'Action' is 'Kill'.")] - public readonly BitSet DeathTypes = default(BitSet); + public readonly BitSet DeathTypes = default; public override object Create(ActorInitializer init) { return new OwnerLostAction(this); } } diff --git a/OpenRA.Mods.Common/Traits/Parachutable.cs b/OpenRA.Mods.Common/Traits/Parachutable.cs index 144cee8082..4582ef3a0e 100644 --- a/OpenRA.Mods.Common/Traits/Parachutable.cs +++ b/OpenRA.Mods.Common/Traits/Parachutable.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits public readonly bool KilledOnImpassableTerrain = true; [Desc("Types of damage that this trait causes to self when 'KilledOnImpassableTerrain' is true. Leave empty for no damage types.")] - public readonly BitSet DamageTypes = default(BitSet); + public readonly BitSet DamageTypes = default; [Desc("Image where Ground/WaterCorpseSequence is looked up.")] public readonly string Image = "explosion"; diff --git a/OpenRA.Mods.Common/Traits/ProximityCaptor.cs b/OpenRA.Mods.Common/Traits/ProximityCaptor.cs index 36f6a6c764..4ee0ae0747 100644 --- a/OpenRA.Mods.Common/Traits/ProximityCaptor.cs +++ b/OpenRA.Mods.Common/Traits/ProximityCaptor.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits public class ProximityCaptorInfo : TraitInfo { [FieldLoader.Require] - public readonly BitSet Types = default(BitSet); + public readonly BitSet Types = default; } public class ProximityCaptor { } diff --git a/OpenRA.Mods.Common/Traits/Render/WithDamageOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithDamageOverlay.cs index 48b61629af..35b1d5e4e0 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithDamageOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithDamageOverlay.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits.Render [Desc("Damage types that this should be used for (defined on the warheads).", "Leave empty to disable all filtering.")] - public readonly BitSet DamageTypes = default(BitSet); + public readonly BitSet DamageTypes = default; [Desc("Trigger when Undamaged, Light, Medium, Heavy, Critical or Dead.")] public readonly DamageState MinimumDamageState = DamageState.Heavy; diff --git a/OpenRA.Mods.Common/Traits/RepairsUnits.cs b/OpenRA.Mods.Common/Traits/RepairsUnits.cs index 02105824cd..3c11a6e86d 100644 --- a/OpenRA.Mods.Common/Traits/RepairsUnits.cs +++ b/OpenRA.Mods.Common/Traits/RepairsUnits.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int Interval = 24; [Desc("Damage types used for the repair.")] - public readonly BitSet RepairDamageTypes = default(BitSet); + public readonly BitSet RepairDamageTypes = default; [NotificationReference("Speech")] [Desc("Speech notification played when starting to repair a unit.")] diff --git a/OpenRA.Mods.Common/Traits/RevealOnDeath.cs b/OpenRA.Mods.Common/Traits/RevealOnDeath.cs index 14407b6d47..a3e9caa1c4 100644 --- a/OpenRA.Mods.Common/Traits/RevealOnDeath.cs +++ b/OpenRA.Mods.Common/Traits/RevealOnDeath.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("DeathTypes for which shroud will be revealed.", "Use an empty list (the default) to allow all DeathTypes.")] - public readonly BitSet DeathTypes = default(BitSet); + public readonly BitSet DeathTypes = default; public override object Create(ActorInitializer init) { return new RevealOnDeath(this); } } diff --git a/OpenRA.Mods.Common/Traits/ShakeOnDeath.cs b/OpenRA.Mods.Common/Traits/ShakeOnDeath.cs index fee0a2ec9e..ec68f95f0f 100644 --- a/OpenRA.Mods.Common/Traits/ShakeOnDeath.cs +++ b/OpenRA.Mods.Common/Traits/ShakeOnDeath.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits public class ShakeOnDeathInfo : TraitInfo { [Desc("DeathType(s) that trigger the shake. Leave empty to always trigger a shake.")] - public readonly BitSet DeathTypes = default(BitSet); + public readonly BitSet DeathTypes = default; public readonly int Duration = 10; public readonly int Intensity = 1; diff --git a/OpenRA.Mods.Common/Traits/Sound/DeathSounds.cs b/OpenRA.Mods.Common/Traits/Sound/DeathSounds.cs index d982a35bc7..842f29596a 100644 --- a/OpenRA.Mods.Common/Traits/Sound/DeathSounds.cs +++ b/OpenRA.Mods.Common/Traits/Sound/DeathSounds.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits.Sound [Desc("Damage types that this should be used for (defined on the warheads).", "If empty, this will be used as the default sound for all death types.")] - public readonly BitSet DeathTypes = default(BitSet); + public readonly BitSet DeathTypes = default; public override object Create(ActorInitializer init) { return new DeathSounds(this); } } diff --git a/OpenRA.Mods.Common/Traits/Sound/SoundOnDamageTransition.cs b/OpenRA.Mods.Common/Traits/Sound/SoundOnDamageTransition.cs index a9a877bc35..5e0216431a 100644 --- a/OpenRA.Mods.Common/Traits/Sound/SoundOnDamageTransition.cs +++ b/OpenRA.Mods.Common/Traits/Sound/SoundOnDamageTransition.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits.Sound public readonly string[] DestroyedSounds = Array.Empty(); [Desc("DamageType(s) that trigger the sounds. Leave empty to always trigger a sound.")] - public readonly BitSet DamageTypes = default(BitSet); + public readonly BitSet DamageTypes = default; public override object Create(ActorInitializer init) { return new SoundOnDamageTransition(this); } } diff --git a/OpenRA.Mods.Common/Traits/TransformCrusherOnCrush.cs b/OpenRA.Mods.Common/Traits/TransformCrusherOnCrush.cs index 64e081dd9f..e070a6e90c 100644 --- a/OpenRA.Mods.Common/Traits/TransformCrusherOnCrush.cs +++ b/OpenRA.Mods.Common/Traits/TransformCrusherOnCrush.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits public readonly bool SkipMakeAnims = true; - public readonly BitSet CrushClasses = default(BitSet); + public readonly BitSet CrushClasses = default; public override object Create(ActorInitializer init) { return new TransformCrusherOnCrush(init, this); } } diff --git a/OpenRA.Mods.Common/Traits/TransformOnCapture.cs b/OpenRA.Mods.Common/Traits/TransformOnCapture.cs index 85c0f280ae..dea74be52e 100644 --- a/OpenRA.Mods.Common/Traits/TransformOnCapture.cs +++ b/OpenRA.Mods.Common/Traits/TransformOnCapture.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits public readonly bool SkipMakeAnims = true; [Desc("Transform only if the capturer's CaptureTypes overlap with these types. Leave empty to allow all types.")] - public readonly BitSet CaptureTypes = default(BitSet); + public readonly BitSet CaptureTypes = default; public override object Create(ActorInitializer init) { return new TransformOnCapture(init, this); } } diff --git a/OpenRA.Mods.Common/Traits/World/Locomotor.cs b/OpenRA.Mods.Common/Traits/World/Locomotor.cs index f53ec7fde6..bfae88fa2a 100644 --- a/OpenRA.Mods.Common/Traits/World/Locomotor.cs +++ b/OpenRA.Mods.Common/Traits/World/Locomotor.cs @@ -73,10 +73,10 @@ namespace OpenRA.Mods.Common.Traits public readonly bool MoveIntoShroud = true; [Desc("e.g. crate, wall, infantry")] - public readonly BitSet Crushes = default(BitSet); + public readonly BitSet Crushes = default; [Desc("Types of damage that are caused while crushing. Leave empty for no damage types.")] - public readonly BitSet CrushDamageTypes = default(BitSet); + public readonly BitSet CrushDamageTypes = default; [FieldLoader.LoadUsing(nameof(LoadSpeeds), true)] [Desc("Lower the value on rough terrain. Leave out entries for impassable terrain.")] @@ -134,7 +134,7 @@ namespace OpenRA.Mods.Common.Traits public readonly LongBitSet Crushable; public readonly CellFlag CellFlag; - public CellCache(LongBitSet immovable, CellFlag cellFlag, LongBitSet crushable = default(LongBitSet)) + public CellCache(LongBitSet immovable, CellFlag cellFlag, LongBitSet crushable = default) { Immovable = immovable; Crushable = crushable; @@ -467,13 +467,13 @@ namespace OpenRA.Mods.Common.Traits if (!actors.Any()) { - cache[cell] = new CellCache(default(LongBitSet), cellFlag); + cache[cell] = new CellCache(default, cellFlag); return; } if (sharesCell && actorMap.HasFreeSubCell(cell)) { - cache[cell] = new CellCache(default(LongBitSet), cellFlag); + cache[cell] = new CellCache(default, cellFlag); return; } diff --git a/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs b/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs index dabe1a982a..bf91ce23c4 100644 --- a/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs @@ -180,7 +180,7 @@ namespace OpenRA.Mods.Common.Traits if (!world.Map.Contains(loc)) return; - var tile = dirty.ContainsKey(loc) ? dirty[loc] : default(Smudge); + var tile = dirty.ContainsKey(loc) ? dirty[loc] : default; // Setting Sequence to null to indicate a deleted smudge. tile.Sequence = null; diff --git a/OpenRA.Mods.Common/Warheads/DamageWarhead.cs b/OpenRA.Mods.Common/Warheads/DamageWarhead.cs index 5b20e95359..2eda2c61d7 100644 --- a/OpenRA.Mods.Common/Warheads/DamageWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/DamageWarhead.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Warheads public readonly int Damage = 0; [Desc("Types of damage that this warhead causes. Leave empty for no damage types.")] - public readonly BitSet DamageTypes = default(BitSet); + public readonly BitSet DamageTypes = default; [Desc("Damage percentage versus each armor type.")] public readonly Dictionary Versus = new Dictionary(); diff --git a/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs index eaa3ca37dd..fde048ede7 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs @@ -836,10 +836,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic public string Faction; public bool IsEmpty => - Type == default(GameType) - && Date == default(DateType) - && Duration == default(DurationType) - && Outcome == default(WinState) + Type == default + && Date == default + && Duration == default + && Outcome == default && string.IsNullOrEmpty(PlayerName) && string.IsNullOrEmpty(MapName) && string.IsNullOrEmpty(Faction); diff --git a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs index a8931a8ba1..b64f2ba76d 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs @@ -443,7 +443,7 @@ namespace OpenRA.Mods.Common.Widgets public void RefreshIcons() { icons = new Dictionary(); - var producer = CurrentQueue != null ? CurrentQueue.MostLikelyProducer() : default(TraitPair); + var producer = CurrentQueue != null ? CurrentQueue.MostLikelyProducer() : default; if (CurrentQueue == null || producer.Trait == null) { if (DisplayedIconCount != 0) diff --git a/OpenRA.Mods.D2k/Traits/Buildings/D2kBuilding.cs b/OpenRA.Mods.D2k/Traits/Buildings/D2kBuilding.cs index 414e6d0f2a..c8da591cec 100644 --- a/OpenRA.Mods.D2k/Traits/Buildings/D2kBuilding.cs +++ b/OpenRA.Mods.D2k/Traits/Buildings/D2kBuilding.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.D2k.Traits.Buildings public readonly int DamageInterval = 100; [Desc("Apply the damage using these damagetypes.")] - public readonly BitSet DamageTypes = default(BitSet); + public readonly BitSet DamageTypes = default; [Desc("Terrain types where the actor will take damage.")] public readonly string[] DamageTerrainTypes = { "Rock" };