underBullet for ducts and related blocks
This commit is contained in:
@@ -50,7 +50,7 @@ import static mindustry.Vars.*;
|
||||
@Component(base = true)
|
||||
abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, QuadTreeObject, Displayable, Senseable, Controllable, Sized{
|
||||
//region vars and initialization
|
||||
static final float timeToSleep = 60f * 1, timeToUncontrol = 60f * 6;
|
||||
static final float timeToSleep = 60f * 1, recentDamageTime = 60f * 5f;
|
||||
static final ObjectSet<Building> tmpTiles = new ObjectSet<>();
|
||||
static final Seq<Building> tempBuilds = new Seq<>();
|
||||
static final BuildTeamChangeEvent teamChangeEvent = new BuildTeamChangeEvent();
|
||||
@@ -91,6 +91,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
transient float healSuppressionTime = -1f;
|
||||
transient float lastHealTime = -120f * 10f;
|
||||
|
||||
private transient float lastDamageTime = -recentDamageTime;
|
||||
private transient float timeScale = 1f, timeScaleDuration;
|
||||
private transient float dumpAccum;
|
||||
|
||||
@@ -406,6 +407,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
return lastHealTime + duration >= Time.time;
|
||||
}
|
||||
|
||||
public boolean wasRecentlyDamaged(){
|
||||
return lastDamageTime + recentDamageTime >= Time.time;
|
||||
}
|
||||
|
||||
public Building nearby(int dx, int dy){
|
||||
return world.build(tile.x + dx, tile.y + dy);
|
||||
}
|
||||
@@ -1781,6 +1786,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
if(dead()) return;
|
||||
|
||||
float dm = state.rules.blockHealth(team);
|
||||
lastDamageTime = Time.time;
|
||||
|
||||
if(Mathf.zero(dm)){
|
||||
damage = health + 1;
|
||||
|
||||
@@ -37,6 +37,7 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
|
||||
@ReadOnly
|
||||
private float rotation;
|
||||
|
||||
transient @Nullable Tile aimTile;
|
||||
transient @Nullable Mover mover;
|
||||
transient boolean absorbed, hit;
|
||||
transient @Nullable Trail trail;
|
||||
@@ -173,7 +174,11 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
|
||||
}
|
||||
}
|
||||
|
||||
if(build != null && isAdded() && build.collide(self()) && type.testCollision(self(), build)
|
||||
if(build != null && isAdded() &&
|
||||
//should underBullet detection be disabled for piercing bullets?
|
||||
//|| type.pierceBuilding
|
||||
(!build.block.underBullets || (aimTile != null && aimTile.build == build))
|
||||
&& build.collide(self()) && type.testCollision(self(), build)
|
||||
&& !build.dead() && (type.collidesTeam || build.team != team) && !(type.pierceBuilding && hasCollided(build.id))){
|
||||
|
||||
boolean remove = false;
|
||||
|
||||
Reference in New Issue
Block a user