Bugfixes
This commit is contained in:
@@ -383,9 +383,9 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
Table tools = new Table().top();
|
||||
|
||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||
Table[] lastTable = {null};
|
||||
|
||||
Consumer<EditorTool> addTool = tool -> {
|
||||
Table[] lastTable = {null};
|
||||
|
||||
ImageButton button = new ImageButton("icon-" + tool.name() + "-small", "clear-toggle");
|
||||
button.clicked(() -> {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.io;
|
||||
|
||||
import io.anuke.arc.collection.IntSet;
|
||||
import io.anuke.arc.collection.StringMap;
|
||||
import io.anuke.arc.files.FileHandle;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
@@ -78,6 +79,7 @@ public class MapIO{
|
||||
Pixmap walls = new Pixmap(map.width, map.height, Format.RGBA8888);
|
||||
int black = Color.rgba8888(Color.BLACK);
|
||||
int shade = Color.rgba8888(0f, 0f, 0f, 0.5f);
|
||||
IntSet teams = new IntSet();
|
||||
CachedTile tile = new CachedTile(){
|
||||
@Override
|
||||
public void setBlock(Block type){
|
||||
@@ -93,15 +95,7 @@ public class MapIO{
|
||||
public void setTeam(Team team){
|
||||
super.setTeam(team);
|
||||
if(block instanceof CoreBlock){
|
||||
if(team != defaultTeam){
|
||||
//map must have other team's cores
|
||||
map.tags.put("othercore", "true");
|
||||
}
|
||||
|
||||
if(team == waveTeam){
|
||||
//map must have default enemy team's core
|
||||
map.tags.put("enemycore", "true");
|
||||
}
|
||||
teams.add(team.ordinal());
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -131,6 +125,16 @@ public class MapIO{
|
||||
}
|
||||
}));
|
||||
|
||||
if(teams.size > 1){
|
||||
//map must have other team's cores
|
||||
map.tags.put("othercore", "true");
|
||||
}
|
||||
|
||||
if(teams.contains(waveTeam.ordinal())){
|
||||
//map must have default enemy team's core
|
||||
map.tags.put("enemycore", "true");
|
||||
}
|
||||
|
||||
floors.drawPixmap(walls, 0, 0);
|
||||
walls.dispose();
|
||||
return floors;
|
||||
|
||||
@@ -10,6 +10,8 @@ import io.anuke.arc.util.serialization.Json;
|
||||
import io.anuke.mindustry.game.SpawnGroup;
|
||||
import io.anuke.mindustry.io.LegacyMapIO;
|
||||
import io.anuke.mindustry.io.MapIO;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.storage.CoreBlock;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
@@ -108,6 +110,31 @@ public class Maps implements Disposable{
|
||||
MapIO.writeMap(file, map);
|
||||
|
||||
if(!headless){
|
||||
//by default, it does not have an enemy core or any other cores
|
||||
map.tags.put("enemycore", "false");
|
||||
map.tags.put("othercore", "false");
|
||||
IntSet teams = new IntSet();
|
||||
|
||||
for(int x = 0; x < map.width; x++){
|
||||
for(int y = 0; y < map.height; y++){
|
||||
Tile tile = world.getTiles()[x][y];
|
||||
|
||||
if(tile.block() instanceof CoreBlock){
|
||||
teams.add(tile.getTeamID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(teams.size > 1){
|
||||
//map must have other team's cores
|
||||
map.tags.put("othercore", "true");
|
||||
}
|
||||
|
||||
if(teams.contains(waveTeam.ordinal())){
|
||||
//map must have default enemy team's core
|
||||
map.tags.put("enemycore", "true");
|
||||
}
|
||||
|
||||
map.texture = new Texture(MapIO.generatePreview(world.getTiles()));
|
||||
}
|
||||
maps.add(map);
|
||||
|
||||
@@ -12,12 +12,11 @@ import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.arc.scene.ui.layout.Unit;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.pooling.Pools;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.Platform;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static io.anuke.mindustry.Vars.iconsize;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class FileChooser extends FloatingDialog{
|
||||
private static final FileHandle homeDirectory = Core.files.absolute(OS.isMac ? OS.getProperty("user.home") + "/Downloads/" : Core.files.getExternalStoragePath());
|
||||
@@ -35,9 +34,9 @@ public class FileChooser extends FloatingDialog{
|
||||
private int lastWidth = Core.graphics.getWidth(), lastHeight = Core.graphics.getHeight();
|
||||
|
||||
public static final Predicate<String> pngFiles = str -> str.equals("png");
|
||||
public static final Predicate<String> anyMapFiles = str -> str.equals(Vars.oldMapExtension) || str.equals(Vars.mapExtension);
|
||||
public static final Predicate<String> mapFiles = str -> str.equals(Vars.mapExtension);
|
||||
public static final Predicate<String> saveFiles = str -> str.equals(Vars.saveExtension);
|
||||
public static final Predicate<String> anyMapFiles = str -> str.equals(oldMapExtension) || str.equals(mapExtension);
|
||||
public static final Predicate<String> mapFiles = str -> str.equals(mapExtension);
|
||||
public static final Predicate<String> saveFiles = str -> str.equals(saveExtension);
|
||||
|
||||
public FileChooser(String title, Predicate<FileHandle> filter, boolean open, Consumer<FileHandle> result){
|
||||
super(title);
|
||||
|
||||
@@ -279,20 +279,6 @@ public class Tile implements Position, TargetTrait{
|
||||
return tmpArray;
|
||||
}
|
||||
|
||||
/** Returns the block the multiblock is linked to, or null if it is not linked to any block.
|
||||
public Tile getLinked(){
|
||||
if(!isLinked()){
|
||||
return null;
|
||||
}else{
|
||||
return world.tile(x + linkX(rotation), y + linkY(rotation));
|
||||
}
|
||||
}
|
||||
|
||||
public Tile target(){
|
||||
Tile link = getLinked();
|
||||
return link == null ? this : link;
|
||||
}*/
|
||||
|
||||
public Rectangle getHitbox(Rectangle rect){
|
||||
return rect.setSize(block().size * tilesize).setCenter(drawx(), drawy());
|
||||
}
|
||||
@@ -346,7 +332,7 @@ public class Tile implements Position, TargetTrait{
|
||||
|
||||
//+26
|
||||
|
||||
if(link().synthetic()){
|
||||
if(link().synthetic() && link().solid()){
|
||||
cost += Mathf.clamp(link().block.health / 10f, 0, 20);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user