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
+2
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.*/
@@ -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();
@@ -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);
@@ -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;
}