Supression system improvements

This commit is contained in:
Anuken
2022-02-05 21:59:38 -05:00
parent 28b2d5d6f7
commit 5fd139261f
7 changed files with 29 additions and 19 deletions
+1 -3
View File
@@ -14,8 +14,6 @@ import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.blocks.defense.MendProjector.*;
import mindustry.world.blocks.defense.RegenProjector.*;
import static mindustry.Vars.*;
@@ -40,7 +38,7 @@ public class Damage{
build.applyHealSuppression(reload + 1f);
//TODO maybe should be block field instead of instanceof check
if(build.wasRecentlyHealed(60f * 12f) || (build instanceof MendBuild || build instanceof RegenProjectorBuild)){
if(build.wasRecentlyHealed(60f * 12f) || build.block.suppressable){
//add prev check so ability spam doesn't lead to particle spam (essentially, recently suppressed blocks don't get new particles)
if(!headless && prev - Time.time <= reload/2f){
@@ -1100,6 +1100,19 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
Draw.color();
}
/** @return whether a building has regen/healing suppressed; if so, spawns particles on it. */
public boolean checkSuppression(){
if(isHealSuppressed()){
if(Mathf.chanceDelta(0.03)){
Fx.regenSuppressParticle.at(x + Mathf.range(block.size * tilesize/2f - 1f), y + Mathf.range(block.size * tilesize/2f - 1f));
}
return true;
}
return false;
}
/** Called after the block is placed by this client. */
@CallSuper
public void playerPlaced(Object config){