From 3e43ddd869e1f23055c359559b301db16b1468ee Mon Sep 17 00:00:00 2001 From: wraitii Date: Sun, 30 Jun 2019 18:55:26 +0000 Subject: [PATCH] Fix 0b41e8ee61, make units again properly hunt animals that died in FoW. The reason was that the unit immediately tried gathering nearby instead of going to the unit's last known position. Related to D1997. Differential Revision: https://code.wildfiregames.com/D1996 This was SVN commit r22414. --- .../data/mods/public/simulation/components/UnitAI.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/binaries/data/mods/public/simulation/components/UnitAI.js b/binaries/data/mods/public/simulation/components/UnitAI.js index 5becf27949..b3c9551914 100644 --- a/binaries/data/mods/public/simulation/components/UnitAI.js +++ b/binaries/data/mods/public/simulation/components/UnitAI.js @@ -2218,6 +2218,18 @@ UnitAI.prototype.UnitFsmSpec = { this.SetNextState("APPROACHING"); return; } + + // Our target is no longer visible - go to its last known position first + // and then hopefully it will become visible. + if (!this.CheckTargetVisible(target) && this.order.data.lastPos) + { + this.PushOrderFront("Walk", { + "x": this.order.data.lastPos.x, + "z": this.order.data.lastPos.z, + "force": this.order.data.force + }); + return; + } } }