Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WithDisguisingInfantryBody crashing when losing the disguise #14383

Merged
merged 3 commits into from Nov 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions OpenRA.Mods.Cnc/Traits/Disguise.cs
Expand Up @@ -122,6 +122,8 @@ public Disguise(Actor self, DisguiseInfo info)
{
this.self = self;
this.info = info;

AsActor = self.Info;
}

void INotifyCreated.Created(Actor self)
Expand Down Expand Up @@ -149,8 +151,12 @@ void IResolveOrder.ResolveOrder(Actor self, Order order)
{
if (order.OrderString == "Disguise")
{
var target = order.TargetActor != self && order.TargetActor.IsInWorld ? order.TargetActor : null;
DisguiseAs(target);
var target = order.Target;
if (target.Type == TargetType.Actor)
DisguiseAs((target.Actor != self && target.Actor.IsInWorld) ? target.Actor : null);

if (target.Type == TargetType.FrozenActor)
DisguiseAs(target.FrozenActor.Info, target.FrozenActor.Owner);
}
}

Expand Down
Expand Up @@ -45,7 +45,7 @@ protected override void Tick(Actor self)
disguisePlayer = disguise.AsPlayer;
disguiseImage = null;

if (disguiseActor != null)
if (disguisePlayer != null)
{
var renderSprites = disguiseActor.TraitInfoOrDefault<RenderSpritesInfo>();
if (renderSprites != null)
Expand Down