Partial fix of editor multiblock undo/redo

This commit is contained in:
Anuken
2020-10-28 09:22:27 -04:00
parent 024f64678c
commit 63e4bca098
6 changed files with 23 additions and 14 deletions

View File

@@ -1191,7 +1191,7 @@ public class Blocks implements ContentList{
requirements(Category.power, with(Items.lead, 100, Items.silicon, 75, Items.phaseFabric, 25, Items.plastanium, 75, Items.thorium, 50));
size = 2;
powerProduction = 4.5f;
itemDuration = 60 * 18f;
itemDuration = 60 * 15f;
}};
solarPanel = new SolarGenerator("solar-panel"){{
@@ -1991,8 +1991,8 @@ public class Blocks implements ContentList{
illuminator = new LightBlock("illuminator"){{
requirements(Category.effect, BuildVisibility.lightingOnly, with(Items.graphite, 12, Items.silicon, 8));
brightness = 0.67f;
radius = 140f;
brightness = 0.75f;
radius = 160f;
consumes.power(0.06f);
}};

View File

@@ -1290,7 +1290,7 @@ public class UnitTypes implements ContentList{
collides = false;
healPercent = 15f;
splashDamage = 320f;
splashDamage = 240f;
splashDamageRadius = 120f;
}};
}});

View File

@@ -50,9 +50,19 @@ public class EditorTile extends Tile{
return;
}
op(OpType.block, block.id);
if(rotation != 0) op(OpType.rotation, (byte)rotation);
if(team != Team.derelict) op(OpType.team, (byte)team.id);
if(!isCenter()){
EditorTile cen = (EditorTile)build.tile;
cen.op(OpType.rotation, (byte)build.rotation);
cen.op(OpType.team, (byte)build.team.id);
cen.op(OpType.block, block.id);
update();
}else{
if(build != null) op(OpType.rotation, (byte)build.rotation);
if(build != null) op(OpType.team, (byte)build.team.id);
op(OpType.block, block.id);
}
super.setBlock(type, team, rotation);
}

View File

@@ -157,7 +157,7 @@ public class MapEditor{
boolean hasOverlap(int x, int y){
Tile tile = world.tile(x, y);
//allow direct replacement of blocks of the same size
if(tile != null && tile.isCenter() && tile.block() != drawBlock && tile.block().size == drawBlock.size){
if(tile != null && tile.isCenter() && tile.block() != drawBlock && tile.block().size == drawBlock.size && tile.x == x && tile.y == y){
return false;
}
@@ -168,12 +168,10 @@ public class MapEditor{
for(int dy = 0; dy < drawBlock.size; dy++){
int worldx = dx + offsetx + x;
int worldy = dy + offsety + y;
if(!(worldx == x && worldy == y)){
Tile other = world.tile(worldx, worldy);
Tile other = world.tile(worldx, worldy);
if(other != null && other.block().isMultiblock()){
return true;
}
if(other != null && other.block().isMultiblock()){
return true;
}
}
}

View File

@@ -217,6 +217,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
//assign entity and type to blocks, so they act as proxies for this one
other.build = entity;
other.block = block;
}
}
}