mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-28 13:47:32 +07:00
Added cliff support to editor
This commit is contained in:
@ -363,6 +363,7 @@ publish.confirm = Are you sure you want to publish this?\n\n[lightgray]Make sure
|
||||
publish.error = Error publishing item: {0}
|
||||
steam.error = Failed to initialize Steam services.\nError: {0}
|
||||
|
||||
editor.cliffs = Walls To Cliffs
|
||||
editor.brush = Brush
|
||||
editor.openin = Open In Editor
|
||||
editor.oregen = Ore Generation
|
||||
|
@ -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();
|
||||
|
||||
|
||||
|
@ -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()){
|
||||
|
@ -150,7 +150,7 @@ public class BlockRenderer{
|
||||
public void checkChanges(){
|
||||
darkEvents.each(pos -> {
|
||||
var tile = world.tile(pos);
|
||||
if(tile != null){
|
||||
if(tile != null && tile.block().fillsTile){
|
||||
tile.data = world.getWallDarkness(tile);
|
||||
}
|
||||
});
|
||||
|
@ -9,6 +9,7 @@ import mindustry.world.*;
|
||||
public class Cliff extends Block{
|
||||
public float size = 11f;
|
||||
public @Load(value = "cliffmask#", length = 256) TextureRegion[] cliffs;
|
||||
public @Load(value = "editor-cliffmask#", length = 256) TextureRegion[] editorCliffs;
|
||||
|
||||
public Cliff(String name){
|
||||
super(name);
|
||||
|
@ -158,7 +158,9 @@ public class Generators{
|
||||
}
|
||||
});
|
||||
|
||||
Fi.get("../blocks/environment/cliffmask" + (val & 0xff) + ".png").writePng(result);
|
||||
Fi fi = Fi.get("../blocks/environment/cliffmask" + (val & 0xff) + ".png");
|
||||
fi.writePng(result);
|
||||
fi.copyTo(Fi.get("../editor").child("editor-" + fi.name()));
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user