Hack around the Lua API.
This commit is contained in:
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
// TODO: This should check whether there is ammo left that is actually suitable for the target
|
||||
if (ammoPools.All(x => !x.Info.SelfReloads && !x.HasAmmo()))
|
||||
return ActivityUtils.SequenceActivities(new ReturnToBase(self), this);
|
||||
return ActivityUtils.SequenceActivities(new ReturnToBase(self, aircraft.Info.AbortOnResupply), this);
|
||||
|
||||
if (attackPlane != null)
|
||||
attackPlane.DoAttack(self, target);
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
// If any AmmoPool is depleted and no weapon is valid against target, return to helipad to reload and then resume the activity
|
||||
if (ammoPools.Any(x => !x.Info.SelfReloads && !x.HasAmmo()) && !attackHeli.HasAnyValidWeapons(target))
|
||||
return ActivityUtils.SequenceActivities(new HeliReturnToBase(self), this);
|
||||
return ActivityUtils.SequenceActivities(new HeliReturnToBase(self, helicopter.Info.AbortOnResupply), this);
|
||||
|
||||
var dist = target.CenterPosition - self.CenterPosition;
|
||||
|
||||
|
||||
@@ -20,11 +20,13 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
readonly Aircraft heli;
|
||||
readonly bool alwaysLand;
|
||||
readonly bool abortOnResupply;
|
||||
|
||||
public HeliReturnToBase(Actor self, bool alwaysLand = true)
|
||||
public HeliReturnToBase(Actor self, bool abortOnResupply, bool alwaysLand = true)
|
||||
{
|
||||
heli = self.Trait<Aircraft>();
|
||||
this.alwaysLand = alwaysLand;
|
||||
this.abortOnResupply = abortOnResupply;
|
||||
}
|
||||
|
||||
public Actor ChooseHelipad(Actor self)
|
||||
@@ -82,7 +84,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
new Turn(self, initialFacing),
|
||||
new HeliLand(self, false),
|
||||
new ResupplyAircraft(self),
|
||||
!heli.Info.AbortOnResupply ? NextActivity : null);
|
||||
!abortOnResupply ? NextActivity : null);
|
||||
}
|
||||
|
||||
return ActivityUtils.SequenceActivities(
|
||||
|
||||
@@ -23,14 +23,16 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly Aircraft plane;
|
||||
readonly AircraftInfo planeInfo;
|
||||
readonly bool alwaysLand;
|
||||
readonly bool abortOnResupply;
|
||||
bool isCalculated;
|
||||
Actor dest;
|
||||
WPos w1, w2, w3;
|
||||
|
||||
public ReturnToBase(Actor self, Actor dest = null, bool alwaysLand = true)
|
||||
public ReturnToBase(Actor self, bool abortOnResupply, Actor dest = null, bool alwaysLand = true)
|
||||
{
|
||||
this.dest = dest;
|
||||
this.alwaysLand = alwaysLand;
|
||||
this.abortOnResupply = abortOnResupply;
|
||||
plane = self.Trait<Aircraft>();
|
||||
planeInfo = self.Info.TraitInfo<AircraftInfo>();
|
||||
}
|
||||
@@ -149,7 +151,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
landingProcedures.Add(new ResupplyAircraft(self));
|
||||
}
|
||||
|
||||
if (!planeInfo.AbortOnResupply)
|
||||
if (!abortOnResupply)
|
||||
landingProcedures.Add(NextActivity);
|
||||
|
||||
return ActivityUtils.SequenceActivities(landingProcedures.ToArray());
|
||||
|
||||
Reference in New Issue
Block a user