From 7214cfc9919efdbfa017325584982fd7daa3b9fb Mon Sep 17 00:00:00 2001 From: temple Date: Mon, 22 Jan 2018 02:49:57 +0000 Subject: [PATCH] Add a visibility check to FindNearbyResource and FindNearestDropsite Differential Revision: https://code.wildfiregames.com/D1161 Reviewed by: s0600204 Comments by: bb This was SVN commit r20955. --- binaries/data/mods/public/simulation/components/UnitAI.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binaries/data/mods/public/simulation/components/UnitAI.js b/binaries/data/mods/public/simulation/components/UnitAI.js index c86a65f2e9..1884f8e8bf 100644 --- a/binaries/data/mods/public/simulation/components/UnitAI.js +++ b/binaries/data/mods/public/simulation/components/UnitAI.js @@ -4125,7 +4125,7 @@ UnitAI.prototype.FindNearbyResource = function(filter, target) } var nearby = cmpRangeManager.ExecuteQuery(entity, 0, range, players, IID_ResourceSupply); return nearby.find(ent => { - if (!this.CanGather(ent)) + if (!this.CanGather(ent) || !this.CheckTargetVisible(ent)) return false; var cmpResourceSupply = Engine.QueryInterface(ent, IID_ResourceSupply); var type = cmpResourceSupply.GetType(); @@ -4175,7 +4175,7 @@ UnitAI.prototype.FindNearestDropsite = function(genericType) continue; let cmpResourceDropsite = Engine.QueryInterface(dropsite, IID_ResourceDropsite); - if (!cmpResourceDropsite.AcceptsType(genericType)) + if (!cmpResourceDropsite.AcceptsType(genericType) || !this.CheckTargetVisible(dropsite)) continue; if (Engine.QueryInterface(dropsite, IID_Ownership).GetOwner() != owner && !cmpResourceDropsite.IsShared()) continue;