diff --git a/core/src/mindustry/content/Bullets.java b/core/src/mindustry/content/Bullets.java index 78af69229f..94f5e8b4bf 100644 --- a/core/src/mindustry/content/Bullets.java +++ b/core/src/mindustry/content/Bullets.java @@ -20,7 +20,7 @@ public class Bullets implements ContentList{ artilleryDense, artilleryPlastic, artilleryPlasticFrag, artilleryHoming, artilleryIncendiary, artilleryExplosive, //flak - flakScrap, flakLead, flakPlastic, flakExplosive, flakSurge, flakGlass, glassFrag, + flakScrap, flakLead, flakPlastic, flakExplosive, flakSurge, flakGlass, flakGlassFrag, flakPlasticFrag, //missiles missileExplosive, missileIncendiary, missileSurge, missileJavelin, missileSwarm, @@ -62,6 +62,7 @@ public class Bullets implements ContentList{ backColor = Pal.plastaniumBack; frontColor = Pal.plastaniumFront; despawnEffect = Fx.none; + collidesAir = false; }}; artilleryPlastic = new ArtilleryBulletType(3.4f, 12, "shell"){{ @@ -122,7 +123,7 @@ public class Bullets implements ContentList{ statusDuration = 60f; }}; - glassFrag = new BasicBulletType(3f, 5, "bullet"){{ + flakGlassFrag = new BasicBulletType(3f, 5, "bullet"){{ width = 5f; height = 12f; shrinkY = 1f; @@ -130,6 +131,7 @@ public class Bullets implements ContentList{ backColor = Pal.gray; frontColor = Color.white; despawnEffect = Fx.none; + collidesGround = false; }}; flakLead = new FlakBulletType(4.2f, 3){{ @@ -165,14 +167,25 @@ public class Bullets implements ContentList{ hitEffect = Fx.flakExplosion; splashDamage = 20f; splashDamageRadius = 20f; - fragBullet = glassFrag; + fragBullet = flakGlassFrag; fragBullets = 5; }}; + flakPlasticFrag = new BasicBulletType(2.5f, 10, "bullet"){{ + width = 10f; + height = 12f; + shrinkY = 1f; + lifetime = 15f; + backColor = Pal.plastaniumBack; + frontColor = Pal.plastaniumFront; + despawnEffect = Fx.none; + collidesGround = false; + }}; + flakPlastic = new FlakBulletType(4f, 6){{ splashDamageRadius = 50f; splashDamage = 25f; - fragBullet = artilleryPlasticFrag; + fragBullet = flakPlasticFrag; fragBullets = 6; hitEffect = Fx.plasticExplosion; frontColor = Pal.plastaniumFront; diff --git a/core/src/mindustry/entities/Damage.java b/core/src/mindustry/entities/Damage.java index e1db6d5e8e..05b5150850 100644 --- a/core/src/mindustry/entities/Damage.java +++ b/core/src/mindustry/entities/Damage.java @@ -225,14 +225,16 @@ public class Damage{ Units.nearby(rect, cons); } - if(!complete){ - int trad = (int)(radius / tilesize); - Tile tile = world.tileWorld(x, y); - if(tile != null){ - tileDamage(team, tile.x, tile.y, trad, damage); + if(ground){ + if(!complete){ + int trad = (int)(radius / tilesize); + Tile tile = world.tileWorld(x, y); + if(tile != null){ + tileDamage(team, tile.x, tile.y, trad, damage); + } + }else{ + completeDamage(team, x, y, radius, damage); } - }else{ - completeDamage(team, x, y, radius, damage); } } diff --git a/core/src/mindustry/entities/bullet/FlakBulletType.java b/core/src/mindustry/entities/bullet/FlakBulletType.java index edbf02184f..489f3e6c4e 100644 --- a/core/src/mindustry/entities/bullet/FlakBulletType.java +++ b/core/src/mindustry/entities/bullet/FlakBulletType.java @@ -29,7 +29,7 @@ public class FlakBulletType extends BasicBulletType{ if(b.timer(2, 6)){ Units.nearbyEnemies(b.team(), Tmp.r1.setSize(explodeRange * 2f).setCenter(b.x(), b.y()), unit -> { - if(b.data() instanceof Float || (unit.isFlying() && !collidesAir) || (unit.isGrounded() && !collidesGround)) return; + if(b.data() instanceof Float || !unit.checkTarget(collidesAir, collidesGround)) return; if(unit.dst(b) < explodeRange){ b.data(0); diff --git a/core/src/mindustry/entities/comp/BulletComp.java b/core/src/mindustry/entities/comp/BulletComp.java index 694426f5ad..a1d0233100 100644 --- a/core/src/mindustry/entities/comp/BulletComp.java +++ b/core/src/mindustry/entities/comp/BulletComp.java @@ -75,7 +75,7 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw @Override public boolean collides(Hitboxc other){ return type.collides && (other instanceof Teamc && ((Teamc)other).team() != team) - && !(other instanceof Flyingc && ((((Flyingc)other).isFlying() && !type.collidesAir) || (((Flyingc)other).isGrounded() && !type.collidesGround))) + && !(other instanceof Flyingc && !((Flyingc)other).checkTarget(type.collidesAir, type.collidesGround)) && !(type.pierce && collided.contains(other.id())); //prevent multiple collisions } @@ -107,7 +107,7 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw public void update(){ type.update(base()); - if(type.collidesTiles && type.collides){ + if(type.collidesTiles && type.collides && type.collidesGround){ world.raycastEach(world.toTile(lastX()), world.toTile(lastY()), tileX(), tileY(), (x, y) -> { Building tile = world.ent(x, y);