mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-07-04 05:55:47 -07:00
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.
This commit is contained in:
parent
340cda5d57
commit
7214cfc991
1 changed files with 2 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue