This commit is contained in:
Anuken
2020-11-29 13:59:09 -05:00
parent 682c1692df
commit 2a9f362e15
4 changed files with 13 additions and 6 deletions

View File

@@ -47,6 +47,8 @@ public class Vars implements Loadable{
public static final int bufferSize = 8192;
/** global charset, since Android doesn't support the Charsets class */
public static final Charset charset = Charset.forName("UTF-8");
/** mods suggested for import */
public static final String[] suggestedMods = {""};
/** main application name, capitalized */
public static final String appName = "Mindustry";
/** URL for itch.io donations. */

View File

@@ -13,6 +13,7 @@ import mindustry.game.EventType.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.world.*;
import mindustry.world.blocks.storage.*;
import mindustry.world.meta.*;
import static mindustry.Vars.*;
@@ -115,7 +116,7 @@ public class Pathfinder implements Runnable{
}
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.solid(),
tile.floor().isLiquid,
@@ -458,7 +459,7 @@ public class Pathfinder implements Runnable{
/** costs of getting to a specific tile */
public int[][] weights;
/** 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 */
IntQueue frontier = new IntQueue();
/** all target positions; these positions have a cost of 0, and must be synchronized on! */

View File

@@ -258,11 +258,11 @@ public class UI implements ApplicationListener, Loadable{
TextField field = cont.field(def, t -> {}).size(330f, 50f).get();
field.setFilter((f, c) -> field.getText().length() < textLength && filter.acceptChar(f, c));
buttons.defaults().size(120, 54).pad(4);
buttons.button("@cancel", this::hide);
buttons.button("@ok", () -> {
confirmed.get(field.getText());
hide();
}).disabled(b -> field.getText().isEmpty());
buttons.button("@cancel", this::hide);
keyDown(KeyCode.enter, () -> {
String text = field.getText();
if(!text.isEmpty()){

View File

@@ -102,12 +102,16 @@ public class ModsDialog extends BaseDialog{
t.button("@mod.import.github", Icon.github, bstyle, () -> {
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 -> {
Core.settings.put("lastmod", text);
ui.showTextInput("@mod.import.github", "", 64, modString.isEmpty() ? suggested : modString, text -> {
if(!modString.isEmpty() || !Structs.eq(suggested, text)){
Core.settings.put("lastmod", text);
}
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("master", text, e2 -> {
githubImport("main", text, e3 -> {