Fix PushOrderFront with construction.

POF introduced in afd1eaee0d.
Placing foundations takes another route, for which was warned in the
original ticket but not done nonetheless.
This fixes that route.

Differential revision: D3642
Comments by: @wraitii
Fixes #6090

This was SVN commit r25024.
This commit is contained in:
Freagarach 2021-03-07 05:55:57 +00:00
parent 09ad8bfbe5
commit b48cd5244f
2 changed files with 6 additions and 3 deletions

View file

@ -281,7 +281,7 @@ function isSnapToEdgesEnabled()
return hotkeyPressed == (config == "disabled");
}
function tryPlaceBuilding(queued)
function tryPlaceBuilding(queued, pushFront)
{
if (placementSupport.mode !== "building")
{
@ -312,6 +312,7 @@ function tryPlaceBuilding(queued)
"autorepair": true,
"autocontinue": true,
"queued": queued,
"pushFront": pushFront,
"formation": g_AutoFormation.getNull()
});
Engine.GuiInterfaceCall("PlaySound", { "name": "order_build", "entity": selection[0] });
@ -574,7 +575,7 @@ function handleInputBeforeGui(ev, hoveredObject)
{
// If queued, let the player continue placing another of the same building.
let queued = Engine.HotkeyIsPressed("session.queue");
if (tryPlaceBuilding(queued))
if (tryPlaceBuilding(queued, Engine.HotkeyIsPressed("session.pushorderfront")))
{
if (queued && g_Selection.toList().length)
inputState = INPUT_BUILDING_PLACEMENT;
@ -732,7 +733,7 @@ function handleInputBeforeGui(ev, hoveredObject)
{
// If queued, let the player continue placing another of the same structure.
let queued = Engine.HotkeyIsPressed("session.queue");
if (tryPlaceBuilding(queued))
if (tryPlaceBuilding(queued, Engine.HotkeyIsPressed("session.pushorderfront")))
{
if (queued && g_Selection.toList().length)
inputState = INPUT_BUILDING_PLACEMENT;
@ -1205,6 +1206,7 @@ function positionUnitsFreehandSelectionMouseUp(ev)
"targetPositions": entityDistribution.map(pos => pos.toFixed(2)),
"targetClasses": Engine.HotkeyIsPressed("session.attackmoveUnit") ? { "attack": ["Unit"] } : { "attack": ["Unit", "Structure"] },
"queued": Engine.HotkeyIsPressed("session.queue"),
"pushFront": Engine.HotkeyIsPressed("session.pushorderfront"),
"formation": NULL_FORMATION,
});

View file

@ -1178,6 +1178,7 @@ function TryConstructBuilding(player, cmpPlayer, controlAllUnits, cmd)
"target": ent,
"autocontinue": cmd.autocontinue,
"queued": cmd.queued,
"pushFront": cmd.pushFront,
"formation": cmd.formation || undefined
});
}