Fixed #923
This commit is contained in:
@@ -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. */
|
/** Creates an array of build requests from a schematic's data, centered on the provided x+y coordinates. */
|
||||||
public Array<BuildRequest> toRequests(Schematic schem, int x, int y){
|
public Array<BuildRequest> 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.*/
|
/** Adds a schematic to the list, also copying it into the files.*/
|
||||||
|
|||||||
@@ -1,25 +1,21 @@
|
|||||||
package io.anuke.mindustry.io;
|
package io.anuke.mindustry.io;
|
||||||
|
|
||||||
import io.anuke.arc.collection.*;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.files.FileHandle;
|
import io.anuke.arc.files.*;
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.arc.graphics.Pixmap;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.Pack;
|
import io.anuke.arc.util.serialization.*;
|
||||||
import io.anuke.arc.util.Structs;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.arc.util.serialization.Json;
|
import io.anuke.mindustry.game.*;
|
||||||
import io.anuke.mindustry.content.Blocks;
|
import io.anuke.mindustry.io.MapIO.*;
|
||||||
import io.anuke.mindustry.game.SpawnGroup;
|
import io.anuke.mindustry.maps.*;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.io.MapIO.TileProvider;
|
|
||||||
import io.anuke.mindustry.maps.Map;
|
|
||||||
import io.anuke.mindustry.type.ContentType;
|
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.world.LegacyColorMapper.LegacyBlock;
|
import io.anuke.mindustry.world.LegacyColorMapper.*;
|
||||||
import io.anuke.mindustry.world.blocks.BlockPart;
|
import io.anuke.mindustry.world.blocks.*;
|
||||||
import io.anuke.mindustry.world.blocks.Floor;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.zip.InflaterInputStream;
|
import java.util.zip.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -208,20 +204,6 @@ public class LegacyMapIO{
|
|||||||
|
|
||||||
//place core
|
//place core
|
||||||
if(color == Color.rgba8888(Color.green)){
|
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
|
//actual core parts
|
||||||
tile.setBlock(Blocks.coreShard);
|
tile.setBlock(Blocks.coreShard);
|
||||||
tile.setTeam(Team.sharded);
|
tile.setTeam(Team.sharded);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import io.anuke.arc.scene.utils.*;
|
|||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.content.*;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.core.GameState.*;
|
import io.anuke.mindustry.core.GameState.*;
|
||||||
|
import io.anuke.mindustry.game.EventType.*;
|
||||||
import io.anuke.mindustry.game.Saves.*;
|
import io.anuke.mindustry.game.Saves.*;
|
||||||
import io.anuke.mindustry.gen.*;
|
import io.anuke.mindustry.gen.*;
|
||||||
import io.anuke.mindustry.graphics.*;
|
import io.anuke.mindustry.graphics.*;
|
||||||
@@ -38,14 +39,8 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
public DeployDialog(){
|
public DeployDialog(){
|
||||||
super("", Styles.fullDialog);
|
super("", Styles.fullDialog);
|
||||||
|
|
||||||
ZoneNode root = new ZoneNode(Zones.groundZero, null);
|
treeLayout();
|
||||||
|
Events.on(ContentReloadEvent.class, e -> treeLayout());
|
||||||
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;
|
|
||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
buttons.addImageTextButton("$techtree", Icon.tree, () -> ui.tech.show()).size(230f, 64f);
|
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(){
|
public void setup(){
|
||||||
platform.updateRPC();
|
platform.updateRPC();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user