Source reformat

This commit is contained in:
Anuken
2019-04-08 09:03:18 -04:00
parent 4a96b9bb00
commit b40beb0d1d
331 changed files with 2822 additions and 3274 deletions

View File

@@ -14,19 +14,19 @@ import io.anuke.mindustry.io.MapIO;
import static io.anuke.mindustry.Vars.world;
public class Map implements Comparable<Map>{
/** Whether this is a custom map.*/
/** Whether this is a custom map. */
public final boolean custom;
/** Metadata. Author description, display name, etc.*/
/** Metadata. Author description, display name, etc. */
public final ObjectMap<String, String> tags;
/** Base file of this map. File can be named anything at all.*/
/** Base file of this map. File can be named anything at all. */
public final FileHandle file;
/** Format version.*/
/** Format version. */
public final int version;
/** Map width/height, shorts.*/
/** Map width/height, shorts. */
public int width, height;
/** Preview texture.*/
/** Preview texture. */
public Texture texture;
/** Build that this map was created in. -1 = unknown or custom build.*/
/** Build that this map was created in. -1 = unknown or custom build. */
public int build;
public Map(FileHandle file, int width, int height, ObjectMap<String, String> tags, boolean custom, int version, int build){
@@ -103,9 +103,9 @@ public class Map implements Comparable<Map>{
@Override
public String toString(){
return "Map{" +
"file='" + file + '\'' +
", custom=" + custom +
", tags=" + tags +
'}';
"file='" + file + '\'' +
", custom=" + custom +
", tags=" + tags +
'}';
}
}

View File

@@ -18,11 +18,11 @@ import java.io.StringWriter;
import static io.anuke.mindustry.Vars.*;
public class Maps implements Disposable{
/** List of all built-in maps. Filenames only.*/
/** List of all built-in maps. Filenames only. */
private static final String[] defaultMapNames = {"fortress"};
/** All maps stored in an ordered array. */
private Array<Map> maps = new Array<>();
/** Serializer for meta.*/
/** Serializer for meta. */
private Json json = new Json();
public Maps(){
@@ -81,8 +81,10 @@ public class Maps implements Disposable{
load();
}
/** Save a custom map to the directory. This updates all values and stored data necessary.
* The tags are copied to prevent mutation later.*/
/**
* Save a custom map to the directory. This updates all values and stored data necessary.
* The tags are copied to prevent mutation later.
*/
public void saveMap(ObjectMap<String, String> baseTags, Tile[][] data){
try{
@@ -162,12 +164,12 @@ public class Maps implements Disposable{
return str == null ? null : str.equals("[]") ? new Array<>() : Array.with(json.fromJson(SpawnGroup[].class, str));
}
/** Find a new filename to put a map to.*/
/** Find a new filename to put a map to. */
private FileHandle findFile(){
//find a map name that isn't used.
int i = maps.size;
while(customMapDirectory.child("map_" + i + "." + mapExtension).exists()){
i ++;
i++;
}
return customMapDirectory.child("map_" + i + "." + mapExtension);
}

View File

@@ -34,7 +34,7 @@ public class BasicGenerator extends RandomGenerator{
for(int i = ores.size - 1; i >= 0; i--){
Item entry = ores.get(i);
if(Math.abs(0.5f - sim.octaveNoise2D(2, 0.7, 1f / (50 + i * 2), offsetX, offsetY)) > 0.23f &&
Math.abs(0.5f - sim2.octaveNoise2D(1, 1, 1f / (40 + i * 4), offsetX, offsetY)) > 0.32f){
Math.abs(0.5f - sim2.octaveNoise2D(1, 1, 1f / (40 + i * 4), offsetX, offsetY)) > 0.32f){
//floor = OreBlock.get(floor, entry);
break;

View File

@@ -11,7 +11,8 @@ public abstract class Generator{
this.height = height;
}
public Generator(){}
public Generator(){
}
public void init(Loadout loadout){

View File

@@ -27,14 +27,16 @@ public class MapGenerator extends Generator{
private String mapName;
private Array<Decoration> decorations = Array.with(new Decoration(Blocks.stone, Blocks.rock, 0.003f));
private Loadout loadout;
/**How much the landscape is randomly distorted.*/
/** How much the landscape is randomly distorted. */
public float distortion = 3;
/**The amount of final enemy spawns used. -1 to use everything in the map.
* This amount of enemy spawns is selected randomly from the map.*/
/**
* The amount of final enemy spawns used. -1 to use everything in the map.
* This amount of enemy spawns is selected randomly from the map.
*/
public int enemySpawns = -1;
/**Whether floor is distorted along with blocks.*/
/** Whether floor is distorted along with blocks. */
public boolean distortFloor = false;
/**Items randomly added to containers and vaults.*/
/** Items randomly added to containers and vaults. */
public ItemStack[] storageDrops = ItemStack.with(Items.copper, 300, Items.lead, 300, Items.silicon, 200, Items.graphite, 200, Items.blastCompound, 200);
public MapGenerator(String mapName){

View File

@@ -24,11 +24,13 @@ public abstract class RandomGenerator extends Generator{
}
}
tiles[width/2][height/2].setBlock(Blocks.coreShard, Team.blue);
tiles[width/2][height/2 - 6].setBlock(Blocks.launchPad, Team.blue);
tiles[width / 2][height / 2].setBlock(Blocks.coreShard, Team.blue);
tiles[width / 2][height / 2 - 6].setBlock(Blocks.launchPad, Team.blue);
}
/**Sets {@link #floor} and {@link #block} to the correct values as output.
* Before this method is called, both are set to {@link Blocks#air} as defaults.*/
/**
* Sets {@link #floor} and {@link #block} to the correct values as output.
* Before this method is called, both are set to {@link Blocks#air} as defaults.
*/
public abstract void generate(int x, int y);
}