This commit is contained in:
Anuken
2021-03-01 13:06:47 -05:00
parent 1de4dd1bfe
commit 05dc13c922
12 changed files with 25 additions and 2 deletions

View File

@@ -256,6 +256,10 @@ public class Block extends UnlockableContent{
/** Drawn when you are placing a block. */
public void drawPlace(int x, int y, int rotation, boolean valid){
drawPotentialLinks(x, y);
}
public void drawPotentialLinks(int x, int y){
if((consumesPower || outputsPower) && hasPower){
Tile tile = world.tile(x, y);
if(tile != null){

View File

@@ -41,6 +41,8 @@ public class BaseTurret extends Block{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
super.drawPlace(x, y, rotation, valid);
Drawf.dashCircle(x * tilesize + offset, y * tilesize + offset, range, Pal.placing);
}

View File

@@ -90,6 +90,8 @@ public class ItemBridge extends Block{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
super.drawPlace(x, y, rotation, valid);
Tile link = findLink(x, y);
Lines.stroke(2f, Pal.placing);

View File

@@ -57,6 +57,8 @@ public class MassDriver extends Block{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
super.drawPlace(x, y, rotation, valid);
Drawf.dashCircle(x * tilesize, y * tilesize, range, Pal.accent);
//check if a mass driver is selected while placing this driver

View File

@@ -263,7 +263,8 @@ public class PowerNode extends PowerBlock{
//add conducting graphs to prevent double link
for(var p : Edges.getEdges(block.size)){
Tile other = tile.nearby(p);
if(other != null && other.team() == team && other.build != null && other.build.power != null){
if(other != null && other.team() == team && other.build != null && other.build.power != null
&& !(block.consumesPower && other.block().consumesPower && !block.outputsPower && !other.block().outputsPower)){
graphs.add(other.build.power.graph);
}
}

View File

@@ -27,6 +27,8 @@ public class ThermalGenerator extends PowerGenerator{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
super.drawPlace(x, y, rotation, valid);
drawPlaceText(Core.bundle.formatFloat("bar.efficiency", sumAttribute(attribute, x, y) * 100, 1), x, y, valid);
}

View File

@@ -47,6 +47,8 @@ public class Cultivator extends GenericCrafter{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
super.drawPlace(x, y, rotation, valid);
drawPlaceText(Core.bundle.formatFloat("bar.efficiency", (1 + sumAttribute(attribute, x, y)) * 100, 1), x, y, valid);
}

View File

@@ -113,6 +113,8 @@ public class Drill extends Block{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
super.drawPlace(x, y, rotation, valid);
Tile tile = world.tile(x, y);
if(tile == null) return;

View File

@@ -31,6 +31,8 @@ public class Pump extends LiquidBlock{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
super.drawPlace(x, y, rotation, valid);
Tile tile = world.tile(x, y);
if(tile == null) return;

View File

@@ -35,6 +35,8 @@ public class SolidPump extends Pump{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
drawPotentialLinks(x, y);
if(attribute != null){
drawPlaceText(Core.bundle.formatFloat("bar.efficiency", Math.max(sumAttribute(attribute, x, y) / size / size + baseEfficiency, 0f) * 100 * percentSolid(x, y), 1), x, y, valid);
}

View File

@@ -56,6 +56,8 @@ public class RepairPoint extends Block{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
super.drawPlace(x, y, rotation, valid);
Drawf.dashCircle(x * tilesize + offset, y * tilesize + offset, repairRadius, Pal.accent);
}