diff --git a/core/src/io/anuke/mindustry/game/Schematics.java b/core/src/io/anuke/mindustry/game/Schematics.java index 4504f988b2..f55432e800 100644 --- a/core/src/io/anuke/mindustry/game/Schematics.java +++ b/core/src/io/anuke/mindustry/game/Schematics.java @@ -212,7 +212,8 @@ public class Schematics implements Loadable{ /** Creates an array of build requests from a schematic's data, centered on the provided x+y coordinates. */ public Array toRequests(Schematic schem, int x, int y){ - return schem.tiles.map(t -> new BuildRequest(t.x + x - schem.width/2, t.y + y - schem.height/2, t.rotation, t.block).original(t.x, t.y, schem.width, schem.height).configure(t.config)).removeAll(s -> !s.block.isVisible() || !s.block.unlocked()); + return schem.tiles.map(t -> new BuildRequest(t.x + x - schem.width/2, t.y + y - schem.height/2, t.rotation, t.block).original(t.x, t.y, schem.width, schem.height).configure(t.config)) + .removeAll(s -> !s.block.isVisible() || (!s.block.unlocked() && world.isZone())); } /** Adds a schematic to the list, also copying it into the files.*/ diff --git a/core/src/io/anuke/mindustry/io/LegacyMapIO.java b/core/src/io/anuke/mindustry/io/LegacyMapIO.java index 31ebe0403d..4d62f6b63d 100644 --- a/core/src/io/anuke/mindustry/io/LegacyMapIO.java +++ b/core/src/io/anuke/mindustry/io/LegacyMapIO.java @@ -1,25 +1,21 @@ package io.anuke.mindustry.io; import io.anuke.arc.collection.*; -import io.anuke.arc.files.FileHandle; -import io.anuke.arc.graphics.Color; -import io.anuke.arc.graphics.Pixmap; -import io.anuke.arc.util.Pack; -import io.anuke.arc.util.Structs; -import io.anuke.arc.util.serialization.Json; -import io.anuke.mindustry.content.Blocks; -import io.anuke.mindustry.game.SpawnGroup; -import io.anuke.mindustry.game.Team; -import io.anuke.mindustry.io.MapIO.TileProvider; -import io.anuke.mindustry.maps.Map; -import io.anuke.mindustry.type.ContentType; +import io.anuke.arc.files.*; +import io.anuke.arc.graphics.*; +import io.anuke.arc.util.*; +import io.anuke.arc.util.serialization.*; +import io.anuke.mindustry.content.*; +import io.anuke.mindustry.game.*; +import io.anuke.mindustry.io.MapIO.*; +import io.anuke.mindustry.maps.*; +import io.anuke.mindustry.type.*; import io.anuke.mindustry.world.*; -import io.anuke.mindustry.world.LegacyColorMapper.LegacyBlock; -import io.anuke.mindustry.world.blocks.BlockPart; -import io.anuke.mindustry.world.blocks.Floor; +import io.anuke.mindustry.world.LegacyColorMapper.*; +import io.anuke.mindustry.world.blocks.*; import java.io.*; -import java.util.zip.InflaterInputStream; +import java.util.zip.*; import static io.anuke.mindustry.Vars.*; @@ -208,20 +204,6 @@ public class LegacyMapIO{ //place core if(color == Color.rgba8888(Color.green)){ - for(int dx = 0; dx < 3; dx++){ - for(int dy = 0; dy < 3; dy++){ - int worldx = dx - 1 + x; - int worldy = dy - 1 + y; - - //multiblock parts - if(Structs.inBounds(worldx, worldy, pixmap.getWidth(), pixmap.getHeight())){ - Tile write = tiles[worldx][worldy]; - write.setBlock(BlockPart.get(dx - 1, dy - 1)); - write.setTeam(Team.sharded); - } - } - } - //actual core parts tile.setBlock(Blocks.coreShard); tile.setTeam(Team.sharded); diff --git a/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java index c92097077a..4a8c1b54cd 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java @@ -17,6 +17,7 @@ import io.anuke.arc.scene.utils.*; import io.anuke.arc.util.*; import io.anuke.mindustry.content.*; import io.anuke.mindustry.core.GameState.*; +import io.anuke.mindustry.game.EventType.*; import io.anuke.mindustry.game.Saves.*; import io.anuke.mindustry.gen.*; import io.anuke.mindustry.graphics.*; @@ -38,14 +39,8 @@ public class DeployDialog extends FloatingDialog{ public DeployDialog(){ super("", Styles.fullDialog); - ZoneNode root = new ZoneNode(Zones.groundZero, null); - - BranchTreeLayout layout = new BranchTreeLayout(); - layout.gapBetweenLevels = layout.gapBetweenNodes = Scl.scl(60f); - layout.gapBetweenNodes = Scl.scl(120f); - layout.layout(root); - bounds.set(layout.getBounds()); - bounds.y += nodeSize*0.4f; + treeLayout(); + Events.on(ContentReloadEvent.class, e -> treeLayout()); addCloseButton(); buttons.addImageTextButton("$techtree", Icon.tree, () -> ui.tech.show()).size(230f, 64f); @@ -98,6 +93,18 @@ public class DeployDialog extends FloatingDialog{ } + void treeLayout(){ + nodes.clear(); + ZoneNode root = new ZoneNode(Zones.groundZero, null); + + BranchTreeLayout layout = new BranchTreeLayout(); + layout.gapBetweenLevels = layout.gapBetweenNodes = Scl.scl(60f); + layout.gapBetweenNodes = Scl.scl(120f); + layout.layout(root); + bounds.set(layout.getBounds()); + bounds.y += nodeSize*0.4f; + } + public void setup(){ platform.updateRPC();