Even more blocks / Map generator config / Editor fixes
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1022 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
BIN
core/assets-raw/sprites/blocks/storage/core-bastion.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 307 B |
BIN
core/assets/maps/stainedMountains.mmap
Normal file
|
Before Width: | Height: | Size: 1022 KiB After Width: | Height: | Size: 1.0 MiB |
@@ -36,7 +36,7 @@ public class Blocks implements ContentList{
|
|||||||
//environment
|
//environment
|
||||||
air, part, spawn, deepwater, water, tar, stone, craters, charr, sand, ice, snow,
|
air, part, spawn, deepwater, water, tar, stone, craters, charr, sand, ice, snow,
|
||||||
grass, holostone, rocks, icerocks, cliffs, pine, whiteTree, whiteTreeDead, sporeCluster,
|
grass, holostone, rocks, icerocks, cliffs, pine, whiteTree, whiteTreeDead, sporeCluster,
|
||||||
iceSnow, sandWater, duneRocks, stainedRocks, stainedStone,
|
iceSnow, sandWater, duneRocks, stainedRocks, stainedStone, stainedRocksRed, stainedStoneRed, stainedRocksYellow, stainedStoneYellow,
|
||||||
|
|
||||||
//crafting
|
//crafting
|
||||||
siliconSmelter, kiln, graphitePress, plastaniumCompressor, multiPress, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer,
|
siliconSmelter, kiln, graphitePress, plastaniumCompressor, multiPress, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer,
|
||||||
@@ -244,6 +244,22 @@ public class Blocks implements ContentList{
|
|||||||
hasOres = true;
|
hasOres = true;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
stainedRocksRed = new StaticWall("stained-rocks-red"){{
|
||||||
|
variants = 2;
|
||||||
|
}};
|
||||||
|
|
||||||
|
stainedStoneRed = new Floor("stained-stone-red"){{
|
||||||
|
edgeStyle = "blocky";
|
||||||
|
}};
|
||||||
|
|
||||||
|
stainedRocksYellow = new StaticWall("stained-rocks-yellow"){{
|
||||||
|
variants = 2;
|
||||||
|
}};
|
||||||
|
|
||||||
|
stainedStoneYellow = new Floor("stained-stone-yellow"){{
|
||||||
|
edgeStyle = "blocky";
|
||||||
|
}};
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
//region crafting
|
//region crafting
|
||||||
|
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ public class Zones implements ContentList{
|
|||||||
}};
|
}};
|
||||||
}};
|
}};
|
||||||
|
|
||||||
stainedMountains = new Zone("stainedMountains", new MapGenerator("groundZero", 2)){{ //TODO implement
|
stainedMountains = new Zone("stainedMountains", new MapGenerator("stainedMountains", 2).dist(2.5f, true)){{ //TODO implement
|
||||||
deployCost = ItemStack.with(Items.copper, 300);
|
deployCost = ItemStack.with(Items.copper, 300);
|
||||||
startingItems = ItemStack.with(Items.copper, 200);
|
startingItems = ItemStack.with(Items.copper, 200);
|
||||||
conditionWave = 15;
|
conditionWave = 15;
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package io.anuke.mindustry.editor;
|
package io.anuke.mindustry.editor;
|
||||||
|
|
||||||
|
import io.anuke.arc.Core;
|
||||||
import io.anuke.arc.collection.IntArray;
|
import io.anuke.arc.collection.IntArray;
|
||||||
import io.anuke.arc.function.IntPositionConsumer;
|
import io.anuke.arc.function.IntPositionConsumer;
|
||||||
|
import io.anuke.arc.input.KeyCode;
|
||||||
import io.anuke.arc.util.Pack;
|
import io.anuke.arc.util.Pack;
|
||||||
import io.anuke.arc.util.Structs;
|
import io.anuke.arc.util.Structs;
|
||||||
import io.anuke.mindustry.content.Blocks;
|
import io.anuke.mindustry.content.Blocks;
|
||||||
@@ -43,7 +45,7 @@ public enum EditorTool{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void touched(MapEditor editor, int x, int y){
|
public void touched(MapEditor editor, int x, int y){
|
||||||
editor.draw(x, y);
|
editor.draw(x, y, isPaint());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
eraser{
|
eraser{
|
||||||
@@ -54,7 +56,7 @@ public enum EditorTool{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void touched(MapEditor editor, int x, int y){
|
public void touched(MapEditor editor, int x, int y){
|
||||||
editor.draw(x, y, Blocks.air);
|
editor.draw(x, y, isPaint(), Blocks.air);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
spray{
|
spray{
|
||||||
@@ -65,7 +67,7 @@ public enum EditorTool{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void touched(MapEditor editor, int x, int y){
|
public void touched(MapEditor editor, int x, int y){
|
||||||
editor.draw(x, y, editor.getDrawBlock(), 0.012);
|
editor.draw(x, y, isPaint(), editor.getDrawBlock(), 0.012);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
line{
|
line{
|
||||||
@@ -181,6 +183,10 @@ public enum EditorTool{
|
|||||||
|
|
||||||
boolean edit, draggable;
|
boolean edit, draggable;
|
||||||
|
|
||||||
|
public static boolean isPaint(){
|
||||||
|
return Core.input.keyDown(KeyCode.CONTROL_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
public void touched(MapEditor editor, int x, int y){
|
public void touched(MapEditor editor, int x, int y){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,15 +85,15 @@ public class MapEditor{
|
|||||||
this.brushSize = size;
|
this.brushSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(int x, int y){
|
public void draw(int x, int y, boolean paint){
|
||||||
draw(x, y, drawBlock);
|
draw(x, y, paint, drawBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(int x, int y, Block drawBlock){
|
public void draw(int x, int y, boolean paint, Block drawBlock){
|
||||||
draw(x, y, drawBlock, 1.0);
|
draw(x, y, paint, drawBlock, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(int x, int y, Block drawBlock, double chance){
|
public void draw(int x, int y, boolean paint, Block drawBlock, double chance){
|
||||||
byte writeID = drawBlock.id;
|
byte writeID = drawBlock.id;
|
||||||
byte partID = Blocks.part.id;
|
byte partID = Blocks.part.id;
|
||||||
byte rotationTeam = Pack.byteByte(drawBlock.rotate ? (byte)rotation : 0, drawBlock.synthetic() ? (byte)drawTeam.ordinal() : 0);
|
byte rotationTeam = Pack.byteByte(drawBlock.rotate ? (byte)rotation : 0, drawBlock.synthetic() ? (byte)drawTeam.ordinal() : 0);
|
||||||
@@ -150,7 +150,7 @@ public class MapEditor{
|
|||||||
if(Mathf.dst(rx, ry) <= brushSize - 0.5f && (chance >= 0.999 || Mathf.chance(chance))){
|
if(Mathf.dst(rx, ry) <= brushSize - 0.5f && (chance >= 0.999 || Mathf.chance(chance))){
|
||||||
int wx = x + rx, wy = y + ry;
|
int wx = x + rx, wy = y + ry;
|
||||||
|
|
||||||
if(wx < 0 || wy < 0 || wx >= map.width() || wy >= map.height()){
|
if(wx < 0 || wy < 0 || wx >= map.width() || wy >= map.height() || (paint && !isfloor && content.block(map.read(wx, wy, DataPosition.wall)) == Blocks.air)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
ui.editor.resetSaved();
|
ui.editor.resetSaved();
|
||||||
Array<Point2> points = br.line(startx, starty, p.x, p.y);
|
Array<Point2> points = br.line(startx, starty, p.x, p.y);
|
||||||
for(Point2 point : points){
|
for(Point2 point : points){
|
||||||
editor.draw(point.x, point.y);
|
editor.draw(point.x, point.y, EditorTool.isPaint());
|
||||||
}
|
}
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
@@ -295,9 +295,9 @@ public class MapView extends Element implements GestureListener{
|
|||||||
float scaling = zoom * Math.min(width, height) / editor.getMap().width();
|
float scaling = zoom * Math.min(width, height) / editor.getMap().width();
|
||||||
|
|
||||||
Draw.color(Palette.accent);
|
Draw.color(Palette.accent);
|
||||||
Lines.stroke(Unit.dp.scl(1f * zoom));
|
Lines.stroke(Unit.dp.scl(2f));
|
||||||
|
|
||||||
if(!editor.getDrawBlock().isMultiblock() || tool == EditorTool.eraser){
|
if((!editor.getDrawBlock().isMultiblock() || tool == EditorTool.eraser) && tool != EditorTool.fill){
|
||||||
if(tool == EditorTool.line && drawing){
|
if(tool == EditorTool.line && drawing){
|
||||||
Vector2 v1 = unproject(startx, starty).add(x, y);
|
Vector2 v1 = unproject(startx, starty).add(x, y);
|
||||||
float sx = v1.x, sy = v1.y;
|
float sx = v1.x, sy = v1.y;
|
||||||
@@ -307,7 +307,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
Lines.poly(brushPolygons[index], v2.x, v2.y, scaling);
|
Lines.poly(brushPolygons[index], v2.x, v2.y, scaling);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tool.edit && (!mobile || drawing)){
|
if((tool.edit || tool == EditorTool.line) && (!mobile || drawing)){
|
||||||
Point2 p = project(mousex, mousey);
|
Point2 p = project(mousex, mousey);
|
||||||
Vector2 v = unproject(p.x, p.y).add(x, y);
|
Vector2 v = unproject(p.x, p.y).add(x, y);
|
||||||
Lines.poly(brushPolygons[index], v.x, v.y, scaling);
|
Lines.poly(brushPolygons[index], v.x, v.y, scaling);
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ public class MapGenerator extends Generator{
|
|||||||
* This amount of enemy spawns is selected randomly from the map.*/
|
* This amount of enemy spawns is selected randomly from the map.*/
|
||||||
public int enemySpawns = -1;
|
public int enemySpawns = -1;
|
||||||
|
|
||||||
|
public boolean distortFloor = false;
|
||||||
|
|
||||||
public MapGenerator(String mapName){
|
public MapGenerator(String mapName){
|
||||||
this.mapName = mapName;
|
this.mapName = mapName;
|
||||||
}
|
}
|
||||||
@@ -47,6 +49,12 @@ public class MapGenerator extends Generator{
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MapGenerator dist(float distortion, boolean floor){
|
||||||
|
this.distortion = distortion;
|
||||||
|
this.distortFloor = floor;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
map = world.maps.loadInternalMap(mapName);
|
map = world.maps.loadInternalMap(mapName);
|
||||||
@@ -97,6 +105,10 @@ public class MapGenerator extends Generator{
|
|||||||
tile.setBlock(tiles[newX][newY].block());
|
tile.setBlock(tiles[newX][newY].block());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(distortFloor){
|
||||||
|
tile.setFloor(tiles[newX][newY].floor());
|
||||||
|
}
|
||||||
|
|
||||||
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 && tile.floor() == decor.floor && Mathf.chance(decor.chance)){
|
||||||
tile.setBlock(decor.wall);
|
tile.setBlock(decor.wall);
|
||||||
|
|||||||