Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features
Conflicts: core/src/mindustry/content/Blocks.java core/src/mindustry/net/CrashSender.java core/src/mindustry/ui/Links.java core/src/mindustry/ui/dialogs/SchematicsDialog.java core/src/mindustry/world/blocks/power/LightBlock.java gradle.properties
This commit is contained in:
@@ -24,23 +24,30 @@ import mindustry.world.*;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class Maps{
|
||||
/** All generation filter types. */
|
||||
public static Prov<GenerateFilter>[] allFilterTypes = new Prov[]{
|
||||
NoiseFilter::new, ScatterFilter::new, TerrainFilter::new, DistortFilter::new,
|
||||
RiverNoiseFilter::new, OreFilter::new, OreMedianFilter::new, MedianFilter::new,
|
||||
BlendFilter::new, MirrorFilter::new, ClearFilter::new, CoreSpawnFilter::new,
|
||||
EnemySpawnFilter::new, SpawnPathFilter::new
|
||||
};
|
||||
|
||||
/** List of all built-in maps. Filenames only. */
|
||||
private static String[] defaultMapNames = {"maze", "fortress", "labyrinth", "islands", "tendrils", "caldera", "wasteland", "shattered", "fork", "triad", "mudFlats", "moltenLake", "archipelago", "debrisField", "veins", "glacier", "passage"};
|
||||
/** Maps tagged as PvP */
|
||||
static final String[] pvpMaps = {"veins", "glacier", "passage"};
|
||||
private static String[] pvpMaps = {"veins", "glacier", "passage"};
|
||||
|
||||
/** All maps stored in an ordered array. */
|
||||
private Seq<Map> maps = new Seq<>();
|
||||
/** Serializer for meta. */
|
||||
private Json json = new Json();
|
||||
|
||||
private ShuffleMode shuffleMode = ShuffleMode.all;
|
||||
private @Nullable MapProvider shuffler;
|
||||
|
||||
private AsyncExecutor executor = new AsyncExecutor(2);
|
||||
private ExecutorService executor = Threads.executor(3);
|
||||
private ObjectSet<Map> previewList = new ObjectSet<>();
|
||||
|
||||
public ShuffleMode getShuffleMode(){
|
||||
@@ -352,20 +359,20 @@ public class Maps{
|
||||
if(groups == null) return "[]";
|
||||
|
||||
StringWriter buffer = new StringWriter();
|
||||
json.setWriter(new JsonWriter(buffer));
|
||||
JsonIO.json.setWriter(new JsonWriter(buffer));
|
||||
|
||||
json.writeArrayStart();
|
||||
JsonIO.json.writeArrayStart();
|
||||
for(int i = 0; i < groups.size; i++){
|
||||
json.writeObjectStart(SpawnGroup.class, SpawnGroup.class);
|
||||
groups.get(i).write(json);
|
||||
json.writeObjectEnd();
|
||||
JsonIO.json.writeObjectStart(SpawnGroup.class, SpawnGroup.class);
|
||||
groups.get(i).write(JsonIO.json);
|
||||
JsonIO.json.writeObjectEnd();
|
||||
}
|
||||
json.writeArrayEnd();
|
||||
JsonIO.json.writeArrayEnd();
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
public Seq<SpawnGroup> readWaves(String str){
|
||||
return str == null ? null : str.equals("[]") ? new Seq<>() : Seq.with(json.fromJson(SpawnGroup[].class, str));
|
||||
return str == null ? null : str.equals("[]") ? new Seq<>() : Seq.with(JsonIO.json.fromJson(SpawnGroup[].class, str));
|
||||
}
|
||||
|
||||
public void loadPreviews(){
|
||||
|
||||
@@ -3,6 +3,7 @@ package mindustry.maps.filters;
|
||||
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.scene.*;
|
||||
import arc.scene.event.*;
|
||||
import arc.scene.style.*;
|
||||
import arc.scene.ui.*;
|
||||
@@ -60,16 +61,19 @@ public abstract class FilterOption{
|
||||
|
||||
@Override
|
||||
public void build(Table table){
|
||||
Label label;
|
||||
Element base;
|
||||
if(!display){
|
||||
label = new Label("@filter.option." + name);
|
||||
Label l = new Label("@filter.option." + name);
|
||||
l.setWrap(true);
|
||||
l.setStyle(Styles.outlineLabel);
|
||||
base = l;
|
||||
}else{
|
||||
label = new Label(() -> Core.bundle.get("filter.option." + name) + ": " + Strings.autoFixed(getter.get(), 2));
|
||||
Table t = new Table().marginLeft(11f).marginRight(11f);
|
||||
base = t;
|
||||
t.add("@filter.option." + name).growX().wrap().style(Styles.outlineLabel);
|
||||
t.label(() -> Strings.autoFixed(getter.get(), 2)).style(Styles.outlineLabel).right().labelAlign(Align.right).padLeft(6);
|
||||
}
|
||||
label.setWrap(true);
|
||||
label.setAlignment(Align.center);
|
||||
label.touchable = Touchable.disabled;
|
||||
label.setStyle(Styles.outlineLabel);
|
||||
base.touchable = Touchable.disabled;
|
||||
|
||||
Slider slider = new Slider(min, max, step, false);
|
||||
slider.moved(setter);
|
||||
@@ -80,7 +84,7 @@ public abstract class FilterOption{
|
||||
slider.released(changed);
|
||||
}
|
||||
|
||||
table.stack(slider, label).colspan(2).pad(3).growX().row();
|
||||
table.stack(slider, base).colspan(2).pad(3).growX().row();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,8 +75,7 @@ public abstract class GenerateFilter{
|
||||
|
||||
/** localized display name */
|
||||
public String name(){
|
||||
var s = simpleName();
|
||||
return Core.bundle.get("filter." + s);
|
||||
return Core.bundle.get("filter." + simpleName());
|
||||
}
|
||||
|
||||
public char icon(){
|
||||
|
||||
@@ -162,12 +162,27 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
connected.add(this);
|
||||
}
|
||||
|
||||
void con(int x1, int y1, int x2, int y2){
|
||||
float nscl = rand.random(100f, 140f) * 6f;
|
||||
int stroke = rand.random(3, 9);
|
||||
brush(pathfind(x1, y1, x2, y2, tile -> (tile.solid() ? 50f : 0f) + noise(tile.x, tile.y, 2, 0.4f, 1f / nscl) * 500, Astar.manhattan), stroke);
|
||||
}
|
||||
|
||||
void connect(Room to){
|
||||
if(!connected.add(to)) return;
|
||||
|
||||
float nscl = rand.random(100f, 140f);
|
||||
int stroke = rand.random(3, 9);
|
||||
brush(pathfind(x, y, to.x, to.y, tile -> (tile.solid() ? 5f : 0f) + noise(tile.x, tile.y, 2, 0.4, 1f / nscl) * 500, Astar.manhattan), stroke);
|
||||
Vec2 midpoint = Tmp.v1.set(to.x, to.y).add(x, y).scl(0.5f);
|
||||
rand.nextFloat();
|
||||
|
||||
//add randomized offset to avoid straight lines
|
||||
midpoint.add(Tmp.v2.setToRandomDirection(rand).scl(Tmp.v1.dst(x, y)));
|
||||
|
||||
midpoint.sub(width/2f, height/2f).limit(width / 2f / Mathf.sqrt3).add(width/2f, height/2f);
|
||||
|
||||
int mx = (int)midpoint.x, my = (int)midpoint.y;
|
||||
|
||||
con(x, y, mx, my);
|
||||
con(mx, my, to.x, to.y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,8 +259,6 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
cells(1);
|
||||
distort(10f, 6f);
|
||||
|
||||
inverseFloodFill(tiles.getn(spawn.x, spawn.y));
|
||||
|
||||
Seq<Block> ores = Seq.with(Blocks.oreCopper, Blocks.oreLead);
|
||||
float poles = Math.abs(sector.tile.v.y);
|
||||
float nmag = 0.5f;
|
||||
@@ -296,6 +309,8 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
|
||||
median(2);
|
||||
|
||||
inverseFloodFill(tiles.getn(spawn.x, spawn.y));
|
||||
|
||||
tech();
|
||||
|
||||
pass((x, y) -> {
|
||||
|
||||
Reference in New Issue
Block a user