Remove WithSpriteTurret.AimSequence
We can now use WithTurretAimAnimation instead.
This commit is contained in:
@@ -25,9 +25,6 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
[Desc("Sequence name to use")]
|
[Desc("Sequence name to use")]
|
||||||
[SequenceReference] public readonly string Sequence = "turret";
|
[SequenceReference] public readonly string Sequence = "turret";
|
||||||
|
|
||||||
[Desc("Sequence name to use when prepared to fire")]
|
|
||||||
[SequenceReference] public readonly string AimSequence = null;
|
|
||||||
|
|
||||||
[Desc("Turreted 'Turret' key to display")]
|
[Desc("Turreted 'Turret' key to display")]
|
||||||
public readonly string Turret = "primary";
|
public readonly string Turret = "primary";
|
||||||
|
|
||||||
@@ -62,10 +59,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithSpriteTurret : ConditionalTrait<WithSpriteTurretInfo>, INotifyBuildComplete, INotifySold, INotifyTransform, ITick, INotifyDamageStateChanged
|
public class WithSpriteTurret : ConditionalTrait<WithSpriteTurretInfo>, INotifyBuildComplete, INotifySold, INotifyTransform, INotifyDamageStateChanged
|
||||||
{
|
{
|
||||||
public readonly Animation DefaultAnimation;
|
public readonly Animation DefaultAnimation;
|
||||||
protected readonly AttackBase Attack;
|
|
||||||
readonly RenderSprites rs;
|
readonly RenderSprites rs;
|
||||||
readonly BodyOrientation body;
|
readonly BodyOrientation body;
|
||||||
readonly Turreted t;
|
readonly Turreted t;
|
||||||
@@ -79,7 +75,6 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
{
|
{
|
||||||
rs = self.Trait<RenderSprites>();
|
rs = self.Trait<RenderSprites>();
|
||||||
body = self.Trait<BodyOrientation>();
|
body = self.Trait<BodyOrientation>();
|
||||||
Attack = self.TraitOrDefault<AttackBase>();
|
|
||||||
t = self.TraitsImplementing<Turreted>()
|
t = self.TraitsImplementing<Turreted>()
|
||||||
.First(tt => tt.Name == info.Turret);
|
.First(tt => tt.Name == info.Turret);
|
||||||
arms = self.TraitsImplementing<Armament>()
|
arms = self.TraitsImplementing<Armament>()
|
||||||
@@ -119,26 +114,11 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
DefaultAnimation.ReplaceAnim(NormalizeSequence(self, DefaultAnimation.CurrentSequence.Name));
|
DefaultAnimation.ReplaceAnim(NormalizeSequence(self, DefaultAnimation.CurrentSequence.Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Tick(Actor self)
|
|
||||||
{
|
|
||||||
if (Info.AimSequence == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var sequence = Attack.IsAiming ? Info.AimSequence : Info.Sequence;
|
|
||||||
DefaultAnimation.ReplaceAnim(sequence);
|
|
||||||
}
|
|
||||||
|
|
||||||
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e)
|
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
DamageStateChanged(self);
|
DamageStateChanged(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ITick.Tick(Actor self)
|
|
||||||
{
|
|
||||||
// Split into a protected method to allow subclassing
|
|
||||||
Tick(self);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PlayCustomAnimation(Actor self, string name, Action after = null)
|
public void PlayCustomAnimation(Actor self, string name, Action after = null)
|
||||||
{
|
{
|
||||||
DefaultAnimation.PlayThen(NormalizeSequence(self, name), () =>
|
DefaultAnimation.PlayThen(NormalizeSequence(self, name), () =>
|
||||||
|
|||||||
@@ -1756,6 +1756,24 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Removed AimSequence from WithSpriteTurret, use WithTurretAimAnimation instead
|
||||||
|
if (engineVersion < 20180224)
|
||||||
|
{
|
||||||
|
var spriteTurret = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("WithSpriteTurret", StringComparison.Ordinal));
|
||||||
|
if (spriteTurret != null)
|
||||||
|
{
|
||||||
|
var aimSequence = spriteTurret.Value.Nodes.FirstOrDefault(n => n.Key == "AimSequence");
|
||||||
|
if (aimSequence != null)
|
||||||
|
{
|
||||||
|
var aimAnim = new MiniYamlNode("WithTurretAimAnimation", "");
|
||||||
|
RenameNodeKey(aimSequence, "Sequence");
|
||||||
|
aimAnim.Value.Nodes.Add(aimSequence);
|
||||||
|
spriteTurret.Value.Nodes.Remove(aimSequence);
|
||||||
|
node.Value.Nodes.Add(aimAnim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -496,15 +496,17 @@ MSAM:
|
|||||||
Weapon: 227mm
|
Weapon: 227mm
|
||||||
LocalOffset: 213,128,0, 213,-128,0
|
LocalOffset: 213,128,0, 213,-128,0
|
||||||
Armament@SECONDARY:
|
Armament@SECONDARY:
|
||||||
|
Name: secondary
|
||||||
Weapon: 227mm
|
Weapon: 227mm
|
||||||
LocalOffset: 213,-128,0, 213,128,0
|
LocalOffset: 213,-128,0, 213,128,0
|
||||||
AttackFrontal:
|
AttackFrontal:
|
||||||
WithSpriteTurret:
|
WithSpriteTurret:
|
||||||
AimSequence: aim
|
|
||||||
SpawnActorOnDeath:
|
SpawnActorOnDeath:
|
||||||
Actor: MSAM.Husk
|
Actor: MSAM.Husk
|
||||||
OwnerType: InternalName
|
OwnerType: InternalName
|
||||||
EffectiveOwnerFromOwner: true
|
EffectiveOwnerFromOwner: true
|
||||||
|
WithTurretAimAnimation:
|
||||||
|
Sequence: aim
|
||||||
|
|
||||||
MLRS:
|
MLRS:
|
||||||
Inherits: ^Tank
|
Inherits: ^Tank
|
||||||
|
|||||||
Reference in New Issue
Block a user