Changed enum to two booleans
This commit is contained in:
@@ -65,11 +65,15 @@ public class PowerBlocks extends BlockList implements ContentList{
|
||||
|
||||
battery = new PowerDistributor("battery"){{
|
||||
powerCapacity = 320f;
|
||||
outputsPower = true;
|
||||
consumesPower = true;
|
||||
}};
|
||||
|
||||
batteryLarge = new PowerDistributor("battery-large"){{
|
||||
size = 3;
|
||||
powerCapacity = 2000f;
|
||||
outputsPower = true;
|
||||
consumesPower = true;
|
||||
}};
|
||||
|
||||
powerNode = new PowerNode("power-node"){{
|
||||
|
||||
@@ -12,7 +12,6 @@ import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.consumers.ConsumeItem;
|
||||
import io.anuke.mindustry.world.consumers.ConsumeLiquid;
|
||||
import io.anuke.mindustry.world.consumers.Consumers;
|
||||
import io.anuke.mindustry.world.meta.PowerType;
|
||||
import io.anuke.mindustry.world.meta.Producers;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
@@ -26,7 +25,8 @@ public abstract class BaseBlock extends MappableContent{
|
||||
|
||||
public boolean outputsLiquid = false;
|
||||
public boolean singleLiquid = true;
|
||||
public PowerType powerType = PowerType.consumer;
|
||||
public boolean consumesPower = true;
|
||||
public boolean outputsPower;
|
||||
|
||||
public int itemCapacity;
|
||||
public float liquidCapacity = 10f;
|
||||
|
||||
@@ -155,7 +155,7 @@ public class Block extends BaseBlock {
|
||||
public Array<Tile> getPowerConnections(Tile tile, Array<Tile> out){
|
||||
out.clear();
|
||||
for(Tile other : tile.entity.proximity()){
|
||||
if(other.entity.power != null && !(powerType == PowerType.consumer && other.block().powerType == PowerType.consumer)){
|
||||
if(other.entity.power != null && !(consumesPower && other.block().consumesPower)){
|
||||
out.add(other);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ package io.anuke.mindustry.world.blocks.power;
|
||||
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.PowerBlock;
|
||||
import io.anuke.mindustry.world.meta.PowerType;
|
||||
|
||||
public class PowerDistributor extends PowerBlock{
|
||||
|
||||
public PowerDistributor(String name){
|
||||
super(name);
|
||||
powerType = PowerType.producer;
|
||||
consumesPower = false;
|
||||
outputsPower = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.ObjectSet;
|
||||
import com.badlogic.gdx.utils.Queue;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.meta.PowerType;
|
||||
|
||||
import static io.anuke.mindustry.Vars.threads;
|
||||
|
||||
@@ -74,9 +73,12 @@ public class PowerGraph{
|
||||
public void add(Tile tile){
|
||||
tile.entity.power.graph = this;
|
||||
all.add(tile);
|
||||
if(tile.block().powerType == PowerType.producer){
|
||||
|
||||
if(tile.block().outputsPower){
|
||||
producers.add(tile);
|
||||
}else if(tile.block().powerType == PowerType.consumer){
|
||||
}
|
||||
|
||||
if(tile.block().consumesPower){
|
||||
consumers.add(tile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import io.anuke.mindustry.world.Edges;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.PowerBlock;
|
||||
import io.anuke.mindustry.world.meta.BlockStat;
|
||||
import io.anuke.mindustry.world.meta.PowerType;
|
||||
import io.anuke.mindustry.world.meta.StatUnit;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
@@ -51,7 +50,8 @@ public class PowerNode extends PowerBlock{
|
||||
layer = Layer.power;
|
||||
powerCapacity = 5f;
|
||||
configurable = true;
|
||||
powerType = PowerType.bridge;
|
||||
consumesPower = false;
|
||||
outputsPower = false;
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
||||
|
||||
Reference in New Issue
Block a user