Refactor unreserve actions.

This commit is contained in:
tovl
2019-08-30 22:13:09 +02:00
committed by reaperrr
parent 5787f74af9
commit 145b6a05a3
4 changed files with 29 additions and 21 deletions

View File

@@ -506,25 +506,15 @@ namespace OpenRA.Mods.Common.Traits
MayYieldReservation = true;
}
public void UnReserve(bool takeOff = false)
public void UnReserve()
{
if (reservation == null)
return;
// Move to the host's rally point if it has one
var rp = ReservedActor != null ? ReservedActor.TraitOrDefault<RallyPoint>() : null;
reservation.Dispose();
reservation = null;
ReservedActor = null;
MayYieldReservation = false;
if (takeOff && self.World.Map.DistanceAboveTerrain(CenterPosition).Length <= LandAltitude.Length)
{
self.QueueActivity(new TakeOff(self));
if (rp != null)
self.QueueActivity(new AttackMoveActivity(self, () => MoveTo(rp.Location, null, targetLineColor: Color.OrangeRed)));
}
}
bool AircraftCanEnter(Actor a, TargetModifiers modifiers)