Merged in buthed's power node tweaks
This commit is contained in:
@@ -27,6 +27,9 @@ public class PowerNode extends PowerBlock{
|
|||||||
protected static int returnInt = 0;
|
protected static int returnInt = 0;
|
||||||
protected final static ObjectSet<PowerGraph> graphs = new ObjectSet<>();
|
protected final static ObjectSet<PowerGraph> graphs = new ObjectSet<>();
|
||||||
|
|
||||||
|
/** The maximum range of all power nodes on the map */
|
||||||
|
public static float maxRange;
|
||||||
|
|
||||||
public @Load("laser") TextureRegion laser;
|
public @Load("laser") TextureRegion laser;
|
||||||
public @Load("laser-end") TextureRegion laserEnd;
|
public @Load("laser-end") TextureRegion laserEnd;
|
||||||
public float laserRange = 6;
|
public float laserRange = 6;
|
||||||
@@ -236,10 +239,10 @@ public class PowerNode extends PowerBlock{
|
|||||||
graphs.add(tile.build.power.graph);
|
graphs.add(tile.build.power.graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
Geometry.circle(tile.x, tile.y, (int)(laserRange + 2), (x, y) -> {
|
var worldRange = laserRange * tilesize;
|
||||||
Building other = world.build(x, y);
|
team.data().buildingTree.intersect(tile.worldx() - worldRange, tile.worldy() - worldRange, worldRange * 2, worldRange * 2, build -> {
|
||||||
if(valid.get(other) && !tempBuilds.contains(other)){
|
if(valid.get(build) && !tempBuilds.contains(build)){
|
||||||
tempBuilds.add(other);
|
tempBuilds.add(build);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -289,10 +292,10 @@ public class PowerNode extends PowerBlock{
|
|||||||
graphs.add(tile.build.power.graph);
|
graphs.add(tile.build.power.graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
Geometry.circle(tile.x, tile.y, 13, (x, y) -> {
|
var rangeWorld = maxRange * tilesize;
|
||||||
Building other = world.build(x, y);
|
team.data().buildingTree.intersect(tile.worldx() - rangeWorld, tile.worldy() - rangeWorld, rangeWorld * 2, rangeWorld * 2, build -> {
|
||||||
if(valid.get(other) && !tempBuilds.contains(other)){
|
if(valid.get(build) && !tempBuilds.contains(build)){
|
||||||
tempBuilds.add(other);
|
tempBuilds.add(build);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -364,6 +367,14 @@ public class PowerNode extends PowerBlock{
|
|||||||
|
|
||||||
public class PowerNodeBuild extends Building{
|
public class PowerNodeBuild extends Building{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void created(){ // Called when one is placed/loaded in the world
|
||||||
|
if(autolink && laserRange > maxRange) maxRange = laserRange;
|
||||||
|
|
||||||
|
super.created();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void placed(){
|
public void placed(){
|
||||||
if(net.client() || power.links.size > 0) return;
|
if(net.client() || power.links.size > 0) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user