Various Unit AI fixes following UM / UAI changes
- Garrisoning cleanup (return true in some cases in ENTER when we do change the state) - Fix animal walking speed until D1901 lands - Fix trading behaviour which occasionally bugged out. Differential Revision: https://code.wildfiregames.com/D2045 This was SVN commit r22440.
This commit is contained in:
parent
01161e3451
commit
54ffd9df94
@ -2795,9 +2795,8 @@ UnitAI.prototype.UnitFsmSpec = {
|
||||
|
||||
"GARRISONED": {
|
||||
"enter": function() {
|
||||
if (this.order.data.target)
|
||||
var target = this.order.data.target;
|
||||
else
|
||||
let target = this.order.data.target;
|
||||
if (!target)
|
||||
{
|
||||
this.FinishOrder();
|
||||
return true;
|
||||
@ -2808,7 +2807,6 @@ UnitAI.prototype.UnitFsmSpec = {
|
||||
|
||||
// Check that we can garrison here
|
||||
if (this.CanGarrison(target))
|
||||
{
|
||||
// Check that we're in range of the garrison target
|
||||
if (this.CheckGarrisonRange(target))
|
||||
{
|
||||
@ -2859,7 +2857,10 @@ UnitAI.prototype.UnitFsmSpec = {
|
||||
}
|
||||
|
||||
if (this.IsTurret())
|
||||
{
|
||||
this.SetNextState("IDLE");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -2878,13 +2879,9 @@ UnitAI.prototype.UnitFsmSpec = {
|
||||
}
|
||||
|
||||
}
|
||||
if (!this.CheckTargetRangeExplicit(target, 0, 0) && this.MoveToTarget(target))
|
||||
{
|
||||
this.SetNextState("APPROACHING");
|
||||
return false;
|
||||
}
|
||||
this.SetNextState("APPROACHING");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Garrisoning failed for some reason, so finish the order
|
||||
this.FinishOrder();
|
||||
return true;
|
||||
@ -3045,7 +3042,7 @@ UnitAI.prototype.UnitFsmSpec = {
|
||||
"ROAMING": {
|
||||
"enter": function() {
|
||||
// Walk in a random direction
|
||||
this.SelectAnimation("walk", false, 1);
|
||||
this.SelectAnimation("move", false, 1);
|
||||
this.SetFacePointAfterMove(false);
|
||||
this.MoveRandomly(+this.template.RoamDistance);
|
||||
// Set a random timer to switch to feeding state
|
||||
@ -5199,7 +5196,7 @@ UnitAI.prototype.MoveToMarket = function(targetMarket)
|
||||
}
|
||||
|
||||
this.waypoints = undefined;
|
||||
return this.MoveToTarget(targetMarket);
|
||||
return this.MoveToTargetRange(targetMarket, IID_Trader);
|
||||
};
|
||||
|
||||
UnitAI.prototype.PerformTradeAndMoveToNextMarket = function(currentMarket)
|
||||
|
Loading…
Reference in New Issue
Block a user