Fixed node connection bug
This commit is contained in:
@@ -63,17 +63,13 @@ public class PowerBlocks extends BlockList implements ContentList{
|
|||||||
health = 600;
|
health = 600;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
battery = new PowerDistributor("battery"){{
|
battery = new Battery("battery"){{
|
||||||
powerCapacity = 320f;
|
powerCapacity = 320f;
|
||||||
outputsPower = true;
|
|
||||||
consumesPower = true;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
batteryLarge = new PowerDistributor("battery-large"){{
|
batteryLarge = new Battery("battery-large"){{
|
||||||
size = 3;
|
size = 3;
|
||||||
powerCapacity = 2000f;
|
powerCapacity = 2000f;
|
||||||
outputsPower = true;
|
|
||||||
consumesPower = true;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
powerNode = new PowerNode("power-node"){{
|
powerNode = new PowerNode("power-node"){{
|
||||||
|
|||||||
@@ -150,12 +150,18 @@ public class Block extends BaseBlock {
|
|||||||
|
|
||||||
public void powerGraphRemoved(Tile tile){
|
public void powerGraphRemoved(Tile tile){
|
||||||
tile.entity.power.graph.remove(tile);
|
tile.entity.power.graph.remove(tile);
|
||||||
|
for(int i = 0; i < tile.entity.power.links.size; i++){
|
||||||
|
Tile other = world.tile(tile.entity.power.links.get(i));
|
||||||
|
if(other != null && other.entity != null && other.entity.power != null){
|
||||||
|
other.entity.power.links.removeValue(tile.packedPosition());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Array<Tile> getPowerConnections(Tile tile, Array<Tile> out){
|
public Array<Tile> getPowerConnections(Tile tile, Array<Tile> out){
|
||||||
out.clear();
|
out.clear();
|
||||||
for(Tile other : tile.entity.proximity()){
|
for(Tile other : tile.entity.proximity()){
|
||||||
if(other.entity.power != null && !(consumesPower && other.block().consumesPower)){
|
if(other.entity.power != null && !(consumesPower && other.block().consumesPower && !outputsPower && !other.block().outputsPower)){
|
||||||
out.add(other);
|
out.add(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
core/src/io/anuke/mindustry/world/blocks/power/Battery.java
Normal file
10
core/src/io/anuke/mindustry/world/blocks/power/Battery.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package io.anuke.mindustry.world.blocks.power;
|
||||||
|
|
||||||
|
public class Battery extends PowerDistributor{
|
||||||
|
|
||||||
|
public Battery(String name){
|
||||||
|
super(name);
|
||||||
|
outputsPower = true;
|
||||||
|
consumesPower = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user