Ticket #1930: delayed_fix.patch

File delayed_fix.patch, 1.2 KB (added by leper, 11 years ago)

alternate solution

  • binaries/data/mods/public/simulation/components/UnitAI.js

    diff --git a/binaries/data/mods/public/simulation/components/UnitAI.js b/binaries/data/mods/public/simulation/components/UnitAI.js
    index 06edb74..494edaf 100644
    a b var UnitFsmSpec = {  
    20782078                        this.FinishOrder();
    20792079                        return true;
    20802080                    }
    2081                     else
     2081
     2082                    // Check if the target is still repairable
     2083                    var cmpHealth = Engine.QueryInterface(target, IID_Health);
     2084                    if (cmpHealth && cmpHealth.GetHitpoints() >= cmpHealth.GetMaxHitpoints())
    20822085                    {
    2083                         var cmpFoundation = Engine.QueryInterface(target, IID_Foundation);
    2084                         if (cmpFoundation)
    2085                             cmpFoundation.AddBuilder(this.entity);
     2086                        // The building was already finished/fully repaired before we arrived;
     2087                        // let the ConstructionFinished handler handle this.
     2088                        this.OnGlobalConstructionFinished({"entity": target, "newentity": target});
     2089                        return true;
    20862090                    }
    20872091
     2092                    var cmpFoundation = Engine.QueryInterface(target, IID_Foundation);
     2093                    if (cmpFoundation)
     2094                        cmpFoundation.AddBuilder(this.entity);
     2095
    20882096                    this.SelectAnimation("build", false, 1.0, "build");
    20892097                    this.StartTimer(1000, 1000);
    20902098                    return false;