Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken 2021-09-27 19:02:10 -04:00
commit f5a0528c73
2 changed files with 8 additions and 2 deletions

View File

@ -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. */

View File

@ -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;