From 401384ae5bef0061031882e2acf55e25fd795c83 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 20 Sep 2020 16:35:25 -0400 Subject: [PATCH] Anuken/Mindustry-Suggestions/issues/548 --- core/src/mindustry/game/Saves.java | 16 +++++++--------- core/src/mindustry/world/Build.java | 6 +++--- .../src/mindustry/world/blocks/defense/Wall.java | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/core/src/mindustry/game/Saves.java b/core/src/mindustry/game/Saves.java index 0d2b75bf9c..0f7908aa63 100644 --- a/core/src/mindustry/game/Saves.java +++ b/core/src/mindustry/game/Saves.java @@ -78,7 +78,6 @@ public class Saves{ } public void update(){ - SaveSlot current = this.current; if(current != null && state.isGame() && !(state.isPaused() && Core.scene.hasDialog())){ @@ -93,14 +92,13 @@ public class Saves{ if(time > Core.settings.getInt("saveinterval") * 60){ saving = true; - Time.runTask(2f, () -> { - try{ - current.save(); - }catch(Throwable e){ - e.printStackTrace(); - } - saving = false; - }); + try{ + current.save(); + }catch(Throwable e){ + e.printStackTrace(); + } + + Time.runTask(3f, () -> saving = false); time = 0; } diff --git a/core/src/mindustry/world/Build.java b/core/src/mindustry/world/Build.java index 39c4f8024b..43421f7f2f 100644 --- a/core/src/mindustry/world/Build.java +++ b/core/src/mindustry/world/Build.java @@ -59,7 +59,7 @@ public class Build{ result.beforePlaceBegan(tile, previous); tile.setBlock(sub, team, rotation); - tile.bc().setConstruct(previous, result); + tile.bc().setConstruct(previous.size == sub.size ? previous : Blocks.air, result); result.placeBegan(tile, previous); @@ -91,7 +91,7 @@ public class Build{ } if(type.isMultiblock()){ - if((type.canReplace(tile.block()) || (tile.block instanceof ConstructBlock && tile.bc().cblock == type)) && + if(((type.canReplace(tile.block()) || tile.block.alwaysReplace) || (tile.block instanceof ConstructBlock && tile.bc().cblock == type)) && type.canPlaceOn(tile, team) && tile.interactable(team)){ //if the block can be replaced but the sizes differ, check all the spaces around the block to make sure it can fit @@ -105,7 +105,7 @@ public class Build{ int wx = dx + offsetx + x, wy = dy + offsety + y; Tile check = world.tile(wx, wy); - if(check == null || (!check.block.alwaysReplace && check.block != tile.block)) return false; + if(check == null || (!check.block.alwaysReplace && check.block != tile.block && !(check.block.size == 1 && type.canReplace(check.block)))) return false; } } } diff --git a/core/src/mindustry/world/blocks/defense/Wall.java b/core/src/mindustry/world/blocks/defense/Wall.java index c99100166a..25f78fc050 100644 --- a/core/src/mindustry/world/blocks/defense/Wall.java +++ b/core/src/mindustry/world/blocks/defense/Wall.java @@ -55,7 +55,7 @@ public class Wall extends Block{ @Override public boolean canReplace(Block other){ - return super.canReplace(other) && health > other.health && size == other.size; + return (other != this || rotate) && this.group != BlockGroup.none && other.group == this.group && health > other.health && size >= other.size; } public class WallBuild extends Building{