Fixed core errors
This commit is contained in:
@@ -51,7 +51,7 @@ public class EditorTile extends Tile{
|
||||
if(block == type) return;
|
||||
op(OpType.block, block.id);
|
||||
if(rotation != 0) op(OpType.rotation, rotation);
|
||||
if(team != 0) op(OpType.team, team);
|
||||
if(team() != Team.derelict) op(OpType.team, team().id);
|
||||
super.setBlock(type);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.*;
|
||||
|
||||
public enum EditorTool{
|
||||
zoom,
|
||||
@@ -16,7 +15,7 @@ public enum EditorTool{
|
||||
public void touched(MapEditor editor, int x, int y){
|
||||
if(!Structs.inBounds(x, y, editor.width(), editor.height())) return;
|
||||
|
||||
Tile tile = editor.tile(x, y).link();
|
||||
Tile tile = editor.tile(x, y);
|
||||
editor.drawBlock = tile.block() == Blocks.air ? tile.overlay() == Blocks.air ? tile.floor() : tile.overlay() : tile.block();
|
||||
}
|
||||
},
|
||||
@@ -63,7 +62,7 @@ public enum EditorTool{
|
||||
editor.drawBlocks(x, y, true, tile -> true);
|
||||
}else if(mode == 2){
|
||||
//draw teams
|
||||
editor.drawCircle(x, y, tile -> tile.link().setTeam(editor.drawTeam));
|
||||
editor.drawCircle(x, y, tile -> tile.setTeam(editor.drawTeam));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -108,7 +107,7 @@ public enum EditorTool{
|
||||
//mode 0 or 1, fill everything with the floor/tile or replace it
|
||||
if(mode == 0 || mode == -1){
|
||||
//can't fill parts or multiblocks
|
||||
if(tile.block() instanceof BlockPart || tile.block().isMultiblock()){
|
||||
if(tile.block().isMultiblock()){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -137,10 +136,10 @@ public enum EditorTool{
|
||||
}else if(mode == 1){ //mode 1 is team fill
|
||||
|
||||
//only fill synthetic blocks, it's meaningless otherwise
|
||||
if(tile.link().synthetic()){
|
||||
if(tile.synthetic()){
|
||||
Team dest = tile.team();
|
||||
if(dest == editor.drawTeam) return;
|
||||
fill(editor, x, y, false, t -> t.getTeamID() == (int)dest.id && t.link().synthetic(), t -> t.setTeam(editor.drawTeam));
|
||||
fill(editor, x, y, false, t -> t.getTeamID() == (int)dest.id && t.synthetic(), t -> t.setTeam(editor.drawTeam));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,22 +70,7 @@ public class MapEditor{
|
||||
//adds missing blockparts
|
||||
//TODO remove, may not be necessary with blockpart refactor later
|
||||
public void checkLinkedTiles(){
|
||||
Tiles tiles = world.tiles;
|
||||
|
||||
//clear old parts
|
||||
for(Tile tile : tiles){
|
||||
if(tile.block() instanceof BlockPart){
|
||||
tile.setBlock(Blocks.air);
|
||||
}
|
||||
}
|
||||
|
||||
//re-add them
|
||||
for(Tile tile : tiles){
|
||||
if(tile.block().isMultiblock()){
|
||||
tile.setBlock(tile.block(), tile.team(), 0);
|
||||
}
|
||||
|
||||
}
|
||||
//TODO actually remove
|
||||
}
|
||||
|
||||
public void load(Runnable r){
|
||||
@@ -152,6 +137,7 @@ public class MapEditor{
|
||||
int offsetx = -(drawBlock.size - 1) / 2;
|
||||
int offsety = -(drawBlock.size - 1) / 2;
|
||||
|
||||
//TODO this is completely unnecessary now!
|
||||
for(int dx = 0; dx < drawBlock.size; dx++){
|
||||
for(int dy = 0; dy < drawBlock.size; dy++){
|
||||
int worldx = dx + offsetx + x;
|
||||
@@ -163,7 +149,7 @@ public class MapEditor{
|
||||
Block block = tile.block();
|
||||
|
||||
//bail out if there's anything blocking the way
|
||||
if(block.isMultiblock() || block instanceof BlockPart){
|
||||
if(block.isMultiblock()){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -180,9 +166,10 @@ public class MapEditor{
|
||||
if(!tester.get(tile)) return;
|
||||
|
||||
//remove linked tiles blocking the way
|
||||
if(!isFloor && (tile.isLinked() || tile.block().isMultiblock())){
|
||||
tile.link().remove();
|
||||
}
|
||||
//TODO also unnecessary
|
||||
//if(!isFloor && (tile.isLinked() || tile.block().isMultiblock())){
|
||||
// tile.link().remove();
|
||||
//}
|
||||
|
||||
if(isFloor){
|
||||
tile.setFloor(drawBlock.asFloor());
|
||||
|
||||
@@ -119,7 +119,7 @@ public class MapRenderer implements Disposable{
|
||||
int idxWall = (wx % chunkSize) + (wy % chunkSize) * chunkSize;
|
||||
int idxDecal = (wx % chunkSize) + (wy % chunkSize) * chunkSize + chunkSize * chunkSize;
|
||||
|
||||
if(wall != Blocks.air && (wall.synthetic() || wall instanceof BlockPart)){
|
||||
if(wall != Blocks.air && wall.synthetic()){
|
||||
region = !Core.atlas.isFound(wall.editorIcon()) ? Core.atlas.find("clear-editor") : wall.editorIcon();
|
||||
|
||||
if(wall.rotate){
|
||||
|
||||
Reference in New Issue
Block a user