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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

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

View File

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

View File

@@ -13,6 +13,7 @@ import mindustry.game.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.*; import mindustry.world.*;
import mindustry.world.meta.*; import mindustry.world.meta.*;
@@ -31,6 +32,8 @@ public class BeamDrill extends Block{
public int range = 5; public int range = 5;
public int tier = 1; public int tier = 1;
public float laserWidth = 0.65f; 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 Color sparkColor = Color.valueOf("fd9e81"), glowColor = Color.white;
public float glowIntensity = 0.2f, pulseIntensity = 0.07f; public float glowIntensity = 0.2f, pulseIntensity = 0.07f;
@@ -59,6 +62,14 @@ public class BeamDrill extends Block{
super.init(); 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 @Override
public boolean outputsItems(){ public boolean outputsItems(){
return true; return true;
@@ -80,6 +91,15 @@ public class BeamDrill extends Block{
Draw.rect(topRegion, plan.drawx(), plan.drawy(), plan.rotation * 90); 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 @Override
public void drawPlace(int x, int y, int rotation, boolean valid){ public void drawPlace(int x, int y, int rotation, boolean valid){
Item item = null, invalidItem = null; Item item = null, invalidItem = null;
@@ -166,6 +186,7 @@ public class BeamDrill extends Block{
public float time; public float time;
public float warmup; public float warmup;
public float lastDrillSpeed;
@Override @Override
public void drawSelect(){ public void drawSelect(){
@@ -188,7 +209,7 @@ public class BeamDrill extends Block{
warmup = Mathf.approachDelta(warmup, Mathf.num(consValid()), 1f / 60f); warmup = Mathf.approachDelta(warmup, Mathf.num(consValid()), 1f / 60f);
lastItem = null; lastItem = null;
boolean multiple = false; 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 //update facing tiles
for(int p = 0; p < size; p++){ for(int p = 0; p < size; p++){
@@ -201,6 +222,7 @@ public class BeamDrill extends Block{
if(other.solid()){ if(other.solid()){
Item drop = other.wallDrop(); Item drop = other.wallDrop();
if(drop != null && drop.hardness <= tier){ if(drop != null && drop.hardness <= tier){
facingAmount ++;
if(lastItem != drop && lastItem != null){ if(lastItem != drop && lastItem != null){
multiple = true; multiple = true;
} }
@@ -220,7 +242,15 @@ public class BeamDrill extends Block{
lastItem = null; lastItem = null;
} }
time += edelta(); float multiplier = 1f;
if(cons.optionalValid()){
multiplier *= optionalBoostIntensity;
}
lastDrillSpeed = (facingAmount * multiplier * timeScale) / drillTime;
time += edelta() * multiplier;
if(time >= drillTime){ if(time >= drillTime){
for(Tile tile : facing){ for(Tile tile : facing){