diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index df4c835abd..062c8cc965 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -93,6 +93,8 @@ public class BulletType extends Content implements Cloneable{ public boolean collides = true; /** If true, this projectile collides with non-surface floors. */ public boolean collideFloor = false; + /** If true, this projectile collides with static walls */ + public boolean collideTerrain = false; /** Whether velocity is inherited from the shooter. */ public boolean keepVelocity = true; /** Whether to scale lifetime (not actually velocity!) to disappear at the target position. Used for artillery. */ diff --git a/core/src/mindustry/entities/comp/BulletComp.java b/core/src/mindustry/entities/comp/BulletComp.java index 5054694531..788cfaeb8c 100644 --- a/core/src/mindustry/entities/comp/BulletComp.java +++ b/core/src/mindustry/entities/comp/BulletComp.java @@ -14,6 +14,7 @@ import mindustry.game.Teams.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.world.*; +import mindustry.world.blocks.environment.*; import static mindustry.Vars.*; @@ -140,9 +141,12 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw while(x >= 0 && y >= 0 && x < ww && y < wh){ Building build = world.build(x, y); - if(type.collideFloor){ + if(type.collideFloor || type.collideTerrain){ Tile tile = world.tile(x, y); - if(tile == null || tile.floor().hasSurface() || tile.block() != Blocks.air){ + if( + type.collideFloor && (tile == null || tile.floor().hasSurface() || tile.block() != Blocks.air) || + type.collideTerrain && tile != null && tile.block() instanceof StaticWall + ){ type.despawned(self()); remove(); hit = true;