Better target priority + underBullets for pierce
This commit is contained in:
@@ -3,7 +3,8 @@ package mindustry.entities;
|
||||
/** Higher priority blocks will always get targeted over those of lower priority, regardless of distance. */
|
||||
public class TargetPriority{
|
||||
public static final float
|
||||
wall = -1f,
|
||||
wall = -2f,
|
||||
transport = -1f,
|
||||
base = 0f,
|
||||
constructing = 1f,
|
||||
turret = 2f,
|
||||
|
||||
@@ -559,6 +559,8 @@ public class BulletType extends Content implements Cloneable{
|
||||
bullet.owner = owner;
|
||||
bullet.team = team;
|
||||
bullet.time = 0f;
|
||||
bullet.originX = x;
|
||||
bullet.originY = y;
|
||||
bullet.aimTile = world.tileWorld(aimX, aimY);
|
||||
bullet.initVel(angle, speed * velocityScl);
|
||||
if(backMove){
|
||||
|
||||
@@ -38,6 +38,7 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
|
||||
private float rotation;
|
||||
|
||||
transient @Nullable Tile aimTile;
|
||||
transient float originX, originY;
|
||||
transient @Nullable Mover mover;
|
||||
transient boolean absorbed, hit;
|
||||
transient @Nullable Trail trail;
|
||||
@@ -177,7 +178,12 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
|
||||
if(build != null && isAdded() &&
|
||||
//should underBullet detection be disabled for piercing bullets?
|
||||
//|| type.pierceBuilding
|
||||
(!build.block.underBullets || (aimTile != null && aimTile.build == build))
|
||||
(!build.block.underBullets ||
|
||||
//direct hit on correct tile
|
||||
(aimTile != null && aimTile.build == build) ||
|
||||
//a piercing bullet overshot the aim tile, it's fine to hit things now
|
||||
(type.pierce && aimTile != null && dst(originX, originY) > aimTile.dst(originX, originY) + 2f))
|
||||
|
||||
&& 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