Linear warmup for certain blocks

This commit is contained in:
Anuken
2021-07-08 19:33:15 -04:00
parent b8717b62c8
commit baabf49fba
4 changed files with 7 additions and 11 deletions

View File

@@ -162,7 +162,7 @@ public class BeamDrill extends Block{
if(lasers[0] == null) updateLasers(); if(lasers[0] == null) updateLasers();
boolean cons = shouldConsume(); boolean cons = shouldConsume();
warmup = Mathf.lerpDelta(warmup, Mathf.num(consValid()), 0.1f); warmup = Mathf.approachDelta(warmup, Mathf.num(consValid()), 1f / 60f);
lastItem = null; lastItem = null;
boolean multiple = false; boolean multiple = false;

View File

@@ -36,7 +36,7 @@ public class Drill extends Block{
/** How many times faster the drill will progress when boosted by liquid. */ /** How many times faster the drill will progress when boosted by liquid. */
public float liquidBoostIntensity = 1.6f; public float liquidBoostIntensity = 1.6f;
/** Speed at which the drill speeds up. */ /** Speed at which the drill speeds up. */
public float warmupSpeed = 0.02f; public float warmupSpeed = 0.015f;
//return variables for countOre //return variables for countOre
protected @Nullable Item returnItem; protected @Nullable Item returnItem;
@@ -266,14 +266,14 @@ public class Drill extends Block{
speed *= efficiency(); // Drill slower when not at full power speed *= efficiency(); // Drill slower when not at full power
lastDrillSpeed = (speed * dominantItems * warmup) / (drillTime + hardnessDrillMultiplier * dominantItem.hardness); lastDrillSpeed = (speed * dominantItems * warmup) / (drillTime + hardnessDrillMultiplier * dominantItem.hardness);
warmup = Mathf.lerpDelta(warmup, speed, warmupSpeed); warmup = Mathf.approachDelta(warmup, speed, warmupSpeed);
progress += delta() * dominantItems * speed * warmup; progress += delta() * dominantItems * speed * warmup;
if(Mathf.chanceDelta(updateEffectChance * warmup)) if(Mathf.chanceDelta(updateEffectChance * warmup))
updateEffect.at(x + Mathf.range(size * 2f), y + Mathf.range(size * 2f)); updateEffect.at(x + Mathf.range(size * 2f), y + Mathf.range(size * 2f));
}else{ }else{
lastDrillSpeed = 0f; lastDrillSpeed = 0f;
warmup = Mathf.lerpDelta(warmup, 0f, warmupSpeed); warmup = Mathf.approachDelta(warmup, 0f, warmupSpeed);
return; return;
} }

View File

@@ -27,11 +27,7 @@ public class Incinerator extends Block{
@Override @Override
public void updateTile(){ public void updateTile(){
if(consValid() && efficiency() > 0.9f){ heat = Mathf.approachDelta(heat, consValid() && efficiency() > 0.9f ? 1f : 0f, 0.04f);
heat = Mathf.lerpDelta(heat, 1f, 0.04f);
}else{
heat = Mathf.lerpDelta(heat, 0f, 0.02f);
}
} }
@Override @Override

View File

@@ -148,7 +148,7 @@ public class WallCrafter extends Block{
boolean cons = shouldConsume(); boolean cons = shouldConsume();
warmup = Mathf.lerpDelta(warmup, Mathf.num(consValid()), 0.1f); warmup = Mathf.approachDelta(warmup, Mathf.num(consValid()), 1f / 40f);
float dx = Geometry.d4x(rotation) * 0.5f, dy = Geometry.d4y(rotation) * 0.5f; float dx = Geometry.d4x(rotation) * 0.5f, dy = Geometry.d4y(rotation) * 0.5f;
float eff = getEfficiency(tile.x, tile.y, rotation, dest -> { float eff = getEfficiency(tile.x, tile.y, rotation, dest -> {
@@ -157,7 +157,7 @@ public class WallCrafter extends Block{
updateEffect.at( updateEffect.at(
dest.worldx() + Mathf.range(3f) - dx * tilesize, dest.worldx() + Mathf.range(3f) - dx * tilesize,
dest.worldy() + Mathf.range(3f) - dy * tilesize, dest.worldy() + Mathf.range(3f) - dy * tilesize,
Tmp.c1.set(dest.block().mapColor).mul(1f) dest.block().mapColor
); );
} }
}, null); }, null);