Drill multipliers for regular drills and beam drills (#8339)

* Drill multipliers for other drills

* h
This commit is contained in:
MEEPofFaith 2023-03-08 06:19:57 -08:00 committed by GitHub
parent 29d4246019
commit 10e0be9d68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 5 deletions

View file

@ -42,6 +42,9 @@ public class BeamDrill extends Block{
/** How many times faster the drill will progress when boosted by an optional consumer. */
public float optionalBoostIntensity = 2.5f;
/** Multipliers of drill speed for each item. Defaults to 1. */
public ObjectFloatMap<Item> drillMultipliers = new ObjectFloatMap<>();
public Color sparkColor = Color.valueOf("fd9e81"), glowColor = Color.white;
public float glowIntensity = 0.2f, pulseIntensity = 0.07f;
public float glowScl = 3f;
@ -161,7 +164,7 @@ public class BeamDrill extends Block{
}
if(item != null){
float width = drawPlaceText(Core.bundle.formatFloat("bar.drillspeed", 60f / drillTime * count, 2), x, y, valid);
float width = drawPlaceText(Core.bundle.formatFloat("bar.drillspeed", 60f / getDrillTime(item) * count, 2), x, y, valid);
if(!multiple){
float dx = x * tilesize + offset - width/2f - 4f, dy = y * tilesize + offset + size * tilesize / 2f + 5, s = iconSmall / 4f;
Draw.mixcol(Color.darkGray, 1f);
@ -194,6 +197,10 @@ public class BeamDrill extends Block{
return false;
}
public float getDrillTime(Item item){
return drillTime / drillMultipliers.get(item, 1f);
}
public class BeamDrillBuild extends Building{
public Tile[] facing = new Tile[size];
public Point2[] lasers = new Point2[size];
@ -227,6 +234,7 @@ public class BeamDrill extends Block{
updateFacing();
float multiplier = Mathf.lerp(1f, optionalBoostIntensity, optionalEfficiency);
float drillTime = getDrillTime(lastItem);
boostWarmup = Mathf.lerpDelta(boostWarmup, optionalEfficiency, 0.1f);
lastDrillSpeed = (facingAmount * multiplier * timeScale) / drillTime;

View file

@ -31,9 +31,6 @@ public class BurstDrill extends Drill{
public Sound drillSound = Sounds.drillImpact;
public float drillSoundVolume = 0.6f, drillSoundPitchRand = 0.1f;
/** Multipliers of drill speed for each item. Defaults to 1. */
public ObjectFloatMap<Item> drillMultipliers = new ObjectFloatMap<>();
public BurstDrill(String name){
super(name);

View file

@ -59,6 +59,9 @@ public class Drill extends Block{
/** Chance the update effect will appear. */
public float updateEffectChance = 0.02f;
/** Multipliers of drill speed for each item. Defaults to 1. */
public ObjectFloatMap<Item> drillMultipliers = new ObjectFloatMap<>();
public boolean drawRim = false;
public boolean drawSpinSprite = true;
public Color heatColor = Color.valueOf("ff5512");
@ -160,7 +163,7 @@ public class Drill extends Block{
}
public float getDrillTime(Item item){
return drillTime + hardnessDrillMultiplier * item.hardness;
return (drillTime + hardnessDrillMultiplier * item.hardness) / drillMultipliers.get(item, 1f);
}
@Override