Removed ores from existing built-in maps / Default oregen

This commit is contained in:
Anuken 2019-07-25 23:24:12 -04:00
parent 951cbf3d16
commit 0ffa0351b5
16 changed files with 93 additions and 23 deletions

View File

@ -269,6 +269,8 @@ filter.distort = Distort
filter.noise = Noise
filter.ore = Ore
filter.rivernoise = River Noise
filter.mirror = Mirror
filter.clear = Clear
filter.scatter = Scatter
filter.terrain = Terrain
filter.option.scale = Scale

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -91,6 +91,11 @@ public class EditorTile extends Tile{
super.rotation(rotation);
}
@Override
public void setOverlay(Block overlay){
setOverlayID(overlay.id);
}
@Override
public void setOverlayID(short overlay){
if(state.is(State.playing)){

View File

@ -20,6 +20,7 @@ import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.util.*;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.*;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.core.Platform;
import io.anuke.mindustry.game.*;
@ -32,7 +33,7 @@ import io.anuke.mindustry.ui.dialogs.FloatingDialog;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Block.Icon;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.OverlayFloor;
import io.anuke.mindustry.world.blocks.*;
import io.anuke.mindustry.world.blocks.storage.CoreBlock;
import static io.anuke.mindustry.Vars.*;
@ -590,6 +591,28 @@ public class MapEditorDialog extends Dialog implements Disposable{
editor.undo();
}
//more undocumented features, fantastic
if(Core.input.keyTap(KeyCode.T)){
//clears all 'decoration' from the map
for(int x = 0; x < editor.width(); x++){
for(int y = 0; y < editor.height(); y++){
Tile tile = editor.tile(x, y);
if(tile.block().breakable && tile.block() instanceof Rock){
tile.setBlock(Blocks.air);
editor.renderer().updatePoint(x, y);
}
if(tile.overlay() != Blocks.air && tile.overlay() != Blocks.spawn){
tile.setOverlay(Blocks.air);
editor.renderer().updatePoint(x, y);
}
}
}
editor.flushOp();
}
if(Core.input.keyTap(KeyCode.Y)){
editor.redo();
}

View File

@ -29,7 +29,7 @@ public class MapGenerateDialog extends FloatingDialog{
private final Supplier<GenerateFilter>[] filterTypes = new Supplier[]{
NoiseFilter::new, ScatterFilter::new, TerrainFilter::new, DistortFilter::new,
RiverNoiseFilter::new, OreFilter::new, MedianFilter::new, BlendFilter::new,
MirrorFilter::new
MirrorFilter::new, ClearFilter::new
};
private final MapEditor editor;
private final boolean applied;
@ -64,6 +64,12 @@ public class MapGenerateDialog extends FloatingDialog{
hide();
});
}).size(160f, 64f);
}else{
buttons.addButton("$settings.reset", () -> {
filters.set(world.maps.readFilters(""));
rebuildFilters();
update();
}).size(160f, 64f);
}
buttons.addButton("$editor.randomize", () -> {
for(GenerateFilter filter : filters){
@ -137,9 +143,9 @@ public class MapGenerateDialog extends FloatingDialog{
public void addDefaultOres(Array<GenerateFilter> filters){
int index = 0;
for(Block block : new Block[]{Blocks.oreCopper, Blocks.oreCoal, Blocks.oreLead, Blocks.oreTitanium, Blocks.oreThorium}){
for(Block block : new Block[]{Blocks.oreCopper, Blocks.oreLead, Blocks.oreCoal, Blocks.oreTitanium, Blocks.oreThorium}){
OreFilter filter = new OreFilter();
filter.threshold += index ++ * 0.025f;
filter.threshold += index ++ * 0.019f;
filter.ore = block;
filters.add(filter);
}

View File

@ -186,25 +186,35 @@ public class Maps implements Disposable{
@SuppressWarnings("unchecked")
public Array<GenerateFilter> readFilters(String str){
if(str == null || str.isEmpty()){
return Array.with(
//stone
new ScatterFilter(){{
flooronto = Blocks.stone;
block = Blocks.rock;
}},
new ScatterFilter(){{
flooronto = Blocks.shale;
block = Blocks.shaleBoulder;
}},
new ScatterFilter(){{
flooronto = Blocks.snow;
block = Blocks.snowrock;
}},
new ScatterFilter(){{
flooronto = Blocks.ice;
block = Blocks.snowrock;
}}
//create default filters list
Array<GenerateFilter> filters = Array.with(
new ScatterFilter(){{
flooronto = Blocks.stone;
block = Blocks.rock;
}},
new ScatterFilter(){{
flooronto = Blocks.shale;
block = Blocks.shaleBoulder;
}},
new ScatterFilter(){{
flooronto = Blocks.snow;
block = Blocks.snowrock;
}},
new ScatterFilter(){{
flooronto = Blocks.ice;
block = Blocks.snowrock;
}}
);
int index = 0;
for(Block block : new Block[]{Blocks.oreCopper, Blocks.oreLead, Blocks.oreCoal, Blocks.oreTitanium, Blocks.oreThorium}){
OreFilter filter = new OreFilter();
filter.threshold += index ++ * 0.019f;
filter.ore = block;
filters.add(filter);
}
return filters;
}else{
return JsonIO.read(Array.class, str);
}

View File

@ -0,0 +1,24 @@
package io.anuke.mindustry.maps.filters;
import io.anuke.mindustry.content.*;
import io.anuke.mindustry.world.*;
import static io.anuke.mindustry.maps.filters.FilterOption.*;
public class ClearFilter extends GenerateFilter{
protected Block block = Blocks.air;
{
options(
new BlockOption("block", () -> block, b -> block = b, wallsOnly)
);
}
@Override
public void apply(){
if(in.block == block){
in.block = Blocks.air;
}
}
}

View File

@ -8,7 +8,7 @@ import static io.anuke.mindustry.maps.filters.FilterOption.BlockOption;
import static io.anuke.mindustry.maps.filters.FilterOption.oresOnly;
public class OreFilter extends GenerateFilter{
public float scl = 45, threshold = 0.73f, octaves = 3f, falloff = 0.4f;
public float scl = 43, threshold = 0.705f, octaves = 3f, falloff = 0.4f;
public Block ore = Blocks.oreCopper;
{