Turn Actor.GetCurrentActivity into a property
This commit is contained in:
@@ -794,8 +794,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
|
||||
if (!harvester.IsIdle)
|
||||
{
|
||||
var act = harvester.GetCurrentActivity();
|
||||
|
||||
var act = harvester.CurrentActivity;
|
||||
if (act.NextActivity == null || act.NextActivity.GetType() != typeof(FindResources))
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -125,10 +125,10 @@ namespace OpenRA.Mods.Common.AI
|
||||
|
||||
protected static bool IsRearm(Actor a)
|
||||
{
|
||||
var activity = a.GetCurrentActivity();
|
||||
if (activity == null)
|
||||
if (a.IsIdle)
|
||||
return false;
|
||||
|
||||
var activity = a.CurrentActivity;
|
||||
var type = activity.GetType();
|
||||
if (type == typeof(Rearm) || type == typeof(ResupplyAircraft))
|
||||
return true;
|
||||
|
||||
@@ -44,15 +44,16 @@ namespace OpenRA.Mods.Common.AI
|
||||
if (a.IsIdle)
|
||||
return false;
|
||||
|
||||
var type = a.GetCurrentActivity().GetType();
|
||||
var activity = a.CurrentActivity;
|
||||
var type = activity.GetType();
|
||||
if (type == typeof(Attack) || type == typeof(FlyAttack))
|
||||
return true;
|
||||
|
||||
var next = a.GetCurrentActivity().NextActivity;
|
||||
var next = activity.NextActivity;
|
||||
if (next == null)
|
||||
return false;
|
||||
|
||||
var nextType = a.GetCurrentActivity().NextActivity.GetType();
|
||||
var nextType = next.GetType();
|
||||
if (nextType == typeof(Attack) || nextType == typeof(FlyAttack))
|
||||
return true;
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
void INotifyBlockingMove.OnNotifyBlockingMove(Actor self, Actor blocking)
|
||||
{
|
||||
// I'm blocking someone else from moving to my location:
|
||||
var act = self.GetCurrentActivity();
|
||||
var act = self.CurrentActivity;
|
||||
|
||||
// If I'm just waiting around then get out of the way:
|
||||
if (act is Wait)
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
yield return new TextRenderable(font, self.CenterPosition - offset, 0, color, tagString);
|
||||
|
||||
// Get the actor's activity.
|
||||
var activity = self.GetCurrentActivity();
|
||||
var activity = self.CurrentActivity;
|
||||
if (activity != null)
|
||||
{
|
||||
var activityName = activity.GetType().ToString().Split('.').Last();
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
if (!self.IsInWorld || self.IsDead)
|
||||
yield break;
|
||||
|
||||
var activity = self.GetCurrentActivity();
|
||||
var activity = self.CurrentActivity;
|
||||
if (activity != null)
|
||||
{
|
||||
var targets = activity.GetTargets(self);
|
||||
|
||||
Reference in New Issue
Block a user