1
0
forked from 0ad/0ad

Fix obstructed entities being able to drop off resources.

Introduced in 7ba4b1ffc8 by not checking the range anymore.
Reported by @FFFF at
https://wildfiregames.com/forum/topic/72985-stuck-units-delivering-resourses/.

Differential revision: https://code.wildfiregames.com/D4531
Tested by: @Langbart
Fixes #6446

This was SVN commit r26619.
This commit is contained in:
Freagarach 2022-03-11 06:39:25 +00:00
parent 41033d951e
commit dff79a388b

View File

@ -2679,7 +2679,8 @@ UnitAI.prototype.UnitFsmSpec = {
"DROPPINGRESOURCES": {
"enter": function() {
let cmpResourceGatherer = Engine.QueryInterface(this.entity, IID_ResourceGatherer);
if (this.CanReturnResource(this.order.data.target, true, cmpResourceGatherer))
if (this.CanReturnResource(this.order.data.target, true, cmpResourceGatherer) &&
cmpResourceGatherer.IsTargetInRange(this.order.data.target))
{
cmpResourceGatherer.CommitResources(this.order.data.target);
this.SetNextState("GATHER.APPROACHING");
@ -2823,7 +2824,8 @@ UnitAI.prototype.UnitFsmSpec = {
"DROPPINGRESOURCES": {
"enter": function() {
let cmpResourceGatherer = Engine.QueryInterface(this.entity, IID_ResourceGatherer);
if (this.CanReturnResource(this.order.data.target, true, cmpResourceGatherer))
if (this.CanReturnResource(this.order.data.target, true, cmpResourceGatherer) &&
cmpResourceGatherer.IsTargetInRange(this.order.data.target))
{
cmpResourceGatherer.CommitResources(this.order.data.target);