autolink 2
This commit is contained in:
@@ -175,7 +175,6 @@ public class MapEditor{
|
|||||||
|
|
||||||
world.setBlock(tile(x, y), drawBlock, drawTeam);
|
world.setBlock(tile(x, y), drawBlock, drawTeam);
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
boolean isFloor = drawBlock.isFloor() && drawBlock != Blocks.air;
|
boolean isFloor = drawBlock.isFloor() && drawBlock != Blocks.air;
|
||||||
|
|
||||||
Consumer<Tile> drawer = tile -> {
|
Consumer<Tile> drawer = tile -> {
|
||||||
|
|||||||
@@ -281,6 +281,10 @@ public class Block extends BlockStorage{
|
|||||||
Call.linkPowerNodes(null, tempTiles.first(), tile);
|
Call.linkPowerNodes(null, tempTiles.first(), tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(outputsPower && !consumesPower){
|
||||||
|
PowerNode.lastPlaced = tile.pos();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removed(Tile tile){
|
public void removed(Tile tile){
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import static io.anuke.mindustry.Vars.world;
|
|||||||
|
|
||||||
public class PowerNode extends PowerBlock{
|
public class PowerNode extends PowerBlock{
|
||||||
//last distribution block placed
|
//last distribution block placed
|
||||||
private static int lastPlaced = -1;
|
public static int lastPlaced = -1;
|
||||||
|
|
||||||
protected Vector2 t1 = new Vector2(), t2 = new Vector2();
|
protected Vector2 t1 = new Vector2(), t2 = new Vector2();
|
||||||
protected TextureRegion laser, laserEnd;
|
protected TextureRegion laser, laserEnd;
|
||||||
@@ -105,19 +105,14 @@ public class PowerNode extends PowerBlock{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playerPlaced(Tile tile){
|
public void playerPlaced(Tile tile){
|
||||||
super.playerPlaced(tile);
|
|
||||||
Tile before = world.tile(lastPlaced);
|
Tile before = world.tile(lastPlaced);
|
||||||
if(linkValid(tile, before) && before.block() instanceof PowerNode){
|
|
||||||
for(Tile near : before.entity.proximity()){
|
if(linkValid(tile, before) && !before.entity.proximity().contains(tile)){
|
||||||
if(near == tile){
|
|
||||||
lastPlaced = tile.pos();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Call.linkPowerNodes(null, tile, before);
|
Call.linkPowerNodes(null, tile, before);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastPlaced = tile.pos();
|
lastPlaced = tile.pos();
|
||||||
|
super.playerPlaced(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user