Rename WithSmoke into a more generic WithDamageOverlay trait.
Rename Sequence parameter to Image to avoid confusion.
This commit is contained in:
@@ -431,6 +431,7 @@
|
||||
<Compile Include="Traits\Render\WithChargeAnimation.cs" />
|
||||
<Compile Include="Traits\Render\WithChargeOverlay.cs" />
|
||||
<Compile Include="Traits\Render\WithCrateBody.cs" />
|
||||
<Compile Include="Traits\Render\WithDamageOverlay.cs" />
|
||||
<Compile Include="Traits\Render\WithDeathAnimation.cs" />
|
||||
<Compile Include="Traits\Render\WithDecoration.cs" />
|
||||
<Compile Include="Traits\Render\WithDockingAnimation.cs" />
|
||||
@@ -447,7 +448,6 @@
|
||||
<Compile Include="Traits\Render\WithResources.cs" />
|
||||
<Compile Include="Traits\Render\WithSpriteRotorOverlay.cs" />
|
||||
<Compile Include="Traits\Render\WithShadow.cs" />
|
||||
<Compile Include="Traits\Render\WithSmoke.cs" />
|
||||
<Compile Include="Traits\Render\WithSpriteBody.cs" />
|
||||
<Compile Include="Traits\Render\WithSpriteTurret.cs" />
|
||||
<Compile Include="Traits\Render\WithFacingSpriteBody.cs" />
|
||||
|
||||
@@ -17,13 +17,13 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Common.Traits.Render
|
||||
{
|
||||
[Desc("Renders an overlay when the actor is taking heavy damage.")]
|
||||
public class WithSmokeInfo : ITraitInfo, Requires<RenderSpritesInfo> // TODO: rename to WithDamageOverlay
|
||||
public class WithDamageOverlayInfo : ITraitInfo, Requires<RenderSpritesInfo>
|
||||
{
|
||||
public readonly string Sequence = "smoke_m"; // TODO: rename to image
|
||||
public readonly string Image = "smoke_m";
|
||||
|
||||
[SequenceReference("Sequence")] public readonly string IdleSequence = "idle";
|
||||
[SequenceReference("Sequence")] public readonly string LoopSequence = "loop";
|
||||
[SequenceReference("Sequence")] public readonly string EndSequence = "end";
|
||||
[SequenceReference("Image")] public readonly string IdleSequence = "idle";
|
||||
[SequenceReference("Image")] public readonly string LoopSequence = "loop";
|
||||
[SequenceReference("Image")] public readonly string EndSequence = "end";
|
||||
|
||||
[Desc("Damage types that this should be used for (defined on the warheads).",
|
||||
"Leave empty to disable all filtering.")]
|
||||
@@ -33,23 +33,23 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
public readonly DamageState MinimumDamageState = DamageState.Heavy;
|
||||
public readonly DamageState MaximumDamageState = DamageState.Dead;
|
||||
|
||||
public object Create(ActorInitializer init) { return new WithSmoke(init.Self, this); }
|
||||
public object Create(ActorInitializer init) { return new WithDamageOverlay(init.Self, this); }
|
||||
}
|
||||
|
||||
public class WithSmoke : INotifyDamage
|
||||
public class WithDamageOverlay : INotifyDamage
|
||||
{
|
||||
readonly WithSmokeInfo info;
|
||||
readonly WithDamageOverlayInfo info;
|
||||
readonly Animation anim;
|
||||
|
||||
bool isSmoking;
|
||||
|
||||
public WithSmoke(Actor self, WithSmokeInfo info)
|
||||
public WithDamageOverlay(Actor self, WithDamageOverlayInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
|
||||
var rs = self.Trait<RenderSprites>();
|
||||
|
||||
anim = new Animation(self.World, info.Sequence);
|
||||
anim = new Animation(self.World, info.Image);
|
||||
rs.Add(new AnimationWithOffset(anim, null, () => !isSmoking));
|
||||
}
|
||||
|
||||
@@ -788,6 +788,22 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
n.Key = "DetonationDelay";
|
||||
}
|
||||
|
||||
// WithSmoke was refactored to become more generic and Sequence/Image notation has been unified.
|
||||
if (engineVersion < 20160528)
|
||||
{
|
||||
if (depth == 1 && node.Key.StartsWith("WithSmoke"))
|
||||
{
|
||||
var s = node.Value.Nodes.FirstOrDefault(n => n.Key == "Sequence");
|
||||
if (s != null)
|
||||
s.Key = "Image";
|
||||
|
||||
var parts = node.Key.Split('@');
|
||||
node.Key = "WithDamageOverlay";
|
||||
if (parts.Length > 1)
|
||||
node.Key += "@" + parts[1];
|
||||
}
|
||||
}
|
||||
|
||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
HiddenUnderFog:
|
||||
AttackMove:
|
||||
DrawLineToTarget:
|
||||
WithSmoke:
|
||||
WithDamageOverlay:
|
||||
WithFacingSpriteBody:
|
||||
Explodes:
|
||||
Weapon: UnitExplodeSmall
|
||||
@@ -446,7 +446,7 @@
|
||||
ActorLostNotification:
|
||||
AttackMove:
|
||||
DrawLineToTarget:
|
||||
WithSmoke:
|
||||
WithDamageOverlay:
|
||||
Explodes:
|
||||
Weapon: UnitExplodeShip
|
||||
EmptyWeapon: UnitExplodeShip
|
||||
@@ -636,19 +636,19 @@
|
||||
Type: Wood
|
||||
Targetable:
|
||||
TargetTypes: Trees
|
||||
WithSmoke@SmallBurn:
|
||||
WithDamageOverlay@SmallBurn:
|
||||
DamageType: Incendiary
|
||||
Sequence: burn-s
|
||||
Image: burn-s
|
||||
MinimumDamageState: Light
|
||||
MaximumDamageState: Medium
|
||||
WithSmoke@MediumBurn:
|
||||
WithDamageOverlay@MediumBurn:
|
||||
DamageType: Incendiary
|
||||
Sequence: burn-m
|
||||
Image: burn-m
|
||||
MinimumDamageState: Medium
|
||||
MaximumDamageState: Heavy
|
||||
WithSmoke@LargeBurn:
|
||||
WithDamageOverlay@LargeBurn:
|
||||
DamageType: Incendiary
|
||||
Sequence: burn-l
|
||||
Image: burn-l
|
||||
MinimumDamageState: Heavy
|
||||
MaximumDamageState: Dead
|
||||
AutoTargetIgnore:
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
GivesBounty:
|
||||
GpsDot:
|
||||
String: Vehicle
|
||||
WithSmoke:
|
||||
WithDamageOverlay:
|
||||
Guard:
|
||||
Guardable:
|
||||
Tooltip:
|
||||
@@ -325,7 +325,7 @@
|
||||
RepairableNear:
|
||||
GpsDot:
|
||||
String: Ship
|
||||
WithSmoke:
|
||||
WithDamageOverlay:
|
||||
Explodes:
|
||||
Weapon: UnitExplodeShip
|
||||
EmptyWeapon: UnitExplodeShip
|
||||
|
||||
Reference in New Issue
Block a user