Fixed conduits not reacting with each other

This commit is contained in:
Anuken
2020-08-23 13:25:47 -04:00
parent 5e6465e8f3
commit 2f19cab144
27 changed files with 71 additions and 74 deletions

View File

@@ -150,7 +150,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
}
public Team team(){
return build == null ? Team.derelict : build.team();
return build == null ? Team.derelict : build.team;
}
public void setTeam(Team team){

View File

@@ -147,7 +147,7 @@ public interface Autotiler{
default boolean blends(Tile tile, int rotation, int direction){
Building other = tile.getNearbyEntity(Mathf.mod(rotation - direction, 4));
return other != null && other.team() == tile.team() && blends(tile, rotation, other.tileX(), other.tileY(), other.rotation, other.block());
return other != null && other.team == tile.team() && blends(tile, rotation, other.tileX(), other.tileY(), other.rotation, other.block());
}
default boolean blendsArmored(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){

View File

@@ -91,7 +91,7 @@ public class Wall extends Block{
//create lightning if necessary
if(lightningChance > 0){
if(Mathf.chance(lightningChance)){
Lightning.create(team(), Pal.surge, lightningDamage, x, y, bullet.rotation() + 180f, lightningLength);
Lightning.create(team, Pal.surge, lightningDamage, x, y, bullet.rotation() + 180f, lightningLength);
}
}

View File

@@ -65,7 +65,7 @@ public class LaserTurret extends PowerTurret{
bullet = null;
}
}else if(reload > 0){
Liquid liquid = liquids().current();
Liquid liquid = liquids.current();
float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount;
float used = (cheating() ? maxUsed * Time.delta : Math.min(liquids.get(liquid), maxUsed * Time.delta)) * liquid.heatCapacity * coolantMultiplier;

View File

@@ -163,7 +163,7 @@ public class Conveyor extends Block implements Autotiler{
if(front() != null && front() != null){
next = front();
nextc = next instanceof ConveyorBuild && next.team() == team ? (ConveyorBuild)next : null;
nextc = next instanceof ConveyorBuild && next.team == team ? (ConveyorBuild)next : null;
aligned = nextc != null && rotation == next.rotation;
}
}

View File

@@ -341,7 +341,7 @@ public class ItemBridge extends Block{
@Override
public boolean acceptLiquid(Building source, Liquid liquid, float amount){
if(team != source.team() || !hasLiquids) return false;
if(team != source.team || !hasLiquids) return false;
Tile other = world.tile(link);

View File

@@ -49,7 +49,7 @@ public class Junction extends Block{
Building dest = nearby(i);
//skip blocks that don't want the item, keep waiting until they do
if(dest == null || !dest.acceptItem(this, item) || dest.team() != team){
if(dest == null || !dest.acceptItem(this, item) || dest.team != team){
continue;
}
@@ -73,7 +73,7 @@ public class Junction extends Block{
if(relative == -1 || !buffer.accepts(relative)) return false;
Building to = nearby(relative);
return to != null && to.team() == team;
return to != null && to.team == team;
}
@Override

View File

@@ -223,7 +223,7 @@ public class MassDriver extends Block{
if(link == other.pos()){
configure(-1);
return false;
}else if(other.block() instanceof MassDriver && other.dst(tile) <= range && other.team() == team){
}else if(other.block() instanceof MassDriver && other.dst(tile) <= range && other.team == team){
configure(other.pos());
return false;
}
@@ -254,7 +254,7 @@ public class MassDriver extends Block{
float angle = tile.angleTo(target);
Bullets.driverBolt.create(this, team(),
Bullets.driverBolt.create(this, team,
x + Angles.trnsx(angle, translation), y + Angles.trnsy(angle, translation),
angle, -1f, bulletSpeed, bulletLifetime, data);

View File

@@ -76,7 +76,7 @@ public class OverflowGate extends Block{
@Override
public boolean acceptItem(Building source, Item item){
return team == source.team() && lastItem == null && items.total() == 0;
return team == source.team && lastItem == null && items.total() == 0;
}
@Override
@@ -91,7 +91,7 @@ public class OverflowGate extends Block{
int from = relativeToEdge(src);
if(from == -1) return null;
Building to = nearby((from + 2) % 4);
boolean canForward = to != null && to.acceptItem(this, item) && to.team() == team && !(to.block() instanceof OverflowGate);
boolean canForward = to != null && to.acceptItem(this, item) && to.team == team && !(to.block() instanceof OverflowGate);
if(!canForward || invert){
Building a = nearby(Mathf.mod(from - 1, 4));

View File

@@ -51,7 +51,7 @@ public class Router extends Block{
@Override
public boolean acceptItem(Building source, Item item){
return team == source.team() && lastItem == null && items.total() == 0;
return team == source.team && lastItem == null && items.total() == 0;
}
@Override

View File

@@ -76,7 +76,7 @@ public class Sorter extends Block{
public boolean acceptItem(Building source, Item item){
Building to = getTileTarget(item, source, false);
return to != null && to.acceptItem(this, item) && to.team() == team;
return to != null && to.acceptItem(this, item) && to.team == team;
}
@Override

View File

@@ -26,7 +26,7 @@ public class ArmoredConduit extends Conduit{
// draw the cap when a conduit would normally leak
Building next = front();
if(next != null && next.team() == team && next.block().hasLiquids) return;
if(next != null && next.team == team && next.block().hasLiquids) return;
Draw.rect(capRegion, x, y, rotdeg());
}

View File

@@ -30,7 +30,7 @@ public class BlockPayload implements Payload{
}
public void place(Tile tile, int rotation){
tile.setBlock(entity.block(), entity.team(), rotation, () -> entity);
tile.setBlock(entity.block(), entity.team, rotation, () -> entity);
entity.dropped();
}

View File

@@ -53,7 +53,7 @@ public class PowerDiode extends Block{
public void updateTile(){
super.updateTile();
if(front() == null || back() == null || !back().block().hasPower || !front().block().hasPower || back().team() != front().team()) return;
if(front() == null || back() == null || !back().block().hasPower || !front().block().hasPower || back().team != front().team) return;
PowerGraph backGraph = back().power.graph;
PowerGraph frontGraph = front().power.graph;

View File

@@ -68,7 +68,7 @@ public class PowerNode extends PowerBlock{
power.links.add(other.pos());
}
if(other.team() == entity.team()){
if(other.team == entity.team){
if(!other.power.links.contains(entity.pos())){
other.power.links.add(entity.pos());
@@ -184,7 +184,7 @@ public class PowerNode extends PowerBlock{
protected void getPotentialLinks(Tile tile, Cons<Building> others){
Boolf<Building> valid = other -> other != null && other.tile() != tile && other.power != null &&
((!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.tile(), laserRange * tilesize) && other.team() == player.team()
overlaps(tile.x * tilesize + offset, tile.y * tilesize + offset, other.tile(), laserRange * tilesize) && other.team == player.team()
&& !other.proximity().contains(e -> e.tile() == tile) && !graphs.contains(other.power.graph);
tempTileEnts.clear();
@@ -235,7 +235,7 @@ public class PowerNode extends PowerBlock{
}
public boolean linkValid(Building tile, Building link, boolean checkMaxNodes){
if(tile == link || link == null || !link.block().hasPower || tile.team() != link.team()) return false;
if(tile == link || link == null || !link.block().hasPower || tile.team != link.team) return false;
if(overlaps(tile, link, laserRange * tilesize) || (link.block() instanceof PowerNode && overlaps(link, tile, ((PowerNode)link.block()).laserRange * tilesize))){
if(checkMaxNodes && link.block() instanceof PowerNode){