Many various internal changes

This commit is contained in:
Anuken
2019-12-26 17:46:01 -05:00
parent 36ec88e2e2
commit de5979f4ee
53 changed files with 435 additions and 575 deletions

View File

@@ -10,6 +10,7 @@ import mindustry.core.*;
import mindustry.game.*;
import mindustry.maps.*;
import mindustry.world.*;
import mindustry.world.LegacyColorMapper.*;
import mindustry.world.blocks.storage.*;
import java.io.*;
@@ -91,7 +92,7 @@ public class MapIO{
public void setTeam(Team team){
super.setTeam(team);
if(block instanceof CoreBlock){
map.teams.add((int) team.id);
map.teams.add((int)team.id);
}
}
};
@@ -150,6 +151,28 @@ public class MapIO{
return Color.rgba8888(wall.solid ? wall.color : ore == Blocks.air ? floor.color : ore.color);
}
/** Reads a pixmap in the 3.5 pixmap format. */
public static void readPixmap(Pixmap pixmap, Tile[][] tiles){
for(int x = 0; x < pixmap.getWidth(); x++){
for(int y = 0; y < pixmap.getHeight(); y++){
int color = pixmap.getPixel(x, pixmap.getHeight() - 1 - y);
LegacyBlock block = LegacyColorMapper.get(color);
Tile tile = tiles[x][y];
tile.setFloor(block.floor);
tile.setBlock(block.wall);
if(block.ore != null) tile.setOverlay(block.ore);
//place core
if(color == Color.rgba8888(Color.green)){
//actual core parts
tile.setBlock(Blocks.coreShard);
tile.setTeam(Team.sharded);
}
}
}
}
interface TileProvider{
Tile get(int x, int y);
}