Updated uCore / Sector deploying support

This commit is contained in:
Anuken
2018-07-16 20:53:35 -04:00
parent dd45b43d7f
commit 07f0be8d8d
8 changed files with 79 additions and 25 deletions

View File

@@ -1,13 +1,12 @@
package io.anuke.mindustry.maps;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Pixmap.Format;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.math.GridPoint2;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.maps.generation.WorldGenerator.GenResult;
import io.anuke.mindustry.world.ColorMapper;
import io.anuke.ucore.core.Settings;
import io.anuke.ucore.util.Geometry;
import io.anuke.ucore.util.GridMap;
@@ -77,8 +76,6 @@ public class Sectors{
Pixmap pixmap = new Pixmap(sectorImageSize, sectorImageSize, Format.RGBA8888);
int worldX = sector.x * sectorSize;
int worldY = sector.y * sectorSize;
for(int x = 0; x < sectorImageSize; x++){
for(int y = 0; y < sectorImageSize; y++){
int toX = x * sectorSize / sectorImageSize;
@@ -86,7 +83,7 @@ public class Sectors{
GenResult result = world.generator().generateTile(sector.x, sector.y, toX, toY);
int color = ColorMapper.getBlockColor(result.wall == Blocks.air ? result.floor : result.wall);
int color = Color.rgba8888(result.floor.minimapColor);
pixmap.drawPixel(x, sectorImageSize - 1 - y, color);
}
}

View File

@@ -165,12 +165,12 @@ public class WorldGenerator{
}
}
public void generateMap(Tile[][] tiles, int seed){
public void generateMap(Tile[][] tiles, int sectorX, int sectorY){
int width = tiles.length, height = tiles[0].length;
for(int x = 0; x < width; x++){
for(int y = 0; y < height; y++){
GenResult result = generateTile(0, 0, x, y);
GenResult result = generateTile(sectorX, sectorY, x, y);
Tile tile = new Tile(x, y, (byte)result.floor.id, (byte)result.wall.id, (byte)0, (byte)0, result.elevation);
tiles[x][y] = tile;
}
@@ -212,12 +212,12 @@ public class WorldGenerator{
Block floor = Blocks.stone;
Block wall = Blocks.air;
double elevation = sim.octaveNoise2D(3, 0.5, 1f / 100, x, y) * 4.1 - 1;
double temp = sim3.octaveNoise2D(7, 0.54, 1f / 320f, x, y);
double elevation = sim.octaveNoise2D(3, 0.5, 1f / 500, x, y) * 4.1 - 1;
double temp = sim3.octaveNoise2D(7, 0.54, 1f / 820f, x, y);
double r = sim2.octaveNoise2D(1, 0.6, 1f / 70, x, y);
double edgeDist = Math.max(sectorSize / 2, sectorSize / 2) - Math.max(Math.abs(x - sectorSize / 2), Math.abs(y - sectorSize / 2));
double dst = Vector2.dst(sectorSize / 2, sectorSize / 2, x, y);
double dst = Vector2.dst((sectorX * sectorSize) + sectorSize/2f, (sectorY * sectorSize) + sectorSize/2f, x, y);
double elevDip = 30;
double border = 14;