Fix CA1851
This commit is contained in:
@@ -54,13 +54,15 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
||||
{
|
||||
var locomotorInfos = rules.Actors[SystemActors.World].TraitInfos<LocomotorInfo>();
|
||||
LocomotorInfo = locomotorInfos.FirstOrDefault(li => li.Name == Locomotor);
|
||||
if (LocomotorInfo == null)
|
||||
var locomotorInfos = rules.Actors[SystemActors.World].TraitInfos<LocomotorInfo>()
|
||||
.Where(li => li.Name == Locomotor).ToList();
|
||||
if (locomotorInfos.Count == 0)
|
||||
throw new YamlException($"A locomotor named '{Locomotor}' doesn't exist.");
|
||||
else if (locomotorInfos.Count(li => li.Name == Locomotor) > 1)
|
||||
else if (locomotorInfos.Count > 1)
|
||||
throw new YamlException($"There is more than one locomotor named '{Locomotor}'.");
|
||||
|
||||
LocomotorInfo = locomotorInfos[0];
|
||||
|
||||
base.RulesetLoaded(rules, ai);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user