mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-11 07:39:39 +07:00
Fixed #919
This commit is contained in:
parent
a5cec84be1
commit
d342c2c081
@ -108,7 +108,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
Geometry.circle(tile.x, tile.y, (int)(laserRange + 1), (x, y) -> {
|
Geometry.circle(tile.x, tile.y, (int)(laserRange + 1), (x, y) -> {
|
||||||
Tile other = world.ltile(x, y);
|
Tile other = world.ltile(x, y);
|
||||||
if(valid.test(other)){
|
if(valid.test(other)){
|
||||||
if(!insulated(tile, other)) {
|
if(!insulated(tile, other)){
|
||||||
tempTiles.add(other);
|
tempTiles.add(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,14 +127,14 @@ public class PowerNode extends PowerBlock{
|
|||||||
private void getPotentialLinks(Tile tile, Consumer<Tile> others){
|
private void getPotentialLinks(Tile tile, Consumer<Tile> others){
|
||||||
Predicate<Tile> valid = other -> other != null && other != tile && other.entity != null && other.entity.power != null &&
|
Predicate<Tile> valid = other -> other != null && other != tile && other.entity != null && other.entity.power != null &&
|
||||||
((!other.block().outputsPower && other.block().consumesPower) || (other.block().outputsPower && !other.block().consumesPower) || other.block() instanceof PowerNode) &&
|
((!other.block().outputsPower && other.block().consumesPower) || (other.block().outputsPower && !other.block().consumesPower) || other.block() instanceof PowerNode) &&
|
||||||
overlaps(tile.x * tilesize + offset(), tile.y *tilesize + offset(), other, laserRange * tilesize) && other.getTeam() == player.getTeam()
|
overlaps(tile.x * tilesize + offset(), tile.y * tilesize + offset(), other, laserRange * tilesize) && other.getTeam() == player.getTeam()
|
||||||
&& !other.entity.proximity().contains(tile) && !graphs.contains(other.entity.power.graph);
|
&& !other.entity.proximity().contains(tile) && !graphs.contains(other.entity.power.graph);
|
||||||
|
|
||||||
tempTiles.clear();
|
tempTiles.clear();
|
||||||
graphs.clear();
|
graphs.clear();
|
||||||
Geometry.circle(tile.x, tile.y, (int)(laserRange + 1), (x, y) -> {
|
Geometry.circle(tile.x, tile.y, (int)(laserRange + 1), (x, y) -> {
|
||||||
Tile other = world.ltile(x, y);
|
Tile other = world.ltile(x, y);
|
||||||
if(valid.test(other)){
|
if(valid.test(other) && !tempTiles.contains(other)){
|
||||||
tempTiles.add(other);
|
tempTiles.add(other);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -163,18 +163,18 @@ public class PowerNode extends PowerBlock{
|
|||||||
TileEntity entity = tile.entity();
|
TileEntity entity = tile.entity();
|
||||||
other = other.link();
|
other = other.link();
|
||||||
|
|
||||||
Tile result = other;
|
|
||||||
|
|
||||||
if(linkValid(tile, other)){
|
if(linkValid(tile, other)){
|
||||||
tile.configure(other.pos());
|
tile.configure(other.pos());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tile == other){
|
if(tile == other){
|
||||||
if (other.entity.power.links.size == 0){
|
if(other.entity.power.links.size == 0){
|
||||||
getPotentialLinks(tile, link -> tile.configure(link.pos()));
|
getPotentialLinks(tile, link -> {
|
||||||
} else {
|
tile.configure(link.pos());
|
||||||
while (entity.power.links.size > 0){
|
});
|
||||||
|
}else{
|
||||||
|
while(entity.power.links.size > 0){
|
||||||
tile.configure(entity.power.links.get(0));
|
tile.configure(entity.power.links.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -311,9 +311,9 @@ public class PowerNode extends PowerBlock{
|
|||||||
x2 += t2.x;
|
x2 += t2.x;
|
||||||
y2 += t2.y;
|
y2 += t2.y;
|
||||||
|
|
||||||
float fract = 1f-tile.entity.power.graph.getSatisfaction();
|
float fract = 1f - tile.entity.power.graph.getSatisfaction();
|
||||||
|
|
||||||
Draw.color(Color.white, Pal.powerLight, fract*0.86f + Mathf.absin(3f, 0.1f));
|
Draw.color(Color.white, Pal.powerLight, fract * 0.86f + Mathf.absin(3f, 0.1f));
|
||||||
Draw.alpha(opacity);
|
Draw.alpha(opacity);
|
||||||
Drawf.laser(laser, laserEnd, x1, y1, x2, y2, 0.25f);
|
Drawf.laser(laser, laserEnd, x1, y1, x2, y2, 0.25f);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
Loading…
Reference in New Issue
Block a user