New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find alternative landing spots for blocked reinforcements #13785

merged 2 commits into from Oct 8, 2017
Jump to file or symbol
Failed to load files and symbols.
+19 −1
Diff settings


Just for now

Viewing a subset of changes. View all

Add an domain index check

  • Loading branch information...
abcdefg30 committed Aug 23, 2017
commit 692a0262ec0e8c0d01e7b9a4ba4fa9042bee67b4
@@ -26,7 +26,13 @@ namespace OpenRA.Mods.Common.Scripting
public class ReinforcementsGlobal : ScriptGlobal
public ReinforcementsGlobal(ScriptContext context) : base(context) { }
readonly DomainIndex domainIndex;
public ReinforcementsGlobal(ScriptContext context)
: base(context)
domainIndex = context.World.WorldActor.Trait<DomainIndex>();
Actor CreateActor(Player owner, string actorType, bool addToWorld, CPos? entryLocation = null, CPos? nextLocation = null)
@@ -153,11 +159,23 @@ public Actor[] Reinforce(Player owner, string[] actorTypes, CPos[] entryPath, in
// Try to find an alternative landing spot if we can't land at the current destination
if (!aircraft.CanLand(destination) && dropRange > 0)
var mobiles = cargo != null ? cargo.Passengers.Select(a =>
var mobileInfo = a.Info.TraitInfoOrDefault<MobileInfo>();
if (mobileInfo == null)
return new Pair<MobileInfo, uint>(null, 0);
return new Pair<MobileInfo, uint>(mobileInfo, (uint)mobileInfo.GetMovementClass(a.World.Map.Rules.TileSet));
}) : new Pair<MobileInfo, uint>[0];
foreach (var c in transport.World.Map.FindTilesInCircle(destination, dropRange))
if (!aircraft.CanLand(c))
if (!mobiles.All(m => m.First == null || domainIndex.IsPassable(destination, c, m.First, m.Second)))
destination = c;
ProTip! Use n and p to navigate between commits in a pull request.