Do not go to the nearest dropsite when full and asked to hunt/slaughter and attack instead. This is fine as long as units don't decay.

Comments by: @wraitii, @Freagarach
Reported by: @FeldFeld
Fixes: #5954
Refs: 6d187f2145
Differential Revision: https://code.wildfiregames.com/D3444
This was SVN commit r25664.
This commit is contained in:
Stan 2021-06-04 08:44:15 +00:00
parent dd61eb4751
commit 741d53e3e7

View File

@ -494,13 +494,6 @@ UnitAI.prototype.UnitFsmSpec = {
return ACCEPT_ORDER;
}
// If the unit is full go to the nearest dropsite instead of trying to gather.
if (!cmpResourceGatherer.CanCarryMore(msg.data.type.generic))
{
this.SetNextState("INDIVIDUAL.GATHER.RETURNINGRESOURCE");
return ACCEPT_ORDER;
}
if (this.MustKillGatherTarget(msg.data.target))
{
// Make sure we can attack the target, else we'll get very stuck
@ -534,6 +527,13 @@ UnitAI.prototype.UnitFsmSpec = {
return ACCEPT_ORDER;
}
// If the unit is full go to the nearest dropsite instead of trying to gather.
if (!cmpResourceGatherer.CanCarryMore(msg.data.type.generic))
{
this.SetNextState("INDIVIDUAL.GATHER.RETURNINGRESOURCE");
return ACCEPT_ORDER;
}
this.RememberTargetPosition();
if (!msg.data.initPos)
msg.data.initPos = msg.data.lastPos;