mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-19 16:57:15 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
ae83779253
@ -28,7 +28,7 @@ public class DefenderAI extends AIController{
|
||||
public Teamc findTarget(float x, float y, float range, boolean air, boolean ground){
|
||||
|
||||
//Sort by max health and closer target.
|
||||
var result = Units.closest(unit.team, x, y, Math.max(range, 400f), u -> !u.dead() && u.type != unit.type, (u, tx, ty) -> -u.maxHealth + Mathf.dst2(u.x, u.y, tx, ty) / 6400f);
|
||||
var result = Units.closest(unit.team, x, y, Math.max(range, 400f), u -> !u.dead() && u.type != unit.type && u.targetable(unit.team), (u, tx, ty) -> -u.maxHealth + Mathf.dst2(u.x, u.y, tx, ty) / 6400f);
|
||||
if(result != null) return result;
|
||||
|
||||
//return core if found
|
||||
|
@ -374,7 +374,7 @@ public class Damage{
|
||||
tmpUnit = null;
|
||||
|
||||
Units.nearbyEnemies(hitter.team, rect, e -> {
|
||||
if((tmpUnit != null && e.dst2(x, y) > tmpUnit.dst2(x, y)) || !e.checkTarget(hitter.type.collidesAir, hitter.type.collidesGround)) return;
|
||||
if((tmpUnit != null && e.dst2(x, y) > tmpUnit.dst2(x, y)) || !e.checkTarget(hitter.type.collidesAir, hitter.type.collidesGround) || !e.targetable(hitter.team)) return;
|
||||
|
||||
e.hitbox(hitrect);
|
||||
Rect other = hitrect;
|
||||
@ -468,7 +468,7 @@ public class Damage{
|
||||
/** Damages all entities and blocks in a radius that are enemies of the team. */
|
||||
public static void damage(Team team, float x, float y, float radius, float damage, boolean complete, boolean air, boolean ground, boolean scaled, Bullet source){
|
||||
Cons<Unit> cons = entity -> {
|
||||
if(entity.team == team || !entity.hittable() || !entity.within(x, y, radius + (scaled ? entity.hitSize / 2f : 0f)) || (entity.isFlying() && !air) || (entity.isGrounded() && !ground)){
|
||||
if(entity.team == team || !entity.checkTarget(air, ground) || !entity.hittable() || !entity.within(x, y, radius + (scaled ? entity.hitSize / 2f : 0f))){
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class EnergyFieldAbility extends Ability{
|
||||
|
||||
if(hitUnits){
|
||||
Units.nearby(null, rx, ry, range, other -> {
|
||||
if(other != unit && (other.isFlying() ? targetAir : targetGround)){
|
||||
if(other != unit && other.checkTarget(targetAir, targetGround) && other.targetable(unit.team)){
|
||||
all.add(other);
|
||||
}
|
||||
});
|
||||
|
@ -30,7 +30,7 @@ public class FlakBulletType extends BasicBulletType{
|
||||
if(b.time >= flakDelay && b.fdata >= 0 && b.timer(2, flakInterval)){
|
||||
Units.nearbyEnemies(b.team, Tmp.r1.setSize(explodeRange * 2f).setCenter(b.x, b.y), unit -> {
|
||||
//fdata < 0 means it's primed to explode
|
||||
if(b.fdata < 0f || !unit.checkTarget(collidesAir, collidesGround) || !unit.type.targetable) return;
|
||||
if(b.fdata < 0f || !unit.checkTarget(collidesAir, collidesGround) || !unit.targetable(b.team)) return;
|
||||
|
||||
if(unit.within(b, explodeRange + unit.hitSize/2f)){
|
||||
//mark as primed
|
||||
|
@ -16,6 +16,7 @@ public class PointBulletType extends BulletType{
|
||||
scaleLife = true;
|
||||
lifetime = 100f;
|
||||
collides = false;
|
||||
reflectable = false;
|
||||
keepVelocity = false;
|
||||
backMove = false;
|
||||
}
|
||||
@ -42,7 +43,7 @@ public class PointBulletType extends BulletType{
|
||||
float range = 1f;
|
||||
|
||||
Units.nearbyEnemies(b.team, px - range, py - range, range*2f, range*2f, e -> {
|
||||
if(e.dead()) return;
|
||||
if(e.dead() || !e.checkTarget(collidesAir, collidesGround) || !e.hittable()) return;
|
||||
|
||||
e.hitbox(Tmp.r1);
|
||||
if(!Tmp.r1.contains(px, py)) return;
|
||||
@ -56,7 +57,7 @@ public class PointBulletType extends BulletType{
|
||||
|
||||
if(result != null){
|
||||
b.collision(result, px, py);
|
||||
}else{
|
||||
}else if(collidesTiles){
|
||||
Building build = Vars.world.buildWorld(px, py);
|
||||
if(build != null && build.team != b.team){
|
||||
build.collision(b);
|
||||
|
Loading…
Reference in New Issue
Block a user