Merge pull request #3722 from Quezler/patch-77

Fast forward boulder deconstruction
This commit is contained in:
Anuken
2020-12-02 12:58:58 -05:00
committed by GitHub
3 changed files with 10 additions and 6 deletions
+2
View File
@@ -193,6 +193,8 @@ public class Block extends UnlockableContent{
public BuildVisibility buildVisibility = BuildVisibility.hidden; public BuildVisibility buildVisibility = BuildVisibility.hidden;
/** Multiplier for speed of building this block. */ /** Multiplier for speed of building this block. */
public float buildCostMultiplier = 1f; public float buildCostMultiplier = 1f;
/** Build completion at which deconstruction finishes. */
public float deconstructThreshold = 0f;
/** Multiplier for cost of research in tech tree. */ /** Multiplier for cost of research in tech tree. */
public float researchCostMultiplier = 1; public float researchCostMultiplier = 1;
/** Whether this block has instant transfer.*/ /** Whether this block has instant transfer.*/
@@ -289,7 +289,7 @@ public class ConstructBlock extends Block{
progress = Mathf.clamp(progress - amount); progress = Mathf.clamp(progress - amount);
if(progress <= 0 || state.rules.infiniteResources){ if(progress <= (previous == null ? 0 : previous.deconstructThreshold) || state.rules.infiniteResources){
if(lastBuilder == null) lastBuilder = builder; if(lastBuilder == null) lastBuilder = builder;
Call.deconstructFinish(tile, this.cblock == null ? previous : this.cblock, lastBuilder); Call.deconstructFinish(tile, this.cblock == null ? previous : this.cblock, lastBuilder);
} }
@@ -12,6 +12,8 @@ public class Boulder extends Block{
super(name); super(name);
breakable = true; breakable = true;
alwaysReplace = true; alwaysReplace = true;
deconstructThreshold = 0.35f;
} }
@Override @Override