Fix IDE0090
This commit is contained in:
committed by
Pavel Penev
parent
164abfdae1
commit
8a285f9b19
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user