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 = {
|
2078 | 2078 | this.FinishOrder(); |
2079 | 2079 | return true; |
2080 | 2080 | } |
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()) |
2082 | 2085 | { |
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; |
2086 | 2090 | } |
2087 | 2091 | |
| 2092 | var cmpFoundation = Engine.QueryInterface(target, IID_Foundation); |
| 2093 | if (cmpFoundation) |
| 2094 | cmpFoundation.AddBuilder(this.entity); |
| 2095 | |
2088 | 2096 | this.SelectAnimation("build", false, 1.0, "build"); |
2089 | 2097 | this.StartTimer(1000, 1000); |
2090 | 2098 | return false; |