Power network base support
This commit is contained in:
@@ -15,6 +15,7 @@ import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.defense.*;
|
||||
import mindustry.world.blocks.environment.*;
|
||||
import mindustry.world.blocks.power.*;
|
||||
import mindustry.world.blocks.production.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
@@ -24,7 +25,7 @@ public class BaseGenerator{
|
||||
private static final Schematic tmpSchem2 = new Schematic(new Array<>(), new StringMap(), 0, 0);
|
||||
private static final Vec2 axis = new Vec2(), rotator = new Vec2();
|
||||
|
||||
private final static int range = 200;
|
||||
private final static int range = 180;
|
||||
|
||||
private Tiles tiles;
|
||||
private Team team;
|
||||
@@ -53,8 +54,6 @@ public class BaseGenerator{
|
||||
|
||||
Block wall = wallsSmall.getFrac(bracket), wallLarge = wallsLarge.getFrac(bracket);
|
||||
|
||||
//TODO random rotation
|
||||
|
||||
for(Tile tile : cores){
|
||||
tile.clearOverlay();
|
||||
Schematics.placeLoadout(coreschem.schematic, tile.x, tile.y, team, coreschem.requiredItem == null ? Blocks.oreCopper : ores.get(coreschem.requiredItem));
|
||||
@@ -86,7 +85,7 @@ public class BaseGenerator{
|
||||
boolean any = false;
|
||||
|
||||
for(Point2 p : Geometry.d8){
|
||||
if(Angles.angleDist(Angles.angle(p.x, p.y), spawn.angleTo(tile.x, tile.y)) > wallAngle){
|
||||
if(Angles.angleDist(Angles.angle(p.x, p.y), spawn.angleTo(tile)) > wallAngle){
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -124,6 +123,14 @@ public class BaseGenerator{
|
||||
}
|
||||
}
|
||||
|
||||
public void postGenerate(){
|
||||
for(Tile tile : tiles){
|
||||
if(tile.isCenter() && tile.block() instanceof PowerNode){
|
||||
tile.entity.placed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void pass(Cons<Tile> cons){
|
||||
Tile core = cores.first();
|
||||
//for(Tile core : cores){
|
||||
|
||||
@@ -4,4 +4,7 @@ import mindustry.world.*;
|
||||
|
||||
public interface WorldGenerator{
|
||||
void generate(Tiles tiles);
|
||||
|
||||
/** Do not modify tiles here. This is only for specialized configuration. */
|
||||
default void postGenerate(Tiles tiles){}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import static mindustry.Vars.*;
|
||||
public class TODOPlanetGenerator extends PlanetGenerator{
|
||||
Simplex noise = new Simplex();
|
||||
RidgedPerlin rid = new RidgedPerlin(1, 2);
|
||||
BaseGenerator basegen = new BaseGenerator();
|
||||
float scl = 5f;
|
||||
float waterOffset = 0.07f;
|
||||
|
||||
@@ -282,7 +283,7 @@ public class TODOPlanetGenerator extends PlanetGenerator{
|
||||
Schematics.placeLoadout(Loadouts.advancedShard, spawn.x, spawn.y);
|
||||
|
||||
if(sector.hasEnemyBase()){
|
||||
new BaseGenerator().generate(tiles, enemies.map(r -> tiles.getn(r.x, r.y)), tiles.get(spawn.x, spawn.y), state.rules.waveTeam, sector);
|
||||
basegen.generate(tiles, enemies.map(r -> tiles.getn(r.x, r.y)), tiles.get(spawn.x, spawn.y), state.rules.waveTeam, sector);
|
||||
|
||||
state.rules.attackMode = true;
|
||||
}
|
||||
@@ -290,4 +291,8 @@ public class TODOPlanetGenerator extends PlanetGenerator{
|
||||
state.rules.waves = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postGenerate(Tiles tiles){
|
||||
basegen.postGenerate();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user