forked from SteamWar/SteamWar
Remove diagonal diagonals, branch only in enemy direction
This commit is contained in:
@@ -47,15 +47,11 @@ public class Hull {
|
||||
private static final int GLASS = BlockIds.impl.materialToId(Material.GLASS);
|
||||
|
||||
private static final IntVector[] DIRECTIONS = new IntVector[]{
|
||||
new IntVector(-1, -1, -1),
|
||||
new IntVector(-1, -1, 0),
|
||||
new IntVector(-1, -1, 1),
|
||||
new IntVector(-1, 0, -1),
|
||||
new IntVector(-1, 0, 0),
|
||||
new IntVector(-1, 0, 1),
|
||||
new IntVector(-1, 1, -1),
|
||||
new IntVector(-1, 1, 0),
|
||||
new IntVector(-1, 1, 1),
|
||||
new IntVector(0, -1, -1),
|
||||
new IntVector(0, -1, 0),
|
||||
new IntVector(0, -1, 1),
|
||||
@@ -64,15 +60,11 @@ public class Hull {
|
||||
new IntVector(0, 1, -1),
|
||||
new IntVector(0, 1, 0),
|
||||
new IntVector(0, 1, 1),
|
||||
new IntVector(1, -1, -1),
|
||||
new IntVector(1, -1, 0),
|
||||
new IntVector(1, -1, 1),
|
||||
new IntVector(1, 0, -1),
|
||||
new IntVector(1, 0, 0),
|
||||
new IntVector(1, 0, 1),
|
||||
new IntVector(1, 1, -1),
|
||||
new IntVector(1, 1, 0),
|
||||
new IntVector(1, 1, 1),
|
||||
};
|
||||
|
||||
private static boolean isOccluding(Material material) {
|
||||
@@ -81,6 +73,7 @@ public class Hull {
|
||||
|
||||
private final Region region;
|
||||
private final boolean groundVisible;
|
||||
private final IntVector primaryDirection;
|
||||
|
||||
private final BitSet occluding;
|
||||
private final BitSet visibility;
|
||||
@@ -94,6 +87,7 @@ public class Hull {
|
||||
public Hull(FightTeam team) {
|
||||
this.region = team.getSchemRegion();
|
||||
this.groundVisible = region.getMinY() != Config.PlayerRegion.getMinY();
|
||||
this.primaryDirection = new IntVector(0, 0, team.isBlue() == (Config.BlueToRedZ > 0) ? -1 : 1);
|
||||
this.occluding = new BitSet(region.volume());
|
||||
this.visibility = new BitSet(region.volume());
|
||||
}
|
||||
@@ -280,12 +274,12 @@ public class Hull {
|
||||
}
|
||||
|
||||
if (occluding.get(id)) {
|
||||
visibilityDirections.compute(id, (pos, v) -> (v == null ? 0 : v) + directionId(direction));
|
||||
visibilityDirections.compute(id, (pos, v) -> (v == null ? 0 : v) | directionId(direction));
|
||||
return;
|
||||
}
|
||||
|
||||
updateBlocks(uncovered, block.add(direction), direction);
|
||||
if(direction.x*direction.x + direction.y*direction.y + direction.z*direction.z > 1) // If direction diagonal
|
||||
if(!direction.equals(primaryDirection))
|
||||
return;
|
||||
|
||||
for(IntVector branchDirection : DIRECTIONS) {
|
||||
|
||||
Reference in New Issue
Block a user