Even more blocks / Map generator config / Editor fixes
This commit is contained in:
@@ -36,7 +36,7 @@ public class Blocks implements ContentList{
|
||||
//environment
|
||||
air, part, spawn, deepwater, water, tar, stone, craters, charr, sand, ice, snow,
|
||||
grass, holostone, rocks, icerocks, cliffs, pine, whiteTree, whiteTreeDead, sporeCluster,
|
||||
iceSnow, sandWater, duneRocks, stainedRocks, stainedStone,
|
||||
iceSnow, sandWater, duneRocks, stainedRocks, stainedStone, stainedRocksRed, stainedStoneRed, stainedRocksYellow, stainedStoneYellow,
|
||||
|
||||
//crafting
|
||||
siliconSmelter, kiln, graphitePress, plastaniumCompressor, multiPress, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer,
|
||||
@@ -244,6 +244,22 @@ public class Blocks implements ContentList{
|
||||
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
|
||||
//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);
|
||||
startingItems = ItemStack.with(Items.copper, 200);
|
||||
conditionWave = 15;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package io.anuke.mindustry.editor;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.collection.IntArray;
|
||||
import io.anuke.arc.function.IntPositionConsumer;
|
||||
import io.anuke.arc.input.KeyCode;
|
||||
import io.anuke.arc.util.Pack;
|
||||
import io.anuke.arc.util.Structs;
|
||||
import io.anuke.mindustry.content.Blocks;
|
||||
@@ -43,7 +45,7 @@ public enum EditorTool{
|
||||
|
||||
@Override
|
||||
public void touched(MapEditor editor, int x, int y){
|
||||
editor.draw(x, y);
|
||||
editor.draw(x, y, isPaint());
|
||||
}
|
||||
},
|
||||
eraser{
|
||||
@@ -54,7 +56,7 @@ public enum EditorTool{
|
||||
|
||||
@Override
|
||||
public void touched(MapEditor editor, int x, int y){
|
||||
editor.draw(x, y, Blocks.air);
|
||||
editor.draw(x, y, isPaint(), Blocks.air);
|
||||
}
|
||||
},
|
||||
spray{
|
||||
@@ -65,7 +67,7 @@ public enum EditorTool{
|
||||
|
||||
@Override
|
||||
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{
|
||||
@@ -181,6 +183,10 @@ public enum EditorTool{
|
||||
|
||||
boolean edit, draggable;
|
||||
|
||||
public static boolean isPaint(){
|
||||
return Core.input.keyDown(KeyCode.CONTROL_LEFT);
|
||||
}
|
||||
|
||||
public void touched(MapEditor editor, int x, int y){
|
||||
|
||||
}
|
||||
|
||||
@@ -85,15 +85,15 @@ public class MapEditor{
|
||||
this.brushSize = size;
|
||||
}
|
||||
|
||||
public void draw(int x, int y){
|
||||
draw(x, y, drawBlock);
|
||||
public void draw(int x, int y, boolean paint){
|
||||
draw(x, y, paint, drawBlock);
|
||||
}
|
||||
|
||||
public void draw(int x, int y, Block drawBlock){
|
||||
draw(x, y, drawBlock, 1.0);
|
||||
public void draw(int x, int y, boolean paint, Block drawBlock){
|
||||
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 partID = Blocks.part.id;
|
||||
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))){
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ public class MapView extends Element implements GestureListener{
|
||||
ui.editor.resetSaved();
|
||||
Array<Point2> points = br.line(startx, starty, p.x, p.y);
|
||||
for(Point2 point : points){
|
||||
editor.draw(point.x, point.y);
|
||||
editor.draw(point.x, point.y, EditorTool.isPaint());
|
||||
}
|
||||
updated = true;
|
||||
}
|
||||
@@ -295,9 +295,9 @@ public class MapView extends Element implements GestureListener{
|
||||
float scaling = zoom * Math.min(width, height) / editor.getMap().width();
|
||||
|
||||
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){
|
||||
Vector2 v1 = unproject(startx, starty).add(x, 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);
|
||||
}
|
||||
|
||||
if(tool.edit && (!mobile || drawing)){
|
||||
if((tool.edit || tool == EditorTool.line) && (!mobile || drawing)){
|
||||
Point2 p = project(mousex, mousey);
|
||||
Vector2 v = unproject(p.x, p.y).add(x, y);
|
||||
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.*/
|
||||
public int enemySpawns = -1;
|
||||
|
||||
public boolean distortFloor = false;
|
||||
|
||||
public MapGenerator(String mapName){
|
||||
this.mapName = mapName;
|
||||
}
|
||||
@@ -47,6 +49,12 @@ public class MapGenerator extends Generator{
|
||||
return this;
|
||||
}
|
||||
|
||||
public MapGenerator dist(float distortion, boolean floor){
|
||||
this.distortion = distortion;
|
||||
this.distortFloor = floor;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
map = world.maps.loadInternalMap(mapName);
|
||||
@@ -97,6 +105,10 @@ public class MapGenerator extends Generator{
|
||||
tile.setBlock(tiles[newX][newY].block());
|
||||
}
|
||||
|
||||
if(distortFloor){
|
||||
tile.setFloor(tiles[newX][newY].floor());
|
||||
}
|
||||
|
||||
for(Decoration decor : decorations){
|
||||
if(tile.block() == Blocks.air && tile.floor() == decor.floor && Mathf.chance(decor.chance)){
|
||||
tile.setBlock(decor.wall);
|
||||
|
||||
Reference in New Issue
Block a user