Allow ulocate to output enemy buildings (#6704)

* Allow ulocate to output enemy buildings
Previously you would have to use ucontrol getblock to get the actual Building
that's weird and just confuses newbs
like me

* whoops, turns out ulocate doesn't have a range

* c o d e s t y l e

* Always return building object if on same team
This commit is contained in:
BalaM314
2023-06-16 23:57:05 +05:30
committed by GitHub
parent 017aa71da8
commit d14cdfd59c

View File

@@ -322,7 +322,14 @@ public class LExecutor{
cache.found = false;
exec.setnum(outFound, 0);
}
exec.setobj(outBuild, res != null && res.build != null && res.build.team == exec.team ? cache.build = res.build : null);
if(res != null && res.build != null &&
(unit.within(res.build.x, res.build.y, Math.max(unit.range(), buildingRange)) || res.build.team == exec.team)){
cache.build = res.build;
exec.setobj(outBuild, res.build);
}else{
exec.setobj(outBuild, null);
}
}else{
exec.setobj(outBuild, cache.build);
exec.setbool(outFound, cache.found);