@@ -93,6 +93,8 @@ public class BulletType extends Content implements Cloneable{
|
|||||||
public boolean collides = true;
|
public boolean collides = true;
|
||||||
/** If true, this projectile collides with non-surface floors. */
|
/** If true, this projectile collides with non-surface floors. */
|
||||||
public boolean collideFloor = false;
|
public boolean collideFloor = false;
|
||||||
|
/** If true, this projectile collides with static walls */
|
||||||
|
public boolean collideTerrain = false;
|
||||||
/** Whether velocity is inherited from the shooter. */
|
/** Whether velocity is inherited from the shooter. */
|
||||||
public boolean keepVelocity = true;
|
public boolean keepVelocity = true;
|
||||||
/** Whether to scale lifetime (not actually velocity!) to disappear at the target position. Used for artillery. */
|
/** Whether to scale lifetime (not actually velocity!) to disappear at the target position. Used for artillery. */
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import mindustry.game.Teams.*;
|
|||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
import mindustry.world.blocks.environment.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
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){
|
while(x >= 0 && y >= 0 && x < ww && y < wh){
|
||||||
Building build = world.build(x, y);
|
Building build = world.build(x, y);
|
||||||
|
|
||||||
if(type.collideFloor){
|
if(type.collideFloor || type.collideTerrain){
|
||||||
Tile tile = world.tile(x, y);
|
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());
|
type.despawned(self());
|
||||||
remove();
|
remove();
|
||||||
hit = true;
|
hit = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user