Implemented Anuken/Mindustry-Suggestions/issues/3026
This commit is contained in:
@@ -91,6 +91,8 @@ public class BulletType extends Content implements Cloneable{
|
||||
public boolean collidesAir = true, collidesGround = true;
|
||||
/** Whether this bullet types collides with anything at all. */
|
||||
public boolean collides = true;
|
||||
/** If true, this projectile collides with non-surface floors. */
|
||||
public boolean collideFloor = 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. */
|
||||
|
||||
@@ -6,12 +6,14 @@ import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.game.Teams.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -137,6 +139,17 @@ 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){
|
||||
Tile tile = world.tile(x, y);
|
||||
if(tile == null || tile.floor().hasSurface() || tile.block() != Blocks.air){
|
||||
type.despawned(self());
|
||||
remove();
|
||||
hit = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(build != null && isAdded() && build.collide(self()) && type.testCollision(self(), build)
|
||||
&& !build.dead() && (type.collidesTeam || build.team != team) && !(type.pierceBuilding && hasCollided(build.id))){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user