mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-20 23:33:59 -07:00
Fix floating units when a building they were tasked to construct finishes while they're still en-route, based on a patch by mattlott.
This was SVN commit r11775.
This commit is contained in:
parent
cb599d4ae5
commit
e8cb2a71da
1 changed files with 12 additions and 0 deletions
|
|
@ -1368,6 +1368,11 @@ var UnitFsmSpec = {
|
|||
// Save the current order's data in case we need it later
|
||||
var oldAutocontinue = this.order.data.autocontinue;
|
||||
|
||||
// Save the current state so we can continue walking if necessary
|
||||
// FinishOrder() below will switch to IDLE if there's no order, which sets the idle animation.
|
||||
// Idle animation while moving towards finished construction looks weird (ghosty).
|
||||
var oldState = this.GetCurrentState();
|
||||
|
||||
// We finished building it.
|
||||
// Switch to the next order (if any)
|
||||
if (this.FinishOrder())
|
||||
|
|
@ -1413,6 +1418,13 @@ var UnitFsmSpec = {
|
|||
this.Repair(nearbyFoundation, oldAutocontinue, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Unit was approaching and there's nothing to do now, so switch to walking
|
||||
if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|
||||
{
|
||||
// We've already started walking to the given point
|
||||
this.SetNextState("INDIVIDUAL.WALKING");
|
||||
}
|
||||
},
|
||||
|
||||
// Override the LeaveFoundation order since we don't want to be
|
||||
|
|
|
|||
Loading…
Reference in a new issue