From b1c0e36cee98bd968a9b64e17425906d1007aaae Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 10 Dec 2024 00:44:26 +0100 Subject: [PATCH] Remove diagonal diagonals, branch only in enemy direction --- .../src/de/steamwar/fightsystem/utils/Hull.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java index 86eda93d..e69a7986 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java @@ -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) {