mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-06 07:30:35 +07:00
Faster beryllium drilling with burst drills
This commit is contained in:
parent
6a5d7da4ae
commit
36ce1ea2af
@ -2754,7 +2754,6 @@ public class Blocks{
|
||||
|
||||
//TODO awful name
|
||||
largePlasmaBore = new BeamDrill("large-plasma-bore"){{
|
||||
//TODO requirements
|
||||
requirements(Category.production, with(Items.silicon, 100, Items.oxide, 25, Items.beryllium, 100, Items.tungsten, 70));
|
||||
consumePower(0.8f);
|
||||
drillTime = 110f;
|
||||
@ -2769,7 +2768,6 @@ public class Blocks{
|
||||
consumeLiquid(Liquids.nitrogen, 3f / 60f).boost();
|
||||
}};
|
||||
|
||||
//TODO should be crusher or something
|
||||
impactDrill = new BurstDrill("impact-drill"){{
|
||||
requirements(Category.production, with(Items.silicon, 70, Items.beryllium, 90, Items.graphite, 60));
|
||||
drillTime = 60f * 12f;
|
||||
@ -2783,13 +2781,14 @@ public class Blocks{
|
||||
blockedItem = Items.thorium;
|
||||
researchCostMultiplier = 0.5f;
|
||||
|
||||
drillMultipliers.put(Items.beryllium, 2.5f);
|
||||
|
||||
fogRadius = 4;
|
||||
|
||||
consumePower(160f / 60f);
|
||||
consumeLiquid(Liquids.water, 0.2f);
|
||||
}};
|
||||
|
||||
//TODO bad name
|
||||
eruptionDrill = new BurstDrill("eruption-drill"){{
|
||||
requirements(Category.production, with(Items.silicon, 200, Items.oxide, 20, Items.tungsten, 200, Items.thorium, 120));
|
||||
drillTime = 60f * 6f;
|
||||
@ -2811,6 +2810,8 @@ public class Blocks{
|
||||
glowColor.a = 0.6f;
|
||||
fogRadius = 5;
|
||||
|
||||
drillMultipliers.put(Items.beryllium, 2.5f);
|
||||
|
||||
//TODO different requirements
|
||||
consumePower(6f);
|
||||
consumeLiquids(LiquidStack.with(Liquids.hydrogen, 4f / 60f));
|
||||
|
@ -3,11 +3,13 @@ package mindustry.world.blocks.production;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
|
||||
public class BurstDrill extends Drill{
|
||||
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 glowColor = arrowColor.cpy();
|
||||
|
||||
/** Multipliers of drill speed for each item. Defaults to 1. */
|
||||
public ObjectFloatMap<Item> drillMultipliers = new ObjectFloatMap<>();
|
||||
|
||||
public BurstDrill(String name){
|
||||
super(name);
|
||||
|
||||
@ -40,6 +45,11 @@ public class BurstDrill extends Drill{
|
||||
return new TextureRegion[]{region, topRegion};
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDrillTime(Item item){
|
||||
return drillTime / drillMultipliers.get(item, 1f);
|
||||
}
|
||||
|
||||
public class BurstDrillBuild extends DrillBuild{
|
||||
//used so the lights don't fade out immediately
|
||||
public float smoothProgress = 0f;
|
||||
@ -57,6 +67,8 @@ public class BurstDrill extends Drill{
|
||||
dump(items.has(dominantItem) ? dominantItem : null);
|
||||
}
|
||||
|
||||
float drillTime = getDrillTime(dominantItem);
|
||||
|
||||
smoothProgress = Mathf.lerpDelta(smoothProgress, progress / (drillTime - 20f), 0.1f);
|
||||
|
||||
if(items.total() <= itemCapacity - dominantItems && dominantItems > 0 && efficiency > 0){
|
||||
|
@ -135,7 +135,7 @@ public class Drill extends Block{
|
||||
countOre(tile);
|
||||
|
||||
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;
|
||||
Draw.mixcol(Color.darkGray, 1f);
|
||||
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
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
@ -274,10 +278,12 @@ public class Drill extends Block{
|
||||
|
||||
timeDrilled += warmup * delta();
|
||||
|
||||
float delay = getDrillTime(dominantItem);
|
||||
|
||||
if(items.total() < itemCapacity && dominantItems > 0 && efficiency > 0){
|
||||
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);
|
||||
progress += delta() * dominantItems * speed * warmup;
|
||||
|
||||
@ -289,8 +295,6 @@ public class Drill extends Block{
|
||||
return;
|
||||
}
|
||||
|
||||
float delay = drillTime + hardnessDrillMultiplier * dominantItem.hardness;
|
||||
|
||||
if(dominantItems > 0 && progress >= delay && items.total() < itemCapacity){
|
||||
offload(dominantItem);
|
||||
|
||||
@ -302,7 +306,7 @@ public class Drill extends Block{
|
||||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user