This commit is contained in:
Anuken
2025-07-21 02:17:07 -04:00
parent fab3c08ddb
commit f0820572ce
6 changed files with 12 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ import mindustry.world.blocks.environment.*;
import static mindustry.Vars.*;
public class DrawOperation{
static final int
static final byte
opFloor = 0,
opBlock = 1,
opRotation = 2,

View File

@@ -146,7 +146,7 @@ public class EditorSpriteCache implements Disposable{
index += vertexSize * 4;
}
/** Renders the cached mesh. The shader must already have the correct view matrix (usually u_projectionViewMatrix) set as a uniform. */
/** Renders the cached mesh. The shader must already have the correct view matrix set as a uniform. */
public void render(Shader shader){
if(mesh == null) throw new IllegalStateException("Cache is empty, call build() first.");

View File

@@ -148,7 +148,7 @@ public class MapEditor{
y = Mathf.clamp(y, (drawBlock.size - 1) / 2, height() - drawBlock.size / 2 - 1);
if(!hasOverlap(x, y)){
tile(x, y).setBlock(drawBlock, drawTeam, rotation);
addTileOp(TileOp.get((short)x, (short)y, (byte)DrawOperation.opTeam, (byte)drawTeam.id));
addTileOp(TileOp.get((short)x, (short)y, DrawOperation.opTeam, (byte)drawTeam.id));
}
}else{
boolean isFloor = drawBlock.isFloor() && drawBlock != Blocks.air;
@@ -166,13 +166,13 @@ public class MapEditor{
}
}else if(!(tile.block().isMultiblock() && !drawBlock.isMultiblock())){
if(drawBlock.rotate && tile.build != null && tile.build.rotation != rotation){
addTileOp(TileOp.get(tile.x, tile.y, (byte)DrawOperation.opRotation, (byte)rotation));
addTileOp(TileOp.get(tile.x, tile.y, DrawOperation.opRotation, (byte)rotation));
}
tile.setBlock(drawBlock, drawTeam, rotation);
if(drawBlock.synthetic()){
addTileOp(TileOp.get(tile.x, tile.y, (byte)DrawOperation.opTeam, (byte)drawTeam.id));
addTileOp(TileOp.get(tile.x, tile.y, DrawOperation.opTeam, (byte)drawTeam.id));
}
}
};

View File

@@ -128,6 +128,10 @@ public class MapRenderer implements Disposable{
void updateStatic(int x, int y){
renderer.blocks.floor.recacheTile(x, y);
if(x > 0) renderer.blocks.floor.recacheTile(x - 1, y);
if(y > 0) renderer.blocks.floor.recacheTile(x, y - 1);
if(x < world.width() - 1) renderer.blocks.floor.recacheTile(x + 1, y);
if(y < world.height() - 1) renderer.blocks.floor.recacheTile(x, y + 1);
}
void updateBlock(Tile tile){

View File

@@ -9,7 +9,6 @@ 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);