Core vicinity buildup system

This commit is contained in:
Anuken
2022-04-11 12:14:17 -04:00
parent bdeef68a0b
commit 6fe71dfe9c
12 changed files with 86 additions and 16 deletions

View File

@@ -356,9 +356,9 @@ public class BlockIndexer{
float dist = candidate.dst(x, y) - candidate.hitSize() / 2f;
if(target == null ||
//if its closer and is at least equal priority
(dist < targetDist && candidate.block.priority.ordinal() >= target.block.priority.ordinal()) ||
(dist < targetDist && candidate.block.priority >= target.block.priority) ||
// block has higher priority (so range doesnt matter)
(candidate.block.priority.ordinal() > target.block.priority.ordinal())){
(candidate.block.priority > target.block.priority)){
target = candidate;
targetDist = dist;
}
@@ -388,9 +388,9 @@ public class BlockIndexer{
float bdst = next.dst(x, y) - next.hitSize() / 2f;
if(bdst < range && (closest == null ||
//this one is closer, and it is at least of equal priority
(bdst < dst && (!usePriority || closest.block.priority.ordinal() <= next.block.priority.ordinal())) ||
(bdst < dst && (!usePriority || closest.block.priority <= next.block.priority)) ||
//priority is used, and new block has higher priority regardless of range
(usePriority && closest.block.priority.ordinal() < next.block.priority.ordinal()))){
(usePriority && closest.block.priority < next.block.priority))){
dst = bdst;
closest = next;
}

View File

@@ -131,7 +131,7 @@ public class Pathfinder implements Runnable{
}
}
//the other tile is no longer near solid, remove the solid bit
if(!otherNearSolid){
if(!otherNearSolid && tiles.length > other.array()){
tiles[other.array()] &= ~(PathTile.bitMaskNearSolid);
}
}