From baabf49fbaa9e4f3dfa0d29d3a35d60a52f68923 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 8 Jul 2021 19:33:15 -0400 Subject: [PATCH] Linear warmup for certain blocks --- core/src/mindustry/world/blocks/production/BeamDrill.java | 2 +- core/src/mindustry/world/blocks/production/Drill.java | 6 +++--- core/src/mindustry/world/blocks/production/Incinerator.java | 6 +----- core/src/mindustry/world/blocks/production/WallCrafter.java | 4 ++-- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/core/src/mindustry/world/blocks/production/BeamDrill.java b/core/src/mindustry/world/blocks/production/BeamDrill.java index 37d9ccd8a5..f210e774ae 100644 --- a/core/src/mindustry/world/blocks/production/BeamDrill.java +++ b/core/src/mindustry/world/blocks/production/BeamDrill.java @@ -162,7 +162,7 @@ public class BeamDrill extends Block{ if(lasers[0] == null) updateLasers(); boolean cons = shouldConsume(); - warmup = Mathf.lerpDelta(warmup, Mathf.num(consValid()), 0.1f); + warmup = Mathf.approachDelta(warmup, Mathf.num(consValid()), 1f / 60f); lastItem = null; boolean multiple = false; diff --git a/core/src/mindustry/world/blocks/production/Drill.java b/core/src/mindustry/world/blocks/production/Drill.java index b833d9be9d..c7ab619a96 100644 --- a/core/src/mindustry/world/blocks/production/Drill.java +++ b/core/src/mindustry/world/blocks/production/Drill.java @@ -36,7 +36,7 @@ public class Drill extends Block{ /** How many times faster the drill will progress when boosted by liquid. */ public float liquidBoostIntensity = 1.6f; /** Speed at which the drill speeds up. */ - public float warmupSpeed = 0.02f; + public float warmupSpeed = 0.015f; //return variables for countOre protected @Nullable Item returnItem; @@ -266,14 +266,14 @@ public class Drill extends Block{ speed *= efficiency(); // Drill slower when not at full power 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; if(Mathf.chanceDelta(updateEffectChance * warmup)) updateEffect.at(x + Mathf.range(size * 2f), y + Mathf.range(size * 2f)); }else{ lastDrillSpeed = 0f; - warmup = Mathf.lerpDelta(warmup, 0f, warmupSpeed); + warmup = Mathf.approachDelta(warmup, 0f, warmupSpeed); return; } diff --git a/core/src/mindustry/world/blocks/production/Incinerator.java b/core/src/mindustry/world/blocks/production/Incinerator.java index 35765f6961..148d1ca4a8 100644 --- a/core/src/mindustry/world/blocks/production/Incinerator.java +++ b/core/src/mindustry/world/blocks/production/Incinerator.java @@ -27,11 +27,7 @@ public class Incinerator extends Block{ @Override public void updateTile(){ - if(consValid() && efficiency() > 0.9f){ - heat = Mathf.lerpDelta(heat, 1f, 0.04f); - }else{ - heat = Mathf.lerpDelta(heat, 0f, 0.02f); - } + heat = Mathf.approachDelta(heat, consValid() && efficiency() > 0.9f ? 1f : 0f, 0.04f); } @Override diff --git a/core/src/mindustry/world/blocks/production/WallCrafter.java b/core/src/mindustry/world/blocks/production/WallCrafter.java index f4bf3d67c9..c93ea43c31 100644 --- a/core/src/mindustry/world/blocks/production/WallCrafter.java +++ b/core/src/mindustry/world/blocks/production/WallCrafter.java @@ -148,7 +148,7 @@ public class WallCrafter extends Block{ 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 eff = getEfficiency(tile.x, tile.y, rotation, dest -> { @@ -157,7 +157,7 @@ public class WallCrafter extends Block{ updateEffect.at( dest.worldx() + Mathf.range(3f) - dx * tilesize, dest.worldy() + Mathf.range(3f) - dy * tilesize, - Tmp.c1.set(dest.block().mapColor).mul(1f) + dest.block().mapColor ); } }, null);