Skip to content

Commit

Permalink
Restore logic for using bodies with matching names in WDIB.
Browse files Browse the repository at this point in the history
It is still a bit buggy tho. There's a crash that i couldn't figure out how to solve.
  • Loading branch information
MustaphaTR committed Jan 13, 2024
1 parent 642ce93 commit 556e432
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions OpenRA.Mods.Cnc/Traits/Render/WithDisguisingInfantryBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ protected override void Tick(Actor self)
{
if (disguise.AsSprite != intendedSprite)
{
var infantryBody = disguise.AsActor.TraitInfos<WithInfantryBodyInfo>()
.FirstOrDefault(t => t.EnabledByDefault);
// Force actor back to the stand state to avoid mismatched sequences
PlayStandAnimation(self);

var infantryBodies = disguise.AsActor.TraitInfos<WithInfantryBodyInfo>();
var infantryBody = infantryBodies.FirstOrDefault(t => t.Name == Info.Name) ?? infantryBodies.FirstOrDefault(t => t.EnabledByDefault);
if (infantryBody != null)
disguiseInfantryBody = infantryBody;

Expand Down

0 comments on commit 556e432

Please sign in to comment.