mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 12:52:36 +00:00
Fix units in formation blocking construction and not moving out of the way (see #779).
Make non-movement-blocking buildings (e.g. farms) not require units to move out of the way. This was SVN commit r9510.
This commit is contained in:
@@ -99,7 +99,7 @@ Foundation.prototype.Build = function(builderEnt, work)
|
||||
if (!this.committed)
|
||||
{
|
||||
var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|
||||
if (cmpObstruction)
|
||||
if (cmpObstruction && cmpObstruction.GetBlockMovementFlag())
|
||||
{
|
||||
// If there's any units in the way, ask them to move away
|
||||
// and return early from this method.
|
||||
|
||||
@@ -407,6 +407,25 @@ var UnitFsmSpec = {
|
||||
this.SetNextState("INDIVIDUAL.IDLE");
|
||||
},
|
||||
|
||||
// Override the LeaveFoundation order since we're not doing
|
||||
// anything more important (and we might be stuck in the WALKING
|
||||
// state forever and need to get out of foundations in that case)
|
||||
"Order.LeaveFoundation": function(msg) {
|
||||
// Move a tile outside the building
|
||||
var range = 4;
|
||||
var ok = this.MoveToTargetRangeExplicit(msg.data.target, range, range);
|
||||
if (ok)
|
||||
{
|
||||
// We've started walking to the given point
|
||||
this.SetNextState("WALKING");
|
||||
}
|
||||
else
|
||||
{
|
||||
// We are already at the target, or can't move at all
|
||||
this.FinishOrder();
|
||||
}
|
||||
},
|
||||
|
||||
"IDLE": {
|
||||
"enter": function() {
|
||||
this.SelectAnimation("idle");
|
||||
@@ -417,6 +436,10 @@ var UnitFsmSpec = {
|
||||
"enter": function () {
|
||||
this.SelectAnimation("move");
|
||||
},
|
||||
|
||||
// (We stay in this state even if we're already in position
|
||||
// and no longer moving, because the formation controller might
|
||||
// move and we'll automatically start chasing after it again)
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user