Optional beam drill liquid input / Fixed graphite color

This commit is contained in:
Anuken
2021-11-20 10:15:55 -05:00
parent 0d197fa00c
commit a39d156d12
4 changed files with 37 additions and 3 deletions

View File

@@ -1950,6 +1950,8 @@ public class Blocks implements ContentList{
tier = 4;
size = 2;
range = 3; //TODO make it 2?
consumes.liquid(Liquids.hydrogen, 1f / 60f).boost();
}};
//TODO awful name
@@ -1963,6 +1965,8 @@ public class Blocks implements ContentList{
size = 3;
range = 6;
laserWidth = 0.7f;
consumes.liquid(Liquids.hydrogen, 2f / 60f).boost();
}};
//endregion

View File

@@ -28,7 +28,7 @@ public class Items implements ContentList{
cost = 1.5f;
}};
graphite = new Item("graphite", Color.valueOf("b2c6d2")){{
graphite = new Item("graphite", Color.valueOf("95abd9")){{
cost = 1f;
}};

View File

@@ -13,6 +13,7 @@ import mindustry.game.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.*;
import mindustry.world.meta.*;
@@ -31,6 +32,8 @@ public class BeamDrill extends Block{
public int range = 5;
public int tier = 1;
public float laserWidth = 0.65f;
/** How many times faster the drill will progress when boosted by an optional consumer. */
public float optionalBoostIntensity = 2f;
public Color sparkColor = Color.valueOf("fd9e81"), glowColor = Color.white;
public float glowIntensity = 0.2f, pulseIntensity = 0.07f;
@@ -59,6 +62,14 @@ public class BeamDrill extends Block{
super.init();
}
@Override
public void setBars(){
super.setBars();
bars.add("drillspeed", (BeamDrillBuild e) ->
new Bar(() -> Core.bundle.format("bar.drillspeed", Strings.fixed(e.lastDrillSpeed * 60, 2)), () -> Pal.ammo, () -> e.warmup));
}
@Override
public boolean outputsItems(){
return true;
@@ -80,6 +91,15 @@ public class BeamDrill extends Block{
Draw.rect(topRegion, plan.drawx(), plan.drawy(), plan.rotation * 90);
}
@Override
public void setStats(){
super.setStats();
if(optionalBoostIntensity != 1){
stats.add(Stat.boostEffect, optionalBoostIntensity, StatUnit.timesSpeed);
}
}
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
Item item = null, invalidItem = null;
@@ -166,6 +186,7 @@ public class BeamDrill extends Block{
public float time;
public float warmup;
public float lastDrillSpeed;
@Override
public void drawSelect(){
@@ -188,7 +209,7 @@ public class BeamDrill extends Block{
warmup = Mathf.approachDelta(warmup, Mathf.num(consValid()), 1f / 60f);
lastItem = null;
boolean multiple = false;
int dx = Geometry.d4x(rotation), dy = Geometry.d4y(rotation);
int dx = Geometry.d4x(rotation), dy = Geometry.d4y(rotation), facingAmount = 0;
//update facing tiles
for(int p = 0; p < size; p++){
@@ -201,6 +222,7 @@ public class BeamDrill extends Block{
if(other.solid()){
Item drop = other.wallDrop();
if(drop != null && drop.hardness <= tier){
facingAmount ++;
if(lastItem != drop && lastItem != null){
multiple = true;
}
@@ -220,7 +242,15 @@ public class BeamDrill extends Block{
lastItem = null;
}
time += edelta();
float multiplier = 1f;
if(cons.optionalValid()){
multiplier *= optionalBoostIntensity;
}
lastDrillSpeed = (facingAmount * multiplier * timeScale) / drillTime;
time += edelta() * multiplier;
if(time >= drillTime){
for(Tile tile : facing){