Rename WithAttackAnimation.BodyName to just .Body
Shorter and more consistent with Armament.Turret, WithTurretedAttackAnimation.Turret, WithSpriteBarrel.Armament etc.
This commit is contained in:
@@ -35,13 +35,13 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
public readonly AttackDelayType DelayRelativeTo = AttackDelayType.Preparation;
|
public readonly AttackDelayType DelayRelativeTo = AttackDelayType.Preparation;
|
||||||
|
|
||||||
[Desc("Which sprite body to modify.")]
|
[Desc("Which sprite body to modify.")]
|
||||||
public readonly string BodyName = "body";
|
public readonly string Body = "body";
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new WithAttackAnimation(init, this); }
|
public override object Create(ActorInitializer init) { return new WithAttackAnimation(init, this); }
|
||||||
|
|
||||||
public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
||||||
{
|
{
|
||||||
var matches = ai.TraitInfos<WithSpriteBodyInfo>().Count(w => BodyName == w.Name);
|
var matches = ai.TraitInfos<WithSpriteBodyInfo>().Count(w => Body == w.Name);
|
||||||
if (matches != 1)
|
if (matches != 1)
|
||||||
throw new YamlException("WithAttackAnimation needs exactly one sprite body with matching name.");
|
throw new YamlException("WithAttackAnimation needs exactly one sprite body with matching name.");
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
attack = init.Self.Trait<AttackBase>();
|
attack = init.Self.Trait<AttackBase>();
|
||||||
armament = init.Self.TraitsImplementing<Armament>()
|
armament = init.Self.TraitsImplementing<Armament>()
|
||||||
.Single(a => a.Info.Name == Info.Armament);
|
.Single(a => a.Info.Name == Info.Armament);
|
||||||
wsb = init.Self.TraitsImplementing<WithSpriteBody>().First(w => w.Info.Name == Info.BodyName);
|
wsb = init.Self.TraitsImplementing<WithSpriteBody>().First(w => w.Info.Name == Info.Body);
|
||||||
|
|
||||||
noAimOrReloadAnim = string.IsNullOrEmpty(Info.AimSequence) && string.IsNullOrEmpty(Info.ReloadPrefix);
|
noAimOrReloadAnim = string.IsNullOrEmpty(Info.AimSequence) && string.IsNullOrEmpty(Info.ReloadPrefix);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user