Tile cleanup
Before Width: | Height: | Size: 195 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1018 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
@ -271,23 +271,28 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
metalFloorDamaged = new Floor("metal-floor-damaged"){{
|
metalFloorDamaged = new Floor("metal-floor-damaged"){{
|
||||||
variants = 0;
|
variants = 6;
|
||||||
|
blendGroup = metalFloor;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
metalFloor2 = new Floor("metal-floor-2"){{
|
metalFloor2 = new Floor("metal-floor-2"){{
|
||||||
variants = 0;
|
variants = 0;
|
||||||
|
blendGroup = metalFloor;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
metalFloor3 = new Floor("metal-floor-3"){{
|
metalFloor3 = new Floor("metal-floor-3"){{
|
||||||
variants = 0;
|
variants = 0;
|
||||||
|
blendGroup = metalFloor;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
metalFloor4 = new Floor("metal-floor-4"){{
|
metalFloor4 = new Floor("metal-floor-4"){{
|
||||||
variants = 0;
|
variants = 0;
|
||||||
|
blendGroup = metalFloor;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
metalFloor5 = new Floor("metal-floor-5"){{
|
metalFloor5 = new Floor("metal-floor-5"){{
|
||||||
variants = 0;
|
variants = 0;
|
||||||
|
blendGroup = metalFloor;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
@ -1414,6 +1419,9 @@ public class Blocks implements ContentList{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//special variants
|
||||||
|
new OreBlock(Items.scrap, (Floor)snow);
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,11 @@ public class Zones implements ContentList{
|
|||||||
}};
|
}};
|
||||||
}};
|
}};
|
||||||
|
|
||||||
impact = new Zone("impact0079", new MapGenerator("impact0079")){{ //TODO implement
|
impact = new Zone("impact0079", new MapGenerator("impact0079", 2)
|
||||||
|
.decor(
|
||||||
|
new Decoration(Blocks.snow, Blocks.sporeCluster, 0.01),
|
||||||
|
new Decoration(Blocks.metalFloor, Blocks.metalFloorDamaged, 0.02))
|
||||||
|
){{ //TODO implement
|
||||||
deployCost = ItemStack.with(Items.copper, 4000);
|
deployCost = ItemStack.with(Items.copper, 4000);
|
||||||
startingItems = ItemStack.with(Items.copper, 200);
|
startingItems = ItemStack.with(Items.copper, 200);
|
||||||
conditionWave = 15;
|
conditionWave = 15;
|
||||||
|
@ -114,13 +114,6 @@ public enum EditorTool{
|
|||||||
width = editor.getMap().width();
|
width = editor.getMap().width();
|
||||||
int height = editor.getMap().height();
|
int height = editor.getMap().height();
|
||||||
|
|
||||||
int x1;
|
|
||||||
boolean spanAbove, spanBelow;
|
|
||||||
|
|
||||||
stack.clear();
|
|
||||||
|
|
||||||
stack.add(asi(x, y));
|
|
||||||
|
|
||||||
IntPositionConsumer writer = (px, py) -> {
|
IntPositionConsumer writer = (px, py) -> {
|
||||||
TileDataMarker prev = editor.getPrev(px, py, false);
|
TileDataMarker prev = editor.getPrev(px, py, false);
|
||||||
|
|
||||||
@ -137,32 +130,49 @@ public enum EditorTool{
|
|||||||
editor.onWrite(px, py, prev);
|
editor.onWrite(px, py, prev);
|
||||||
};
|
};
|
||||||
|
|
||||||
while(stack.size > 0){
|
if(isAlt()){
|
||||||
int popped = stack.pop();
|
for(int cx = 0; cx < width; cx++){
|
||||||
x = popped % width;
|
for(int cy = 0; cy < height; cy++){
|
||||||
y = popped / width;
|
if(eq(cx, cy)){
|
||||||
|
writer.accept(cx, cy);
|
||||||
x1 = x;
|
}
|
||||||
while(x1 >= 0 && eq(x1, y)) x1--;
|
|
||||||
x1++;
|
|
||||||
spanAbove = spanBelow = false;
|
|
||||||
while(x1 < width && eq(x1, y)){
|
|
||||||
writer.accept(x1, y);
|
|
||||||
|
|
||||||
if(!spanAbove && y > 0 && eq(x1, y - 1)){
|
|
||||||
stack.add(asi(x1, y - 1));
|
|
||||||
spanAbove = true;
|
|
||||||
}else if(spanAbove && y > 0 && eq(x1, y - 1)){
|
|
||||||
spanAbove = false;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
int x1;
|
||||||
|
boolean spanAbove, spanBelow;
|
||||||
|
|
||||||
if(!spanBelow && y < height - 1 && eq(x1, y + 1)){
|
stack.clear();
|
||||||
stack.add(asi(x1, y + 1));
|
|
||||||
spanBelow = true;
|
stack.add(asi(x, y));
|
||||||
}else if(spanBelow && y < height - 1 && eq(x1, y + 1)){
|
|
||||||
spanBelow = false;
|
while(stack.size > 0){
|
||||||
}
|
int popped = stack.pop();
|
||||||
|
x = popped % width;
|
||||||
|
y = popped / width;
|
||||||
|
|
||||||
|
x1 = x;
|
||||||
|
while(x1 >= 0 && eq(x1, y)) x1--;
|
||||||
x1++;
|
x1++;
|
||||||
|
spanAbove = spanBelow = false;
|
||||||
|
while(x1 < width && eq(x1, y)){
|
||||||
|
writer.accept(x1, y);
|
||||||
|
|
||||||
|
if(!spanAbove && y > 0 && eq(x1, y - 1)){
|
||||||
|
stack.add(asi(x1, y - 1));
|
||||||
|
spanAbove = true;
|
||||||
|
}else if(spanAbove && y > 0 && eq(x1, y - 1)){
|
||||||
|
spanAbove = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!spanBelow && y < height - 1 && eq(x1, y + 1)){
|
||||||
|
stack.add(asi(x1, y + 1));
|
||||||
|
spanBelow = true;
|
||||||
|
}else if(spanBelow && y < height - 1 && eq(x1, y + 1)){
|
||||||
|
spanBelow = false;
|
||||||
|
}
|
||||||
|
x1++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,6 +197,10 @@ public enum EditorTool{
|
|||||||
return Core.input.keyDown(KeyCode.CONTROL_LEFT);
|
return Core.input.keyDown(KeyCode.CONTROL_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isAlt(){
|
||||||
|
return Core.input.keyDown(KeyCode.TAB);
|
||||||
|
}
|
||||||
|
|
||||||
public void touched(MapEditor editor, int x, int y){
|
public void touched(MapEditor editor, int x, int y){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import io.anuke.mindustry.maps.MapTileData.TileDataMarker;
|
|||||||
import io.anuke.mindustry.type.ItemStack;
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
import io.anuke.mindustry.world.blocks.Floor;
|
||||||
import io.anuke.mindustry.world.blocks.OreBlock;
|
import io.anuke.mindustry.world.blocks.OreBlock;
|
||||||
import io.anuke.mindustry.world.blocks.StaticWall;
|
import io.anuke.mindustry.world.blocks.StaticWall;
|
||||||
import io.anuke.mindustry.world.blocks.storage.CoreBlock;
|
import io.anuke.mindustry.world.blocks.storage.CoreBlock;
|
||||||
@ -46,7 +47,7 @@ public class MapGenerator extends Generator{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public MapGenerator decor(Decoration... decor){
|
public MapGenerator decor(Decoration... decor){
|
||||||
this.decorations = Array.with(decor);
|
this.decorations.addAll(decor);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,8 +119,10 @@ public class MapGenerator extends Generator{
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(Decoration decor : decorations){
|
for(Decoration decor : decorations){
|
||||||
if(tile.block() == Blocks.air && tile.floor() == decor.floor && Mathf.chance(decor.chance)){
|
if(tile.block() == Blocks.air && !(decor.wall instanceof Floor) && tile.floor() == decor.floor && Mathf.chance(decor.chance)){
|
||||||
tile.setBlock(decor.wall);
|
tile.setBlock(decor.wall);
|
||||||
|
}else if(tile.floor() == decor.floor && decor.wall instanceof Floor && Mathf.chance(decor.chance)){
|
||||||
|
tile.setFloor((Floor)decor.wall);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|