Make ActorTags display ChildActivities

This commit is contained in:
reaperrr
2019-04-28 11:58:54 +00:00
committed by reaperrr
parent b774556a5f
commit da6bf1a57d
2 changed files with 11 additions and 4 deletions

View File

@@ -161,6 +161,16 @@ namespace OpenRA.Activities
{ {
yield break; yield break;
} }
public IEnumerable<string> DebugLabelComponents()
{
var act = this;
while (act != null)
{
yield return act.GetType().Name;
act = act.childActivity;
}
}
} }
public static class ActivityExts public static class ActivityExts

View File

@@ -80,10 +80,7 @@ namespace OpenRA.Mods.Common.Traits.Render
// Get the actor's activity. // Get the actor's activity.
var activity = self.CurrentActivity; var activity = self.CurrentActivity;
if (activity != null) if (activity != null)
{ yield return new TextRenderable(font, self.CenterPosition, 0, color, activity.DebugLabelComponents().JoinWith("."));
var activityName = activity.GetType().ToString().Split('.').Last();
yield return new TextRenderable(font, self.CenterPosition, 0, color, activityName);
}
// Get the AI squad that this actor belongs to. // Get the AI squad that this actor belongs to.
if (!self.Owner.IsBot) if (!self.Owner.IsBot)