PR cleanup
This commit is contained in:
@@ -131,13 +131,14 @@ feature.unsupported = Your device does not support this feature.
|
|||||||
|
|
||||||
mods.initfailed = [red]\u26A0[] The previous Mindustry instance failed to initialize. This was likely caused by misbehaving mods.\n\nTo prevent a crash loop, [red]all mods have been disabled.[]
|
mods.initfailed = [red]\u26A0[] The previous Mindustry instance failed to initialize. This was likely caused by misbehaving mods.\n\nTo prevent a crash loop, [red]all mods have been disabled.[]
|
||||||
mods = Mods
|
mods = Mods
|
||||||
|
mods.name = Mod:
|
||||||
mods.none = [lightgray]No mods found!
|
mods.none = [lightgray]No mods found!
|
||||||
mods.guide = Modding Guide
|
mods.guide = Modding Guide
|
||||||
mods.report = Report Bug
|
mods.report = Report Bug
|
||||||
mods.openfolder = Open Folder
|
mods.openfolder = Open Folder
|
||||||
mods.viewcontent = View Content
|
mods.viewcontent = View Content
|
||||||
mods.reload = Reload
|
mods.reload = Reload
|
||||||
mods.reloadexit = The game will now exit, to reload mods.
|
mods.reloadexit = To reload mods, the game will now exit.
|
||||||
mod.installed = [[Installed]
|
mod.installed = [[Installed]
|
||||||
mod.display = [gray]Mod:[orange] {0}
|
mod.display = [gray]Mod:[orange] {0}
|
||||||
mod.enabled = [lightgray]Enabled
|
mod.enabled = [lightgray]Enabled
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ public class Vars implements Loadable{
|
|||||||
public static String steamPlayerName = "";
|
public static String steamPlayerName = "";
|
||||||
/** If true, the BE server list is always used. */
|
/** If true, the BE server list is always used. */
|
||||||
public static boolean forceBeServers = false;
|
public static boolean forceBeServers = false;
|
||||||
|
/** If true, mod code and scripts do not run. For internal testing only. This WILL break mods if enabled. */
|
||||||
|
public static boolean skipModCode = false;
|
||||||
/** Default accessible content types used for player-selectable icons. */
|
/** Default accessible content types used for player-selectable icons. */
|
||||||
public static final ContentType[] defaultContentIcons = {ContentType.item, ContentType.liquid, ContentType.block, ContentType.unit};
|
public static final ContentType[] defaultContentIcons = {ContentType.item, ContentType.liquid, ContentType.block, ContentType.unit};
|
||||||
/** Default rule environment. */
|
/** Default rule environment. */
|
||||||
|
|||||||
@@ -462,7 +462,7 @@ public class Mods implements Loadable{
|
|||||||
|
|
||||||
// Add local mods
|
// Add local mods
|
||||||
Seq.with(modDirectory.list())
|
Seq.with(modDirectory.list())
|
||||||
.retainAll(f -> f.extEquals("jar") || f.extEquals("zip") || (f.isDirectory() && Structs.contains(metaFiles, meta -> f.child(meta).exists())))
|
.retainAll(f -> f.extEquals("jar") || f.extEquals("zip") || (f.isDirectory() && Structs.contains(metaFiles, meta -> resolveRoot(f).child(meta).exists())))
|
||||||
.each(candidates::add);
|
.each(candidates::add);
|
||||||
|
|
||||||
// Add Steam workshop mods
|
// Add Steam workshop mods
|
||||||
@@ -679,41 +679,44 @@ public class Mods implements Loadable{
|
|||||||
cont.row();
|
cont.row();
|
||||||
cont.pane(p -> {
|
cont.pane(p -> {
|
||||||
toCheck.each(mod -> {
|
toCheck.each(mod -> {
|
||||||
p.add(mod.meta.displayName).wrap().growX().left().labelAlign(Align.left);
|
p.add(Core.bundle.get("mods.name") + " [accent]" + mod.meta.displayName).wrap().growX().left().labelAlign(Align.left);
|
||||||
p.row();
|
p.row();
|
||||||
p.table(d -> {
|
p.table(d -> {
|
||||||
mod.missingDependencies.each(dep -> {
|
mod.missingDependencies.each(dep -> {
|
||||||
d.add(dep).wrap().growX().left().labelAlign(Align.left);
|
d.add("[lightgray] > []" + dep).wrap().growX().left().labelAlign(Align.left);
|
||||||
d.row();
|
d.row();
|
||||||
});
|
});
|
||||||
if(soft){
|
if(soft){
|
||||||
mod.missingSoftDependencies.each(dep -> {
|
mod.missingSoftDependencies.each(dep -> {
|
||||||
d.add(dep + " " + Core.bundle.get("mod.dependencies.soft")).wrap().growX().left().labelAlign(Align.left);
|
d.add("[lightgray] > []" + dep + " [lightgray]" + Core.bundle.get("mod.dependencies.soft")).wrap().growX().left().labelAlign(Align.left);
|
||||||
d.row();
|
d.row();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).growX().padBottom(8f).padLeft(12f);
|
}).growX().padBottom(8f).padLeft(8f);
|
||||||
p.row();
|
p.row();
|
||||||
});
|
});
|
||||||
}).fillX().colspan(span);
|
}).fillX().colspan(span);
|
||||||
|
|
||||||
cont.row();
|
cont.row();
|
||||||
|
|
||||||
cont.button("@cancel", this::hide).size(150, 50);
|
cont.button("@cancel", Icon.cancel, this::hide).size(160, 50);
|
||||||
cont.button(soft ? "@mod.dependencies.downloadreq" : "@mod.dependencies.download", () -> {
|
cont.button(soft ? "@mod.dependencies.downloadreq" : "@mod.dependencies.download", Icon.download, () -> {
|
||||||
hide();
|
hide();
|
||||||
Seq<String> toImport = new Seq<>();
|
Seq<String> toImport = new Seq<>();
|
||||||
toCheck.each(mod -> mod.missingDependencies.each(toImport::addUnique));
|
toCheck.each(mod -> mod.missingDependencies.each(toImport::addUnique));
|
||||||
downloadDependencies(toImport);
|
downloadDependencies(toImport);
|
||||||
}).size(150, 50);
|
}).size(160, 50);
|
||||||
if(soft){
|
if(soft){
|
||||||
cont.button("@mod.dependencies.downloadall", () -> {
|
if(Core.graphics.isPortrait()){
|
||||||
|
cont.row();
|
||||||
|
}
|
||||||
|
cont.button("@mod.dependencies.downloadall", Icon.download, () -> {
|
||||||
hide();
|
hide();
|
||||||
Seq<String> toImport = new Seq<>();
|
Seq<String> toImport = new Seq<>();
|
||||||
toCheck.each(mod -> mod.missingDependencies.each(toImport::addUnique));
|
toCheck.each(mod -> mod.missingDependencies.each(toImport::addUnique));
|
||||||
toCheck.each(mod -> mod.missingSoftDependencies.each(toImport::addUnique));
|
toCheck.each(mod -> mod.missingSoftDependencies.each(toImport::addUnique));
|
||||||
downloadDependencies(toImport);
|
downloadDependencies(toImport);
|
||||||
}).size(150, 50);
|
}).size(160, 50);
|
||||||
}
|
}
|
||||||
}}.show();
|
}}.show();
|
||||||
}
|
}
|
||||||
@@ -732,39 +735,39 @@ public class Mods implements Loadable{
|
|||||||
setFillParent(true);
|
setFillParent(true);
|
||||||
cont.margin(15);
|
cont.margin(15);
|
||||||
|
|
||||||
cont.add("@mod.dependencies.status").center();
|
cont.add("@mod.dependencies.status").color(Pal.accent).center();
|
||||||
cont.row();
|
cont.row();
|
||||||
cont.image().width(300f).pad(2).height(4f).color(Color.lightGray);
|
cont.image().width(300f).pad(2).height(4f).color(Pal.accent);
|
||||||
cont.row();
|
cont.row();
|
||||||
|
|
||||||
cont.pane(p -> {
|
cont.pane(p -> {
|
||||||
if(success.any()){
|
if(success.any()){
|
||||||
p.add("@mod.dependencies.success").wrap().fillX().left().labelAlign(Align.left);
|
p.add("@mod.dependencies.success").color(Pal.accent).wrap().fillX().left().labelAlign(Align.left);
|
||||||
p.row();
|
p.row();
|
||||||
p.table(t -> {
|
p.table(t -> {
|
||||||
success.each(d -> {
|
success.each(d -> {
|
||||||
t.add(d).wrap().growX().left().labelAlign(Align.left);
|
t.add("[accent] > []" + d).wrap().growX().left().labelAlign(Align.left);
|
||||||
t.row();
|
t.row();
|
||||||
});
|
});
|
||||||
}).growX().padBottom(8f).padLeft(12f);
|
}).growX().padBottom(8f).padLeft(8f);
|
||||||
p.row();
|
p.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(failed.any()){
|
if(failed.any()){
|
||||||
p.add("@mod.dependencies.failure").wrap().fillX().left().labelAlign(Align.left);
|
p.add("@mod.dependencies.failure").color(Color.scarlet).wrap().fillX().left().labelAlign(Align.left);
|
||||||
p.row();
|
p.row();
|
||||||
p.table(t -> {
|
p.table(t -> {
|
||||||
failed.each(d -> {
|
failed.each(d -> {
|
||||||
t.add(d).wrap().growX().left().labelAlign(Align.left);
|
t.add("[scarlet] > []" + d).wrap().growX().left().labelAlign(Align.left);
|
||||||
t.row();
|
t.row();
|
||||||
});
|
});
|
||||||
}).growX().padBottom(8f).padLeft(12f);
|
}).growX().padBottom(8f).padLeft(8f);
|
||||||
}
|
}
|
||||||
}).fillX();
|
}).fillX();
|
||||||
cont.row();
|
cont.row();
|
||||||
|
|
||||||
if(success.any()){
|
if(success.any()){
|
||||||
cont.image().width(300f).pad(2).height(4f).color(Color.lightGray);
|
cont.image().width(300f).pad(2).height(4f).color(Pal.accent);
|
||||||
cont.row();
|
cont.row();
|
||||||
cont.add("@mods.reloadexit").center();
|
cont.add("@mods.reloadexit").center();
|
||||||
cont.row();
|
cont.row();
|
||||||
@@ -800,6 +803,8 @@ public class Mods implements Loadable{
|
|||||||
|
|
||||||
/** This must be run on the main thread! */
|
/** This must be run on the main thread! */
|
||||||
public void loadScripts(){
|
public void loadScripts(){
|
||||||
|
if(skipModCode) return;
|
||||||
|
|
||||||
Time.mark();
|
Time.mark();
|
||||||
boolean[] any = {false};
|
boolean[] any = {false};
|
||||||
|
|
||||||
@@ -1147,6 +1152,7 @@ public class Mods implements Loadable{
|
|||||||
Core.settings.getBool("mod-" + baseName + "-enabled", true) &&
|
Core.settings.getBool("mod-" + baseName + "-enabled", true) &&
|
||||||
Version.isAtLeast(meta.minGameVersion) &&
|
Version.isAtLeast(meta.minGameVersion) &&
|
||||||
(meta.getMinMajor() >= 136 || headless) &&
|
(meta.getMinMajor() >= 136 || headless) &&
|
||||||
|
!skipModCode &&
|
||||||
initialize
|
initialize
|
||||||
){
|
){
|
||||||
if(ios){
|
if(ios){
|
||||||
|
|||||||
@@ -114,6 +114,10 @@ public class ModsDialog extends BaseDialog{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void getModList(Cons<Seq<ModListing>> listener){
|
||||||
|
getModList(0, listener);
|
||||||
|
}
|
||||||
|
|
||||||
void getModList(int index, Cons<Seq<ModListing>> listener){
|
void getModList(int index, Cons<Seq<ModListing>> listener){
|
||||||
if(index >= modJsonURLs.length) return;
|
if(index >= modJsonURLs.length) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user