Make Tick return bool

This commit is contained in:
tovl
2019-05-14 21:13:25 +02:00
committed by teinarss
parent 09c1611239
commit 3790169db9
49 changed files with 328 additions and 318 deletions

View File

@@ -45,14 +45,14 @@ namespace OpenRA.Mods.Common.Activities
lastVisibleTarget = Target.FromPos(initialTargetPosition.Value);
}
public override Activity Tick(Actor self)
public override bool Tick(Actor self)
{
// Refuse to take off if it would land immediately again.
if (aircraft.ForceLanding)
Cancel(self);
if (IsCanceling)
return NextActivity;
return true;
bool targetIsHiddenActor;
target = target.Recalculate(self.Owner, out targetIsHiddenActor);
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Activities
// If we are ticking again after previously sequencing a MoveWithRange then that move must have completed
// Either we are in range and can see the target, or we've lost track of it and should give up
if (wasMovingWithinRange && targetIsHiddenActor)
return NextActivity;
return true;
wasMovingWithinRange = false;
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Activities
// Target is hidden or dead, and we don't have a fallback position to move towards
if (useLastVisibleTarget && !lastVisibleTarget.IsValidFor(self))
return NextActivity;
return true;
var pos = self.CenterPosition;
var checkTarget = useLastVisibleTarget ? lastVisibleTarget : target;
@@ -85,12 +85,12 @@ namespace OpenRA.Mods.Common.Activities
if (checkTarget.IsInRange(pos, maxRange) && !checkTarget.IsInRange(pos, minRange))
{
Fly.FlyTick(self, aircraft, aircraft.Facing, aircraft.Info.CruiseAltitude);
return useLastVisibleTarget ? NextActivity : this;
return useLastVisibleTarget;
}
wasMovingWithinRange = true;
QueueChild(aircraft.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, targetLineColor));
return this;
return false;
}
}
}