Fix harvesters refusing to queue dock orders whenn empty
(cherry picked from commit 19040126046a53fd5092515f2a4895fdd5c9c87a)
This commit is contained in:
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Info.EnterCursor,
|
||||
Info.EnterBlockedCursor,
|
||||
() => Info.RequiresForceMove,
|
||||
DockingPossible,
|
||||
CanQueueDockAt,
|
||||
CanDockAt);
|
||||
}
|
||||
}
|
||||
@@ -109,9 +109,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
string IOrderVoice.VoicePhraseForOrder(Actor self, Order order)
|
||||
{
|
||||
if (order.OrderString == "Dock" && CanDockAt(order.Target.Actor, false))
|
||||
return Info.Voice;
|
||||
else if (order.OrderString == "ForceDock" && CanDockAt(order.Target.Actor, true))
|
||||
if (order.Target.Type != TargetType.Actor || IsTraitDisabled)
|
||||
return null;
|
||||
|
||||
if (order.OrderString != "Dock" && order.OrderString != "ForceDock")
|
||||
return null;
|
||||
|
||||
if (CanQueueDockAt(order.Target.Actor, order.OrderString == "ForceDock", order.Queued))
|
||||
return Info.Voice;
|
||||
|
||||
return null;
|
||||
@@ -125,12 +129,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>Clone of <see cref="DockClientManager.DockingPossible(Actor, bool)"/>.</summary>
|
||||
public bool DockingPossible(Actor target, bool forceEnter)
|
||||
{
|
||||
return !IsTraitDisabled && target.TraitsImplementing<DockHost>().Any(host => dockClients.Any(client => client.CanDock(host.GetDockType)));
|
||||
}
|
||||
|
||||
/// <summary>Clone of <see cref="DockClientManager.CanDockAt(Actor, bool, bool)"/>.</summary>
|
||||
public bool CanDockAt(Actor target, bool forceEnter)
|
||||
{
|
||||
@@ -140,5 +138,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return !IsTraitDisabled && target.TraitsImplementing<DockHost>().Any(
|
||||
host => dockClients.Any(client => client.CanDockAt(target, host, forceEnter, true)));
|
||||
}
|
||||
|
||||
/// <summary>Clone of <see cref="DockClientManager.CanQueueDockAt(Actor, bool, bool)"/>.</summary>
|
||||
public bool CanQueueDockAt(Actor target, bool forceEnter, bool isQueued)
|
||||
{
|
||||
if (Info.RequiresForceMove && !forceEnter)
|
||||
return false;
|
||||
|
||||
return (!IsTraitDisabled)
|
||||
&& target.TraitsImplementing<IDockHost>().Any(
|
||||
host => dockClients.Any(client => client.CanQueueDockAt(target, host, forceEnter, isQueued)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user