Fixed #3654
This commit is contained in:
@@ -47,6 +47,8 @@ public class Vars implements Loadable{
|
|||||||
public static final int bufferSize = 8192;
|
public static final int bufferSize = 8192;
|
||||||
/** global charset, since Android doesn't support the Charsets class */
|
/** global charset, since Android doesn't support the Charsets class */
|
||||||
public static final Charset charset = Charset.forName("UTF-8");
|
public static final Charset charset = Charset.forName("UTF-8");
|
||||||
|
/** mods suggested for import */
|
||||||
|
public static final String[] suggestedMods = {""};
|
||||||
/** main application name, capitalized */
|
/** main application name, capitalized */
|
||||||
public static final String appName = "Mindustry";
|
public static final String appName = "Mindustry";
|
||||||
/** URL for itch.io donations. */
|
/** URL for itch.io donations. */
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import mindustry.game.EventType.*;
|
|||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
import mindustry.world.blocks.storage.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
@@ -115,7 +116,7 @@ public class Pathfinder implements Runnable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
return PathTile.get(
|
return PathTile.get(
|
||||||
tile.build == null || !tile.solid() ? 0 : Math.min((int)(tile.build.health / 40), 80),
|
tile.build == null || !tile.solid() || tile.block() instanceof CoreBlock ? 0 : Math.min((int)(tile.build.health / 40), 80),
|
||||||
tile.getTeamID(),
|
tile.getTeamID(),
|
||||||
tile.solid(),
|
tile.solid(),
|
||||||
tile.floor().isLiquid,
|
tile.floor().isLiquid,
|
||||||
@@ -458,7 +459,7 @@ public class Pathfinder implements Runnable{
|
|||||||
/** costs of getting to a specific tile */
|
/** costs of getting to a specific tile */
|
||||||
public int[][] weights;
|
public int[][] weights;
|
||||||
/** search IDs of each position - the highest, most recent search is prioritized and overwritten */
|
/** search IDs of each position - the highest, most recent search is prioritized and overwritten */
|
||||||
int[][] searches;
|
public int[][] searches;
|
||||||
/** search frontier, these are Pos objects */
|
/** search frontier, these are Pos objects */
|
||||||
IntQueue frontier = new IntQueue();
|
IntQueue frontier = new IntQueue();
|
||||||
/** all target positions; these positions have a cost of 0, and must be synchronized on! */
|
/** all target positions; these positions have a cost of 0, and must be synchronized on! */
|
||||||
|
|||||||
@@ -258,11 +258,11 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
TextField field = cont.field(def, t -> {}).size(330f, 50f).get();
|
TextField field = cont.field(def, t -> {}).size(330f, 50f).get();
|
||||||
field.setFilter((f, c) -> field.getText().length() < textLength && filter.acceptChar(f, c));
|
field.setFilter((f, c) -> field.getText().length() < textLength && filter.acceptChar(f, c));
|
||||||
buttons.defaults().size(120, 54).pad(4);
|
buttons.defaults().size(120, 54).pad(4);
|
||||||
|
buttons.button("@cancel", this::hide);
|
||||||
buttons.button("@ok", () -> {
|
buttons.button("@ok", () -> {
|
||||||
confirmed.get(field.getText());
|
confirmed.get(field.getText());
|
||||||
hide();
|
hide();
|
||||||
}).disabled(b -> field.getText().isEmpty());
|
}).disabled(b -> field.getText().isEmpty());
|
||||||
buttons.button("@cancel", this::hide);
|
|
||||||
keyDown(KeyCode.enter, () -> {
|
keyDown(KeyCode.enter, () -> {
|
||||||
String text = field.getText();
|
String text = field.getText();
|
||||||
if(!text.isEmpty()){
|
if(!text.isEmpty()){
|
||||||
|
|||||||
@@ -102,12 +102,16 @@ public class ModsDialog extends BaseDialog{
|
|||||||
|
|
||||||
t.button("@mod.import.github", Icon.github, bstyle, () -> {
|
t.button("@mod.import.github", Icon.github, bstyle, () -> {
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
|
var modString = Core.settings.getString("lastmod", "");
|
||||||
|
var suggested = Structs.random(suggestedMods);
|
||||||
|
|
||||||
ui.showTextInput("@mod.import.github", "", 64, Core.settings.getString("lastmod", "Anuken/ExampleMod"), text -> {
|
ui.showTextInput("@mod.import.github", "", 64, modString.isEmpty() ? suggested : modString, text -> {
|
||||||
Core.settings.put("lastmod", text);
|
if(!modString.isEmpty() || !Structs.eq(suggested, text)){
|
||||||
|
Core.settings.put("lastmod", text);
|
||||||
|
}
|
||||||
|
|
||||||
ui.loadfrag.show();
|
ui.loadfrag.show();
|
||||||
//Try to download the 6.0 branch first, but if it doesn't exist try master.
|
//Try to download the 6.0 branch first, but if it doesn't exist, try master.
|
||||||
githubImport("6.0", text, e1 -> {
|
githubImport("6.0", text, e1 -> {
|
||||||
githubImport("master", text, e2 -> {
|
githubImport("master", text, e2 -> {
|
||||||
githubImport("main", text, e3 -> {
|
githubImport("main", text, e3 -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user