Remove ResupplyAircraft and AllowYieldingReservation
The few extra things those two activities did can be done in Resupply, making them redundant.
This commit is contained in:
@@ -1,32 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2019 The OpenRA Developers (see AUTHORS)
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version. For more
|
|
||||||
* information, see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using OpenRA.Activities;
|
|
||||||
using OpenRA.Mods.Common.Traits;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Activities
|
|
||||||
{
|
|
||||||
public class AllowYieldingReservation : Activity
|
|
||||||
{
|
|
||||||
readonly Aircraft aircraft;
|
|
||||||
|
|
||||||
public AllowYieldingReservation(Actor self)
|
|
||||||
{
|
|
||||||
aircraft = self.Trait<Aircraft>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
|
||||||
{
|
|
||||||
aircraft.AllowYieldingReservation();
|
|
||||||
return NextActivity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2019 The OpenRA Developers (see AUTHORS)
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version. For more
|
|
||||||
* information, see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.Activities;
|
|
||||||
using OpenRA.Mods.Common.Traits;
|
|
||||||
using OpenRA.Traits;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Activities
|
|
||||||
{
|
|
||||||
public class ResupplyAircraft : Activity
|
|
||||||
{
|
|
||||||
public ResupplyAircraft(Actor self) { }
|
|
||||||
|
|
||||||
protected override void OnFirstRun(Actor self)
|
|
||||||
{
|
|
||||||
var aircraft = self.Trait<Aircraft>();
|
|
||||||
var host = aircraft.GetActorBelow();
|
|
||||||
|
|
||||||
if (host == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QueueChild(self, new Resupply(self, host, WDist.Zero));
|
|
||||||
QueueChild(self, new AllowYieldingReservation(self));
|
|
||||||
if (aircraft.Info.TakeOffOnResupply)
|
|
||||||
QueueChild(self, new TakeOff(self, (a, b, c) => NextActivity == null && b.NextActivity == null));
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
|
||||||
{
|
|
||||||
if (ChildActivity != null)
|
|
||||||
{
|
|
||||||
ChildActivity = ActivityUtils.RunActivity(self, ChildActivity);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NextActivity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -235,7 +235,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
else
|
else
|
||||||
QueueChild(self, new Land(self, Target.FromPos(dest.CenterPosition + offset), true, dest), true);
|
QueueChild(self, new Land(self, Target.FromPos(dest.CenterPosition + offset), true, dest), true);
|
||||||
|
|
||||||
QueueChild(self, new ResupplyAircraft(self), true);
|
QueueChild(self, new Resupply(self, dest, WDist.Zero), true);
|
||||||
resupplied = true;
|
resupplied = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,17 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
notifyResupply.ResupplyTick(host.Actor, self, activeResupplyTypes);
|
notifyResupply.ResupplyTick(host.Actor, self, activeResupplyTypes);
|
||||||
|
|
||||||
if (activeResupplyTypes == 0)
|
if (activeResupplyTypes == 0)
|
||||||
|
{
|
||||||
|
var aircraft = self.TraitOrDefault<Aircraft>();
|
||||||
|
if (aircraft != null)
|
||||||
|
{
|
||||||
|
aircraft.AllowYieldingReservation();
|
||||||
|
if (aircraft.Info.TakeOffOnResupply)
|
||||||
|
Queue(self, new TakeOff(self, (a, b, c) => NextActivity == null && b.NextActivity == null));
|
||||||
|
}
|
||||||
|
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,6 @@
|
|||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Activities\Air\AllowYieldingReservation.cs" />
|
|
||||||
<Compile Include="Activities\Air\FallToEarth.cs" />
|
<Compile Include="Activities\Air\FallToEarth.cs" />
|
||||||
<Compile Include="Activities\Air\Fly.cs" />
|
<Compile Include="Activities\Air\Fly.cs" />
|
||||||
<Compile Include="Activities\Air\FlyAttack.cs" />
|
<Compile Include="Activities\Air\FlyAttack.cs" />
|
||||||
@@ -76,7 +75,6 @@
|
|||||||
<Compile Include="Activities\Air\HeliFlyCircle.cs" />
|
<Compile Include="Activities\Air\HeliFlyCircle.cs" />
|
||||||
<Compile Include="Activities\Air\HeliLand.cs" />
|
<Compile Include="Activities\Air\HeliLand.cs" />
|
||||||
<Compile Include="Activities\Air\Land.cs" />
|
<Compile Include="Activities\Air\Land.cs" />
|
||||||
<Compile Include="Activities\Air\ResupplyAircraft.cs" />
|
|
||||||
<Compile Include="Activities\Air\ReturnToBase.cs" />
|
<Compile Include="Activities\Air\ReturnToBase.cs" />
|
||||||
<Compile Include="Activities\Air\TakeOff.cs" />
|
<Compile Include="Activities\Air\TakeOff.cs" />
|
||||||
<Compile Include="Activities\Attack.cs" />
|
<Compile Include="Activities\Attack.cs" />
|
||||||
|
|||||||
@@ -19,19 +19,19 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
[ScriptPropertyGroup("Movement")]
|
[ScriptPropertyGroup("Movement")]
|
||||||
public class AircraftProperties : ScriptActorProperties, Requires<AircraftInfo>
|
public class AircraftProperties : ScriptActorProperties, Requires<AircraftInfo>
|
||||||
{
|
{
|
||||||
readonly AircraftInfo aircraftInfo;
|
readonly Aircraft aircraft;
|
||||||
|
|
||||||
public AircraftProperties(ScriptContext context, Actor self)
|
public AircraftProperties(ScriptContext context, Actor self)
|
||||||
: base(context, self)
|
: base(context, self)
|
||||||
{
|
{
|
||||||
aircraftInfo = self.Info.TraitInfo<AircraftInfo>();
|
aircraft = self.Trait<Aircraft>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[ScriptActorPropertyActivity]
|
[ScriptActorPropertyActivity]
|
||||||
[Desc("Fly within the cell grid.")]
|
[Desc("Fly within the cell grid.")]
|
||||||
public void Move(CPos cell)
|
public void Move(CPos cell)
|
||||||
{
|
{
|
||||||
if (!aircraftInfo.CanHover)
|
if (!aircraft.Info.CanHover)
|
||||||
Self.QueueActivity(new Fly(Self, Target.FromCell(Self.World, cell)));
|
Self.QueueActivity(new Fly(Self, Target.FromCell(Self.World, cell)));
|
||||||
else
|
else
|
||||||
Self.QueueActivity(new HeliFly(Self, Target.FromCell(Self.World, cell)));
|
Self.QueueActivity(new HeliFly(Self, Target.FromCell(Self.World, cell)));
|
||||||
@@ -55,7 +55,10 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
[Desc("Starts the resupplying activity when being on a host building.")]
|
[Desc("Starts the resupplying activity when being on a host building.")]
|
||||||
public void Resupply()
|
public void Resupply()
|
||||||
{
|
{
|
||||||
Self.QueueActivity(new ResupplyAircraft(Self));
|
var atLandAltitude = Self.World.Map.DistanceAboveTerrain(Self.CenterPosition) == aircraft.Info.LandAltitude;
|
||||||
|
var host = aircraft.GetActorBelow();
|
||||||
|
if (atLandAltitude && host != null)
|
||||||
|
Self.QueueActivity(new Resupply(Self, host, WDist.Zero));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -595,7 +595,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var atLandAltitude = self.World.Map.DistanceAboveTerrain(CenterPosition) == Info.LandAltitude;
|
var atLandAltitude = self.World.Map.DistanceAboveTerrain(CenterPosition) == Info.LandAltitude;
|
||||||
|
|
||||||
// Work-around to prevent players from accidentally canceling resupply by pressing 'Stop',
|
// Work-around to prevent players from accidentally canceling resupply by pressing 'Stop',
|
||||||
// by re-queueing ResupplyAircraft as long as resupply hasn't finished and aircraft is still on resupplier.
|
// by re-queueing Resupply as long as resupply hasn't finished and aircraft is still on resupplier.
|
||||||
// TODO: Investigate moving this back to ResolveOrder's "Stop" handling,
|
// TODO: Investigate moving this back to ResolveOrder's "Stop" handling,
|
||||||
// once conflicts with other traits' "Stop" orders have been fixed.
|
// once conflicts with other traits' "Stop" orders have been fixed.
|
||||||
if (atLandAltitude)
|
if (atLandAltitude)
|
||||||
@@ -603,7 +603,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var host = GetActorBelow();
|
var host = GetActorBelow();
|
||||||
if (host != null && (CanRearmAt(host) || CanRepairAt(host)))
|
if (host != null && (CanRearmAt(host) || CanRepairAt(host)))
|
||||||
{
|
{
|
||||||
self.QueueActivity(new ResupplyAircraft(self));
|
self.QueueActivity(new Resupply(self, host, WDist.Zero));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,10 +38,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
var resupplier = ReturnToBase.ChooseResupplier(self, true);
|
var resupplier = ReturnToBase.ChooseResupplier(self, true);
|
||||||
if (resupplier != null)
|
if (resupplier != null)
|
||||||
{
|
|
||||||
self.QueueActivity(new ReturnToBase(self, aircraftInfo.AbortOnResupply, resupplier));
|
self.QueueActivity(new ReturnToBase(self, aircraftInfo.AbortOnResupply, resupplier));
|
||||||
self.QueueActivity(new ResupplyAircraft(self));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// nowhere to land, pick something friendly and circle over it.
|
// nowhere to land, pick something friendly and circle over it.
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
|
|
||||||
var activity = a.CurrentActivity;
|
var activity = a.CurrentActivity;
|
||||||
var type = activity.GetType();
|
var type = activity.GetType();
|
||||||
if (type == typeof(Resupply) || type == typeof(ResupplyAircraft))
|
if (type == typeof(Resupply))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var next = activity.NextActivity;
|
var next = activity.NextActivity;
|
||||||
@@ -148,7 +148,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
var nextType = next.GetType();
|
var nextType = next.GetType();
|
||||||
if (nextType == typeof(Resupply) || nextType == typeof(ResupplyAircraft))
|
if (nextType == typeof(Resupply))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user