Fix IDE0090

This commit is contained in:
RoosterDragon
2023-04-05 19:34:12 +01:00
committed by Pavel Penev
parent 164abfdae1
commit 8a285f9b19
385 changed files with 790 additions and 794 deletions

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Activities
Target target;
Target lastVisibleTarget;
bool useLastVisibleTarget;
readonly List<WPos> positionBuffer = new List<WPos>();
readonly List<WPos> positionBuffer = new();
public Fly(Actor self, in Target t, WDist nearEnough, WPos? initialTargetPosition = null, Color? targetLineColor = null)
: this(self, t, initialTargetPosition, targetLineColor)

View File

@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Activities
return TickChild(self);
}
readonly List<CPos> searchCells = new List<CPos>();
readonly List<CPos> searchCells = new();
int searchCellsTick = -1;
List<CPos> CalculatePathToTarget(Actor self, BlockedByActor check)

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Activities
{
public readonly string ToActor;
public CVec Offset = CVec.Zero;
public WAngle Facing = new WAngle(384);
public WAngle Facing = new(384);
public string[] Sounds = Array.Empty<string>();
public string Notification = null;
public string TextNotification = null;

View File

@@ -187,9 +187,9 @@ namespace OpenRA.Mods.Common.Widgets
readonly CellLayer<byte> mapHeight;
readonly CellLayer<ResourceTile> mapResources;
readonly Queue<UndoCopyPaste> undoCopyPastes = new Queue<UndoCopyPaste>();
readonly Queue<EditorActorPreview> removedActors = new Queue<EditorActorPreview>();
readonly Queue<EditorActorPreview> addedActorPreviews = new Queue<EditorActorPreview>();
readonly Queue<UndoCopyPaste> undoCopyPastes = new();
readonly Queue<EditorActorPreview> removedActors = new();
readonly Queue<EditorActorPreview> addedActorPreviews = new();
public CopyPasteEditorAction(MapCopyFilters copyFilters, Map map,
Dictionary<CPos, (TerrainTile, ResourceTile, byte)> tiles, Dictionary<string, ActorReference> previews,

View File

@@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.Widgets
readonly IResourceLayer resourceLayer;
readonly string resourceType;
readonly List<CellResource> cellResources = new List<CellResource>();
readonly List<CellResource> cellResources = new();
public AddResourcesEditorAction(string resourceType, IResourceLayer resourceLayer)
{

View File

@@ -161,7 +161,7 @@ namespace OpenRA.Mods.Common.Widgets
readonly Map map;
readonly CPos cell;
readonly Queue<UndoTile> undoTiles = new Queue<UndoTile>();
readonly Queue<UndoTile> undoTiles = new();
readonly TerrainTemplateInfo terrainTemplate;
public PaintTileEditorAction(ushort template, Map map, CPos cell)
@@ -230,7 +230,7 @@ namespace OpenRA.Mods.Common.Widgets
readonly Map map;
readonly CPos cell;
readonly Queue<UndoTile> undoTiles = new Queue<UndoTile>();
readonly Queue<UndoTile> undoTiles = new();
readonly TerrainTemplateInfo terrainTemplate;
public FloodFillEditorAction(ushort template, Map map, CPos cell)

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Effects
{
public class FloatingText : IEffect, IEffectAnnotation
{
static readonly WVec Velocity = new WVec(0, 0, 86);
static readonly WVec Velocity = new(0, 0, 86);
readonly SpriteFont font;
readonly string text;

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Effects
readonly Animation flag;
readonly Animation circles;
readonly List<WPos> targetLineNodes = new List<WPos> { };
readonly List<WPos> targetLineNodes = new() { };
List<CPos> cachedLocations;
public RallyPointIndicator(Actor building, RallyPoint rp)

View File

@@ -59,9 +59,9 @@ namespace OpenRA.Mods.Common.FileFormats
3, 4, 5, 6, 7, 8
};
static readonly Huffman LitCode = new Huffman(LitLen, 256);
static readonly Huffman LenCode = new Huffman(LenLen, 16);
static readonly Huffman DistCode = new Huffman(DistLen, 64);
static readonly Huffman LitCode = new(LitLen, 256);
static readonly Huffman LenCode = new(LenLen, 16);
static readonly Huffman DistCode = new(DistLen, 64);
/// <summary>PKWare Compression Library stream.</summary>
/// <param name="input">Compressed input stream.</param>

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.FileFormats
{
public class IniFile
{
readonly Dictionary<string, IniSection> sections = new Dictionary<string, IniSection>();
readonly Dictionary<string, IniSection> sections = new();
public IniFile(Stream s)
{
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.FileFormats
}
}
readonly Regex sectionPattern = new Regex(@"^\[([^]]*)\]");
readonly Regex sectionPattern = new(@"^\[([^]]*)\]");
IniSection ProcessSection(string line)
{
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.FileFormats
public class IniSection : IEnumerable<KeyValuePair<string, string>>
{
public string Name { get; }
readonly Dictionary<string, string> values = new Dictionary<string, string>();
readonly Dictionary<string, string> values = new();
public IniSection(string name)
{

View File

@@ -372,7 +372,7 @@ namespace OpenRA.Mods.Common.FileFormats
}
}
readonly Dictionary<string, FileDescriptor> index = new Dictionary<string, FileDescriptor>();
readonly Dictionary<string, FileDescriptor> index = new();
readonly Dictionary<int, Stream> volumes;
readonly uint version;

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.FileSystem
public string Name { get; }
public IEnumerable<string> Contents => index.Keys;
readonly Dictionary<string, Entry> index = new Dictionary<string, Entry>();
readonly Dictionary<string, Entry> index = new();
readonly Stream s;
readonly long dataStart = 255;

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Graphics
public readonly int BgraSheetSize = 2048;
public readonly int IndexedSheetSize = 2048;
static readonly MiniYaml NoData = new MiniYaml(null);
static readonly MiniYaml NoData = new(null);
public DefaultSpriteSequenceLoader(ModData modData)
{
@@ -118,91 +118,91 @@ namespace OpenRA.Mods.Common.Graphics
}
[Desc("File name of the sprite to use for this sequence.")]
protected static readonly SpriteSequenceField<string> Filename = new SpriteSequenceField<string>(nameof(Filename), null);
protected static readonly SpriteSequenceField<string> Filename = new(nameof(Filename), null);
[Desc("Frame index to start from.")]
protected static readonly SpriteSequenceField<int> Start = new SpriteSequenceField<int>(nameof(Start), 0);
protected static readonly SpriteSequenceField<int> Start = new(nameof(Start), 0);
[Desc("Number of frames to use. Does not have to be the total amount the sprite sheet has.")]
protected static readonly SpriteSequenceField<int> Length = new SpriteSequenceField<int>(nameof(Length), 1);
protected static readonly SpriteSequenceField<int> Length = new(nameof(Length), 1);
[Desc("Overrides Length if a different number of frames is defined between facings.")]
protected static readonly SpriteSequenceField<int> Stride = new SpriteSequenceField<int>(nameof(Stride), -1);
protected static readonly SpriteSequenceField<int> Stride = new(nameof(Stride), -1);
[Desc("The number of facings that are provided by sprite frames. Use negative values to rotate counter-clockwise.")]
protected static readonly SpriteSequenceField<int> Facings = new SpriteSequenceField<int>(nameof(Facings), 1);
protected static readonly SpriteSequenceField<int> Facings = new(nameof(Facings), 1);
[Desc("The total number of facings for the sequence. If >Facings, the closest facing sprite will be rotated to match. Use negative values to rotate counter-clockwise.")]
protected static readonly SpriteSequenceField<int?> InterpolatedFacings = new SpriteSequenceField<int?>(nameof(InterpolatedFacings), null);
protected static readonly SpriteSequenceField<int?> InterpolatedFacings = new(nameof(InterpolatedFacings), null);
[Desc("Time (in milliseconds at default game speed) to wait until playing the next frame in the animation.")]
protected static readonly SpriteSequenceField<int> Tick = new SpriteSequenceField<int>(nameof(Tick), 40);
protected static readonly SpriteSequenceField<int> Tick = new(nameof(Tick), 40);
[Desc("Value controlling the Z-order. A higher values means rendering on top of other sprites at the same position. " +
"Use power of 2 values to avoid glitches.")]
protected static readonly SpriteSequenceField<WDist> ZOffset = new SpriteSequenceField<WDist>(nameof(ZOffset), WDist.Zero);
protected static readonly SpriteSequenceField<WDist> ZOffset = new(nameof(ZOffset), WDist.Zero);
[Desc("Additional sprite depth Z offset to apply as a function of sprite Y (0: vertical, 1: flat on terrain)")]
protected static readonly SpriteSequenceField<int> ZRamp = new SpriteSequenceField<int>(nameof(ZRamp), 0);
protected static readonly SpriteSequenceField<int> ZRamp = new(nameof(ZRamp), 0);
[Desc("If the shadow is not part of the sprite, but baked into the same sprite sheet at a fixed offset, " +
"set this to the frame index where it starts.")]
protected static readonly SpriteSequenceField<int> ShadowStart = new SpriteSequenceField<int>(nameof(ShadowStart), -1);
protected static readonly SpriteSequenceField<int> ShadowStart = new(nameof(ShadowStart), -1);
[Desc("Set Z-Offset for the separate shadow. Used by the later Westwood 2.5D titles.")]
protected static readonly SpriteSequenceField<WDist> ShadowZOffset = new SpriteSequenceField<WDist>(nameof(ShadowZOffset), new WDist(-5));
protected static readonly SpriteSequenceField<WDist> ShadowZOffset = new(nameof(ShadowZOffset), new WDist(-5));
[Desc("The individual frames to play instead of going through them sequentially from the `Start`.")]
protected static readonly SpriteSequenceField<int[]> Frames = new SpriteSequenceField<int[]>(nameof(Frames), null);
protected static readonly SpriteSequenceField<int[]> Frames = new(nameof(Frames), null);
[Desc("Don't apply terrain lighting or colored overlays.")]
protected static readonly SpriteSequenceField<bool> IgnoreWorldTint = new SpriteSequenceField<bool>(nameof(IgnoreWorldTint), false);
protected static readonly SpriteSequenceField<bool> IgnoreWorldTint = new(nameof(IgnoreWorldTint), false);
[Desc("Adjusts the rendered size of the sprite")]
protected static readonly SpriteSequenceField<float> Scale = new SpriteSequenceField<float>(nameof(Scale), 1);
protected static readonly SpriteSequenceField<float> Scale = new(nameof(Scale), 1);
[Desc("Play the sprite sequence back and forth.")]
protected static readonly SpriteSequenceField<bool> Reverses = new SpriteSequenceField<bool>(nameof(Reverses), false);
protected static readonly SpriteSequenceField<bool> Reverses = new(nameof(Reverses), false);
[Desc("Support a frame order where each animation step is split per each direction.")]
protected static readonly SpriteSequenceField<bool> Transpose = new SpriteSequenceField<bool>(nameof(Transpose), false);
protected static readonly SpriteSequenceField<bool> Transpose = new(nameof(Transpose), false);
[Desc("Mirror on the X axis.")]
protected static readonly SpriteSequenceField<bool> FlipX = new SpriteSequenceField<bool>(nameof(FlipX), false);
protected static readonly SpriteSequenceField<bool> FlipX = new(nameof(FlipX), false);
[Desc("Mirror on the Y axis.")]
protected static readonly SpriteSequenceField<bool> FlipY = new SpriteSequenceField<bool>(nameof(FlipY), false);
protected static readonly SpriteSequenceField<bool> FlipY = new(nameof(FlipY), false);
[Desc("Change the position in-game on X, Y, Z.")]
protected static readonly SpriteSequenceField<float3> Offset = new SpriteSequenceField<float3>(nameof(Offset), float3.Zero);
protected static readonly SpriteSequenceField<float3> Offset = new(nameof(Offset), float3.Zero);
[Desc("Apply an OpenGL/Photoshop inspired blend mode.")]
protected static readonly SpriteSequenceField<BlendMode> BlendMode = new SpriteSequenceField<BlendMode>(nameof(BlendMode), OpenRA.BlendMode.Alpha);
protected static readonly SpriteSequenceField<BlendMode> BlendMode = new(nameof(BlendMode), OpenRA.BlendMode.Alpha);
[Desc("Create a virtual sprite file by concatenating one or more frames from multiple files, with optional transformations applied. " +
"All defined frames will be loaded into memory, even if unused, so use this property with care.")]
protected static readonly SpriteSequenceField<MiniYaml> Combine = new SpriteSequenceField<MiniYaml>(nameof(Combine), null);
protected static readonly SpriteSequenceField<MiniYaml> Combine = new(nameof(Combine), null);
[Desc("Sets transparency - use one value to set for all frames or provide a value for each frame.")]
protected static readonly SpriteSequenceField<float[]> Alpha = new SpriteSequenceField<float[]>(nameof(Alpha), null);
protected static readonly SpriteSequenceField<float[]> Alpha = new(nameof(Alpha), null);
[Desc("Fade the animation from fully opaque on the first frame to fully transparent after the last frame.")]
protected static readonly SpriteSequenceField<bool> AlphaFade = new SpriteSequenceField<bool>(nameof(AlphaFade), false);
protected static readonly SpriteSequenceField<bool> AlphaFade = new(nameof(AlphaFade), false);
[Desc("Name of the file containing the depth data sprite.")]
protected static readonly SpriteSequenceField<string> DepthSprite = new SpriteSequenceField<string>(nameof(DepthSprite), null);
protected static readonly SpriteSequenceField<string> DepthSprite = new(nameof(DepthSprite), null);
[Desc("Frame index containing the depth data.")]
protected static readonly SpriteSequenceField<int> DepthSpriteFrame = new SpriteSequenceField<int>(nameof(DepthSpriteFrame), 0);
protected static readonly SpriteSequenceField<int> DepthSpriteFrame = new(nameof(DepthSpriteFrame), 0);
[Desc("X, Y offset to apply to the depth sprite.")]
protected static readonly SpriteSequenceField<float2> DepthSpriteOffset = new SpriteSequenceField<float2>(nameof(DepthSpriteOffset), float2.Zero);
protected static readonly SpriteSequenceField<float2> DepthSpriteOffset = new(nameof(DepthSpriteOffset), float2.Zero);
protected static readonly MiniYaml NoData = new MiniYaml(null);
protected static readonly MiniYaml NoData = new(null);
protected readonly ISpriteSequenceLoader Loader;
protected string image;
protected List<SpriteReservation> spritesToLoad = new List<SpriteReservation>();
protected List<SpriteReservation> spritesToLoad = new();
protected Sprite[] sprites;
protected Sprite[] shadowSprites;
protected bool reverseFacings;

View File

@@ -17,9 +17,9 @@ namespace OpenRA.Mods.Common.Graphics
{
public class IsometricSelectionBoxAnnotationRenderable : IRenderable, IFinalizedRenderable
{
static readonly float2 TLOffset = new float2(-12, -6);
static readonly float2 TROffset = new float2(12, -6);
static readonly float2 TOffset = new float2(0, -13);
static readonly float2 TLOffset = new(-12, -6);
static readonly float2 TROffset = new(12, -6);
static readonly float2 TOffset = new(0, -13);
static readonly float2[] Offsets =
{
-TROffset, -TLOffset, -TOffset,

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Graphics
public class TilesetSpecificSpriteSequence : DefaultSpriteSequence
{
[Desc("Dictionary of <tileset name>: filename to override the Filename key.")]
static readonly SpriteSequenceField<Dictionary<string, string>> TilesetFilenames = new SpriteSequenceField<Dictionary<string, string>>(nameof(TilesetFilenames), null);
static readonly SpriteSequenceField<Dictionary<string, string>> TilesetFilenames = new(nameof(TilesetFilenames), null);
public TilesetSpecificSpriteSequence(SpriteCache cache, ISpriteSequenceLoader loader, string image, string sequence, MiniYaml data, MiniYaml defaults)
: base(cache, loader, image, sequence, data, defaults) { }

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.HitShapes
[FieldLoader.Require]
public readonly int2 PointB;
public readonly WDist Radius = new WDist(426);
public readonly WDist Radius = new(426);
[Desc("Defines the top offset relative to the actor's center.")]
public readonly int VerticalTopOffset = 0;

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.HitShapes
public WDist OuterRadius => Radius;
[FieldLoader.Require]
public readonly WDist Radius = new WDist(426);
public readonly WDist Radius = new(426);
[Desc("Defines the top offset relative to the actor's center.")]
public readonly int VerticalTopOffset = 0;

View File

@@ -24,9 +24,9 @@ namespace OpenRA.Mods.Common.Lint
{
const BindingFlags Binding = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
readonly List<string> referencedKeys = new List<string>();
readonly Dictionary<string, string[]> referencedVariablesPerKey = new Dictionary<string, string[]>();
readonly List<string> variableReferences = new List<string>();
readonly List<string> referencedKeys = new();
readonly Dictionary<string, string[]> referencedVariablesPerKey = new();
readonly List<string> variableReferences = new();
void ILintPass.Run(Action<string> emitError, Action<string> emitWarning, ModData modData)
{

View File

@@ -105,7 +105,7 @@ namespace OpenRA
public readonly string ContentInstallerMod = "modcontent";
[FieldLoader.LoadUsing(nameof(LoadPackages))]
public readonly Dictionary<string, ModPackage> Packages = new Dictionary<string, ModPackage>();
public readonly Dictionary<string, ModPackage> Packages = new();
static object LoadPackages(MiniYaml yaml)
{

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Pathfinder
sealed class CellInfoLayerPool
{
const int MaxPoolSize = 4;
readonly Stack<CellLayer<CellInfo>> pool = new Stack<CellLayer<CellInfo>>(MaxPoolSize);
readonly Stack<CellLayer<CellInfo>> pool = new(MaxPoolSize);
readonly Map map;
public CellInfoLayerPool(Map map)
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Pathfinder
public class PooledCellInfoLayer : IDisposable
{
CellInfoLayerPool layerPool;
List<CellLayer<CellInfo>> layers = new List<CellLayer<CellInfo>>();
List<CellLayer<CellInfo>> layers = new();
public PooledCellInfoLayer(CellInfoLayerPool layerPool)
{

View File

@@ -103,7 +103,7 @@ namespace OpenRA.Mods.Common.Pathfinder
readonly Locomotor locomotor;
readonly IActorMap actorMap;
readonly Func<CPos, CPos, int> costEstimator;
readonly HashSet<int> dirtyGridIndexes = new HashSet<int>();
readonly HashSet<int> dirtyGridIndexes = new();
readonly HashSet<CPos> cellsWithBlockingActor;
Grid mapBounds;
int gridXs;

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Pathfinder
// PERF: Maintain a pool of layers used for paths searches for each world. These searches are performed often
// so we wish to avoid the high cost of initializing a new search space every time by reusing the old ones.
static readonly ConditionalWeakTable<World, CellInfoLayerPool> LayerPoolTable = new ConditionalWeakTable<World, CellInfoLayerPool>();
static readonly ConditionalWeakTable<World, CellInfoLayerPool> LayerPoolTable = new();
static readonly ConditionalWeakTable<World, CellInfoLayerPool>.CreateValueCallback CreateLayerPool = world => new CellInfoLayerPool(world.Map);
static CellInfoLayerPool LayerPoolForWorld(World world)

View File

@@ -34,13 +34,13 @@ namespace OpenRA.Mods.Common.Projectiles
public readonly int DamageInterval = 3;
[Desc("The width of the beam.")]
public readonly WDist Width = new WDist(512);
public readonly WDist Width = new(512);
[Desc("The shape of the beam. Accepts values Cylindrical or Flat.")]
public readonly BeamRenderableShape Shape = BeamRenderableShape.Cylindrical;
[Desc("How far beyond the target the projectile keeps on travelling.")]
public readonly WDist BeyondTargetRange = new WDist(0);
public readonly WDist BeyondTargetRange = new(0);
[Desc("The minimum distance the beam travels.")]
public readonly WDist MinDistance = WDist.Zero;

View File

@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Projectiles
public readonly bool Blockable = true;
[Desc("Width of projectile (used for finding blocking actors).")]
public readonly WDist Width = new WDist(1);
public readonly WDist Width = new(1);
[Desc("Arc in WAngles, two values indicate variable arc.")]
public readonly WAngle[] LaunchAngle = { WAngle.Zero };
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Projectiles
public readonly string BounceSound = null;
[Desc("Terrain where the projectile explodes instead of bouncing.")]
public readonly HashSet<string> InvalidBounceTerrain = new HashSet<string>();
public readonly HashSet<string> InvalidBounceTerrain = new();
[Desc("Trigger the explosion if the projectile touches an actor thats owner has these player relationships.")]
public readonly PlayerRelationship ValidBounceBlockerRelationships = PlayerRelationship.Enemy | PlayerRelationship.Neutral;
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Projectiles
public readonly int ContrailZOffset = 2047;
[Desc("Thickness of the emitted line.")]
public readonly WDist ContrailWidth = new WDist(64);
public readonly WDist ContrailWidth = new(64);
[Desc("RGB color at the contrail start.")]
public readonly Color ContrailStartColor = Color.White;

View File

@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Projectiles
public readonly WVec Velocity = WVec.Zero;
[Desc("Value added to Velocity every tick.")]
public readonly WVec Acceleration = new WVec(0, 0, -15);
public readonly WVec Acceleration = new(0, 0, -15);
public IProjectile Create(ProjectileArgs args) { return new GravityBomb(this, args); }
}

View File

@@ -31,11 +31,11 @@ namespace OpenRA.Mods.Common.Projectiles
public readonly bool Blockable = false;
[Desc("The width of the projectile.")]
public readonly WDist Width = new WDist(1);
public readonly WDist Width = new(1);
[Desc("Scan radius for actors with projectile-blocking trait. If set to a negative value (default), it will automatically scale",
"to the blocker with the largest health shape. Only set custom values if you know what you're doing.")]
public readonly WDist BlockerScanRadius = new WDist(-1);
public readonly WDist BlockerScanRadius = new(-1);
public IProjectile Create(ProjectileArgs args) { return new InstantHit(this, args); }
}

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Projectiles
public class LaserZapInfo : IProjectileInfo
{
[Desc("The width of the zap.")]
public readonly WDist Width = new WDist(86);
public readonly WDist Width = new(86);
[Desc("The shape of the beam. Accepts values Cylindrical or Flat.")]
public readonly BeamRenderableShape Shape = BeamRenderableShape.Cylindrical;
@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Projectiles
public readonly bool SecondaryBeam = false;
[Desc("The width of the zap.")]
public readonly WDist SecondaryBeamWidth = new WDist(86);
public readonly WDist SecondaryBeamWidth = new(86);
[Desc("The shape of the beam. Accepts values Cylindrical or Flat.")]
public readonly BeamRenderableShape SecondaryBeamShape = BeamRenderableShape.Cylindrical;

View File

@@ -45,22 +45,22 @@ namespace OpenRA.Mods.Common.Projectiles
public readonly Color ShadowColor = Color.FromArgb(140, 0, 0, 0);
[Desc("Minimum vertical launch angle (pitch).")]
public readonly WAngle MinimumLaunchAngle = new WAngle(-64);
public readonly WAngle MinimumLaunchAngle = new(-64);
[Desc("Maximum vertical launch angle (pitch).")]
public readonly WAngle MaximumLaunchAngle = new WAngle(128);
public readonly WAngle MaximumLaunchAngle = new(128);
[Desc("Minimum launch speed in WDist / tick. Defaults to Speed if -1.")]
public readonly WDist MinimumLaunchSpeed = new WDist(-1);
public readonly WDist MinimumLaunchSpeed = new(-1);
[Desc("Maximum launch speed in WDist / tick. Defaults to Speed if -1.")]
public readonly WDist MaximumLaunchSpeed = new WDist(-1);
public readonly WDist MaximumLaunchSpeed = new(-1);
[Desc("Maximum projectile speed in WDist / tick")]
public readonly WDist Speed = new WDist(384);
public readonly WDist Speed = new(384);
[Desc("Projectile acceleration when propulsion activated.")]
public readonly WDist Acceleration = new WDist(5);
public readonly WDist Acceleration = new(5);
[Desc("How many ticks before this missile is armed and can explode.")]
public readonly int Arm = 0;
@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Projectiles
public readonly bool TerrainHeightAware = false;
[Desc("Width of projectile (used for finding blocking actors).")]
public readonly WDist Width = new WDist(1);
public readonly WDist Width = new(1);
[Desc("The maximum/constant/incremental inaccuracy used in conjunction with the InaccuracyType property.")]
public readonly WDist Inaccuracy = WDist.Zero;
@@ -81,16 +81,16 @@ namespace OpenRA.Mods.Common.Projectiles
public readonly InaccuracyType InaccuracyType = InaccuracyType.Absolute;
[Desc("Inaccuracy override when successfully locked onto target. Defaults to Inaccuracy if negative.")]
public readonly WDist LockOnInaccuracy = new WDist(-1);
public readonly WDist LockOnInaccuracy = new(-1);
[Desc("Probability of locking onto and following target.")]
public readonly int LockOnProbability = 100;
[Desc("Horizontal rate of turn.")]
public readonly WAngle HorizontalRateOfTurn = new WAngle(20);
public readonly WAngle HorizontalRateOfTurn = new(20);
[Desc("Vertical rate of turn.")]
public readonly WAngle VerticalRateOfTurn = new WAngle(24);
public readonly WAngle VerticalRateOfTurn = new(24);
[Desc("Gravity applied while in free fall.")]
public readonly int Gravity = 10;
@@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Projectiles
public readonly WDist AirburstAltitude = WDist.Zero;
[Desc("Cruise altitude. Zero means no cruise altitude used.")]
public readonly WDist CruiseAltitude = new WDist(512);
public readonly WDist CruiseAltitude = new(512);
[Desc("Activate homing mechanism after this many ticks.")]
public readonly int HomingActivationDelay = 0;
@@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Projectiles
public readonly int ContrailZOffset = 2047;
[Desc("Thickness of the emitted line.")]
public readonly WDist ContrailWidth = new WDist(64);
public readonly WDist ContrailWidth = new(64);
[Desc("RGB color at the contrail start.")]
public readonly Color ContrailStartColor = Color.White;
@@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Projectiles
[Desc("Explodes when inside this proximity radius to target.",
"Note: If this value is lower than the missile speed, this check might",
"not trigger fast enough, causing the missile to fly past the target.")]
public readonly WDist CloseEnough = new WDist(298);
public readonly WDist CloseEnough = new(298);
public IProjectile Create(ProjectileArgs args) { return new Missile(this, args); }
}

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Projectiles
public readonly int ZOffset = 0;
[Desc("The width of the main trajectory. (\"beam\").")]
public readonly WDist BeamWidth = new WDist(86);
public readonly WDist BeamWidth = new(86);
[Desc("The shape of the beam. Accepts values Cylindrical or Flat.")]
public readonly BeamRenderableShape BeamShape = BeamRenderableShape.Cylindrical;
@@ -57,13 +57,13 @@ namespace OpenRA.Mods.Common.Projectiles
public readonly int BeamAlphaDeltaPerTick = -8;
[Desc("Thickness of the helix")]
public readonly WDist HelixThickness = new WDist(32);
public readonly WDist HelixThickness = new(32);
[Desc("The radius of the spiral effect. (WDist)")]
public readonly WDist HelixRadius = new WDist(64);
public readonly WDist HelixRadius = new(64);
[Desc("Height of one complete helix turn, measured parallel to the axis of the helix (WDist)")]
public readonly WDist HelixPitch = new WDist(512);
public readonly WDist HelixPitch = new(512);
[Desc("Helix radius gets + this value per tick during drawing")]
public readonly int HelixRadiusDeltaPerTick = 8;
@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Projectiles
public readonly int HelixAlphaDeltaPerTick = -8;
[Desc("Helix spins by this much over time each tick.")]
public readonly WAngle HelixAngleDeltaPerTick = new WAngle(16);
public readonly WAngle HelixAngleDeltaPerTick = new(16);
[Desc("Draw each cycle of helix with this many quantization steps")]
public readonly int QuantizationCount = 16;

View File

@@ -20,13 +20,13 @@ namespace OpenRA.Mods.Common.Scripting.Global
: base(context) { }
public WAngle North => WAngle.Zero;
public WAngle NorthWest => new WAngle(128);
public WAngle West => new WAngle(256);
public WAngle SouthWest => new WAngle(384);
public WAngle South => new WAngle(512);
public WAngle SouthEast => new WAngle(640);
public WAngle East => new WAngle(768);
public WAngle NorthEast => new WAngle(896);
public WAngle NorthWest => new(128);
public WAngle West => new(256);
public WAngle SouthWest => new(384);
public WAngle South => new(512);
public WAngle SouthEast => new(640);
public WAngle East => new(768);
public WAngle NorthEast => new(896);
[Desc("Create an arbitrary angle.")]
public WAngle New(int a) { return new WAngle(a); }

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Part of the new Lua API.")]
public class LuaScriptInfo : TraitInfo, Requires<SpawnMapActorsInfo>
{
public readonly HashSet<string> Scripts = new HashSet<string>();
public readonly HashSet<string> Scripts = new();
public override object Create(ActorInitializer init) { return new LuaScript(this); }
}

View File

@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Server
const string GameOffline = "notification-game-offline";
static readonly Beacon LanGameBeacon;
static readonly Dictionary<int, string> MasterServerErrors = new Dictionary<int, string>()
static readonly Dictionary<int, string> MasterServerErrors = new()
{
{ 1, NoPortForward },
{ 2, BlacklistedTitle }
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Server
bool isInitialPing = true;
volatile bool isBusy;
readonly Queue<string> masterServerMessages = new Queue<string>();
readonly Queue<string> masterServerMessages = new();
static MasterServerPinger()
{

View File

@@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.Terrain
[FieldLoader.Ignore]
public readonly TerrainTypeInfo[] TerrainInfo;
readonly Dictionary<string, byte> terrainIndexByType = new Dictionary<string, byte>();
readonly Dictionary<string, byte> terrainIndexByType = new();
readonly byte defaultWalkableTerrainIndex;
public DefaultTerrain(IReadOnlyFileSystem fileSystem, string filepath)
@@ -163,7 +163,7 @@ namespace OpenRA.Mods.Common.Terrain
IEnumerable<Color> ITerrainInfo.RestrictedPlayerColors { get { return TerrainInfo.Where(ti => ti.RestrictPlayerColor).Select(ti => ti.Color); } }
float ITerrainInfo.MinHeightColorBrightness => MinHeightColorBrightness;
float ITerrainInfo.MaxHeightColorBrightness => MaxHeightColorBrightness;
TerrainTile ITerrainInfo.DefaultTerrainTile => new TerrainTile(Templates.First().Key, 0);
TerrainTile ITerrainInfo.DefaultTerrainTile => new(Templates.First().Key, 0);
string[] ITemplatedTerrainInfo.EditorTemplateOrder => EditorTemplateOrder;
IReadOnlyDictionary<ushort, TerrainTemplateInfo> ITemplatedTerrainInfo.Templates => Templates;

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Terrain
public sealed class DefaultTileCache : IDisposable
{
readonly Dictionary<ushort, TheaterTemplate> templates = new Dictionary<ushort, TheaterTemplate>();
readonly Dictionary<ushort, TheaterTemplate> templates = new();
readonly Cache<SheetType, SheetBuilder> sheetBuilders;
readonly MersenneTwister random;

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
public class AcceptsDeliveredCashInfo : TraitInfo
{
[Desc("Accepted `DeliversCash` types. Leave empty to accept all types.")]
public readonly HashSet<string> ValidTypes = new HashSet<string>();
public readonly HashSet<string> ValidTypes = new();
[Desc("Player relationships the owner of the delivering actor needs.")]
public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Ally;

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
public class AcceptsDeliveredExperienceInfo : TraitInfo, Requires<GainsExperienceInfo>
{
[Desc("Accepted `DeliversExperience` types. Leave empty to accept all types.")]
public readonly HashSet<string> ValidTypes = new HashSet<string>();
public readonly HashSet<string> ValidTypes = new();
[Desc("Player relationships the owner of the delivering actor needs.")]
public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Ally;

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits
public class ActorSpawnerInfo : ConditionalTraitInfo
{
[Desc("Type of ActorSpawner with which it connects.")]
public readonly HashSet<string> Types = new HashSet<string>() { };
public readonly HashSet<string> Types = new() { };
public override object Create(ActorInitializer init) { return new ActorSpawner(this); }
}

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int MaxHeightDelta = -1;
[Desc("If > 0, force visibility to be recalculated if the unit moves within a cell by more than this distance.")]
public readonly WDist MoveRecalculationThreshold = new WDist(256);
public readonly WDist MoveRecalculationThreshold = new(256);
[Desc("Possible values are CenterPosition (measure range from the center) and ",
"Footprint (measure range from the footprint)")]

View File

@@ -37,13 +37,13 @@ namespace OpenRA.Mods.Common.Traits
"'Land' will behave like 'None' (hover or circle) if a suitable landing site is not available.")]
public readonly IdleBehaviorType IdleBehavior = IdleBehaviorType.None;
public readonly WDist CruiseAltitude = new WDist(1280);
public readonly WDist CruiseAltitude = new(1280);
[Desc("Whether the aircraft can be repulsed.")]
public readonly bool Repulsable = true;
[Desc("The distance it tries to maintain from other aircraft if repulsable.")]
public readonly WDist IdealSeparation = new WDist(1706);
public readonly WDist IdealSeparation = new(1706);
[Desc("The speed at which the aircraft is repulsed from other aircraft. Specify -1 for normal movement speed.")]
public readonly int RepulsionSpeed = -1;
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly WAngle InitialFacing = WAngle.Zero;
[Desc("Speed at which the actor turns.")]
public readonly WAngle TurnSpeed = new WAngle(512);
public readonly WAngle TurnSpeed = new(512);
[Desc("Turn speed to apply when aircraft flies in circles while idle. Defaults to TurnSpeed if undefined.")]
public readonly WAngle? IdleTurnSpeed = null;
@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Minimum altitude where this aircraft is considered airborne.")]
public readonly int MinAirborneAltitude = 1;
public readonly HashSet<string> LandableTerrainTypes = new HashSet<string>();
public readonly HashSet<string> LandableTerrainTypes = new();
[Desc("Can the actor be ordered to move in to shroud?")]
public readonly bool MoveIntoShroud = true;
@@ -136,7 +136,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly WAngle MaximumPitch = WAngle.FromDegrees(10);
[Desc("How fast this actor ascends or descends when moving vertically only (vertical take off/landing or hovering towards CruiseAltitude).")]
public readonly WDist AltitudeVelocity = new WDist(43);
public readonly WDist AltitudeVelocity = new(43);
[Desc("Sounds to play when the actor is taking off.")]
public readonly string[] TakeoffSounds = Array.Empty<string>();
@@ -145,13 +145,13 @@ namespace OpenRA.Mods.Common.Traits
public readonly string[] LandingSounds = Array.Empty<string>();
[Desc("The distance of the resupply base that the aircraft will wait for its turn.")]
public readonly WDist WaitDistanceFromResupplyBase = new WDist(3072);
public readonly WDist WaitDistanceFromResupplyBase = new(3072);
[Desc("The number of ticks that a airplane will wait to make a new search for an available airport.")]
public readonly int NumberOfTicksToVerifyAvailableAirport = 150;
[Desc("Facing to use for actor previews (map editor, color picker, etc)")]
public readonly WAngle PreviewFacing = new WAngle(384);
public readonly WAngle PreviewFacing = new(384);
[Desc("Display order for the facing slider in the map editor")]
public readonly int EditorFacingDisplayOrder = 3;

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly bool Moves = false;
[Desc("Velocity (per tick) at which aircraft falls to ground.")]
public readonly WDist Velocity = new WDist(43);
public readonly WDist Velocity = new(43);
public WeaponInfo ExplosionWeapon { get; private set; }

View File

@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits
public class AmmoPool : INotifyCreated, INotifyAttack, ISync
{
public readonly AmmoPoolInfo Info;
readonly Stack<int> tokens = new Stack<int>();
readonly Stack<int> tokens = new();
// HACK: Temporarily needed until Rearm activity is gone for good
[Sync]

View File

@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly WDist Recoil = WDist.Zero;
[Desc("Recoil recovery per-frame")]
public readonly WDist RecoilRecovery = new WDist(9);
public readonly WDist RecoilRecovery = new(9);
[SequenceReference]
[Desc("Muzzle flash sequence to render")]
@@ -125,7 +125,7 @@ namespace OpenRA.Mods.Common.Traits
int currentBarrel;
readonly int barrelCount;
readonly List<(int Ticks, int Burst, Action<int> Func)> delayedActions = new List<(int, int, Action<int>)>();
readonly List<(int Ticks, int Burst, Action<int> Func)> delayedActions = new();
public WDist Recoil;
public int FireDelay { get; protected set; }

View File

@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Voice = "Action";
[Desc("Tolerance for attack angle. Range [0, 512], 512 covers 360 degrees.")]
public readonly WAngle FacingTolerance = new WAngle(512);
public readonly WAngle FacingTolerance = new(512);
public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
{

View File

@@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string AttackAnythingCondition = null;
[FieldLoader.Ignore]
public readonly Dictionary<UnitStance, string> ConditionByStance = new Dictionary<UnitStance, string>();
public readonly Dictionary<UnitStance, string> ConditionByStance = new();
[Desc("Allow the player to change the unit stance.")]
public readonly bool EnableStances = true;

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
public class AutoTargetPriorityInfo : ConditionalTraitInfo, Requires<AutoTargetInfo>
{
[Desc("Target types that can be AutoTargeted.")]
public readonly BitSet<TargetableType> ValidTargets = new BitSet<TargetableType>("Ground", "Water", "Air");
public readonly BitSet<TargetableType> ValidTargets = new("Ground", "Water", "Air");
[Desc("Target types that can't be AutoTargeted.", "Overrules ValidTargets.")]
public readonly BitSet<TargetableType> InvalidTargets;

View File

@@ -19,37 +19,37 @@ namespace OpenRA.Mods.Common.Traits
public class BaseBuilderBotModuleInfo : ConditionalTraitInfo
{
[Desc("Tells the AI what building types are considered construction yards.")]
public readonly HashSet<string> ConstructionYardTypes = new HashSet<string>();
public readonly HashSet<string> ConstructionYardTypes = new();
[Desc("Tells the AI what building types are considered vehicle production facilities.")]
public readonly HashSet<string> VehiclesFactoryTypes = new HashSet<string>();
public readonly HashSet<string> VehiclesFactoryTypes = new();
[Desc("Tells the AI what building types are considered refineries.")]
public readonly HashSet<string> RefineryTypes = new HashSet<string>();
public readonly HashSet<string> RefineryTypes = new();
[Desc("Tells the AI what building types are considered power plants.")]
public readonly HashSet<string> PowerTypes = new HashSet<string>();
public readonly HashSet<string> PowerTypes = new();
[Desc("Tells the AI what building types are considered infantry production facilities.")]
public readonly HashSet<string> BarracksTypes = new HashSet<string>();
public readonly HashSet<string> BarracksTypes = new();
[Desc("Tells the AI what building types are considered production facilities.")]
public readonly HashSet<string> ProductionTypes = new HashSet<string>();
public readonly HashSet<string> ProductionTypes = new();
[Desc("Tells the AI what building types are considered naval production facilities.")]
public readonly HashSet<string> NavalProductionTypes = new HashSet<string>();
public readonly HashSet<string> NavalProductionTypes = new();
[Desc("Tells the AI what building types are considered silos (resource storage).")]
public readonly HashSet<string> SiloTypes = new HashSet<string>();
public readonly HashSet<string> SiloTypes = new();
[Desc("Tells the AI what building types are considered defenses.")]
public readonly HashSet<string> DefenseTypes = new HashSet<string>();
public readonly HashSet<string> DefenseTypes = new();
[Desc("Production queues AI uses for buildings.")]
public readonly HashSet<string> BuildingQueues = new HashSet<string> { "Building" };
public readonly HashSet<string> BuildingQueues = new() { "Building" };
[Desc("Production queues AI uses for defenses.")]
public readonly HashSet<string> DefenseQueues = new HashSet<string> { "Defense" };
public readonly HashSet<string> DefenseQueues = new() { "Defense" };
[Desc("Minimum distance in cells from center of the base when checking for building placement.")]
public readonly int MinBaseRadius = 2;
@@ -120,7 +120,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int CheckForWaterRadius = 8;
[Desc("Terrain types which are considered water for base building purposes.")]
public readonly HashSet<string> WaterTerrainTypes = new HashSet<string> { "Water" };
public readonly HashSet<string> WaterTerrainTypes = new() { "Water" };
[Desc("What buildings to the AI should build.", "What integer percentage of the total base must be this type of building.")]
public readonly Dictionary<string, int> BuildingFractions = null;
@@ -155,7 +155,7 @@ namespace OpenRA.Mods.Common.Traits
IResourceLayer resourceLayer;
IBotPositionsUpdated[] positionsUpdatedModules;
CPos initialBaseCenter;
readonly List<BaseBuilderQueueManager> builders = new List<BaseBuilderQueueManager>();
readonly List<BaseBuilderQueueManager> builders = new();
public BaseBuilderBotModule(Actor self, BaseBuilderBotModuleInfo info)
: base(info)

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
[FieldLoader.LoadUsing(nameof(LoadConsiderations))]
[Desc("The decisions associated with this power")]
public readonly List<Consideration> Considerations = new List<Consideration>();
public readonly List<Consideration> Considerations = new();
[Desc("Minimum ticks to wait until next Decision scan attempt.")]
public readonly int MinimumScanTimeInterval = 250;
@@ -121,7 +121,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly PlayerRelationship Against = PlayerRelationship.Enemy;
[Desc("What types should the desired targets of this power be?")]
public readonly BitSet<TargetableType> Types = new BitSet<TargetableType>("Air", "Ground", "Water");
public readonly BitSet<TargetableType> Types = new("Air", "Ground", "Water");
[Desc("How attractive are these types of targets?")]
public readonly int Attractiveness = 100;

View File

@@ -21,11 +21,11 @@ namespace OpenRA.Mods.Common.Traits
{
[Desc("Actor types that can capture other actors (via `Captures`).",
"Leave this empty to disable capturing.")]
public readonly HashSet<string> CapturingActorTypes = new HashSet<string>();
public readonly HashSet<string> CapturingActorTypes = new();
[Desc("Actor types that can be targeted for capturing.",
"Leave this empty to include all actors.")]
public readonly HashSet<string> CapturableActorTypes = new HashSet<string>();
public readonly HashSet<string> CapturableActorTypes = new();
[Desc("Minimum delay (in ticks) between trying to capture with CapturingActorTypes.")]
public readonly int MinimumCaptureDelay = 375;
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits
int minCaptureDelayTicks;
// Units that the bot already knows about and has given a capture order. Any unit not on this list needs to be given a new order.
readonly List<Actor> activeCapturers = new List<Actor>();
readonly List<Actor> activeCapturers = new();
public CaptureManagerBotModule(Actor self, CaptureManagerBotModuleInfo info)
: base(info)

View File

@@ -22,10 +22,10 @@ namespace OpenRA.Mods.Common.Traits
{
[Desc("Actor types that are considered harvesters. If harvester count drops below RefineryTypes count, a new harvester is built.",
"Leave empty to disable harvester replacement. Currently only needed by harvester replacement system.")]
public readonly HashSet<string> HarvesterTypes = new HashSet<string>();
public readonly HashSet<string> HarvesterTypes = new();
[Desc("Actor types that are counted as refineries. Currently only needed by harvester replacement system.")]
public readonly HashSet<string> RefineryTypes = new HashSet<string>();
public readonly HashSet<string> RefineryTypes = new();
[Desc("Interval (in ticks) between giving out orders to idle harvesters.")]
public readonly int ScanForIdleHarvestersInterval = 50;
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits
readonly World world;
readonly Player player;
readonly Func<Actor, bool> unitCannotBeOrdered;
readonly Dictionary<Actor, HarvesterTraitWrapper> harvesters = new Dictionary<Actor, HarvesterTraitWrapper>();
readonly Dictionary<Actor, HarvesterTraitWrapper> harvesters = new();
IResourceLayer resourceLayer;
ResourceClaimLayer claimLayer;

View File

@@ -19,13 +19,13 @@ namespace OpenRA.Mods.Common.Traits
public class McvManagerBotModuleInfo : ConditionalTraitInfo
{
[Desc("Actor types that are considered MCVs (deploy into base builders).")]
public readonly HashSet<string> McvTypes = new HashSet<string>();
public readonly HashSet<string> McvTypes = new();
[Desc("Actor types that are considered construction yards (base builders).")]
public readonly HashSet<string> ConstructionYardTypes = new HashSet<string>();
public readonly HashSet<string> ConstructionYardTypes = new();
[Desc("Actor types that are able to produce MCVs.")]
public readonly HashSet<string> McvFactoryTypes = new HashSet<string>();
public readonly HashSet<string> McvFactoryTypes = new();
[Desc("Try to maintain at least this many ConstructionYardTypes, build an MCV if number is below this.")]
public readonly int MinimumConstructionYardCount = 1;

View File

@@ -23,27 +23,27 @@ namespace OpenRA.Mods.Common.Traits
{
[ActorReference]
[Desc("Actor types that are valid for naval squads.")]
public readonly HashSet<string> NavalUnitsTypes = new HashSet<string>();
public readonly HashSet<string> NavalUnitsTypes = new();
[ActorReference]
[Desc("Actor types that are excluded from ground attacks.")]
public readonly HashSet<string> AirUnitsTypes = new HashSet<string>();
public readonly HashSet<string> AirUnitsTypes = new();
[ActorReference]
[Desc("Actor types that should generally be excluded from attack squads.")]
public readonly HashSet<string> ExcludeFromSquadsTypes = new HashSet<string>();
public readonly HashSet<string> ExcludeFromSquadsTypes = new();
[ActorReference]
[Desc("Actor types that are considered construction yards (base builders).")]
public readonly HashSet<string> ConstructionYardTypes = new HashSet<string>();
public readonly HashSet<string> ConstructionYardTypes = new();
[ActorReference]
[Desc("Enemy building types around which to scan for targets for naval squads.")]
public readonly HashSet<string> NavalProductionTypes = new HashSet<string>();
public readonly HashSet<string> NavalProductionTypes = new();
[ActorReference]
[Desc("Own actor types that are prioritized when defending.")]
public readonly HashSet<string> ProtectionTypes = new HashSet<string>();
public readonly HashSet<string> ProtectionTypes = new();
[Desc("Minimum number of units AI must have before attacking.")]
public readonly int SquadSize = 8;
@@ -114,12 +114,12 @@ namespace OpenRA.Mods.Common.Traits
public readonly Player Player;
readonly Predicate<Actor> unitCannotBeOrdered;
readonly List<Actor> unitsHangingAroundTheBase = new List<Actor>();
readonly List<Actor> unitsHangingAroundTheBase = new();
// Units that the bot already knows about. Any unit not on this list needs to be given a role.
readonly List<Actor> activeUnits = new List<Actor>();
readonly List<Actor> activeUnits = new();
public List<Squad> Squads = new List<Squad>();
public List<Squad> Squads = new();
IBot bot;
IBotPositionsUpdated[] notifyPositionsUpdated;

View File

@@ -95,8 +95,8 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
"then AttackOrFlee is Flee"
};
public static readonly AttackOrFleeFuzzy Default = new AttackOrFleeFuzzy(null, null, null);
public static readonly AttackOrFleeFuzzy Rush = new AttackOrFleeFuzzy(new[]
public static readonly AttackOrFleeFuzzy Default = new(null, null, null);
public static readonly AttackOrFleeFuzzy Rush = new(new[]
{
"if ((OwnHealth is Normal) " +
"and ((EnemyHealth is NearDead) or (EnemyHealth is Injured) or (EnemyHealth is Normal)) " +
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
"then AttackOrFlee is Flee"
}, null, null);
readonly MamdaniFuzzySystem fuzzyEngine = new MamdaniFuzzySystem();
readonly MamdaniFuzzySystem fuzzyEngine = new();
public AttackOrFleeFuzzy(
IEnumerable<string> rulesForNormalOwnHealth,

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
public class Squad
{
public List<Actor> Units = new List<Actor>();
public List<Actor> Units = new();
public SquadType Type;
internal IBot Bot;

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
{
abstract class AirStateBase : StateBase
{
static readonly BitSet<TargetableType> AirTargetTypes = new BitSet<TargetableType>("Air");
static readonly BitSet<TargetableType> AirTargetTypes = new("Air");
protected const int MissileUnitMultiplier = 3;

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
{
[Desc("Tells the AI how to use its support powers.")]
[FieldLoader.LoadUsing(nameof(LoadDecisions))]
public readonly List<SupportPowerDecision> Decisions = new List<SupportPowerDecision>();
public readonly List<SupportPowerDecision> Decisions = new();
static object LoadDecisions(MiniYaml yaml)
{
@@ -40,9 +40,9 @@ namespace OpenRA.Mods.Common.Traits
{
readonly World world;
readonly Player player;
readonly Dictionary<SupportPowerInstance, int> waitingPowers = new Dictionary<SupportPowerInstance, int>();
readonly Dictionary<string, SupportPowerDecision> powerDecisions = new Dictionary<string, SupportPowerDecision>();
readonly List<SupportPowerInstance> stalePowers = new List<SupportPowerInstance>();
readonly Dictionary<SupportPowerInstance, int> waitingPowers = new();
readonly Dictionary<string, SupportPowerDecision> powerDecisions = new();
readonly List<SupportPowerInstance> stalePowers = new();
SupportPowerManager supportPowerManager;
public SupportPowerBotModule(Actor self, SupportPowerBotModuleInfo info)

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int IdleBaseUnitsMaximum = 12;
[Desc("Production queues AI uses for producing units.")]
public readonly HashSet<string> UnitQueues = new HashSet<string> { "Vehicle", "Infantry", "Plane", "Ship", "Aircraft" };
public readonly HashSet<string> UnitQueues = new() { "Vehicle", "Infantry", "Plane", "Ship", "Aircraft" };
[Desc("What units to the AI should build.", "What relative share of the total army must be this type of unit.")]
public readonly Dictionary<string, int> UnitsToBuild = null;
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits
readonly World world;
readonly Player player;
readonly List<string> queuedBuildRequests = new List<string>();
readonly List<string> queuedBuildRequests = new();
IBotRequestPauseUnitProduction[] requestPause;
int idleUnitCount;

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string[] Prerequisites = Array.Empty<string>();
[Desc("Production queue(s) that can produce this.")]
public readonly HashSet<string> Queue = new HashSet<string>();
public readonly HashSet<string> Queue = new();
[Desc("Override the production structure type (from the Production Produces list) that this unit should be built at.")]
public readonly string BuildAtProductionType = null;

View File

@@ -47,11 +47,11 @@ namespace OpenRA.Mods.Common.Traits
readonly BridgeLayer bridgeLayer;
// Fixed at map load
readonly List<CPos[]> segmentLocations = new List<CPos[]>();
readonly List<CPos[]> segmentLocations = new();
// Changes as segments are killed and repaired
readonly Dictionary<CPos, IBridgeSegment> segments = new Dictionary<CPos, IBridgeSegment>();
readonly HashSet<CPos> dirtyLocations = new HashSet<CPos>();
readonly Dictionary<CPos, IBridgeSegment> segments = new();
readonly HashSet<CPos> dirtyLocations = new();
// Enabled during a repair action
int repairStep;

View File

@@ -29,14 +29,14 @@ namespace OpenRA.Mods.Common.Traits
public class BuildingInfo : TraitInfo, IOccupySpaceInfo, IPlaceBuildingDecorationInfo
{
[Desc("Where you are allowed to place the building (Water, Clear, ...)")]
public readonly HashSet<string> TerrainTypes = new HashSet<string>();
public readonly HashSet<string> TerrainTypes = new();
[Desc("x means cell is blocked, capital X means blocked but not counting as targetable, ",
"= means part of the footprint but passable, _ means completely empty.")]
[FieldLoader.LoadUsing(nameof(LoadFootprint))]
public readonly Dictionary<CVec, FootprintCellType> Footprint;
public readonly CVec Dimensions = new CVec(1, 1);
public readonly CVec Dimensions = new(1, 1);
[Desc("Shift center of the actor by this offset.")]
public readonly WVec LocalCenterOffset = WVec.Zero;

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly WAngle? Facing = null;
[Desc("Type tags on this exit.")]
public readonly HashSet<string> ProductionTypes = new HashSet<string>();
public readonly HashSet<string> ProductionTypes = new();
[Desc("Number of ticks to wait before moving into the world.")]
public readonly int ExitDelay = 0;

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int TransitionDelay = 33;
[Desc("Blocks bullets scaled to open value.")]
public readonly WDist BlocksProjectilesHeight = new WDist(640);
public readonly WDist BlocksProjectilesHeight = new(640);
[Desc("Determines what projectiles to block based on their allegiance to the gate owner.")]
public readonly PlayerRelationship BlocksProjectilesValidRelationships = PlayerRelationship.Ally | PlayerRelationship.Neutral | PlayerRelationship.Enemy;
@@ -139,7 +139,7 @@ namespace OpenRA.Mods.Common.Traits
return blockedPositions.Any(loc => self.World.ActorMap.GetActorsAt(loc).Any(a => a != self));
}
WDist IBlocksProjectiles.BlockingHeight => new WDist(Info.BlocksProjectilesHeight.Length * (OpenPosition - Position) / OpenPosition);
WDist IBlocksProjectiles.BlockingHeight => new(Info.BlocksProjectilesHeight.Length * (OpenPosition - Position) / OpenPosition);
PlayerRelationship IBlocksProjectiles.ValidRelationships => Info.BlocksProjectilesValidRelationships;
}

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
{
[FieldLoader.Require]
[Desc("Types of buildable area this actor gives.")]
public readonly HashSet<string> AreaTypes = new HashSet<string>();
public readonly HashSet<string> AreaTypes = new();
public override object Create(ActorInitializer init) { return new GivesBuildableArea(this); }
}
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
public GivesBuildableArea(GivesBuildableAreaInfo info)
: base(info) { }
readonly HashSet<string> noAreaTypes = new HashSet<string>();
readonly HashSet<string> noAreaTypes = new();
public HashSet<string> AreaTypes => !IsTraitDisabled ? Info.AreaTypes : noAreaTypes;
}

View File

@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int Range = 5;
[Desc("LineBuildNode 'Types' to attach to.")]
public readonly HashSet<string> NodeTypes = new HashSet<string> { "wall" };
public readonly HashSet<string> NodeTypes = new() { "wall" };
[ActorReference(typeof(LineBuildInfo))]
[Desc("Actor type for line-built segments (defaults to same actor).")]

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
public class LineBuildNodeInfo : TraitInfo<LineBuildNode>
{
[Desc("This actor is of LineBuild 'NodeType'...")]
public readonly HashSet<string> Types = new HashSet<string> { "wall" };
public readonly HashSet<string> Types = new() { "wall" };
[Desc("Cells (outside the footprint) that contain cells that can connect to this actor.")]
public readonly CVec[] Connections = new[] { new CVec(1, 0), new CVec(0, 1), new CVec(-1, 0), new CVec(0, -1) };

View File

@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly bool BaselineSpawn = false;
[Desc("Direction the aircraft should face to land.")]
public readonly WAngle Facing = new WAngle(256);
public readonly WAngle Facing = new(256);
public override object Create(ActorInitializer init) { return new ProductionAirdrop(init, this); }
}

View File

@@ -67,10 +67,10 @@ namespace OpenRA.Mods.Common.Traits
{
readonly IHealth health;
readonly Predicate<Player> isNotActiveAlly;
readonly Stack<int> repairTokens = new Stack<int>();
readonly Stack<int> repairTokens = new();
int remainingTicks;
public readonly List<Player> Repairers = new List<Player>();
public readonly List<Player> Repairers = new();
public bool RepairActive { get; private set; }
public RepairableBuilding(Actor self, RepairableBuildingInfo info)

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
{
[FieldLoader.Require]
[Desc("Types of buildable are this actor requires.")]
public readonly HashSet<string> AreaTypes = new HashSet<string>();
public readonly HashSet<string> AreaTypes = new();
[Desc("Maximum range from the actor with 'GivesBuildableArea' this can be placed at.")]
public readonly int Adjacent = 2;

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
[ActorReference]
[FieldLoader.Require]
public readonly HashSet<string> DockActors = new HashSet<string> { };
public readonly HashSet<string> DockActors = new() { };
[VoiceReference]
public readonly string Voice = "Action";

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
[CursorReference(dictionaryReference: LintDictionaryReference.Values)]
[Desc("Cursor overrides to display for specific terrain types.",
"A dictionary of [terrain type]: [cursor name].")]
public readonly Dictionary<string, string> TerrainCursors = new Dictionary<string, string>();
public readonly Dictionary<string, string> TerrainCursors = new();
[CursorReference]
[Desc("Cursor to display when a move order cannot be issued at target location.")]

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
{
[ActorReference]
[FieldLoader.Require]
public readonly HashSet<string> RepairActors = new HashSet<string> { };
public readonly HashSet<string> RepairActors = new() { };
[VoiceReference]
public readonly string Voice = "Action";

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
class CapturableProgressBar : ConditionalTrait<CapturableProgressBarInfo>, ISelectionBar, ICaptureProgressWatcher
{
readonly Dictionary<Actor, (int Current, int Total)> progress = new Dictionary<Actor, (int, int)>();
readonly Dictionary<Actor, (int Current, int Total)> progress = new();
public CapturableProgressBar(CapturableProgressBarInfo info)
: base(info) { }

View File

@@ -27,8 +27,8 @@ namespace OpenRA.Mods.Common.Traits
class CapturableProgressBlink : ConditionalTrait<CapturableProgressBlinkInfo>, ITick, ICaptureProgressWatcher
{
readonly List<Player> captorOwners = new List<Player>();
readonly HashSet<Actor> captors = new HashSet<Actor>();
readonly List<Player> captorOwners = new();
readonly HashSet<Actor> captors = new();
int tick = 0;
public CapturableProgressBlink(CapturableProgressBlinkInfo info)

View File

@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits
int beingCapturedToken = Actor.InvalidConditionToken;
bool enteringCurrentTarget;
readonly HashSet<Actor> currentCaptors = new HashSet<Actor>();
readonly HashSet<Actor> currentCaptors = new();
public bool BeingCaptured { get; private set; }

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int MaxWeight = 0;
[Desc("`Passenger.CargoType`s that can be loaded into this actor.")]
public readonly HashSet<string> Types = new HashSet<string>();
public readonly HashSet<string> Types = new();
[Desc("A list of actor types that are initially spawned into this actor.")]
public readonly string[] InitialUnits = Array.Empty<string>();
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly bool EjectOnDeath = false;
[Desc("Terrain types that this actor is allowed to eject actors onto. Leave empty for all terrain types.")]
public readonly HashSet<string> UnloadTerrainTypes = new HashSet<string>();
public readonly HashSet<string> UnloadTerrainTypes = new();
[VoiceReference]
[Desc("Voice to play when ordered to unload the passengers.")]
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly WDist LoadRange = WDist.FromCells(5);
[Desc("Which direction the passenger will face (relative to the transport) when unloading.")]
public readonly WAngle PassengerFacing = new WAngle(512);
public readonly WAngle PassengerFacing = new(512);
[Desc("Delay (in ticks) before continuing after loading a passenger.")]
public readonly int AfterLoadDelay = 8;
@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits
[ActorReference(dictionaryReference: LintDictionaryReference.Keys)]
[Desc("Conditions to grant when specified actors are loaded inside the transport.",
"A dictionary of [actor name]: [condition].")]
public readonly Dictionary<string, string> PassengerConditions = new Dictionary<string, string>();
public readonly Dictionary<string, string> PassengerConditions = new();
[GrantedConditionReference]
public IEnumerable<string> LinterPassengerConditions => PassengerConditions.Values;
@@ -94,9 +94,9 @@ namespace OpenRA.Mods.Common.Traits
{
public readonly CargoInfo Info;
readonly Actor self;
readonly List<Actor> cargo = new List<Actor>();
readonly HashSet<Actor> reserves = new HashSet<Actor>();
readonly Dictionary<string, Stack<int>> passengerTokens = new Dictionary<string, Stack<int>>();
readonly List<Actor> cargo = new();
readonly HashSet<Actor> reserves = new();
readonly Dictionary<string, Stack<int>> passengerTokens = new();
readonly Lazy<IFacing> facing;
readonly bool checkTerrainType;
@@ -104,7 +104,7 @@ namespace OpenRA.Mods.Common.Traits
int reservedWeight = 0;
Aircraft aircraft;
int loadingToken = Actor.InvalidConditionToken;
readonly Stack<int> loadedTokens = new Stack<int>();
readonly Stack<int> loadedTokens = new();
bool takeOffAfterLoad;
bool initialised;

View File

@@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Traits
[ActorReference(dictionaryReference: LintDictionaryReference.Keys)]
[Desc("Conditions to grant when a specified actor is being carried.",
"A dictionary of [actor name]: [condition].")]
public readonly Dictionary<string, string> CarryableConditions = new Dictionary<string, string>();
public readonly Dictionary<string, string> CarryableConditions = new();
[VoiceReference]
public readonly string Voice = "Action";

View File

@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Palette = "cloak";
public readonly bool IsPlayerPalette = false;
public readonly BitSet<DetectionType> DetectionTypes = new BitSet<DetectionType>("Cloak");
public readonly BitSet<DetectionType> DetectionTypes = new("Cloak");
[GrantedConditionReference]
[Desc("The condition to grant to self while cloaked.")]

View File

@@ -55,10 +55,10 @@ namespace OpenRA.Mods.Common.Traits
}
public readonly ExternalConditionInfo Info;
readonly Dictionary<object, HashSet<int>> permanentTokens = new Dictionary<object, HashSet<int>>();
readonly Dictionary<object, HashSet<int>> permanentTokens = new();
// Tokens are sorted on insert/remove by ascending expiry time
readonly List<TimedToken> timedTokens = new List<TimedToken>();
readonly List<TimedToken> timedTokens = new();
IConditionTimerWatcher[] watchers;
int duration;
int expires;

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Condition = null;
[Desc("Name of the armaments that grant this condition.")]
public readonly HashSet<string> ArmamentNames = new HashSet<string>() { "primary" };
public readonly HashSet<string> ArmamentNames = new() { "primary" };
[Desc("Shots required to apply an instance of the condition. If there are more instances of the condition granted than values listed,",
"the last value is used for all following instances beyond the defined range.")]
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
public class GrantConditionOnAttack : PausableConditionalTrait<GrantConditionOnAttackInfo>, INotifyCreated, ITick, INotifyAttack
{
readonly Stack<int> tokens = new Stack<int>();
readonly Stack<int> tokens = new();
int cooldown = 0;
int shotsFired = 0;

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string DeployedCondition = null;
[Desc("The terrain types that this actor can deploy on. Leave empty to allow any.")]
public readonly HashSet<string> AllowedTerrainTypes = new HashSet<string>();
public readonly HashSet<string> AllowedTerrainTypes = new();
[Desc("Can this actor deploy on slopes?")]
public readonly bool CanDeployOnRamps = false;

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Condition = null;
[Desc("Only grant this condition for certain factions.")]
public readonly HashSet<string> Factions = new HashSet<string>();
public readonly HashSet<string> Factions = new();
[Desc("Should it recheck everything when it is captured?")]
public readonly bool ResetOnOwnerChange = false;

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
[ActorReference]
[Desc("The actors to grant condition for. If empty condition will be granted for all actors.")]
public readonly HashSet<string> Actors = new HashSet<string>();
public readonly HashSet<string> Actors = new();
[Desc("How long condition is applies for. Use -1 for infinite.")]
public readonly int Duration = -1;

View File

@@ -27,8 +27,8 @@ namespace OpenRA.Mods.Common.Traits
public class LineBuildSegmentExternalCondition : ConditionalTrait<LineBuildSegmentExternalConditionInfo>, INotifyLineBuildSegmentsChanged
{
readonly HashSet<Actor> segments = new HashSet<Actor>();
readonly Dictionary<Actor, int> tokens = new Dictionary<Actor, int>();
readonly HashSet<Actor> segments = new();
readonly Dictionary<Actor, int> tokens = new();
public LineBuildSegmentExternalCondition(LineBuildSegmentExternalConditionInfo info)
: base(info) { }

View File

@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits
{
readonly Actor self;
readonly Dictionary<Actor, int> tokens = new Dictionary<Actor, int>();
readonly Dictionary<Actor, int> tokens = new();
int proximityTrigger;
WPos cachedPosition;

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int Duration = 0;
[Desc("Allowed to land on.")]
public readonly HashSet<string> TerrainTypes = new HashSet<string>();
public readonly HashSet<string> TerrainTypes = new();
[Desc("Define actors that can collect crates by setting this into the Crushes field from the Mobile trait.")]
public readonly string CrushClass = "crate";

View File

@@ -33,10 +33,10 @@ namespace OpenRA.Mods.Common.Traits
public readonly int MaxRadius = 4;
[Desc("The list of unit target types we are allowed to duplicate.")]
public readonly BitSet<TargetableType> ValidTargets = new BitSet<TargetableType>("Ground", "Water");
public readonly BitSet<TargetableType> ValidTargets = new("Ground", "Water");
[Desc("Which factions this crate action can occur for.")]
public readonly HashSet<string> ValidFactions = new HashSet<string>();
public readonly HashSet<string> ValidFactions = new();
[Desc("Is the new duplicates given to a specific owner, regardless of whom collected it?")]
public readonly string Owner = null;

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string[] Units = Array.Empty<string>();
[Desc("Factions that are allowed to trigger this action.")]
public readonly HashSet<string> ValidFactions = new HashSet<string>();
public readonly HashSet<string> ValidFactions = new();
[Desc("Override the owner of the newly spawned unit: e.g. Creeps or Neutral")]
public readonly string Owner = null;
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
{
readonly Actor self;
readonly GiveUnitCrateActionInfo info;
readonly List<CPos> usedCells = new List<CPos>();
readonly List<CPos> usedCells = new();
public GiveUnitCrateAction(Actor self, GiveUnitCrateActionInfo info)
: base(self, info)

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int Duration = 0;
[Desc("The range to search for extra collectors in.", "Extra collectors will also be granted the crate action.")]
public readonly WDist Range = new WDist(3);
public readonly WDist Range = new(3);
[Desc("The maximum number of extra collectors to grant the crate action to.", "-1 = no limit")]
public readonly int MaxExtraCollectors = 4;

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int Levels = 1;
[Desc("The range to search for extra collectors in.", "Extra collectors will also be granted the crate action.")]
public readonly WDist Range = new WDist(3);
public readonly WDist Range = new(3);
[Desc("The maximum number of extra collectors to grant the crate action to.")]
public readonly int MaxExtraCollectors = 4;

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Sound to play when being crushed.")]
public readonly string CrushSound = null;
[Desc("Which crush classes does this actor belong to.")]
public readonly BitSet<CrushClass> CrushClasses = new BitSet<CrushClass>("infantry");
public readonly BitSet<CrushClass> CrushClasses = new("infantry");
[Desc("Probability of mobile actors noticing and evading a crush attempt.")]
public readonly int WarnProbability = 75;
[Desc("Will friendly units just crush me instead of pathing around.")]

View File

@@ -46,8 +46,8 @@ namespace OpenRA.Mods.Common.Traits
}
}
readonly List<DemolishAction> actions = new List<DemolishAction>();
readonly List<DemolishAction> removeActions = new List<DemolishAction>();
readonly List<DemolishAction> actions = new();
readonly List<DemolishAction> removeActions = new();
IDamageModifier[] damageModifiers;
public Demolishable(DemolishableInfo info)

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
public class DetectCloakedInfo : ConditionalTraitInfo
{
[Desc("Specific cloak classifications I can reveal.")]
public readonly BitSet<DetectionType> DetectionTypes = new BitSet<DetectionType>("Cloak");
public readonly BitSet<DetectionType> DetectionTypes = new("Cloak");
public readonly WDist Range = WDist.FromCells(5);

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
public class Encyclopedia
{
public static readonly Encyclopedia Instance = new Encyclopedia();
public static readonly Encyclopedia Instance = new();
Encyclopedia() { }
}
}

View File

@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits
readonly GainsExperienceInfo info;
readonly int initialExperience;
readonly List<(int RequiredExperience, string Condition)> nextLevel = new List<(int, string)>();
readonly List<(int RequiredExperience, string Condition)> nextLevel = new();
// Stored as a percentage of our value
[Sync]

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
class GivesBounty : ConditionalTrait<GivesBountyInfo>, INotifyKilled, INotifyPassengerEntered, INotifyPassengerExited
{
readonly Dictionary<Actor, GivesBounty[]> passengerBounties = new Dictionary<Actor, GivesBounty[]>();
readonly Dictionary<Actor, GivesBounty[]> passengerBounties = new();
public GivesBounty(GivesBountyInfo info)
: base(info) { }

View File

@@ -22,13 +22,13 @@ namespace OpenRA.Mods.Common.Traits
{
public class HarvesterInfo : ConditionalTraitInfo, Requires<MobileInfo>
{
public readonly HashSet<string> DeliveryBuildings = new HashSet<string>();
public readonly HashSet<string> DeliveryBuildings = new();
[Desc("How long (in ticks) to wait until (re-)checking for a nearby available DeliveryBuilding if not yet linked to one.")]
public readonly int SearchForDeliveryBuildingDelay = 125;
[Desc("Cell to move to when automatically unblocking DeliveryBuilding.")]
public readonly CVec UnblockCell = new CVec(0, 4);
public readonly CVec UnblockCell = new(0, 4);
[Desc("How much resources it can carry.")]
public readonly int Capacity = 28;
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int HarvestFacings = 0;
[Desc("Which resources it can harvest.")]
public readonly HashSet<string> Resources = new HashSet<string>();
public readonly HashSet<string> Resources = new();
[Desc("Percentage of maximum speed when fully loaded.")]
public readonly int FullyLoadedSpeed = 85;
@@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Traits
readonly Mobile mobile;
readonly IResourceLayer resourceLayer;
readonly ResourceClaimLayer claimLayer;
readonly Dictionary<string, int> contents = new Dictionary<string, int>();
readonly Dictionary<string, int> contents = new();
int conditionToken = Actor.InvalidConditionToken;
[Sync]

View File

@@ -20,10 +20,10 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Spawns remains of a husk actor with the correct facing.")]
public class HuskInfo : TraitInfo, IPositionableInfo, IFacingInfo, IActorPreviewInitInfo
{
public readonly HashSet<string> AllowedTerrain = new HashSet<string>();
public readonly HashSet<string> AllowedTerrain = new();
[Desc("Facing to use for actor previews (map editor, color picker, etc)")]
public readonly WAngle PreviewFacing = new WAngle(384);
public readonly WAngle PreviewFacing = new(384);
IEnumerable<ActorInit> IActorPreviewInitInfo.ActorPreviewInits(ActorInfo ai, ActorPreviewType type)
{

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int AttackPanicChance = 20;
[Desc("The terrain types that this actor should avoid running on to while panicking.")]
public readonly HashSet<string> AvoidTerrainTypes = new HashSet<string>();
public readonly HashSet<string> AvoidTerrainTypes = new();
[SequenceReference(prefix: true)]
public readonly string PanicSequencePrefix = "panic-";

View File

@@ -31,10 +31,10 @@ namespace OpenRA.Mods.Common.Traits
public readonly BitSet<DamageType> DamageTriggers = default;
[Desc("Damage modifiers for each damage type (defined on the warheads) while the unit is prone.")]
public readonly Dictionary<string, int> DamageModifiers = new Dictionary<string, int>();
public readonly Dictionary<string, int> DamageModifiers = new();
[Desc("Muzzle offset modifier to apply while prone.")]
public readonly WVec ProneOffset = new WVec(500, 0, 0);
public readonly WVec ProneOffset = new(500, 0, 0);
[SequenceReference(prefix: true)]
[Desc("Sequence prefix to apply while prone.")]

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly WAngle InitialFacing = WAngle.Zero;
[Desc("Speed at which the actor turns.")]
public readonly WAngle TurnSpeed = new WAngle(512);
public readonly WAngle TurnSpeed = new(512);
public readonly int Speed = 1;
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits
[CursorReference(dictionaryReference: LintDictionaryReference.Values)]
[Desc("Cursor overrides to display for specific terrain types.",
"A dictionary of [terrain type]: [cursor name].")]
public readonly Dictionary<string, string> TerrainCursors = new Dictionary<string, string>();
public readonly Dictionary<string, string> TerrainCursors = new();
[CursorReference]
[Desc("Cursor to display when a move order cannot be issued at target location.")]
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly Color TargetLineColor = Color.Green;
[Desc("Facing to use for actor previews (map editor, color picker, etc)")]
public readonly WAngle PreviewFacing = new WAngle(384);
public readonly WAngle PreviewFacing = new(384);
[Desc("Display order for the facing slider in the map editor")]
public readonly int EditorFacingDisplayOrder = 3;
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The distance from the edge of a cell over which the actor will adjust its tilt when moving between cells with different ramp types.",
"-1 means that the actor does not tilt on slopes.")]
public readonly WDist TerrainOrientationAdjustmentMargin = new WDist(-1);
public readonly WDist TerrainOrientationAdjustmentMargin = new(-1);
IEnumerable<ActorInit> IActorPreviewInitInfo.ActorPreviewInits(ActorInfo ai, ActorPreviewType type)
{

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string[] Prerequisites = Array.Empty<string>();
[Desc("Queues that this cost will apply.")]
public readonly HashSet<string> Queue = new HashSet<string>();
public readonly HashSet<string> Queue = new();
int IProductionCostModifierInfo.GetProductionCostModifier(TechTree techTree, string queue)
{

Some files were not shown because too many files have changed in this diff Show More