Power network base support

This commit is contained in:
Anuken
2020-06-05 14:23:57 -04:00
parent b3ff616af2
commit 597d58e843
7 changed files with 31 additions and 5 deletions
+2
View File
@@ -0,0 +1,2 @@
mschxś%Ś] „GD4ńˇ>ôjĹŤ5A0@Űxů¶KÍţfgöi íŚ~ÉTs@KÉaÚŮ=(lŽĽ]Ňć=ú™JátbĚŃS˛ö\ />cÂtÄ7'âÂVô•qwqźźąl1Ř•'*â·Â»Íń™¸IAA52Z4
uQ˛I´ZšşÚ%şú~ÄjęţZ zz]'fa苡/†ľřúňUú\ą,Ä
+2
View File
@@ -0,0 +1,2 @@
mschŠA
!Û…À^rÈ7|”q‡]A•|?cº(h‚ƒï©1üexœcéÍqÊŸ,í»Æ,ÒãÍ5MQ¼ç'õ’S—–Zq–É-@Àæ:L´Ëí"o—@ƒ4'
+2
View File
@@ -0,0 +1,2 @@
mschxœE
ƒ0 „¯¦þÀ`{Ž>T¦A µ–*Œ½ûÀõg°@øÂå.Æ  =o‚n)Õãv쎣 ìÅA¯lºMü,ý“ÏSâã&ÓÊÞNìÌ­s¸/‘ÃjO1!Êq` ûK¢ñû,&[ÀÿR Œ¤(O€®»6 EÖ * ?»Ê».¡šëº>hRSÉ–-êTQBTP5PýAÙù–Ø(¢
+5
View File
@@ -235,6 +235,11 @@ public class World{
}
});
//postgenerate for bases
if(sector.preset == null){
sector.planet.generator.postGenerate(tiles);
}
//reset rules
setSectorRules(sector);
@@ -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();
}
}