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;
/** List of block flags. Used for AI indexing. */
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;
/** How much this block affects the unit cap by.
* The block flags must contain unitModifier in order for this to work. */
@ -139,9 +139,9 @@ public class Block extends UnlockableContent{
public boolean consumesTap;
/** Whether to draw the glow of the liquid for this block, if it has one. */
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;
/** Whether this block uses conveyor-type placement mode.*/
/** Whether this block uses conveyor-type placement mode. */
public boolean conveyorPlacement;
/**
* 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. */
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;
/** Active sound base volume. */
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;
/** Idle sound base volume. */
public float ambientSoundVolume = 0.05f;
@ -193,6 +193,8 @@ public class Block extends UnlockableContent{
public BuildVisibility buildVisibility = BuildVisibility.hidden;
/** Multiplier for speed of building this block. */
public float buildCostMultiplier = 1f;
/** Build completion at which deconstruction finishes. */
public float deconstructThreshold = 0f;
/** Multiplier for cost of research in tech tree. */
public float researchCostMultiplier = 1;
/** Whether this block has instant transfer.*/

View File

@ -289,7 +289,7 @@ public class ConstructBlock extends Block{
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;
Call.deconstructFinish(tile, this.cblock == null ? previous : this.cblock, lastBuilder);
}

View File

@ -12,6 +12,8 @@ public class Boulder extends Block{
super(name);
breakable = true;
alwaysReplace = true;
deconstructThreshold = 0.35f;
}
@Override