Fixed avoidance layering

This commit is contained in:
Anuken
2025-07-06 20:33:13 -04:00
parent f0d8c06380
commit 05349a4aef

View File

@@ -60,13 +60,10 @@ public class AvoidanceProcess implements AsyncProcess{
//only do avoidance if it's relevant to the team
if(team.team.isAI() && !team.team.rules().rtsAi){
for(var unit : team.units){
if(!unit.isFlying()){
int layer = unit.collisionLayer();
if(layer < PhysicsProcess.layers){
//scaling is oversized 2x because units need to avoid things that are at their origin tile
float scaling = 2f;
requests.add(Point2.pack(unit.tileX(), unit.tileY()), Float.floatToRawIntBits(unit.hitSize * unitCollisionRadiusScale / tilesize * scaling), unit.id);
}
if(unit.collisionLayer() == PhysicsProcess.layerGround){
//scaling is oversized 2x because units need to avoid things that are at their origin tile
float scaling = 2f;
requests.add(Point2.pack(unit.tileX(), unit.tileY()), Float.floatToRawIntBits(unit.hitSize * unitCollisionRadiusScale / tilesize * scaling), unit.id);
}
}
}