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

View File

@@ -1679,7 +1679,7 @@ public class Blocks{
requirements(Category.effect, with(Items.silicon, 80, Items.carbide, 30, Items.oxide, 40, Items.thorium, 30));
outlineColor = Pal.darkOutline;
consumes.power(3f);
range = 150f;
range = 160f;
size = 3;
buildSpeed = 1.5f;
}};

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){

View File

@@ -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){

View File

@@ -208,6 +208,8 @@ public class Block extends UnlockableContent{
public boolean hasColor = false;
/** Whether units target this block. */
public boolean targetable = true;
/** If true, this block is mending-related and can be suppressed with special units/missiles. */
public boolean suppressable = false;
/** Whether the overdrive core has any effect on this block. */
public boolean canOverdrive = true;
/** Outlined icon color.*/

View File

@@ -40,6 +40,7 @@ public class BuildTurret extends BaseTurret{
group = BlockGroup.turrets;
sync = false;
rotateSpeed = 10f;
suppressable = true;
}
@Override
@@ -105,6 +106,8 @@ public class BuildTurret extends BaseTurret{
unit.lookAt(angleTo(unit.buildPlan()));
}
checkSuppression();
unit.buildSpeedMultiplier(efficiency() * timeScale);
unit.speedMultiplier(efficiency() * timeScale);
@@ -200,6 +203,11 @@ public class BuildTurret extends BaseTurret{
unit.buildSpeedMultiplier(Math.max(unit.buildSpeedMultiplier(), 0.00001f));
}
@Override
public float efficiency(){
return super.efficiency() * (isHealSuppressed() ? 0f : 1f);
}
@Override
public boolean shouldConsume(){
return super.shouldConsume() && unit.activelyBuilding();

View File

@@ -36,6 +36,7 @@ public class MendProjector extends Block{
hasItems = true;
emitLight = true;
lightRadius = 50f;
suppressable = true;
envEnabled |= Env.space;
}
@@ -65,19 +66,6 @@ public class MendProjector extends Block{
indexer.eachBlock(player.team(), x * tilesize + offset, y * tilesize + offset, range, other -> true, other -> Drawf.selected(other, Tmp.c1.set(baseColor).a(Mathf.absin(4f, 1f))));
}
/** @return whether a building has regen/healing suppressed; if so, spawns particles on it. */
public static boolean checkSuppression(Building build){
if(build.isHealSuppressed()){
if(Mathf.chanceDelta(0.03)){
Fx.regenSuppressParticle.at(build.x + Mathf.range(build.block.size * tilesize/2f - 1f), build.y + Mathf.range(build.block.size * tilesize/2f - 1f));
}
return true;
}
return false;
}
public class MendBuild extends Building implements Ranged{
public float heat, charge = Mathf.random(reload), phaseHeat, smoothEfficiency;
@@ -88,7 +76,7 @@ public class MendProjector extends Block{
@Override
public void updateTile(){
boolean canHeal = !checkSuppression(this);
boolean canHeal = !checkSuppression();
smoothEfficiency = Mathf.lerpDelta(smoothEfficiency, efficiency(), 0.08f);
heat = Mathf.lerpDelta(heat, consValid() && canHeal ? 1f : 0f, 0.08f);

View File

@@ -44,6 +44,7 @@ public class RegenProjector extends Block{
hasPower = true;
hasItems = true;
emitLight = true;
suppressable = true;
envEnabled |= Env.space;
rotateDraw = false;
}
@@ -117,7 +118,7 @@ public class RegenProjector extends Block{
didRegen = false;
//no healing when suppressed
if(MendProjector.checkSuppression(this)){
if(checkSuppression()){
return;
}