Merge branch 'master' of https://github.com/Anuken/Mindustry into maps
This commit is contained in:
@@ -129,8 +129,12 @@ public class RtsAI{
|
||||
boolean handleSquad(Seq<Unit> units, boolean noDefenders){
|
||||
float health = 0f, dps = 0f;
|
||||
float ax = 0f, ay = 0f;
|
||||
boolean targetAir = true, targetGround = true;
|
||||
|
||||
for(var unit : units){
|
||||
if(!unit.type.targetAir) targetAir = false;
|
||||
if(!unit.type.targetGround) targetGround = false;
|
||||
|
||||
ax += unit.x;
|
||||
ay += unit.y;
|
||||
health += unit.health;
|
||||
@@ -176,6 +180,8 @@ public class RtsAI{
|
||||
}
|
||||
}
|
||||
|
||||
boolean tair = targetAir, tground = targetGround;
|
||||
|
||||
//find aggressor, or else, the thing being attacked
|
||||
Vec2 defendPos = null;
|
||||
Teamc defendTarget = null;
|
||||
@@ -183,7 +189,7 @@ public class RtsAI{
|
||||
float checkRange = 260f;
|
||||
|
||||
//TODO could be made faster by storing bullet shooter
|
||||
Unit aggressor = Units.closestEnemy(data.team, defend.x, defend.y, checkRange, u -> true);
|
||||
Unit aggressor = Units.closestEnemy(data.team, defend.x, defend.y, checkRange, u -> u.checkTarget(tair, tground));
|
||||
if(aggressor != null){
|
||||
defendTarget = aggressor;
|
||||
}else if(false){ //TODO currently ignored, no use defending against nothing
|
||||
|
||||
@@ -129,7 +129,7 @@ public class CommandAI extends AIController{
|
||||
|
||||
@Override
|
||||
public void hit(Bullet bullet){
|
||||
if(unit.team.isAI() && bullet.owner instanceof Teamc teamc && teamc.team() != unit.team && attackTarget == null){
|
||||
if(unit.team.isAI() && bullet.owner instanceof Teamc teamc && teamc.team() != unit.team && attackTarget == null && !(teamc instanceof Unit u && !u.checkTarget(unit.type.targetAir, unit.type.targetGround))){
|
||||
commandTarget(teamc, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,10 +66,14 @@ public class HaloPart extends DrawPart{
|
||||
float pointRot = rot + shapeMoveRot * prog * sign + shapeRotation * sign + baseRot * sign;
|
||||
|
||||
if(tri){
|
||||
Drawf.tri(shapeX, shapeY, rad, triLen, pointRot);
|
||||
if(rad > 0.001 && triLen > 0.001){
|
||||
Drawf.tri(shapeX, shapeY, rad, triLen, pointRot);
|
||||
}
|
||||
}else if(!hollow){
|
||||
Fill.poly(shapeX, shapeY, sides, rad, pointRot);
|
||||
}else{
|
||||
if(rad > 0.001){
|
||||
Fill.poly(shapeX, shapeY, sides, rad, pointRot);
|
||||
}
|
||||
}else if(str > 0.001){
|
||||
Lines.stroke(str);
|
||||
Lines.poly(shapeX, shapeY, sides, rad, pointRot);
|
||||
Lines.stroke(1f);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ShapePart extends DrawPart{
|
||||
}else{
|
||||
Fill.circle(rx, ry, rad);
|
||||
}
|
||||
}else{
|
||||
}else if(str > 0.0001f){
|
||||
Lines.stroke(str);
|
||||
if(!circle){
|
||||
Lines.poly(rx, ry, sides, rad, moveRot * prog * sign + params.rotation - 90 * sign + rotation * sign + baseRot * sign);
|
||||
|
||||
Reference in New Issue
Block a user