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

@@ -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)
{

View File

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

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Used for bursted one-colored whole screen effects. Add this to the world actor.")]
public class FlashPaletteEffectInfo : TraitInfo
{
public readonly HashSet<string> ExcludePalettes = new HashSet<string> { "cursor", "chrome", "colorpicker", "fog", "shroud" };
public readonly HashSet<string> ExcludePalettes = new() { "cursor", "chrome", "colorpicker", "fog", "shroud" };
[Desc("Measured in ticks.")]
public readonly int Length = 20;

View File

@@ -21,10 +21,10 @@ namespace OpenRA.Mods.Common.Traits
public class GlobalLightingPaletteEffectInfo : TraitInfo, ILobbyCustomRulesIgnore
{
[Desc("Do not modify graphics that use any palette in this list.")]
public readonly HashSet<string> ExcludePalettes = new HashSet<string> { "cursor", "chrome", "colorpicker", "fog", "shroud", "alpha" };
public readonly HashSet<string> ExcludePalettes = new() { "cursor", "chrome", "colorpicker", "fog", "shroud", "alpha" };
[Desc("Do not modify graphics that start with these letters.")]
public readonly HashSet<string> ExcludePalettePrefixes = new HashSet<string>();
public readonly HashSet<string> ExcludePalettePrefixes = new();
public readonly float Red = 1f;
public readonly float Green = 1f;

View File

@@ -21,17 +21,17 @@ namespace OpenRA.Mods.Common.Traits
{
[Desc("Defines to which palettes this effect should be applied to.",
"If none specified, it applies to all palettes not explicitly excluded.")]
public readonly HashSet<string> Palettes = new HashSet<string>();
public readonly HashSet<string> Palettes = new();
[Desc("Defines for which tileset IDs this effect should be loaded.",
"If none specified, it applies to all tileset IDs not explicitly excluded.")]
public readonly HashSet<string> Tilesets = new HashSet<string>();
public readonly HashSet<string> Tilesets = new();
[Desc("Defines which palettes should be excluded from this effect.")]
public readonly HashSet<string> ExcludePalettes = new HashSet<string>();
public readonly HashSet<string> ExcludePalettes = new();
[Desc("Don't apply the effect for these tileset IDs.")]
public readonly HashSet<string> ExcludeTilesets = new HashSet<string>();
public readonly HashSet<string> ExcludeTilesets = new();
[Desc("Palette index of first RotationRange color.")]
public readonly int RotationBase = 0x60;

View File

@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits
public class IndexedColorRemap : IPaletteRemap
{
readonly Dictionary<int, int> replacements = new Dictionary<int, int>();
readonly Dictionary<int, int> replacements = new();
readonly IPalette basePalette;
public IndexedColorRemap(IPalette basePalette, int[] ramp, int[] remap)

View File

@@ -30,10 +30,10 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Defines for which tileset IDs this palette should be loaded.",
"If none specified, it applies to all tileset IDs not explicitly excluded.")]
public readonly HashSet<string> Tilesets = new HashSet<string>();
public readonly HashSet<string> Tilesets = new();
[Desc("Don't load palette for these tileset IDs.")]
public readonly HashSet<string> ExcludeTilesets = new HashSet<string>();
public readonly HashSet<string> ExcludeTilesets = new();
[FieldLoader.Require]
[Desc("Name of the file to load.")]

View File

@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string WaterCorpsePalette = "effect";
[Desc("Terrain types on which to display WaterCorpseSequence.")]
public readonly HashSet<string> WaterTerrainTypes = new HashSet<string> { "Water" };
public readonly HashSet<string> WaterTerrainTypes = new() { "Water" };
public readonly string WaterImpactSound = null;

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
[ActorReference(dictionaryReference: LintDictionaryReference.Keys)]
[Desc("Conditions to grant when this actor is loaded inside specified transport.",
"A dictionary of [actor name]: [condition].")]
public readonly Dictionary<string, string> CargoConditions = new Dictionary<string, string>();
public readonly Dictionary<string, string> CargoConditions = new();
[GrantedConditionReference]
public IEnumerable<string> LinterCargoConditions => CargoConditions.Values;

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
public class GrantConditionOnPrerequisiteManager : ITechTreeElement
{
readonly Actor self;
readonly Dictionary<string, List<(Actor Actor, GrantConditionOnPrerequisite GrantConditionOnPrerequisite)>> upgradables = new Dictionary<string, List<(Actor, GrantConditionOnPrerequisite)>>();
readonly Dictionary<string, List<(Actor Actor, GrantConditionOnPrerequisite GrantConditionOnPrerequisite)>> upgradables = new();
readonly TechTree techTree;
public GrantConditionOnPrerequisiteManager(ActorInitializer init)

View File

@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits
[FieldLoader.Require]
[Desc("Prerequisites to grant when this checkbox is enabled.")]
public readonly HashSet<string> Prerequisites = new HashSet<string>();
public readonly HashSet<string> Prerequisites = new();
IEnumerable<string> ITechTreePrerequisiteInfo.Prerequisites(ActorInfo info) { return Prerequisites; }
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits
public class LobbyPrerequisiteCheckbox : INotifyCreated, ITechTreePrerequisite
{
readonly LobbyPrerequisiteCheckboxInfo info;
HashSet<string> prerequisites = new HashSet<string>();
HashSet<string> prerequisites = new();
public LobbyPrerequisiteCheckbox(LobbyPrerequisiteCheckboxInfo info)
{

View File

@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits
public class MissionObjectives : INotifyWinStateChanged, ISync, IResolveOrder, IWorldLoaded
{
public readonly MissionObjectivesInfo Info;
readonly List<MissionObjective> objectives = new List<MissionObjective>();
readonly List<MissionObjective> objectives = new();
readonly Player player;
public IReadOnlyList<MissionObjective> Objectives => objectives;

View File

@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
readonly ModularBotInfo info;
readonly World world;
readonly Queue<Order> orders = new Queue<Order>();
readonly Queue<Order> orders = new();
Player player;

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string CannotPlaceTextNotification = null;
[Desc("Hotkey to toggle between PlaceBuildingVariants when placing a structure.")]
public readonly HotkeyReference ToggleVariantKey = new HotkeyReference();
public readonly HotkeyReference ToggleVariantKey = new();
public override object Create(ActorInitializer init) { return new PlaceBuilding(this); }
}

View File

@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string CashTickDownNotification = null;
[Desc("Monetary value of each resource type.", "Dictionary of [resource type]: [value per unit].")]
public readonly Dictionary<string, int> ResourceValues = new Dictionary<string, int>();
public readonly Dictionary<string, int> ResourceValues = new();
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(MapPreview map)
{

View File

@@ -35,11 +35,11 @@ namespace OpenRA.Mods.Common.Traits
public int Experience => experience != null ? experience.Experience : 0;
// Low resolution (every 30 seconds) record of earnings, covering the entire game
public List<int> IncomeSamples = new List<int>(100);
public List<int> IncomeSamples = new(100);
public int Income;
public int DisplayIncome;
public List<int> ArmySamples = new List<int>(100);
public List<int> ArmySamples = new(100);
public int KillsCost;
public int DeathsCost;
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
public int AssetsValue;
// High resolution (every second) record of earnings, limited to the last minute
readonly Queue<int> earnedSeconds = new Queue<int>(60);
readonly Queue<int> earnedSeconds = new(60);
int lastIncome;
int lastIncomeTick;

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Group = null;
[Desc("Only enable this queue for certain factions.")]
public readonly HashSet<string> Factions = new HashSet<string>();
public readonly HashSet<string> Factions = new();
[Desc("Should the prerequisite remain enabled if the owner changes?")]
public readonly bool Sticky = true;
@@ -128,8 +128,8 @@ namespace OpenRA.Mods.Common.Traits
public readonly ProductionQueueInfo Info;
// A list of things we could possibly build
protected readonly Dictionary<ActorInfo, ProductionState> Producible = new Dictionary<ActorInfo, ProductionState>();
protected readonly List<ProductionItem> Queue = new List<ProductionItem>();
protected readonly Dictionary<ActorInfo, ProductionState> Producible = new();
protected readonly List<ProductionItem> Queue = new();
readonly IEnumerable<ActorInfo> allProducibles;
readonly IEnumerable<ActorInfo> buildableProducibles;

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string[] RequiresPrerequisites = Array.Empty<string>();
[Desc("Only grant this prerequisite 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
public class TechTree
{
readonly List<Watcher> watchers = new List<Watcher>();
readonly List<Watcher> watchers = new();
public TechTree(ActorInitializer init)
{

View File

@@ -30,12 +30,12 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Requirements for accepting a plug type.",
"Key is the plug type that the requirements applies to.",
"Value is the condition expression defining the requirements to place the plug.")]
public readonly Dictionary<string, BooleanExpression> Requirements = new Dictionary<string, BooleanExpression>();
public readonly Dictionary<string, BooleanExpression> Requirements = new();
[Desc("Options to display in the map editor.",
"Key is the plug type that the requirements applies to.",
"Value is the label that is displayed in the actor editor dropdown.")]
public readonly Dictionary<string, string> EditorOptions = new Dictionary<string, string>();
public readonly Dictionary<string, string> EditorOptions = new();
[Desc("Label to use for an empty plug socket.")]
public readonly string EmptyOption = "Empty";

View File

@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
readonly PowerManagerInfo info;
readonly DeveloperMode devMode;
readonly Dictionary<Actor, int> powerDrain = new Dictionary<Actor, int>();
readonly Dictionary<Actor, int> powerDrain = new();
[Sync]
int totalProvided;

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly WDist Range = WDist.FromCells(5);
[Desc("Allowed ProximityCaptor actors to capture this actor.")]
public readonly BitSet<CaptureType> CaptorTypes = new BitSet<CaptureType>("Player", "Vehicle", "Tank", "Infantry");
public readonly BitSet<CaptureType> CaptorTypes = new("Player", "Vehicle", "Tank", "Infantry");
[Desc("If set, the capturing process stops immediately after another player comes into Range.")]
public readonly bool MustBeClear = false;
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
public ProximityCapturableInfo Info;
public Actor Self;
readonly List<Actor> actorsInRange = new List<Actor>();
readonly List<Actor> actorsInRange = new();
int proximityTrigger;
WPos prevPosition;
bool skipTriggerUpdate;

View File

@@ -20,10 +20,10 @@ namespace OpenRA.Mods.Common.Traits
[ActorReference]
[FieldLoader.Require]
[Desc("Actors that this actor can dock to and get rearmed by.")]
public readonly HashSet<string> RearmActors = new HashSet<string> { };
public readonly HashSet<string> RearmActors = new() { };
[Desc("Name(s) of AmmoPool(s) that use this trait to rearm.")]
public readonly HashSet<string> AmmoPools = new HashSet<string> { "primary" };
public readonly HashSet<string> AmmoPools = new() { "primary" };
public override object Create(ActorInitializer init) { return new Rearmable(this); }
}

View File

@@ -18,11 +18,11 @@ namespace OpenRA.Mods.Common.Traits
public class RejectsOrdersInfo : ConditionalTraitInfo
{
[Desc("Explicit list of rejected orders. Leave empty to reject all minus those listed under Except.")]
public readonly HashSet<string> Reject = new HashSet<string>();
public readonly HashSet<string> Reject = new();
[Desc("List of orders that should *not* be rejected.",
"Also overrides other instances of this trait's Reject fields.")]
public readonly HashSet<string> Except = new HashSet<string>();
public readonly HashSet<string> Except = new();
public override object Create(ActorInitializer init) { return new RejectsOrders(this); }
}

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int TrailDelay = 0;
[Desc("Thickness of the emitted line.")]
public readonly WDist TrailWidth = new WDist(64);
public readonly WDist TrailWidth = new(64);
[Desc("RGB color at the contrail start.")]
public readonly Color StartColor = Color.White;

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits
public class DrawLineToTarget : IRenderAboveShroud, IRenderAnnotationsWhenSelected, INotifySelected
{
readonly DrawLineToTargetInfo info;
readonly List<IRenderable> renderableCache = new List<IRenderable>();
readonly List<IRenderable> renderableCache = new();
long lifetime;
public DrawLineToTarget(DrawLineToTargetInfo info)

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits.Render
public class HoversInfo : ConditionalTraitInfo, Requires<IMoveInfo>
{
[Desc("Maximum visual Z axis distance relative to actual position + InitialHeight.")]
public readonly WDist BobDistance = new WDist(-43);
public readonly WDist BobDistance = new(-43);
[Desc("Actual altitude of actor needs to be this or higher to enable hover effect.")]
public readonly WDist MinHoveringAltitude = WDist.Zero;
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits.Render
public readonly int RiseTicks = 20;
[Desc("Initial Z axis modifier relative to actual position.")]
public readonly WDist InitialHeight = new WDist(43);
public readonly WDist InitialHeight = new(43);
public override object Create(ActorInitializer init) { return new Hovers(this); }

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits.Render
public readonly string Palette = "effect";
[Desc("Only leave trail on listed terrain types. Leave empty to leave trail on all terrain types.")]
public readonly HashSet<string> TerrainTypes = new HashSet<string>();
public readonly HashSet<string> TerrainTypes = new();
[Desc("Accepts values: Cell to draw the trail sprite in the center of the current cell,",
"CenterPosition to draw the trail sprite at the current position.")]

View File

@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits.Render
// This makes sure that the keys are unique with respect to the registering ITechTreeElement.
readonly string prefix;
readonly Dictionary<ActorInfo, bool> overlayActive = new Dictionary<ActorInfo, bool>();
readonly Dictionary<ActorInfo, bool> overlayActive = new();
public ProductionIconOverlayManager(ActorInitializer init, ProductionIconOverlayManagerInfo info)
{

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits.Render
public class RenderDetectionCircleInfo : TraitInfo, Requires<DetectCloakedInfo>
{
[Desc("WAngle the Radar update line advances per tick.")]
public readonly WAngle UpdateLineTick = new WAngle(-1);
public readonly WAngle UpdateLineTick = new(-1);
[Desc("Number of trailing Radar update lines.")]
public readonly int TrailCount = 0;

View File

@@ -141,7 +141,7 @@ namespace OpenRA.Mods.Common.Traits.Render
public readonly RenderSpritesInfo Info;
readonly string faction;
readonly List<AnimationWrapper> anims = new List<AnimationWrapper>();
readonly List<AnimationWrapper> anims = new();
string cachedImage;
public static Func<WAngle> MakeFacingFunc(Actor self)

View File

@@ -105,8 +105,8 @@ namespace OpenRA.Mods.Common.Traits.Render
public readonly RenderVoxelsInfo Info;
readonly List<ModelAnimation> components = new List<ModelAnimation>();
readonly Dictionary<ModelAnimation, AnimationWrapper> wrappers = new Dictionary<ModelAnimation, AnimationWrapper>();
readonly List<ModelAnimation> components = new();
readonly Dictionary<ModelAnimation, AnimationWrapper> wrappers = new();
readonly Actor self;
readonly BodyOrientation body;

View File

@@ -32,10 +32,10 @@ namespace OpenRA.Mods.Common.Traits.Render
public readonly bool VisibleThroughFog = false;
[Desc("Height at which to play the animation when descending.")]
public readonly WDist DistanceAboveTerrain = new WDist(756);
public readonly WDist DistanceAboveTerrain = new(756);
[Desc("Only play on these terrain types.")]
public readonly HashSet<string> TerrainTypes = new HashSet<string>();
public readonly HashSet<string> TerrainTypes = new();
public override object Create(ActorInitializer init) { return new WithAircraftLandingEffect(this); }
}

View File

@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits.Render
[SequenceReference(nameof(Image), dictionaryReference: LintDictionaryReference.Values)]
[Desc("Pip sequence to use for specific passenger actors.")]
public readonly Dictionary<string, string> CustomPipSequences = new Dictionary<string, string>();
public readonly Dictionary<string, string> CustomPipSequences = new();
[PaletteReference]
public readonly string Palette = "chrome";

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits.Render
public readonly string[] XmasImages = Array.Empty<string>();
[Desc("Terrain types on which to display WaterSequence.")]
public readonly HashSet<string> WaterTerrainTypes = new HashSet<string> { "Water" };
public readonly HashSet<string> WaterTerrainTypes = new() { "Water" };
[SequenceReference]
public readonly string IdleSequence = "idle";

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