Change FieldLoader.LoadUsing to use nameof

This commit is contained in:
teinarss
2021-02-28 17:31:18 +01:00
committed by abcdefg30
parent 6b794ba3e5
commit 53b781960c
12 changed files with 15 additions and 15 deletions

View File

@@ -22,7 +22,7 @@ namespace OpenRA
public class Fonts : IGlobalModData public class Fonts : IGlobalModData
{ {
[FieldLoader.LoadUsing("LoadFonts")] [FieldLoader.LoadUsing(nameof(LoadFonts))]
public readonly Dictionary<string, FontData> FontList; public readonly Dictionary<string, FontData> FontList;
static object LoadFonts(MiniYaml y) static object LoadFonts(MiniYaml y)

View File

@@ -121,10 +121,10 @@ namespace OpenRA.GameRules
[Desc("Does this weapon aim at the target's center regardless of other targetable offsets?")] [Desc("Does this weapon aim at the target's center regardless of other targetable offsets?")]
public readonly bool TargetActorCenter = false; public readonly bool TargetActorCenter = false;
[FieldLoader.LoadUsing("LoadProjectile")] [FieldLoader.LoadUsing(nameof(LoadProjectile))]
public readonly IProjectileInfo Projectile; public readonly IProjectileInfo Projectile;
[FieldLoader.LoadUsing("LoadWarheads")] [FieldLoader.LoadUsing(nameof(LoadWarheads))]
public readonly List<IWarhead> Warheads = new List<IWarhead>(); public readonly List<IWarhead> Warheads = new List<IWarhead>();
public WeaponInfo(string name, MiniYaml content) public WeaponInfo(string name, MiniYaml content)

View File

@@ -22,7 +22,7 @@ namespace OpenRA
public class GameSpeeds : IGlobalModData public class GameSpeeds : IGlobalModData
{ {
[FieldLoader.LoadUsing("LoadSpeeds")] [FieldLoader.LoadUsing(nameof(LoadSpeeds))]
public readonly Dictionary<string, GameSpeed> Speeds; public readonly Dictionary<string, GameSpeed> Speeds;
static object LoadSpeeds(MiniYaml y) static object LoadSpeeds(MiniYaml y)

View File

@@ -129,7 +129,7 @@ namespace OpenRA.Network
[FieldLoader.Ignore] [FieldLoader.Ignore]
public readonly bool IsJoinable = false; public readonly bool IsJoinable = false;
[FieldLoader.LoadUsing("LoadClients")] [FieldLoader.LoadUsing(nameof(LoadClients))]
public readonly GameClient[] Clients; public readonly GameClient[] Clients;
/// <summary>The list of spawnpoints that are disabled for this game</summary> /// <summary>The list of spawnpoints that are disabled for this game</summary>

View File

@@ -24,7 +24,7 @@ namespace OpenRA
public readonly string ProfileName; public readonly string ProfileName;
public readonly string ProfileRank = "Registered Player"; public readonly string ProfileRank = "Registered Player";
[FieldLoader.LoadUsing("LoadBadges")] [FieldLoader.LoadUsing(nameof(LoadBadges))]
public readonly List<PlayerBadge> Badges; public readonly List<PlayerBadge> Badges;
static object LoadBadges(MiniYaml yaml) static object LoadBadges(MiniYaml yaml)

View File

@@ -91,7 +91,7 @@ namespace OpenRA
public readonly string HeaderMessage; public readonly string HeaderMessage;
public readonly string ContentInstallerMod = "modcontent"; public readonly string ContentInstallerMod = "modcontent";
[FieldLoader.LoadUsing("LoadPackages")] [FieldLoader.LoadUsing(nameof(LoadPackages))]
public readonly Dictionary<string, ModPackage> Packages = new Dictionary<string, ModPackage>(); public readonly Dictionary<string, ModPackage> Packages = new Dictionary<string, ModPackage>();
static object LoadPackages(MiniYaml yaml) static object LoadPackages(MiniYaml yaml)
@@ -105,7 +105,7 @@ namespace OpenRA
return packages; return packages;
} }
[FieldLoader.LoadUsing("LoadDownloads")] [FieldLoader.LoadUsing(nameof(LoadDownloads))]
public readonly string[] Downloads = { }; public readonly string[] Downloads = { };
static object LoadDownloads(MiniYaml yaml) static object LoadDownloads(MiniYaml yaml)
@@ -114,7 +114,7 @@ namespace OpenRA
return downloadNode != null ? downloadNode.Value.Nodes.Select(n => n.Key).ToArray() : new string[0]; return downloadNode != null ? downloadNode.Value.Nodes.Select(n => n.Key).ToArray() : new string[0];
} }
[FieldLoader.LoadUsing("LoadSources")] [FieldLoader.LoadUsing(nameof(LoadSources))]
public readonly string[] Sources = { }; public readonly string[] Sources = { };
static object LoadSources(MiniYaml yaml) static object LoadSources(MiniYaml yaml)

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("What is the fine scan radius of this power?", "For doing a detailed scan in the general target area.", "Minimum is 1")] [Desc("What is the fine scan radius of this power?", "For doing a detailed scan in the general target area.", "Minimum is 1")]
public readonly int FineScanRadius = 2; public readonly int FineScanRadius = 2;
[FieldLoader.LoadUsing("LoadConsiderations")] [FieldLoader.LoadUsing(nameof(LoadConsiderations))]
[Desc("The decisions associated with this power")] [Desc("The decisions associated with this power")]
public readonly List<Consideration> Considerations = new List<Consideration>(); public readonly List<Consideration> Considerations = new List<Consideration>();

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
public class SupportPowerBotModuleInfo : ConditionalTraitInfo, Requires<SupportPowerManagerInfo> public class SupportPowerBotModuleInfo : ConditionalTraitInfo, Requires<SupportPowerManagerInfo>
{ {
[Desc("Tells the AI how to use its support powers.")] [Desc("Tells the AI how to use its support powers.")]
[FieldLoader.LoadUsing("LoadDecisions")] [FieldLoader.LoadUsing(nameof(LoadDecisions))]
public readonly List<SupportPowerDecision> Decisions = new List<SupportPowerDecision>(); public readonly List<SupportPowerDecision> Decisions = new List<SupportPowerDecision>();
static object LoadDecisions(MiniYaml yaml) static object LoadDecisions(MiniYaml yaml)

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("x means cell is blocked, capital X means blocked but not counting as targetable, ", [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.")] "= means part of the footprint but passable, _ means completely empty.")]
[FieldLoader.LoadUsing("LoadFootprint")] [FieldLoader.LoadUsing(nameof(LoadFootprint))]
public readonly Dictionary<CVec, FootprintCellType> Footprint; public readonly Dictionary<CVec, FootprintCellType> Footprint;
public readonly CVec Dimensions = new CVec(1, 1); public readonly CVec Dimensions = new CVec(1, 1);

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
"If none specified, all armor types the actor has are valid.")] "If none specified, all armor types the actor has are valid.")]
public readonly BitSet<ArmorType> ArmorTypes = default(BitSet<ArmorType>); public readonly BitSet<ArmorType> ArmorTypes = default(BitSet<ArmorType>);
[FieldLoader.LoadUsing("LoadShape")] [FieldLoader.LoadUsing(nameof(LoadShape))]
[Desc("Engine comes with support for `Circle`, `Capsule`, `Polygon` and `Rectangle`. Defaults to `Circle` when left empty.")] [Desc("Engine comes with support for `Circle`, `Capsule`, `Polygon` and `Rectangle`. Defaults to `Circle` when left empty.")]
public readonly IHitShape Type; public readonly IHitShape Type;

View File

@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Types of damage that are caused while crushing. Leave empty for no damage types.")] [Desc("Types of damage that are caused while crushing. Leave empty for no damage types.")]
public readonly BitSet<DamageType> CrushDamageTypes = default(BitSet<DamageType>); public readonly BitSet<DamageType> CrushDamageTypes = default(BitSet<DamageType>);
[FieldLoader.LoadUsing("LoadSpeeds", true)] [FieldLoader.LoadUsing(nameof(LoadSpeeds), true)]
[Desc("Lower the value on rough terrain. Leave out entries for impassable terrain.")] [Desc("Lower the value on rough terrain. Leave out entries for impassable terrain.")]
public readonly Dictionary<string, TerrainInfo> TerrainSpeeds; public readonly Dictionary<string, TerrainInfo> TerrainSpeeds;

View File

@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
[PaletteReference] [PaletteReference]
public readonly string Palette = TileSet.TerrainPaletteInternalName; public readonly string Palette = TileSet.TerrainPaletteInternalName;
[FieldLoader.LoadUsing("LoadInitialSmudges")] [FieldLoader.LoadUsing(nameof(LoadInitialSmudges))]
public readonly Dictionary<CPos, MapSmudge> InitialSmudges; public readonly Dictionary<CPos, MapSmudge> InitialSmudges;
public static object LoadInitialSmudges(MiniYaml yaml) public static object LoadInitialSmudges(MiniYaml yaml)