This commit is contained in:
Anuken
2021-02-15 09:30:57 -05:00
parent e16622afcc
commit fa52255d04
3 changed files with 14 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
package mindustry.ai.types;
import arc.math.geom.*;
import mindustry.*;
import mindustry.ai.*;
import mindustry.entities.*;
@@ -47,14 +48,17 @@ public class SuicideAI extends GroundAI{
//raycast for target
boolean blocked = Vars.world.raycast(unit.tileX(), unit.tileY(), target.tileX(), target.tileY(), (x, y) -> {
Tile tile = Vars.world.tile(x, y);
if(tile != null && tile.build == target) return false;
if(tile != null && tile.build != null && tile.build.team != unit.team()){
blockedByBlock = true;
return true;
}else{
return tile == null || tile.solid();
for(Point2 p : Geometry.d4c){
Tile tile = Vars.world.tile(x + p.x, y + p.y);
if(tile != null && tile.build == target) return false;
if(tile != null && tile.build != null && tile.build.team != unit.team()){
blockedByBlock = true;
return true;
}else{
return tile == null || tile.solid();
}
}
return false;
});
//shoot when there's an enemy block in the way

View File

@@ -28,7 +28,8 @@ public class ConsumeLiquidFilter extends ConsumeLiquidBase{
public void build(Building build, Table table){
Seq<Liquid> list = content.liquids().select(l -> !l.isHidden() && filter.get(l));
MultiReqImage image = new MultiReqImage();
list.each(liquid -> image.add(new ReqImage(liquid.icon(Cicon.medium), () -> build.liquids != null && build.liquids.get(liquid) >= Math.max(use(build), amount * build.delta()))));
list.each(liquid -> image.add(new ReqImage(liquid.icon(Cicon.medium), () ->
build.liquids != null && build.liquids.current() == liquid && build.liquids.get(liquid) >= Math.max(use(build), amount * build.delta()))));
table.add(image).size(8 * 4);
}