Added cliff support to editor

This commit is contained in:
Anuken
2021-09-05 20:08:02 -04:00
parent 508abba2ec
commit 4da21ba363
6 changed files with 16 additions and 8 deletions

View File

@@ -576,13 +576,11 @@ public class MapEditorDialog extends Dialog implements Disposable{
}).growX().top();
}
if(experimental){
mid.row();
mid.row();
mid.table(t -> {
t.button("Cliffs", Icon.terrain, Styles.cleart, editor::addCliffs).growX().margin(9f);
}).growX().top();
}
mid.table(t -> {
t.button("@editor.cliffs", Icon.terrain, Styles.cleart, editor::addCliffs).growX().margin(9f);
}).growX().top();
}).margin(0).left().growY();

View File

@@ -10,6 +10,7 @@ import mindustry.content.*;
import mindustry.game.*;
import mindustry.graphics.*;
import mindustry.world.*;
import mindustry.world.blocks.environment.*;
import static mindustry.Vars.*;
@@ -132,6 +133,11 @@ public class MapRenderer implements Disposable{
wall.editorVariantRegions()[Mathf.randomSeed(idxWall, 0, wall.editorVariantRegions().length - 1)] :
wall.editorIcon();
if(wall == Blocks.cliff){
mesh.setColor(Tmp.c1.set(floor.mapColor).mul(1.6f));
region = ((Cliff)Blocks.cliff).editorCliffs[tile.data & 0xff];
}
offsetX = tilesize / 2f - region.width / 2f * Draw.scl;
offsetY = tilesize / 2f - region.height / 2f * Draw.scl;
}else if(wall == Blocks.air && !tile.overlay().isAir()){