Changeset 25075

Timestamp:
Mar 18, 2021, 10:01:19 AM (3 years ago)
Author:
wraitii
Message:

Fix infinite loop in healing & potential one elsewhere.

HEAL can infinite loop: if the HEAL.APPROACHING:MoveTo call fails, the unit will fallback to FINDINGNEWTARGET, which looks for new targets to heal, which can loop around.
In #6106, the cause was that the target was not visible despite the order being given (presumably a rangemanager/los incompatibility issue).
When MoveTo() fail, orders usually call FinishOrder as that's irrecoverable.

Further, GATHERING/COLLECTINGTREASURE also did not FinishOrder - there, we do want to consider new resources if the target is e.g. unreachable, so add an explicit check for AbleToMove.

Reported by: moiman

Reviewed By: Freagarach

Fixes #6106

Differential Revision: https://code.wildfiregames.com/D3689

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js

    r25069 r25075  
    23682368                    this.gatheringTarget = this.order.data.target;  // temporary, deleted in "leave".
    23692369
     2370
     2371
     2372
     2373
     2374
     2375
     2376
     2377
    23702378                    let cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
    23712379                    let cmpMirage = Engine.QueryInterface(this.gatheringTarget, IID_Mirage);
     
    26912699                    if (!this.MoveTo(this.order.data, IID_Heal))
    26922700                    {
    2693                         this.SetNextState("FINDINGNEWTARGET");
     2701                        this.);
    26942702                        return true;
    26952703                    }
     
    28902898            "APPROACHING": {
    28912899                "enter": function() {
     2900
     2901
     2902
     2903
     2904
     2905
     2906
    28922907                    if (!this.MoveToTargetRange(this.order.data.target, IID_TreasureCollecter))
    28932908                    {
Note: See TracChangeset for help on using the changeset viewer.