Faster beryllium drilling with burst drills
This commit is contained in:
@@ -2754,7 +2754,6 @@ public class Blocks{
|
|||||||
|
|
||||||
//TODO awful name
|
//TODO awful name
|
||||||
largePlasmaBore = new BeamDrill("large-plasma-bore"){{
|
largePlasmaBore = new BeamDrill("large-plasma-bore"){{
|
||||||
//TODO requirements
|
|
||||||
requirements(Category.production, with(Items.silicon, 100, Items.oxide, 25, Items.beryllium, 100, Items.tungsten, 70));
|
requirements(Category.production, with(Items.silicon, 100, Items.oxide, 25, Items.beryllium, 100, Items.tungsten, 70));
|
||||||
consumePower(0.8f);
|
consumePower(0.8f);
|
||||||
drillTime = 110f;
|
drillTime = 110f;
|
||||||
@@ -2769,7 +2768,6 @@ public class Blocks{
|
|||||||
consumeLiquid(Liquids.nitrogen, 3f / 60f).boost();
|
consumeLiquid(Liquids.nitrogen, 3f / 60f).boost();
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//TODO should be crusher or something
|
|
||||||
impactDrill = new BurstDrill("impact-drill"){{
|
impactDrill = new BurstDrill("impact-drill"){{
|
||||||
requirements(Category.production, with(Items.silicon, 70, Items.beryllium, 90, Items.graphite, 60));
|
requirements(Category.production, with(Items.silicon, 70, Items.beryllium, 90, Items.graphite, 60));
|
||||||
drillTime = 60f * 12f;
|
drillTime = 60f * 12f;
|
||||||
@@ -2783,13 +2781,14 @@ public class Blocks{
|
|||||||
blockedItem = Items.thorium;
|
blockedItem = Items.thorium;
|
||||||
researchCostMultiplier = 0.5f;
|
researchCostMultiplier = 0.5f;
|
||||||
|
|
||||||
|
drillMultipliers.put(Items.beryllium, 2.5f);
|
||||||
|
|
||||||
fogRadius = 4;
|
fogRadius = 4;
|
||||||
|
|
||||||
consumePower(160f / 60f);
|
consumePower(160f / 60f);
|
||||||
consumeLiquid(Liquids.water, 0.2f);
|
consumeLiquid(Liquids.water, 0.2f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//TODO bad name
|
|
||||||
eruptionDrill = new BurstDrill("eruption-drill"){{
|
eruptionDrill = new BurstDrill("eruption-drill"){{
|
||||||
requirements(Category.production, with(Items.silicon, 200, Items.oxide, 20, Items.tungsten, 200, Items.thorium, 120));
|
requirements(Category.production, with(Items.silicon, 200, Items.oxide, 20, Items.tungsten, 200, Items.thorium, 120));
|
||||||
drillTime = 60f * 6f;
|
drillTime = 60f * 6f;
|
||||||
@@ -2811,6 +2810,8 @@ public class Blocks{
|
|||||||
glowColor.a = 0.6f;
|
glowColor.a = 0.6f;
|
||||||
fogRadius = 5;
|
fogRadius = 5;
|
||||||
|
|
||||||
|
drillMultipliers.put(Items.beryllium, 2.5f);
|
||||||
|
|
||||||
//TODO different requirements
|
//TODO different requirements
|
||||||
consumePower(6f);
|
consumePower(6f);
|
||||||
consumeLiquids(LiquidStack.with(Liquids.hydrogen, 4f / 60f));
|
consumeLiquids(LiquidStack.with(Liquids.hydrogen, 4f / 60f));
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ package mindustry.world.blocks.production;
|
|||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
|
import mindustry.type.*;
|
||||||
|
|
||||||
public class BurstDrill extends Drill{
|
public class BurstDrill extends Drill{
|
||||||
public float shake = 2f;
|
public float shake = 2f;
|
||||||
@@ -24,6 +26,9 @@ public class BurstDrill extends Drill{
|
|||||||
public Color arrowColor = Color.valueOf("feb380"), baseArrowColor = Color.valueOf("6e7080");
|
public Color arrowColor = Color.valueOf("feb380"), baseArrowColor = Color.valueOf("6e7080");
|
||||||
public Color glowColor = arrowColor.cpy();
|
public Color glowColor = arrowColor.cpy();
|
||||||
|
|
||||||
|
/** Multipliers of drill speed for each item. Defaults to 1. */
|
||||||
|
public ObjectFloatMap<Item> drillMultipliers = new ObjectFloatMap<>();
|
||||||
|
|
||||||
public BurstDrill(String name){
|
public BurstDrill(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|
||||||
@@ -40,6 +45,11 @@ public class BurstDrill extends Drill{
|
|||||||
return new TextureRegion[]{region, topRegion};
|
return new TextureRegion[]{region, topRegion};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getDrillTime(Item item){
|
||||||
|
return drillTime / drillMultipliers.get(item, 1f);
|
||||||
|
}
|
||||||
|
|
||||||
public class BurstDrillBuild extends DrillBuild{
|
public class BurstDrillBuild extends DrillBuild{
|
||||||
//used so the lights don't fade out immediately
|
//used so the lights don't fade out immediately
|
||||||
public float smoothProgress = 0f;
|
public float smoothProgress = 0f;
|
||||||
@@ -57,6 +67,8 @@ public class BurstDrill extends Drill{
|
|||||||
dump(items.has(dominantItem) ? dominantItem : null);
|
dump(items.has(dominantItem) ? dominantItem : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float drillTime = getDrillTime(dominantItem);
|
||||||
|
|
||||||
smoothProgress = Mathf.lerpDelta(smoothProgress, progress / (drillTime - 20f), 0.1f);
|
smoothProgress = Mathf.lerpDelta(smoothProgress, progress / (drillTime - 20f), 0.1f);
|
||||||
|
|
||||||
if(items.total() <= itemCapacity - dominantItems && dominantItems > 0 && efficiency > 0){
|
if(items.total() <= itemCapacity - dominantItems && dominantItems > 0 && efficiency > 0){
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ public class Drill extends Block{
|
|||||||
countOre(tile);
|
countOre(tile);
|
||||||
|
|
||||||
if(returnItem != null){
|
if(returnItem != null){
|
||||||
float width = drawPlaceText(Core.bundle.formatFloat("bar.drillspeed", 60f / (drillTime + hardnessDrillMultiplier * returnItem.hardness) * returnCount, 2), x, y, valid);
|
float width = drawPlaceText(Core.bundle.formatFloat("bar.drillspeed", 60f / getDrillTime(returnItem) * returnCount, 2), x, y, valid);
|
||||||
float dx = x * tilesize + offset - width/2f - 4f, dy = y * tilesize + offset + size * tilesize / 2f + 5, s = iconSmall / 4f;
|
float dx = x * tilesize + offset - width/2f - 4f, dy = y * tilesize + offset + size * tilesize / 2f + 5, s = iconSmall / 4f;
|
||||||
Draw.mixcol(Color.darkGray, 1f);
|
Draw.mixcol(Color.darkGray, 1f);
|
||||||
Draw.rect(returnItem.fullIcon, dx, dy - 1, s, s);
|
Draw.rect(returnItem.fullIcon, dx, dy - 1, s, s);
|
||||||
@@ -156,6 +156,10 @@ public class Drill extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getDrillTime(Item item){
|
||||||
|
return drillTime + hardnessDrillMultiplier * item.hardness;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStats(){
|
public void setStats(){
|
||||||
super.setStats();
|
super.setStats();
|
||||||
@@ -274,10 +278,12 @@ public class Drill extends Block{
|
|||||||
|
|
||||||
timeDrilled += warmup * delta();
|
timeDrilled += warmup * delta();
|
||||||
|
|
||||||
|
float delay = getDrillTime(dominantItem);
|
||||||
|
|
||||||
if(items.total() < itemCapacity && dominantItems > 0 && efficiency > 0){
|
if(items.total() < itemCapacity && dominantItems > 0 && efficiency > 0){
|
||||||
float speed = Mathf.lerp(1f, liquidBoostIntensity, optionalEfficiency) * efficiency;
|
float speed = Mathf.lerp(1f, liquidBoostIntensity, optionalEfficiency) * efficiency;
|
||||||
|
|
||||||
lastDrillSpeed = (speed * dominantItems * warmup) / (drillTime + hardnessDrillMultiplier * dominantItem.hardness);
|
lastDrillSpeed = (speed * dominantItems * warmup) / delay;
|
||||||
warmup = Mathf.approachDelta(warmup, speed, warmupSpeed);
|
warmup = Mathf.approachDelta(warmup, speed, warmupSpeed);
|
||||||
progress += delta() * dominantItems * speed * warmup;
|
progress += delta() * dominantItems * speed * warmup;
|
||||||
|
|
||||||
@@ -289,8 +295,6 @@ public class Drill extends Block{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float delay = drillTime + hardnessDrillMultiplier * dominantItem.hardness;
|
|
||||||
|
|
||||||
if(dominantItems > 0 && progress >= delay && items.total() < itemCapacity){
|
if(dominantItems > 0 && progress >= delay && items.total() < itemCapacity){
|
||||||
offload(dominantItem);
|
offload(dominantItem);
|
||||||
|
|
||||||
@@ -302,7 +306,7 @@ public class Drill extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double sense(LAccess sensor){
|
public double sense(LAccess sensor){
|
||||||
if(sensor == LAccess.progress && dominantItem != null) return Mathf.clamp(progress / (drillTime + hardnessDrillMultiplier * dominantItem.hardness));
|
if(sensor == LAccess.progress && dominantItem != null) return Mathf.clamp(progress / getDrillTime(dominantItem));
|
||||||
return super.sense(sensor);
|
return super.sense(sensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user