Building target discovered check
This commit is contained in:
@@ -356,7 +356,7 @@ public class BlockIndexer{
|
|||||||
if(enemy == team || (enemy == Team.derelict && !state.rules.coreCapture)) continue;
|
if(enemy == team || (enemy == Team.derelict && !state.rules.coreCapture)) continue;
|
||||||
|
|
||||||
Building candidate = indexer.findTile(enemy, x, y, range, pred, true);
|
Building candidate = indexer.findTile(enemy, x, y, range, pred, true);
|
||||||
if(candidate == null) continue;
|
if(candidate == null || !candidate.isDiscovered(team)) continue;
|
||||||
|
|
||||||
//if a block has the same priority, the closer one should be targeted
|
//if a block has the same priority, the closer one should be targeted
|
||||||
float dist = candidate.dst(x, y) - candidate.hitSize() / 2f;
|
float dist = candidate.dst(x, y) - candidate.hitSize() / 2f;
|
||||||
|
|||||||
@@ -271,6 +271,19 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
//endregion
|
//endregion
|
||||||
//region utility methods
|
//region utility methods
|
||||||
|
|
||||||
|
public boolean isDiscovered(Team viewer){
|
||||||
|
if(block.size <= 2){
|
||||||
|
return fogControl.isDiscovered(viewer, tile.x, tile.y);
|
||||||
|
}else{
|
||||||
|
int s = block.size / 2;
|
||||||
|
return fogControl.isDiscovered(viewer, tile.x, tile.y) ||
|
||||||
|
fogControl.isDiscovered(viewer, tile.x - s, tile.y - s) ||
|
||||||
|
fogControl.isDiscovered(viewer, tile.x - s, tile.y + s) ||
|
||||||
|
fogControl.isDiscovered(viewer, tile.x + s, tile.y + s) ||
|
||||||
|
fogControl.isDiscovered(viewer, tile.x + s, tile.y - s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void addPlan(boolean checkPrevious){
|
public void addPlan(boolean checkPrevious){
|
||||||
addPlan(checkPrevious, false);
|
addPlan(checkPrevious, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,10 @@ public class BaseTurret extends Block{
|
|||||||
super.drawPlace(x, y, rotation, valid);
|
super.drawPlace(x, y, rotation, valid);
|
||||||
|
|
||||||
Drawf.dashCircle(x * tilesize + offset, y * tilesize + offset, range, Pal.placing);
|
Drawf.dashCircle(x * tilesize + offset, y * tilesize + offset, range, Pal.placing);
|
||||||
|
|
||||||
|
if(fogRadiusMultiuplier < 0.99f && state.rules.fog){
|
||||||
|
Drawf.dashCircle(x * tilesize + offset, y * tilesize + offset, range * fogRadiusMultiuplier, Pal.lightishGray);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -25,4 +25,4 @@ org.gradle.caching=true
|
|||||||
#used for slow jitpack builds; TODO see if this actually works
|
#used for slow jitpack builds; TODO see if this actually works
|
||||||
org.gradle.internal.http.socketTimeout=100000
|
org.gradle.internal.http.socketTimeout=100000
|
||||||
org.gradle.internal.http.connectionTimeout=100000
|
org.gradle.internal.http.connectionTimeout=100000
|
||||||
archash=8793e01874
|
archash=5a1cbb8b59
|
||||||
|
|||||||
Reference in New Issue
Block a user