Partial 7.0 merge - API preview
This commit is contained in:
@@ -147,7 +147,7 @@ public class Map implements Comparable<Map>, Publishable{
|
||||
public void addSteamID(String id){
|
||||
tags.put("steamid", id);
|
||||
|
||||
ui.editor.editor.tags.put("steamid", id);
|
||||
editor.tags.put("steamid", id);
|
||||
try{
|
||||
ui.editor.save();
|
||||
}catch(Exception e){
|
||||
@@ -160,7 +160,7 @@ public class Map implements Comparable<Map>, Publishable{
|
||||
public void removeSteamID(){
|
||||
tags.remove("steamid");
|
||||
|
||||
ui.editor.editor.tags.remove("steamid");
|
||||
editor.tags.remove("steamid");
|
||||
try{
|
||||
ui.editor.save();
|
||||
}catch(Exception e){
|
||||
@@ -204,7 +204,7 @@ public class Map implements Comparable<Map>, Publishable{
|
||||
@Override
|
||||
public boolean prePublish(){
|
||||
tags.put("author", player.name);
|
||||
ui.editor.editor.tags.put("author", tags.get("author"));
|
||||
editor.tags.put("author", tags.get("author"));
|
||||
ui.editor.save();
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package mindustry.maps;
|
||||
|
||||
import arc.*;
|
||||
import arc.assets.*;
|
||||
import arc.assets.loaders.*;
|
||||
import arc.assets.loaders.resolvers.*;
|
||||
import arc.files.*;
|
||||
import arc.graphics.*;
|
||||
import arc.struct.*;
|
||||
@@ -13,7 +13,7 @@ import mindustry.ctype.*;
|
||||
public class MapPreviewLoader extends TextureLoader{
|
||||
|
||||
public MapPreviewLoader(){
|
||||
super(new AbsoluteFileHandleResolver());
|
||||
super(Core.files::absolute);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -217,7 +217,7 @@ public class Maps{
|
||||
}
|
||||
|
||||
Pixmap pix = MapIO.generatePreview(world.tiles);
|
||||
executor.submit(() -> map.previewFile().writePNG(pix));
|
||||
executor.submit(() -> map.previewFile().writePng(pix));
|
||||
writeCache(map);
|
||||
|
||||
map.texture = new Texture(pix);
|
||||
@@ -409,7 +409,7 @@ public class Maps{
|
||||
map.texture = new Texture(pix);
|
||||
executor.submit(() -> {
|
||||
try{
|
||||
map.previewFile().writePNG(pix);
|
||||
map.previewFile().writePng(pix);
|
||||
writeCache(map);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -3,6 +3,7 @@ package mindustry.maps.filters;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.maps.filters.FilterOption.*;
|
||||
@@ -26,6 +27,11 @@ public class BlendFilter extends GenerateFilter{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public char icon(){
|
||||
return Iconc.blockSand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
if(in.floor == block || block == Blocks.air || in.floor == ignore) return;
|
||||
|
||||
@@ -2,6 +2,7 @@ package mindustry.maps.filters;
|
||||
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.maps.filters.FilterOption.*;
|
||||
@@ -14,6 +15,11 @@ public class ClearFilter extends GenerateFilter{
|
||||
return Structs.arr(new BlockOption("block", () -> block, b -> block = b, b -> oresOnly.get(b) || wallsOnly.get(b)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public char icon(){
|
||||
return Iconc.blockSnow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package mindustry.maps.filters;
|
||||
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
|
||||
@@ -19,6 +20,11 @@ public class CoreSpawnFilter extends GenerateFilter{
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char icon(){
|
||||
return Iconc.blockCoreShard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Tiles tiles, GenerateInput in){
|
||||
IntSeq spawns = new IntSeq();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mindustry.maps.filters;
|
||||
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.maps.filters.FilterOption.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
@@ -20,6 +21,11 @@ public class DistortFilter extends GenerateFilter{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public char icon(){
|
||||
return Iconc.blockTendrils;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
Tile tile = in.tile(in.x + noise(in.x, in.y, scl, mag) - mag / 2f, in.y + noise(in.x, in.y + o, scl, mag) - mag / 2f);
|
||||
|
||||
@@ -3,6 +3,7 @@ package mindustry.maps.filters;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.maps.filters.FilterOption.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
@@ -17,6 +18,11 @@ public class EnemySpawnFilter extends GenerateFilter{
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char icon(){
|
||||
return Iconc.blockSpawn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Tiles tiles, GenerateInput in){
|
||||
IntSeq spawns = new IntSeq();
|
||||
|
||||
@@ -17,13 +17,13 @@ import mindustry.world.blocks.environment.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public abstract class FilterOption{
|
||||
public static final Boolf<Block> floorsOnly = b -> (b instanceof Floor && !(b instanceof OverlayFloor)) && !headless && Core.atlas.isFound(b.icon(Cicon.full));
|
||||
public static final Boolf<Block> wallsOnly = b -> (!b.synthetic() && !(b instanceof Floor)) && !headless && Core.atlas.isFound(b.icon(Cicon.full)) && b.inEditor;
|
||||
public static final Boolf<Block> floorsOptional = b -> b == Blocks.air || ((b instanceof Floor && !(b instanceof OverlayFloor)) && !headless && Core.atlas.isFound(b.icon(Cicon.full)));
|
||||
public static final Boolf<Block> wallsOptional = b -> (b == Blocks.air || ((!b.synthetic() && !(b instanceof Floor)) && !headless && Core.atlas.isFound(b.icon(Cicon.full)))) && b.inEditor;
|
||||
public static final Boolf<Block> wallsOresOptional = b -> b == Blocks.air || (((!b.synthetic() && !(b instanceof Floor)) || (b instanceof OverlayFloor)) && !headless && Core.atlas.isFound(b.icon(Cicon.full))) && b.inEditor;
|
||||
public static final Boolf<Block> oresOnly = b -> b instanceof OverlayFloor && !headless && Core.atlas.isFound(b.icon(Cicon.full));
|
||||
public static final Boolf<Block> oresFloorsOptional = b -> (b instanceof Floor) && !headless && Core.atlas.isFound(b.icon(Cicon.full));
|
||||
public static final Boolf<Block> floorsOnly = b -> (b instanceof Floor && !(b instanceof OverlayFloor)) && !headless && Core.atlas.isFound(b.fullIcon);
|
||||
public static final Boolf<Block> wallsOnly = b -> (!b.synthetic() && !(b instanceof Floor)) && !headless && Core.atlas.isFound(b.fullIcon) && b.inEditor;
|
||||
public static final Boolf<Block> floorsOptional = b -> b == Blocks.air || ((b instanceof Floor && !(b instanceof OverlayFloor)) && !headless && Core.atlas.isFound(b.fullIcon));
|
||||
public static final Boolf<Block> wallsOptional = b -> (b == Blocks.air || ((!b.synthetic() && !(b instanceof Floor)) && !headless && Core.atlas.isFound(b.fullIcon))) && b.inEditor;
|
||||
public static final Boolf<Block> wallsOresOptional = b -> b == Blocks.air || (((!b.synthetic() && !(b instanceof Floor)) || (b instanceof OverlayFloor)) && !headless && Core.atlas.isFound(b.fullIcon)) && b.inEditor;
|
||||
public static final Boolf<Block> oresOnly = b -> b instanceof OverlayFloor && !headless && Core.atlas.isFound(b.fullIcon);
|
||||
public static final Boolf<Block> oresFloorsOptional = b -> (b instanceof Floor) && !headless && Core.atlas.isFound(b.fullIcon);
|
||||
public static final Boolf<Block> anyOptional = b -> (floorsOnly.get(b) || wallsOnly.get(b) || oresOnly.get(b) || b == Blocks.air) && b.inEditor;
|
||||
|
||||
public abstract void build(Table table);
|
||||
@@ -89,15 +89,15 @@ public abstract class FilterOption{
|
||||
|
||||
@Override
|
||||
public void build(Table table){
|
||||
table.button(b -> b.image(supplier.get().icon(Cicon.small)).update(i -> ((TextureRegionDrawable)i.getDrawable())
|
||||
.setRegion(supplier.get() == Blocks.air ? Icon.none.getRegion() : supplier.get().icon(Cicon.small))).size(8 * 3), () -> {
|
||||
table.button(b -> b.image(supplier.get().uiIcon).update(i -> ((TextureRegionDrawable)i.getDrawable())
|
||||
.setRegion(supplier.get() == Blocks.air ? Icon.none.getRegion() : supplier.get().uiIcon)).size(iconSmall), () -> {
|
||||
BaseDialog dialog = new BaseDialog("");
|
||||
dialog.setFillParent(false);
|
||||
int i = 0;
|
||||
for(Block block : Vars.content.blocks()){
|
||||
if(!filter.get(block)) continue;
|
||||
|
||||
dialog.cont.image(block == Blocks.air ? Icon.none.getRegion() : block.icon(Cicon.medium)).size(8 * 4).pad(3).get().clicked(() -> {
|
||||
dialog.cont.image(block == Blocks.air ? Icon.none.getRegion() : block.uiIcon).size(iconMed).pad(3).get().clicked(() -> {
|
||||
consumer.get(block);
|
||||
dialog.hide();
|
||||
changed.run();
|
||||
|
||||
@@ -82,6 +82,10 @@ public abstract class GenerateFilter{
|
||||
return Core.bundle.get("filter." + c.getSimpleName().toLowerCase().replace("filter", ""), c.getSimpleName().replace("Filter", ""));
|
||||
}
|
||||
|
||||
public char icon(){
|
||||
return '\0';
|
||||
}
|
||||
|
||||
/** set the seed to a random number */
|
||||
public void randomize(){
|
||||
seed = Mathf.random(99999999);
|
||||
|
||||
@@ -3,6 +3,7 @@ package mindustry.maps.filters;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.maps.filters.FilterOption.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
@@ -26,6 +27,11 @@ public class MedianFilter extends GenerateFilter{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public char icon(){
|
||||
return Iconc.blockSporePine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
int rad = (int)radius;
|
||||
|
||||
@@ -6,6 +6,7 @@ import arc.math.geom.*;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.maps.filters.FilterOption.*;
|
||||
import mindustry.world.*;
|
||||
@@ -22,6 +23,11 @@ public class MirrorFilter extends GenerateFilter{
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char icon(){
|
||||
return Iconc.blockMetalFloor5;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void apply(){
|
||||
v1.trnsExact(angle - 90, 1f);
|
||||
|
||||
@@ -2,6 +2,7 @@ package mindustry.maps.filters;
|
||||
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.maps.filters.FilterOption.*;
|
||||
@@ -23,6 +24,11 @@ public class NoiseFilter extends GenerateFilter{
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char icon(){
|
||||
return Iconc.blockPebbles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
float noise = noise(in.x, in.y, scl, 1f, octaves, falloff);
|
||||
|
||||
@@ -2,6 +2,7 @@ package mindustry.maps.filters;
|
||||
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.maps.filters.FilterOption.*;
|
||||
@@ -22,6 +23,11 @@ public class OreFilter extends GenerateFilter{
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char icon(){
|
||||
return Iconc.blockOreCopper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
float noise = noise(in.x, in.y, scl, 1f, octaves, falloff);
|
||||
|
||||
@@ -5,6 +5,7 @@ import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.maps.filters.FilterOption.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
@@ -27,6 +28,11 @@ public class OreMedianFilter extends GenerateFilter{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public char icon(){
|
||||
return Iconc.blockOreLead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
if(in.overlay == Blocks.spawn) return;
|
||||
|
||||
@@ -2,6 +2,7 @@ package mindustry.maps.filters;
|
||||
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.maps.filters.FilterOption.*;
|
||||
@@ -22,6 +23,11 @@ public class RiverNoiseFilter extends GenerateFilter{
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char icon(){
|
||||
return Iconc.blockWater;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
float noise = rnoise(in.x, in.y, scl, 1f);
|
||||
|
||||
@@ -2,6 +2,7 @@ package mindustry.maps.filters;
|
||||
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.maps.filters.FilterOption.*;
|
||||
@@ -20,6 +21,11 @@ public class ScatterFilter extends GenerateFilter{
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char icon(){
|
||||
return Iconc.blockBoulder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.ai.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.maps.filters.FilterOption.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
@@ -23,6 +24,11 @@ public class SpawnPathFilter extends GenerateFilter{
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char icon(){
|
||||
return Iconc.blockCommandCenter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Tiles tiles, GenerateInput in){
|
||||
Tile core = null;
|
||||
|
||||
@@ -3,6 +3,7 @@ package mindustry.maps.filters;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.maps.filters.FilterOption.*;
|
||||
@@ -25,6 +26,11 @@ public class TerrainFilter extends GenerateFilter{
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char icon(){
|
||||
return Iconc.blockStoneWall;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
float noise = noise(in.x, in.y, scl, magnitude, octaves, falloff) + Mathf.dst((float)in.x / in.width, (float)in.y / in.height, 0.5f, 0.5f) * circleScl;
|
||||
|
||||
@@ -15,6 +15,7 @@ import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.defense.*;
|
||||
import mindustry.world.blocks.distribution.*;
|
||||
import mindustry.world.blocks.payloads.*;
|
||||
import mindustry.world.blocks.power.*;
|
||||
import mindustry.world.blocks.production.*;
|
||||
import mindustry.world.meta.*;
|
||||
@@ -103,7 +104,7 @@ public class BaseGenerator{
|
||||
Tile o = tiles.get(tile.x + p.x, tile.y + p.y);
|
||||
|
||||
//do not block payloads
|
||||
if(o != null && (o.block() instanceof PayloadConveyor || o.block() instanceof PayloadAcceptor)){
|
||||
if(o != null && (o.block() instanceof PayloadConveyor || o.block() instanceof PayloadBlock)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,10 @@ public abstract class BasicGenerator implements WorldGenerator{
|
||||
}
|
||||
|
||||
public void tech(){
|
||||
Block[] blocks = {Blocks.darkPanel3};
|
||||
tech(Blocks.darkPanel3, Blocks.darkPanel4, Blocks.darkMetal);
|
||||
}
|
||||
|
||||
public void tech(Block floor1, Block floor2, Block wall){
|
||||
int secSize = 20;
|
||||
pass((x, y) -> {
|
||||
if(!floor.asFloor().hasSurface()) return;
|
||||
@@ -130,14 +133,14 @@ public abstract class BasicGenerator implements WorldGenerator{
|
||||
int sclx = x / secSize, scly = y / secSize;
|
||||
if(noise(sclx, scly, 0.2f, 1f) > 0.63f && noise(sclx, scly + 999, 200f, 1f) > 0.6f && (mx == 0 || my == 0 || mx == secSize - 1 || my == secSize - 1)){
|
||||
if(Mathf.chance(noise(x + 0x231523, y, 40f, 1f))){
|
||||
floor = blocks[rand.random(0, blocks.length - 1)];
|
||||
floor = floor1;
|
||||
if(Mathf.dst(mx, my, secSize/2, secSize/2) > secSize/2f + 2){
|
||||
floor = Blocks.darkPanel4;
|
||||
floor = floor2;
|
||||
}
|
||||
}
|
||||
|
||||
if(block.solid && Mathf.chance(0.7)){
|
||||
block = Blocks.darkMetal;
|
||||
block = wall;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -215,7 +218,9 @@ public abstract class BasicGenerator implements WorldGenerator{
|
||||
read.set(write);
|
||||
}
|
||||
|
||||
tiles.each((x, y) -> tiles.get(x, y).setBlock(!read.get(x, y) ? Blocks.air : tiles.get(x, y).floor().wall));
|
||||
for(var t : tiles){
|
||||
t.setBlock(!read.get(t.x, t.y) ? Blocks.air : t.floor().wall);
|
||||
}
|
||||
}
|
||||
|
||||
protected float noise(float x, float y, double scl, double mag){
|
||||
|
||||
@@ -2,12 +2,19 @@ package mindustry.maps.generators;
|
||||
|
||||
import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import arc.struct.ObjectIntMap.*;
|
||||
import arc.util.noise.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.graphics.g3d.*;
|
||||
import mindustry.graphics.g3d.PlanetGrid.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.type.Weather.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public abstract class PlanetGenerator extends BasicGenerator implements HexMesher{
|
||||
protected IntSeq ints = new IntSeq();
|
||||
protected Sector sector;
|
||||
@@ -43,6 +50,65 @@ public abstract class PlanetGenerator extends BasicGenerator implements HexMeshe
|
||||
}
|
||||
}
|
||||
|
||||
public void addWeather(Sector sector, Rules rules){
|
||||
|
||||
//apply weather based on terrain
|
||||
ObjectIntMap<Block> floorc = new ObjectIntMap<>();
|
||||
ObjectSet<UnlockableContent> content = new ObjectSet<>();
|
||||
|
||||
for(Tile tile : world.tiles){
|
||||
if(world.getDarkness(tile.x, tile.y) >= 3){
|
||||
continue;
|
||||
}
|
||||
|
||||
Liquid liquid = tile.floor().liquidDrop;
|
||||
if(tile.floor().itemDrop != null) content.add(tile.floor().itemDrop);
|
||||
if(tile.overlay().itemDrop != null) content.add(tile.overlay().itemDrop);
|
||||
if(liquid != null) content.add(liquid);
|
||||
|
||||
if(!tile.block().isStatic()){
|
||||
floorc.increment(tile.floor());
|
||||
if(tile.overlay() != Blocks.air){
|
||||
floorc.increment(tile.overlay());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//sort counts in descending order
|
||||
Seq<Entry<Block>> entries = floorc.entries().toArray();
|
||||
entries.sort(e -> -e.value);
|
||||
//remove all blocks occuring < 30 times - unimportant
|
||||
entries.removeAll(e -> e.value < 30);
|
||||
|
||||
Block[] floors = new Block[entries.size];
|
||||
for(int i = 0; i < entries.size; i++){
|
||||
floors[i] = entries.get(i).key;
|
||||
}
|
||||
|
||||
//TODO bad code
|
||||
boolean hasSnow = floors.length > 0 && (floors[0].name.contains("ice") || floors[0].name.contains("snow"));
|
||||
boolean hasRain = floors.length > 0 && !hasSnow && content.contains(Liquids.water) && !floors[0].name.contains("sand");
|
||||
boolean hasDesert = floors.length > 0 && !hasSnow && !hasRain && floors[0] == Blocks.sand;
|
||||
boolean hasSpores = floors.length > 0 && (floors[0].name.contains("spore") || floors[0].name.contains("moss") || floors[0].name.contains("tainted"));
|
||||
|
||||
if(hasSnow){
|
||||
rules.weather.add(new WeatherEntry(Weathers.snow));
|
||||
}
|
||||
|
||||
if(hasRain){
|
||||
rules.weather.add(new WeatherEntry(Weathers.rain));
|
||||
rules.weather.add(new WeatherEntry(Weathers.fog));
|
||||
}
|
||||
|
||||
if(hasDesert){
|
||||
rules.weather.add(new WeatherEntry(Weathers.sandstorm));
|
||||
}
|
||||
|
||||
if(hasSpores){
|
||||
rules.weather.add(new WeatherEntry(Weathers.sporestorm));
|
||||
}
|
||||
}
|
||||
|
||||
protected void genTile(Vec3 position, TileGen tile){
|
||||
|
||||
}
|
||||
@@ -53,6 +119,11 @@ public abstract class PlanetGenerator extends BasicGenerator implements HexMeshe
|
||||
return (float)noise.octaveNoise3D(octaves, falloff, 1f / scl, v.x, v.y, v.z) * (float)mag;
|
||||
}
|
||||
|
||||
/** @return the scaling factor for sector rects. */
|
||||
public float getSizeScl(){
|
||||
return 3200;
|
||||
}
|
||||
|
||||
public void generate(Tiles tiles, Sector sec){
|
||||
this.tiles = tiles;
|
||||
this.sector = sec;
|
||||
|
||||
@@ -115,7 +115,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
tile.floor = getBlock(position);
|
||||
tile.block = tile.floor.asFloor().wall;
|
||||
|
||||
if(rid.getValue(position.x, position.y, position.z, 22) > 0.32){
|
||||
if(rid.getValue(position.x, position.y, position.z, 22) > 0.31){
|
||||
tile.block = Blocks.air;
|
||||
}
|
||||
}
|
||||
@@ -162,12 +162,11 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
}
|
||||
|
||||
void connect(Room to){
|
||||
if(connected.contains(to)) return;
|
||||
if(!connected.add(to)) return;
|
||||
|
||||
connected.add(to);
|
||||
float nscl = rand.random(20f, 60f);
|
||||
int stroke = rand.random(4, 12);
|
||||
brush(pathfind(x, y, to.x, to.y, tile -> (tile.solid() ? 5f : 0f) + noise(tile.x, tile.y, 1, 1, 1f / nscl) * 60, Astar.manhattan), stroke);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +218,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
for(int j = 0; j < enemySpawns; j++){
|
||||
float enemyOffset = rand.range(60f);
|
||||
Tmp.v1.set(cx - width/2, cy - height/2).rotate(180f + enemyOffset).add(width/2, height/2);
|
||||
Room espawn = new Room((int)Tmp.v1.x, (int)Tmp.v1.y, rand.random(8, 15));
|
||||
Room espawn = new Room((int)Tmp.v1.x, (int)Tmp.v1.y, rand.random(8, 16));
|
||||
roomseq.add(espawn);
|
||||
enemies.add(espawn);
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package mindustry.maps.planet;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.maps.generators.*;
|
||||
|
||||
public class TantrosPlanetGenerator extends PlanetGenerator{
|
||||
Color c1 = Color.valueOf("5057a6"), c2 = Color.valueOf("272766"), out = new Color();
|
||||
|
||||
@Override
|
||||
public float getHeight(Vec3 position){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getColor(Vec3 position){
|
||||
float depth = (float)noise.octaveNoise3D(2, 0.56, 1.7f, position.x, position.y, position.z) / 2f;
|
||||
return c1.write(out).lerp(c2, Mathf.clamp(Mathf.round(depth, 0.15f))).a(0.6f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generate(){
|
||||
pass((x, y) -> {
|
||||
floor = Blocks.deepwater;
|
||||
});
|
||||
|
||||
Schematics.placeLaunchLoadout(width / 2, height / 2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user