Supression system improvements
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user