Merge remote-tracking branch 'origin/continuous-sectors' into continuous-sectors

This commit is contained in:
Anuken
2018-09-21 08:47:41 -04:00
81 changed files with 391 additions and 2974 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ public class Sector{
/**Slot ID of this sector's save. -1 means no save has been created.*/
public int saveID = -1;
/**Sector size; if more than 1, the coordinates are the bottom left corner.*/
public int size = 1;
public int width = 1, height = 1;
/**Num of missions in this sector that have been completed so far.*/
public int completedMissions;
/**Display texture. Needs to be disposed.*/
+9 -20
View File
@@ -85,19 +85,14 @@ public class Sectors{
Sector sector = get(x, y);
sector.complete = true;
for(GridPoint2 point : Edges.getEdges(sector.size)){
//TODO work for unique width + height?
for(GridPoint2 point : Edges.getEdges(sector.width)){
createSector(sector.x + point.x, sector.y + point.y);
}
}
/**Creates a sector at a location if it is not present, but does not unlock it.*/
public void createSector(int x, int y){
boolean isLarge = Mathf.randomSeed(3+Bits.packInt((short)round2(x), (short)round2(y))) < sectorLargeChance;
if(isLarge){
x = round2(x);
y = round2(y);
}
if(grid.containsKey(x, y)) return;
@@ -105,11 +100,11 @@ public class Sectors{
sector.x = (short)x;
sector.y = (short)y;
sector.complete = false;
sector.size = isLarge ? 2 : 1;
sector.width = sector.height = 1;
initSector(sector);
for(int cx = 0; cx < sector.size; cx++){
for(int cy = 0; cy < sector.size; cy++){
for(int cx = 0; cx < sector.width; cx++){
for(int cy = 0; cy < sector.height; cy++){
grid.put(x + cx, y + cy, sector);
}
}
@@ -128,8 +123,8 @@ public class Sectors{
for(Sector sector : out){
createTexture(sector);
initSector(sector);
for(int cx = 0; cx < sector.size; cx++){
for(int cy = 0; cy < sector.size; cy++){
for(int cx = 0; cx < sector.width; cx++){
for(int cy = 0; cy < sector.height; cy++){
grid.put(sector.x + cx, sector.y + cy, sector);
}
}
@@ -165,8 +160,7 @@ public class Sectors{
sector.spawns = sector.missions.first().getWaves(sector);
//add all ores for now since material differences aren't well handled yet
sector.ores.addAll(Items.copper, Items.coal, Items.lead, Items.thorium, Items.titanium);
sector.ores.addAll(Items.copper);
//set starter items
if(sector.difficulty > 12){ //now with titanium
@@ -184,15 +178,10 @@ public class Sectors{
}
}
private int round2(int i){
if(i < 0) i --;
return i/2*2;
}
private void createTexture(Sector sector){
if(headless) return; //obviously not created or needed on server
Pixmap pixmap = new Pixmap(sectorImageSize * sector.size, sectorImageSize * sector.size, Format.RGBA8888);
Pixmap pixmap = new Pixmap(sectorImageSize * sector.width, sectorImageSize * sector.height, Format.RGBA8888);
for(int x = 0; x < pixmap.getWidth(); x++){
for(int y = 0; y < pixmap.getHeight(); y++){
@@ -70,7 +70,7 @@ public class FortressGenerator{
gen.setBlock(enemyX, enemyY, StorageBlocks.core, team);
float difficultyScl = Mathf.clamp(gen.sector.difficulty / 20f + gen.random.range(1f/2f), 0f, 0.9999f);
int coreDst = FortressGenerator.coreDst*gen.sector.size;
int coreDst = FortressGenerator.coreDst*gen.sector.width;
Array<Block> turrets = find(b -> b instanceof ItemTurret);
Array<Block> powerTurrets = find(b -> b instanceof PowerTurret);