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
commit d4bee41103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

View File

@ -126,7 +126,7 @@ public class Block extends UnlockableContent{
public BlockGroup group = BlockGroup.none; public BlockGroup group = BlockGroup.none;
/** List of block flags. Used for AI indexing. */ /** List of block flags. Used for AI indexing. */
public EnumSet<BlockFlag> flags = EnumSet.of(); public EnumSet<BlockFlag> flags = EnumSet.of();
/** Targeting priority of this block, as seen by enemies.*/ /** Targeting priority of this block, as seen by enemies .*/
public TargetPriority priority = TargetPriority.base; public TargetPriority priority = TargetPriority.base;
/** How much this block affects the unit cap by. /** How much this block affects the unit cap by.
* The block flags must contain unitModifier in order for this to work. */ * The block flags must contain unitModifier in order for this to work. */
@ -139,9 +139,9 @@ public class Block extends UnlockableContent{
public boolean consumesTap; public boolean consumesTap;
/** Whether to draw the glow of the liquid for this block, if it has one. */ /** Whether to draw the glow of the liquid for this block, if it has one. */
public boolean drawLiquidLight = true; public boolean drawLiquidLight = true;
/** Whether to periodically sync this block across the network.*/ /** Whether to periodically sync this block across the network. */
public boolean sync; public boolean sync;
/** Whether this block uses conveyor-type placement mode.*/ /** Whether this block uses conveyor-type placement mode. */
public boolean conveyorPlacement; public boolean conveyorPlacement;
/** /**
* The color of this block when displayed on the minimap or map preview. * The color of this block when displayed on the minimap or map preview.
@ -173,12 +173,12 @@ public class Block extends UnlockableContent{
/** Radius of the light emitted by this block. */ /** Radius of the light emitted by this block. */
public float lightRadius = 60f; public float lightRadius = 60f;
/** The sound that this block makes while active. One sound loop. Do not overuse.*/ /** The sound that this block makes while active. One sound loop. Do not overuse. */
public Sound loopSound = Sounds.none; public Sound loopSound = Sounds.none;
/** Active sound base volume. */ /** Active sound base volume. */
public float loopSoundVolume = 0.5f; public float loopSoundVolume = 0.5f;
/** The sound that this block makes while idle. Uses one sound loop for all blocks.*/ /** The sound that this block makes while idle. Uses one sound loop for all blocks. */
public Sound ambientSound = Sounds.none; public Sound ambientSound = Sounds.none;
/** Idle sound base volume. */ /** Idle sound base volume. */
public float ambientSoundVolume = 0.05f; public float ambientSoundVolume = 0.05f;
@ -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.*/

View File

@ -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);
} }

View File

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