From 331fd2e803635bcb969564eff44e07b0a8247165 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Tue, 16 Apr 2024 11:36:59 -0700 Subject: [PATCH 01/21] Unmet dependencies dialog + auto import --- core/assets/bundles/bundle.properties | 3 ++ core/src/mindustry/mod/ModListing.java | 3 +- core/src/mindustry/mod/Mods.java | 41 ++++++++++++++++++- core/src/mindustry/ui/dialogs/ModsDialog.java | 8 ++++ 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index cbf4f022d1..9235abcc53 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -183,6 +183,9 @@ mod.preview.missing = Before publishing this mod in the workshop, you must add a mod.folder.missing = Only mods in folder form can be published on the workshop.\nTo convert any mod into a folder, simply unzip its file into a folder and delete the old zip, then restart your game or reload your mods. mod.scripts.disable = Your device does not support mods with scripts. You must disable these mods to play the game. +mod.dependencies.error = [scarlet]Mods are missing dependencies +mod.dependencies.download = Download + about.button = About name = Name: noname = Pick a[accent] player name[] first. diff --git a/core/src/mindustry/mod/ModListing.java b/core/src/mindustry/mod/ModListing.java index e4dfbeccc6..1c029ac122 100644 --- a/core/src/mindustry/mod/ModListing.java +++ b/core/src/mindustry/mod/ModListing.java @@ -2,7 +2,7 @@ package mindustry.mod; /** Mod listing as a data class. */ public class ModListing{ - public String repo, name, subtitle, author, lastUpdated, description, minGameVersion; + public String repo, name, modName, subtitle, author, lastUpdated, description, minGameVersion; public boolean hasScripts, hasJava; public String[] contentTypes = {}; public int stars; @@ -12,6 +12,7 @@ public class ModListing{ return "ModListing{" + "repo='" + repo + '\'' + ", name='" + name + '\'' + + ", modName='" + modName + '\'' + ", author='" + author + '\'' + ", lastUpdated='" + lastUpdated + '\'' + ", description='" + description + '\'' + diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 9e8e6b2b2b..563ed49e1d 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -609,7 +609,6 @@ public class Mods implements Loadable{ if(mods.contains(LoadedMod::hasContentErrors)){ ui.loadfrag.hide(); new Dialog(""){{ - setFillParent(true); cont.margin(15); cont.add("@error.title"); @@ -647,6 +646,46 @@ public class Mods implements Loadable{ cont.button("@ok", this::hide).size(300, 50); }}.show(); } + + //show list of missing dependencies + if(mods.contains(LoadedMod::hasUnmetDependencies)){ + ui.loadfrag.hide(); + new Dialog(""){{ + setFillParent(true); + cont.margin(15); + cont.add("@mod.dependencies.error"); + cont.row(); + cont.image().width(300f).pad(2).colspan(2).height(4f).color(Color.scarlet); + cont.row(); + cont.pane(p -> { + mods.each(LoadedMod::hasUnmetDependencies, mod -> { + p.add(mod.name).wrap().growX().left().get().setAlignment(Align.left); + p.row(); + p.table(d -> { + mod.missingDependencies.each(dep -> { + d.add(" - " + dep).wrap().growX().left().get().setAlignment(Align.left); + d.row(); + }); + }).growX(); + p.row(); + }); + }).fillX(); + + cont.row(); + + cont.table(b -> { + b.button("@ok", this::hide).size(150, 50); + b.button("@mod.dependencies.download", () -> { + hide(); + Seq missingDeps = new Seq<>(); + mods.each(m -> m.enabled() && m.hasUnmetDependencies(), mod -> { + mod.missingDependencies.each(missingDeps::addUnique); + }); + ui.mods.importDependencies(missingDeps); + }).size(150, 50); + }); + }}.show(); + } } public boolean hasContentErrors(){ diff --git a/core/src/mindustry/ui/dialogs/ModsDialog.java b/core/src/mindustry/ui/dialogs/ModsDialog.java index cfc64166ab..804e4ab8ed 100644 --- a/core/src/mindustry/ui/dialogs/ModsDialog.java +++ b/core/src/mindustry/ui/dialogs/ModsDialog.java @@ -673,6 +673,14 @@ public class ModsDialog extends BaseDialog{ } } + public void importDependencies(Seq dependencies){ + getModList(listings -> { + listings.each(l -> dependencies.contains(l.modName), l -> { + githubImportMod(l.repo, l.hasJava); + }); + }); + } + private void githubImportJavaMod(String repo, @Nullable String release){ //grab latest release Http.get(ghApi + "/repos/" + repo + "/releases/" + (release == null ? "latest" : release), res -> { From dd0719c6f11b3a4564aece58a00dd40f20ec52d0 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Tue, 16 Apr 2024 16:48:44 -0700 Subject: [PATCH 02/21] modName -> internalName https://github.com/Anuken/MindustryMods/pull/31/commits/4746a2fd1ea6928fe30df308c1c2a3505f02354c --- core/src/mindustry/mod/ModListing.java | 4 ++-- core/src/mindustry/ui/dialogs/ModsDialog.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/mod/ModListing.java b/core/src/mindustry/mod/ModListing.java index 1c029ac122..ccdb88b717 100644 --- a/core/src/mindustry/mod/ModListing.java +++ b/core/src/mindustry/mod/ModListing.java @@ -2,7 +2,7 @@ package mindustry.mod; /** Mod listing as a data class. */ public class ModListing{ - public String repo, name, modName, subtitle, author, lastUpdated, description, minGameVersion; + public String repo, name, internalName, subtitle, author, lastUpdated, description, minGameVersion; public boolean hasScripts, hasJava; public String[] contentTypes = {}; public int stars; @@ -12,7 +12,7 @@ public class ModListing{ return "ModListing{" + "repo='" + repo + '\'' + ", name='" + name + '\'' + - ", modName='" + modName + '\'' + + ", internalName='" + internalName + '\'' + ", author='" + author + '\'' + ", lastUpdated='" + lastUpdated + '\'' + ", description='" + description + '\'' + diff --git a/core/src/mindustry/ui/dialogs/ModsDialog.java b/core/src/mindustry/ui/dialogs/ModsDialog.java index 804e4ab8ed..9d8041c7fb 100644 --- a/core/src/mindustry/ui/dialogs/ModsDialog.java +++ b/core/src/mindustry/ui/dialogs/ModsDialog.java @@ -675,7 +675,7 @@ public class ModsDialog extends BaseDialog{ public void importDependencies(Seq dependencies){ getModList(listings -> { - listings.each(l -> dependencies.contains(l.modName), l -> { + listings.each(l -> dependencies.contains(l.internalName), l -> { githubImportMod(l.repo, l.hasJava); }); }); From 5ac8abec0f5187615b913ae9901688eaf1bae299 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Tue, 16 Apr 2024 17:09:23 -0700 Subject: [PATCH 03/21] Display feedback to user --- core/assets/bundles/bundle.properties | 2 ++ core/src/mindustry/mod/Mods.java | 16 +++++++++++++--- core/src/mindustry/ui/dialogs/ModsDialog.java | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 9235abcc53..aafb00daba 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -185,6 +185,8 @@ mod.scripts.disable = Your device does not support mods with scripts. You must d mod.dependencies.error = [scarlet]Mods are missing dependencies mod.dependencies.download = Download +mod.dependencies.success = Successfully downloaded all dependencies +mod.dependencies.failure = Failed to download some dependencies: about.button = About name = Name: diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 563ed49e1d..1165a0bf71 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -663,10 +663,10 @@ public class Mods implements Loadable{ p.row(); p.table(d -> { mod.missingDependencies.each(dep -> { - d.add(" - " + dep).wrap().growX().left().get().setAlignment(Align.left); + d.add(" " + dep).wrap().growX().left().get().setAlignment(Align.left); d.row(); }); - }).growX(); + }).growX().padBottom(8f); p.row(); }); }).fillX(); @@ -678,10 +678,20 @@ public class Mods implements Loadable{ b.button("@mod.dependencies.download", () -> { hide(); Seq missingDeps = new Seq<>(); - mods.each(m -> m.enabled() && m.hasUnmetDependencies(), mod -> { + mods.each(LoadedMod::hasUnmetDependencies, mod -> { mod.missingDependencies.each(missingDeps::addUnique); }); + int amount = missingDeps.size; ui.mods.importDependencies(missingDeps); + if(missingDeps.size < amount) requiresReload = true; + + if(missingDeps.isEmpty()){ + ui.showInfo("@mod.dependencies.success"); + }else{ + String[] fail = {Core.bundle.get("mod.dependencies.failure")}; + missingDeps.each(d -> fail[0] += "\n " + d); + ui.showStartupInfo(fail[0]); + } }).size(150, 50); }); }}.show(); diff --git a/core/src/mindustry/ui/dialogs/ModsDialog.java b/core/src/mindustry/ui/dialogs/ModsDialog.java index 9d8041c7fb..8001ebe0c8 100644 --- a/core/src/mindustry/ui/dialogs/ModsDialog.java +++ b/core/src/mindustry/ui/dialogs/ModsDialog.java @@ -677,6 +677,7 @@ public class ModsDialog extends BaseDialog{ getModList(listings -> { listings.each(l -> dependencies.contains(l.internalName), l -> { githubImportMod(l.repo, l.hasJava); + dependencies.remove(l.internalName); }); }); } From 8f8bd67d4bf2cf5317bf6cec6bdc4c0300ddc4ef Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Tue, 16 Apr 2024 17:22:41 -0700 Subject: [PATCH 04/21] Exit after importing --- core/src/mindustry/core/UI.java | 6 +++++- core/src/mindustry/mod/Mods.java | 28 ++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/core/UI.java b/core/src/mindustry/core/UI.java index d634e122b5..554b483d6d 100644 --- a/core/src/mindustry/core/UI.java +++ b/core/src/mindustry/core/UI.java @@ -429,9 +429,13 @@ public class UI implements ApplicationListener, Loadable{ } public void showInfoOnHidden(String info, Runnable listener){ + showInfoOnHidden(info, Align.center, listener); + } + + public void showInfoOnHidden(String info, int align, Runnable listener){ new Dialog(""){{ getCell(cont).growX(); - cont.margin(15).add(info).width(400f).wrap().get().setAlignment(Align.center, Align.center); + cont.margin(15).add(info).width(400f).wrap().get().setAlignment(align, align); buttons.button("@ok", this::hide).size(110, 50).pad(4); hidden(listener); closeOnBack(); diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 1165a0bf71..5d64a02812 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -681,16 +681,29 @@ public class Mods implements Loadable{ mods.each(LoadedMod::hasUnmetDependencies, mod -> { mod.missingDependencies.each(missingDeps::addUnique); }); - int amount = missingDeps.size; + int toImport = missingDeps.size; ui.mods.importDependencies(missingDeps); - if(missingDeps.size < amount) requiresReload = true; if(missingDeps.isEmpty()){ - ui.showInfo("@mod.dependencies.success"); + ui.showInfoOnHidden(Core.bundle.get("mod.dependencies.success") + "\n\n" + Core.bundle.get("mods.reloadexit"), () -> { + Log.info("Exiting to reload mods."); + Core.app.exit(); + }); }else{ String[] fail = {Core.bundle.get("mod.dependencies.failure")}; missingDeps.each(d -> fail[0] += "\n " + d); - ui.showStartupInfo(fail[0]); + + boolean imported = missingDeps.size < toImport; //Mods were loaded + if(imported){ + fail[0] += "\n\n" + Core.bundle.get("mods.reloadexit"); + } + + ui.showInfoOnHidden(fail[0], Align.left, () -> { + if(imported){ + Log.info("Exiting to reload mods."); + Core.app.exit(); + } + }); } }).size(150, 50); }); @@ -698,6 +711,13 @@ public class Mods implements Loadable{ } } + private void reload(){ + ui.showInfoOnHidden("@mods.reloadexit", () -> { + Log.info("Exiting to reload mods."); + Core.app.exit(); + }); + } + public boolean hasContentErrors(){ return mods.contains(LoadedMod::hasContentErrors) || (scripts != null && scripts.hasErrored()); } From e155bf7101c07be7be19238b088606084871128b Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Tue, 16 Apr 2024 17:55:55 -0700 Subject: [PATCH 05/21] Cleaner feedback dialog --- core/assets/bundles/bundle.properties | 5 +- core/src/mindustry/core/UI.java | 6 +- core/src/mindustry/mod/Mods.java | 89 +++++++++++++++++---------- 3 files changed, 62 insertions(+), 38 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index aafb00daba..e5fe685aa6 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -185,8 +185,9 @@ mod.scripts.disable = Your device does not support mods with scripts. You must d mod.dependencies.error = [scarlet]Mods are missing dependencies mod.dependencies.download = Download -mod.dependencies.success = Successfully downloaded all dependencies -mod.dependencies.failure = Failed to download some dependencies: +mod.dependencies.status = Import Results +mod.dependencies.success = Successfully downloaded: +mod.dependencies.failure = Failed to download: about.button = About name = Name: diff --git a/core/src/mindustry/core/UI.java b/core/src/mindustry/core/UI.java index 554b483d6d..d634e122b5 100644 --- a/core/src/mindustry/core/UI.java +++ b/core/src/mindustry/core/UI.java @@ -429,13 +429,9 @@ public class UI implements ApplicationListener, Loadable{ } public void showInfoOnHidden(String info, Runnable listener){ - showInfoOnHidden(info, Align.center, listener); - } - - public void showInfoOnHidden(String info, int align, Runnable listener){ new Dialog(""){{ getCell(cont).growX(); - cont.margin(15).add(info).width(400f).wrap().get().setAlignment(align, align); + cont.margin(15).add(info).width(400f).wrap().get().setAlignment(Align.center, Align.center); buttons.button("@ok", this::hide).size(110, 50).pad(4); hidden(listener); closeOnBack(); diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 5d64a02812..e354f89e14 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -615,7 +615,7 @@ public class Mods implements Loadable{ cont.row(); cont.image().width(300f).pad(2).colspan(2).height(4f).color(Color.scarlet); cont.row(); - cont.add("@mod.errors").wrap().growX().center().get().setAlignment(Align.center); + cont.add("@mod.errors").wrap().growX().center().labelAlign(Align.center); cont.row(); cont.pane(p -> { mods.each(m -> m.enabled() && m.hasContentErrors(), m -> { @@ -655,18 +655,18 @@ public class Mods implements Loadable{ cont.margin(15); cont.add("@mod.dependencies.error"); cont.row(); - cont.image().width(300f).pad(2).colspan(2).height(4f).color(Color.scarlet); + cont.image().width(300f).pad(2).height(4f).color(Color.scarlet); cont.row(); cont.pane(p -> { mods.each(LoadedMod::hasUnmetDependencies, mod -> { - p.add(mod.name).wrap().growX().left().get().setAlignment(Align.left); + p.add(mod.name).wrap().growX().left().labelAlign(Align.left); p.row(); p.table(d -> { mod.missingDependencies.each(dep -> { - d.add(" " + dep).wrap().growX().left().get().setAlignment(Align.left); + d.add(dep).wrap().growX().left().labelAlign(Align.left); d.row(); }); - }).growX().padBottom(8f); + }).growX().padBottom(8f).padLeft(12f); p.row(); }); }).fillX(); @@ -677,40 +677,67 @@ public class Mods implements Loadable{ b.button("@ok", this::hide).size(150, 50); b.button("@mod.dependencies.download", () -> { hide(); - Seq missingDeps = new Seq<>(); + Seq toImport = new Seq<>(); mods.each(LoadedMod::hasUnmetDependencies, mod -> { - mod.missingDependencies.each(missingDeps::addUnique); + mod.missingDependencies.each(toImport::addUnique); }); - int toImport = missingDeps.size; - ui.mods.importDependencies(missingDeps); - - if(missingDeps.isEmpty()){ - ui.showInfoOnHidden(Core.bundle.get("mod.dependencies.success") + "\n\n" + Core.bundle.get("mods.reloadexit"), () -> { - Log.info("Exiting to reload mods."); - Core.app.exit(); - }); - }else{ - String[] fail = {Core.bundle.get("mod.dependencies.failure")}; - missingDeps.each(d -> fail[0] += "\n " + d); - - boolean imported = missingDeps.size < toImport; //Mods were loaded - if(imported){ - fail[0] += "\n\n" + Core.bundle.get("mods.reloadexit"); - } - - ui.showInfoOnHidden(fail[0], Align.left, () -> { - if(imported){ - Log.info("Exiting to reload mods."); - Core.app.exit(); - } - }); - } + Seq remaining = toImport.copy(); + ui.mods.importDependencies(remaining); + toImport.removeAll(remaining); + displayDependencyImportStatus(remaining, toImport); }).size(150, 50); }); }}.show(); } } + private void displayDependencyImportStatus(Seq failed, Seq success){ + new Dialog(""){{ + setFillParent(true); + cont.margin(15); + + cont.add("@mod.dependencies.status").center(); + cont.row(); + cont.image().width(300f).pad(2).height(4f).color(Color.lightGray); + cont.row(); + + cont.pane(p -> { + if(success.any()){ + p.add("@mod.dependencies.success").wrap().fillX().left().labelAlign(Align.left); + p.row(); + p.table(t -> { + success.each(d -> { + t.add(d).wrap().growX().left().labelAlign(Align.left); + t.row(); + }); + }).growX().padBottom(8f).padLeft(12f); + p.row(); + } + + if(failed.any()){ + p.add("@mod.dependencies.failure").wrap().fillX().left().labelAlign(Align.left); + p.row(); + p.table(t -> { + failed.each(d -> { + t.add(d).wrap().growX().left().labelAlign(Align.left); + t.row(); + }); + }).growX().padBottom(8f).padLeft(12f); + } + }).fillX(); + + if(success.any()){ + cont.image().width(300f).pad(2).height(4f).color(Color.lightGray); + cont.row(); + cont.add("@mods.reloadexit").center(); + hidden(() -> { + Log.info("Exiting to reload mods after dependency auto-import."); + Core.app.exit(); + }); + } + }}.show(); + } + private void reload(){ ui.showInfoOnHidden("@mods.reloadexit", () -> { Log.info("Exiting to reload mods."); From 250fb79fa3c5ccb624f8d0c406369309ce456df9 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Tue, 16 Apr 2024 17:57:05 -0700 Subject: [PATCH 06/21] "Auto-Import" instead of "Download"? --- core/assets/bundles/bundle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index e5fe685aa6..db21adf1ac 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -184,7 +184,7 @@ mod.folder.missing = Only mods in folder form can be published on the workshop.\ mod.scripts.disable = Your device does not support mods with scripts. You must disable these mods to play the game. mod.dependencies.error = [scarlet]Mods are missing dependencies -mod.dependencies.download = Download +mod.dependencies.download = Auto-Import mod.dependencies.status = Import Results mod.dependencies.success = Successfully downloaded: mod.dependencies.failure = Failed to download: From ad1a3d694e4617b5b8cca3ac6d442c0fa80a37fe Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Tue, 16 Apr 2024 18:00:47 -0700 Subject: [PATCH 07/21] There is now an escape Forgot to add the ok button --- core/src/mindustry/mod/Mods.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index e354f89e14..49f4af97e2 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -725,16 +725,21 @@ public class Mods implements Loadable{ }).growX().padBottom(8f).padLeft(12f); } }).fillX(); + cont.row(); if(success.any()){ cont.image().width(300f).pad(2).height(4f).color(Color.lightGray); cont.row(); cont.add("@mods.reloadexit").center(); + cont.row(); + hidden(() -> { Log.info("Exiting to reload mods after dependency auto-import."); Core.app.exit(); }); } + + cont.button("@ok", this::hide).size(300, 50); }}.show(); } From 274184e234c0c328e6d986319a15aeb7dac571a0 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Tue, 16 Apr 2024 18:04:00 -0700 Subject: [PATCH 08/21] Less table --- core/src/mindustry/mod/Mods.java | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 49f4af97e2..85481aaf9e 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -653,9 +653,9 @@ public class Mods implements Loadable{ new Dialog(""){{ setFillParent(true); cont.margin(15); - cont.add("@mod.dependencies.error"); + cont.add("@mod.dependencies.error").colspan(2); cont.row(); - cont.image().width(300f).pad(2).height(4f).color(Color.scarlet); + cont.image().width(300f).colspan(2).pad(2).height(4f).color(Color.scarlet); cont.row(); cont.pane(p -> { mods.each(LoadedMod::hasUnmetDependencies, mod -> { @@ -669,24 +669,22 @@ public class Mods implements Loadable{ }).growX().padBottom(8f).padLeft(12f); p.row(); }); - }).fillX(); + }).fillX().colspan(2); cont.row(); - cont.table(b -> { - b.button("@ok", this::hide).size(150, 50); - b.button("@mod.dependencies.download", () -> { - hide(); - Seq toImport = new Seq<>(); - mods.each(LoadedMod::hasUnmetDependencies, mod -> { - mod.missingDependencies.each(toImport::addUnique); - }); - Seq remaining = toImport.copy(); - ui.mods.importDependencies(remaining); - toImport.removeAll(remaining); - displayDependencyImportStatus(remaining, toImport); - }).size(150, 50); - }); + cont.button("@ok", this::hide).size(150, 50); + cont.button("@mod.dependencies.download", () -> { + hide(); + Seq toImport = new Seq<>(); + mods.each(LoadedMod::hasUnmetDependencies, mod -> { + mod.missingDependencies.each(toImport::addUnique); + }); + Seq remaining = toImport.copy(); + ui.mods.importDependencies(remaining); + toImport.removeAll(remaining); + displayDependencyImportStatus(remaining, toImport); + }).size(150, 50); }}.show(); } } From 6e3bc2b4c393cd54c1b45e21a795a98884128acf Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Tue, 16 Apr 2024 18:09:05 -0700 Subject: [PATCH 09/21] Show display name instead of name --- core/src/mindustry/mod/Mods.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 85481aaf9e..30ab2b470c 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -659,7 +659,7 @@ public class Mods implements Loadable{ cont.row(); cont.pane(p -> { mods.each(LoadedMod::hasUnmetDependencies, mod -> { - p.add(mod.name).wrap().growX().left().labelAlign(Align.left); + p.add(mod.meta.displayName).wrap().growX().left().labelAlign(Align.left); p.row(); p.table(d -> { mod.missingDependencies.each(dep -> { From eff7d75712054b8d9c7fdb22c74671d38ed15fcc Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Thu, 18 Apr 2024 11:40:14 -0700 Subject: [PATCH 10/21] Display status after downloads are complete. --- core/src/mindustry/mod/Mods.java | 7 ++++--- core/src/mindustry/ui/dialogs/ModsDialog.java | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 30ab2b470c..348bfbceaa 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -681,9 +681,10 @@ public class Mods implements Loadable{ mod.missingDependencies.each(toImport::addUnique); }); Seq remaining = toImport.copy(); - ui.mods.importDependencies(remaining); - toImport.removeAll(remaining); - displayDependencyImportStatus(remaining, toImport); + ui.mods.importDependencies(remaining, () -> { + toImport.removeAll(remaining); + displayDependencyImportStatus(remaining, toImport); + }); }).size(150, 50); }}.show(); } diff --git a/core/src/mindustry/ui/dialogs/ModsDialog.java b/core/src/mindustry/ui/dialogs/ModsDialog.java index 8001ebe0c8..dee0edc4b6 100644 --- a/core/src/mindustry/ui/dialogs/ModsDialog.java +++ b/core/src/mindustry/ui/dialogs/ModsDialog.java @@ -673,12 +673,13 @@ public class ModsDialog extends BaseDialog{ } } - public void importDependencies(Seq dependencies){ + public void importDependencies(Seq dependencies, Runnable done){ getModList(listings -> { listings.each(l -> dependencies.contains(l.internalName), l -> { - githubImportMod(l.repo, l.hasJava); dependencies.remove(l.internalName); + githubImportMod(l.repo, l.hasJava); }); + done.run(); }); } From a51c4e6909b68c1516dde081d3ccec6b70d4cd63 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Thu, 18 Apr 2024 13:44:52 -0700 Subject: [PATCH 11/21] Don't check disabled mods --- core/src/mindustry/mod/Mods.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 348bfbceaa..5e3809144a 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -658,7 +658,7 @@ public class Mods implements Loadable{ cont.image().width(300f).colspan(2).pad(2).height(4f).color(Color.scarlet); cont.row(); cont.pane(p -> { - mods.each(LoadedMod::hasUnmetDependencies, mod -> { + mods.each(mod -> mod.shouldBeEnabled() && mod.hasUnmetDependencies(), mod -> { p.add(mod.meta.displayName).wrap().growX().left().labelAlign(Align.left); p.row(); p.table(d -> { @@ -677,7 +677,7 @@ public class Mods implements Loadable{ cont.button("@mod.dependencies.download", () -> { hide(); Seq toImport = new Seq<>(); - mods.each(LoadedMod::hasUnmetDependencies, mod -> { + mods.each(mod -> mod.shouldBeEnabled() && mod.hasUnmetDependencies(), mod -> { mod.missingDependencies.each(toImport::addUnique); }); Seq remaining = toImport.copy(); From e6b7d3f82e9f61495e8a9a8cedc2e4194a45727e Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Thu, 18 Apr 2024 21:55:59 -0700 Subject: [PATCH 12/21] Fun fact: This bundle entry is unused --- core/assets/bundles/bundle.properties | 1 - core/assets/bundles/bundle_be.properties | 1 - core/assets/bundles/bundle_bg.properties | 1 - core/assets/bundles/bundle_ca.properties | 1 - core/assets/bundles/bundle_cs.properties | 1 - core/assets/bundles/bundle_da.properties | 1 - core/assets/bundles/bundle_de.properties | 1 - core/assets/bundles/bundle_es.properties | 1 - core/assets/bundles/bundle_et.properties | 1 - core/assets/bundles/bundle_eu.properties | 1 - core/assets/bundles/bundle_fi.properties | 1 - core/assets/bundles/bundle_fil.properties | 1 - core/assets/bundles/bundle_fr.properties | 1 - core/assets/bundles/bundle_hu.properties | 1 - core/assets/bundles/bundle_id_ID.properties | 1 - core/assets/bundles/bundle_it.properties | 1 - core/assets/bundles/bundle_ja.properties | 1 - core/assets/bundles/bundle_ko.properties | 1 - core/assets/bundles/bundle_lt.properties | 1 - core/assets/bundles/bundle_nl.properties | 1 - core/assets/bundles/bundle_nl_BE.properties | 1 - core/assets/bundles/bundle_pl.properties | 1 - core/assets/bundles/bundle_pt_BR.properties | 1 - core/assets/bundles/bundle_pt_PT.properties | 1 - core/assets/bundles/bundle_ro.properties | 1 - core/assets/bundles/bundle_ru.properties | 1 - core/assets/bundles/bundle_sr.properties | 1 - core/assets/bundles/bundle_sv.properties | 1 - core/assets/bundles/bundle_th.properties | 1 - core/assets/bundles/bundle_tk.properties | 1 - core/assets/bundles/bundle_tr.properties | 1 - core/assets/bundles/bundle_uk_UA.properties | 1 - core/assets/bundles/bundle_vi.properties | 1 - core/assets/bundles/bundle_zh_CN.properties | 1 - core/assets/bundles/bundle_zh_TW.properties | 1 - 35 files changed, 35 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index db21adf1ac..2f3e5d531b 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -167,7 +167,6 @@ mod.requiresversion = Requires game version: [red]{0} mod.errors = Errors have occurred loading content. mod.noerrorplay = [red]You have mods with errors.[] Either disable the affected mods or fix the errors before playing. -mod.nowdisabled = [red]Mod '{0}' is missing dependencies:[accent] {1}\n[lightgray]These mods need to be downloaded first.\nThis mod will be automatically disabled. mod.enable = Enable mod.requiresrestart = The game will now close to apply the mod changes. mod.reloadrequired = [red]Restart Required diff --git a/core/assets/bundles/bundle_be.properties b/core/assets/bundles/bundle_be.properties index b1a94fc891..f279f83f59 100644 --- a/core/assets/bundles/bundle_be.properties +++ b/core/assets/bundles/bundle_be.properties @@ -160,7 +160,6 @@ mod.incompletedependencies.details = Гэтая мадыфікацыя не мо mod.requiresversion = Патрабуецца версія гульні: [red]{0} mod.errors = Памылкі былі выкліканыя загружаным змесцівам. mod.noerrorplay = [scarlet]У Вас ёсць мадыфікацыі з памылкамі.[] Выключыце праблемныя мадыфікацыі або выпраўце памылкі перад гульнёй. -mod.nowdisabled = [scarlet]Мадыфікацыі '{0}' патрабуюцца бацькоўскія мадыфікацыі:[accent] {1}\n[lightgray]Спачатку трэба загрузіць іх.\nГэтая мадыфікацыя будзе аўтаматычна адключаная. mod.enable = Укл. mod.requiresrestart = Цяпер гульня зачыніцца, каб прымяніць змены ў мадыфікацыях. mod.reloadrequired = [scarlet]Неабходны перазапуск diff --git a/core/assets/bundles/bundle_bg.properties b/core/assets/bundles/bundle_bg.properties index eafedcdd6b..accfcadfb8 100644 --- a/core/assets/bundles/bundle_bg.properties +++ b/core/assets/bundles/bundle_bg.properties @@ -163,7 +163,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = Възникнаха грешки при зареждане на съдържанието. mod.noerrorplay = [scarlet]Има грешки в някои от модовете, които използвате.[] Трябва да деактивирате тези модове или да поправите грешките преди да играете. -mod.nowdisabled = [scarlet]Липсват зависимости за мод '{0}':[accent] {1}\n[lightgray]Мод {0} ще бъде деактивиран докато не ги изтеглите. mod.enable = Активирай mod.requiresrestart = Играта ще се затвори за да приложи промените в модовете. mod.reloadrequired = [scarlet]Необходимо е рестартиране diff --git a/core/assets/bundles/bundle_ca.properties b/core/assets/bundles/bundle_ca.properties index 149756ce51..88cd669bc8 100644 --- a/core/assets/bundles/bundle_ca.properties +++ b/core/assets/bundles/bundle_ca.properties @@ -163,7 +163,6 @@ mod.incompletedependencies.details = Aquest mod no es pot carregar perquè té u mod.requiresversion = Cal la versió [red]{0}[] del joc. mod.errors = S’han produït errors quan es carregava el contingut. mod.noerrorplay = [scarlet]S’executen mods amb errors.[] Desactiveu els mods afectats o arregleu les errades abans de jugar. -mod.nowdisabled = [scarlet]Falten dependències del mod «{0}»s:[accent] {1}\n[lightgray]S’han de carregar els mods que fan falta.\nAquest mod es desactivarà automàticament. mod.enable = Activa mod.requiresrestart = El programa es tancarà per a aplicar els canvis. mod.reloadrequired = [scarlet]Cal reiniciar diff --git a/core/assets/bundles/bundle_cs.properties b/core/assets/bundles/bundle_cs.properties index 60ea6f6682..5963f0b210 100644 --- a/core/assets/bundles/bundle_cs.properties +++ b/core/assets/bundles/bundle_cs.properties @@ -163,7 +163,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = Při načítání obsahu hry se vyskytly problémy. mod.noerrorplay = [scarlet]Máš modifikace s chybami.[] Buď zakaž dotčené modifikace, nebo oprav chyby před tím, než začneš hrát. -mod.nowdisabled = [scarlet]Modifikaci '{0}' chybí tyto závislosti: [accent]{1}\n[lightgray]Tyto modifikace je třeba nejprve stáhnout.\nTato modifikace bude nyní automaticky zakázána. mod.enable = Povolit mod.requiresrestart = Hra bude ukončena, aby bylo možné nasadit modifikace. mod.reloadrequired = [scarlet]Je vyžadováno znovuspuštění hry. diff --git a/core/assets/bundles/bundle_da.properties b/core/assets/bundles/bundle_da.properties index cb118a0b54..dee38099c8 100644 --- a/core/assets/bundles/bundle_da.properties +++ b/core/assets/bundles/bundle_da.properties @@ -160,7 +160,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = Fejl ved afhentning af indhold. mod.noerrorplay = [scarlet]Du har mods med fejl.[] Deaktiver det eller løs fejl før du starter spillet. -mod.nowdisabled = [scarlet]Mod '{0}' mangler afhængigheder:[accent] {1}\n[lightgray]Disse mods skal hentes først.\nDenne mod vil blive deaktiveret automatisk. mod.enable = Aktiver mod.requiresrestart = Spillet vil nu lukke for at tilføje mod ændringerne mod.reloadrequired = [scarlet]Genindlæsning påkrævet diff --git a/core/assets/bundles/bundle_de.properties b/core/assets/bundles/bundle_de.properties index 4713fb1e5a..75d4484fce 100644 --- a/core/assets/bundles/bundle_de.properties +++ b/core/assets/bundles/bundle_de.properties @@ -166,7 +166,6 @@ mod.requiresversion = Benötigt Spielversion: [red]{0} mod.errors = Beim Laden von Inhalt sind Fehler aufgetreten. mod.noerrorplay = [red]Du hast Mods mit Fehlern.[] Deaktiviere die Mods oder behebe die Fehler, bevor du spielst. -mod.nowdisabled = [red]Mod '{0}' fehlen Abhängigkeiten:[accent] {1}\n[lightgray]Diese Mods müssen erst installiert werden.\nDieser Mod wird automatisch deaktiviert. mod.enable = Aktivieren mod.requiresrestart = Das Spiel wird jetzt beendet, um die Mod-Änderungen anzuwenden. mod.reloadrequired = [red]Neuladen benötigt diff --git a/core/assets/bundles/bundle_es.properties b/core/assets/bundles/bundle_es.properties index ce0c335822..1417f98184 100644 --- a/core/assets/bundles/bundle_es.properties +++ b/core/assets/bundles/bundle_es.properties @@ -163,7 +163,6 @@ mod.incompletedependencies.details = Este mod no se puede cargar debido a depend mod.requiresversion = Requiere la versión del juego: [red]{0} mod.errors = Ha ocurrido un fallo al cargar el contenido. mod.noerrorplay = [scarlet]Se están ejecutando algunos mods con fallos.[]Debes deshabilitarlos o arreglar los errores antes de jugar. -mod.nowdisabled = [scarlet]El mod '{0}' necesita ejecutarse junto a otros mods de los que depende:[accent] {1}\n[lightgray]Es necesario descargar primero estos mods.\nEste mod se desactivará automaticamente. mod.enable = Activar mod.requiresrestart = El juego se cerrará para aplicar los cambios del mod. mod.reloadrequired = [scarlet]Es necesario reiniciar diff --git a/core/assets/bundles/bundle_et.properties b/core/assets/bundles/bundle_et.properties index 6e5dc5c842..1e860d5ac4 100644 --- a/core/assets/bundles/bundle_et.properties +++ b/core/assets/bundles/bundle_et.properties @@ -160,7 +160,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = Errors have occurred loading content. mod.noerrorplay = [scarlet]You have mods with errors.[] Either disable the affected mods or fix the errors before playing. -mod.nowdisabled = [scarlet]Mod '{0}' is missing dependencies:[accent] {1}\n[lightgray]These mods need to be downloaded first.\nThis mod will be automatically disabled. mod.enable = Enable mod.requiresrestart = The game will now close to apply the mod changes. mod.reloadrequired = [scarlet]Reload Required diff --git a/core/assets/bundles/bundle_eu.properties b/core/assets/bundles/bundle_eu.properties index 20dcfa9f68..785ab0981c 100644 --- a/core/assets/bundles/bundle_eu.properties +++ b/core/assets/bundles/bundle_eu.properties @@ -160,7 +160,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = Erroreak gertatu dira edukia kargatzean. mod.noerrorplay = [scarlet]Erroreak dituzten mod-ak dituzu.[] Desgaitu kaltetutako mod-ak edo konpondu erroreak jolastu aurretik. -mod.nowdisabled = [scarlet]'{0}' mod-ak menpekotasunak ditu faltan:[accent] {1}\n[lightgray]Aurretik beste mod hauek deskargatu behar dira.\nMod hau automatikoki desgaituko da. mod.enable = Gaitu mod.requiresrestart = Jolasa itxi egingo da mod-aren aldaketak aplikatzeko. mod.reloadrequired = [scarlet]Birkargatu behar da diff --git a/core/assets/bundles/bundle_fi.properties b/core/assets/bundles/bundle_fi.properties index b81ad76e72..effecd2f51 100644 --- a/core/assets/bundles/bundle_fi.properties +++ b/core/assets/bundles/bundle_fi.properties @@ -160,7 +160,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = Virheitä on tapahtunut pelin ladatessa. mod.noerrorplay = [scarlet]Sinulla on virheellisiä modeja.[] Joko poista ne käytöstä tai korjaa virheet. -mod.nowdisabled = [scarlet]Lisäosa '{0}' tarvitsee muita lisäosia toimiakseen:[accent] {1}\n[lightgray]Nämä lisäosat täytyy asentaa ensin.\nTämä lisäosa poistetaan automaattisesti käytöstä. mod.enable = Käytä mod.requiresrestart = Peli suljetaan jotta muutokset voisivat toteutua. mod.reloadrequired = [scarlet]Vaatii Uudelleenkäynnistystä diff --git a/core/assets/bundles/bundle_fil.properties b/core/assets/bundles/bundle_fil.properties index 18b9fd2aab..61a0df99e4 100644 --- a/core/assets/bundles/bundle_fil.properties +++ b/core/assets/bundles/bundle_fil.properties @@ -160,7 +160,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = May mga error na naitala habang ni-lo-load ang nilalaman. mod.noerrorplay = [scarlet]May mga mod kang may error.[] Maaaring 'wag munang paganahin ang mga apektadong mod o 'di kaya'y ayusin ang mga error bago maglaro. -mod.nowdisabled = [scarlet]Ang mod na '{0}' ay ma kulang na mga dependency:[accent] {1}\n[lightgray]Ang mga ito'y kinakailangang i-download muna.\nAng mod na'to ay kusang 'di papaganahin. mod.enable = Paganahin mod.requiresrestart = Ang laro'y magsasara upang mai-apply ang mga pagbabago sa mod. mod.reloadrequired = [scarlet]Kinakalingang I-restart diff --git a/core/assets/bundles/bundle_fr.properties b/core/assets/bundles/bundle_fr.properties index 3ff26c05c4..68452ca1ec 100644 --- a/core/assets/bundles/bundle_fr.properties +++ b/core/assets/bundles/bundle_fr.properties @@ -167,7 +167,6 @@ mod.requiresversion = Requiert la version: [red]{0} mod.errors = Des erreurs se sont produites lors du chargement du contenu. mod.noerrorplay = [scarlet]Vous avez des mods avec des erreurs.[] Désactivez les mods concernés ou corrigez les erreurs avant de jouer. -mod.nowdisabled = [scarlet]Le mod '{0}' a des dépendances manquantes: [accent]{1}\n[lightgray]Ces mods doivent d'abord être téléchargés.\nCe mod sera automatiquement désactivé. mod.enable = Activer mod.requiresrestart = Le jeu va maintenant se fermer pour appliquer les modifications du mod. mod.reloadrequired = [scarlet]Redémarrage requis diff --git a/core/assets/bundles/bundle_hu.properties b/core/assets/bundles/bundle_hu.properties index b04b225ac8..fb98bd1553 100644 --- a/core/assets/bundles/bundle_hu.properties +++ b/core/assets/bundles/bundle_hu.properties @@ -167,7 +167,6 @@ mod.requiresversion = Szükséges játékverzió: [red]{0}[] mod.errors = Hiba történt a tartalom betöltése közben. mod.noerrorplay = [red]Hibákkal rendelkező modjaid vannak.[] Kapcsold ki, vagy javítsd ki őket a játék előtt. -mod.nowdisabled = [red]A(z) „{0}” modnak nincs megfelelő függősége:[accent] {1}\n[lightgray]Ezeket előbb le kell tölteni.\nEz a mod automatikusan ki lesz kapcsolva. mod.enable = Engedélyezés mod.requiresrestart = A játék kilép a módosítások alkalmazásához. mod.reloadrequired = [red]Újraindítás szükséges diff --git a/core/assets/bundles/bundle_id_ID.properties b/core/assets/bundles/bundle_id_ID.properties index e42084a3a7..b3f6c355d5 100644 --- a/core/assets/bundles/bundle_id_ID.properties +++ b/core/assets/bundles/bundle_id_ID.properties @@ -163,7 +163,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = Terjadi kesalahan saat memuat konten. mod.noerrorplay = [scarlet]Anda memiliki mod dengan suatu kesalahan.[] Nonaktifkan mod yang bersangkutan atau perbaiki kesalahan tersebut sebelum bermain. -mod.nowdisabled = [scarlet]Mod '{0}' tidak memiliki ketergantungan:[accent] {1}\n[lightgray]Mod ini harus diunduh terlebih dahulu.\nMod ini akan dinonaktifkan secara otomatis. mod.enable = Aktifkan mod.requiresrestart = Game akan keluar untuk mengaktifkan perubahan mod. mod.reloadrequired = [scarlet]Muat Ulang Diperlukan diff --git a/core/assets/bundles/bundle_it.properties b/core/assets/bundles/bundle_it.properties index 6383c512ca..11eb629da4 100644 --- a/core/assets/bundles/bundle_it.properties +++ b/core/assets/bundles/bundle_it.properties @@ -161,7 +161,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = Si sono verificati degli errori durante il caricamento del contenuto. mod.noerrorplay = [scarlet]Sono presenti delle mod con errori.[] Puoi disabilitare le mod affette oppure sistemarle prima di giocare. -mod.nowdisabled = [scarlet]Alla mod '{0}' mancano delle dipendenze:[accent] {1}\n[lightgray]Queste mod devono essere scaricate prima.\nQuesta mod verrà disabilitata automaticamente. mod.enable = Abilita mod.requiresrestart = Il gioco verrà chiuso per applicare i cambiamenti. mod.reloadrequired = [scarlet]Riavvio necessario diff --git a/core/assets/bundles/bundle_ja.properties b/core/assets/bundles/bundle_ja.properties index ed0dc7cc69..748be30899 100644 --- a/core/assets/bundles/bundle_ja.properties +++ b/core/assets/bundles/bundle_ja.properties @@ -163,7 +163,6 @@ mod.incompletedependencies.details = 依存関係が無効または欠損して mod.requiresversion = ゲームのバージョンが必要です: [red]{0} mod.errors = コンテンツの読み込み中にエラーが発生しました。 mod.noerrorplay = [scarlet]以下のModにエラーがあります。[] Modを無効化するか、エラーを修正してください。 -mod.nowdisabled = [scarlet]{0} 依存関係がありません。:[accent] {1}\n[lightgray]これらのModをダウンロードし有効化する必要があります。\nなお、このModは自動的に無効化されます。 mod.enable = 有効化 mod.requiresrestart = このModをインストールするためにはゲームの再起動が必要です。 mod.reloadrequired = [scarlet]Modを有効にするには、この画面を開き直してください。 diff --git a/core/assets/bundles/bundle_ko.properties b/core/assets/bundles/bundle_ko.properties index 2ec87a4548..8d6d6d4400 100644 --- a/core/assets/bundles/bundle_ko.properties +++ b/core/assets/bundles/bundle_ko.properties @@ -163,7 +163,6 @@ mod.incompletedependencies.details = 잘못되었거나 누락한 종속성으 mod.requiresversion = 필요한 게임 버전: [red]{0} mod.errors = 콘텐츠를 불러오는 중에 오류가 발생함 mod.noerrorplay = [scarlet]오류가 있는 모드가 있습니다.[] 영향을 받는 모드를 비활성화하거나 플레이하기 전에 오류를 수정하세요. -mod.nowdisabled = [scarlet]모드 '{0}'에 필요한 종속성이 없습니다:[accent] {1}\n[lightgray]이 모드를 먼저 내려받아야 합니다.\n이 모드는 자동으로 비활성화됩니다. mod.enable = 활성화 mod.requiresrestart = 모드 변경 사항을 적용하기 위해 게임을 종료합니다. mod.reloadrequired = [scarlet]재시작 필요 diff --git a/core/assets/bundles/bundle_lt.properties b/core/assets/bundles/bundle_lt.properties index 90cb6efbf4..7b45b3d53b 100644 --- a/core/assets/bundles/bundle_lt.properties +++ b/core/assets/bundles/bundle_lt.properties @@ -160,7 +160,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = Įvyko klaida kraunant turinį. mod.noerrorplay = [scarlet]Turite modifikacijas su klaidomis.[] Išjunkite modifikacijas su klaidomis arba patasykite jas prieš žaidžiant. -mod.nowdisabled = [scarlet]Modifikacijai '{0}' trūksta priklausomybių:[accent] {1}\n[lightgray] Šios modifikacijos turi būti atsisiųstos.\nŠi modifikacija bus automatiškai išjungta. mod.enable = Įjungti mod.requiresrestart = Žaidimas dabar išsijungs modifikacijų pakeitimui. mod.reloadrequired = [scarlet]Privalomas perkrovimas diff --git a/core/assets/bundles/bundle_nl.properties b/core/assets/bundles/bundle_nl.properties index fb69dc8371..3548a35b37 100644 --- a/core/assets/bundles/bundle_nl.properties +++ b/core/assets/bundles/bundle_nl.properties @@ -167,7 +167,6 @@ mod.requiresversion = Vereist spelversie: [red]{0} mod.errors = Er hebben zich fouten voordaan tijdens het laden van de inhoud. mod.noerrorplay = [red]Je mods bevatten fouten.[] Zet de mods uit of los de problemen op voordat je verder gaat met spelen. -mod.nowdisabled = [red]Mod '{0}' mist een aantal benodigdheden:[accent] {1}\n[lightgray]Deze moet je eerst zelf downloaden.\nDeze mod is nu voor je uitgezet. mod.enable = Activeer mod.requiresrestart = Het spel zal nu afsluiten om de veranderingen aan de mods door te voeren. mod.reloadrequired = [scarlet]Herstart Vereist diff --git a/core/assets/bundles/bundle_nl_BE.properties b/core/assets/bundles/bundle_nl_BE.properties index 1f345b97e0..6c6b699025 100644 --- a/core/assets/bundles/bundle_nl_BE.properties +++ b/core/assets/bundles/bundle_nl_BE.properties @@ -160,7 +160,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = Errors have occurred loading content. mod.noerrorplay = [scarlet]You have mods with errors.[] Either disable the affected mods or fix the errors before playing. -mod.nowdisabled = [scarlet]De volgende vereisten ontbreken voor mod '{0}':[accent] {1}\n[lightgray]Deze mods moeten eerst gedownload worden.\nDeze mod wordt automatisch uitgeschakeld. mod.enable = Schakel in mod.requiresrestart = The game will now close to apply the mod changes. mod.reloadrequired = [scarlet]Herladen Vereist diff --git a/core/assets/bundles/bundle_pl.properties b/core/assets/bundles/bundle_pl.properties index 53e9cf4317..8d7c24f294 100644 --- a/core/assets/bundles/bundle_pl.properties +++ b/core/assets/bundles/bundle_pl.properties @@ -163,7 +163,6 @@ mod.incompletedependencies.details = Moda nie da się załadować z powodu niepo mod.requiresversion = Wymagana wersja gry: [red]{0} mod.errors = Wystąpił błąd podczas ładowania treści. mod.noerrorplay = [scarlet]Twoje mody zawierają błędy.[] Wyłącz je lub napraw błędy przed rozpoczęciem gry. -mod.nowdisabled = [scarlet]Brakuje zależności dla moda '{0}':[accent] {1}\n[lightgray]Najpierw trzeba ściągnąć te mody.\nMod zostanie automatycznie wyłączony. mod.enable = Włącz mod.requiresrestart = Gra zostanie wyłączona aby wprowadzić zmiany w modzie. mod.reloadrequired = [scarlet]Wymagany restart diff --git a/core/assets/bundles/bundle_pt_BR.properties b/core/assets/bundles/bundle_pt_BR.properties index 4ba31c527b..122c01975c 100644 --- a/core/assets/bundles/bundle_pt_BR.properties +++ b/core/assets/bundles/bundle_pt_BR.properties @@ -163,7 +163,6 @@ mod.incompletedependencies.details = Este mod não pode ser carregado devido a d mod.requiresversion = Requer a versão do jogo: [red]{0} mod.errors = Ocorreram erros ao carregar o conteúdo. mod.noerrorplay = [scarlet]Você tem mods com erros.[] Desative os mods afetados ou conserte os erros antes de jogar. -mod.nowdisabled = [scarlet]O Mod '{0}' está com dependências ausentes:[accent] {1}\n[lightgray]Esses Mods precisam ser baixados primeiro.\nEsse Mod será desativado automaticamente. mod.enable = Ativar mod.requiresrestart = O jogo irá fechar para aplicar as mudanças do mod. mod.reloadrequired = [scarlet]Recarregamento necessário diff --git a/core/assets/bundles/bundle_pt_PT.properties b/core/assets/bundles/bundle_pt_PT.properties index 1780792fe3..63e30ed2b7 100644 --- a/core/assets/bundles/bundle_pt_PT.properties +++ b/core/assets/bundles/bundle_pt_PT.properties @@ -160,7 +160,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = Ocorreram erros ao carregar o conteúdo. mod.noerrorplay = [scarlet]Tens mods com erros.[] Desative os mods afetados ou corrija os erros antes de jogar. -mod.nowdisabled = [scarlet]Mod '{0}' está faltando dependências:[accent] {1}\n[lightgray]Esses mods precisam ser baixados primeiro. NEste mod será automaticamente desativado mod.enable = Ativar mod.requiresrestart = O jogo será fechado agora para aplicar as alterações no mod. mod.reloadrequired = [scarlet]É necessario recarregar diff --git a/core/assets/bundles/bundle_ro.properties b/core/assets/bundles/bundle_ro.properties index b2db9b66cd..373ce822d3 100644 --- a/core/assets/bundles/bundle_ro.properties +++ b/core/assets/bundles/bundle_ro.properties @@ -163,7 +163,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = Au apărut erori la încărcarea conținutului. mod.noerrorplay = [scarlet]Modurile tale au erori.[] Dezactivează modurile afectate sau repară erorile înainte să joci. -mod.nowdisabled = [scarlet]Modul '{0}' are dependențe lipsă:[accent] {1}\n[lightgray]Mai întâi trebuie să descarci aceste moduri.\nAcest mod va fi dezactivat automat. mod.enable = Activează mod.requiresrestart = Jocul se va închide acum pt a aplica modificările modurilor. mod.reloadrequired = [scarlet]E Nevoie de o Repornire diff --git a/core/assets/bundles/bundle_ru.properties b/core/assets/bundles/bundle_ru.properties index ae8defc92e..e11e611290 100644 --- a/core/assets/bundles/bundle_ru.properties +++ b/core/assets/bundles/bundle_ru.properties @@ -164,7 +164,6 @@ mod.incompletedependencies.details = Этот мод не может быть з mod.requiresversion = Требуется версия игры: [red]{0} mod.errors = Ошибки были вызваны загружаемым содержимым. mod.noerrorplay = [scarlet]У Вас есть модификации с ошибками.[] Выключите проблемные модификации или исправьте ошибки перед игрой. -mod.nowdisabled = [scarlet]Модификации '{0}' требуются родительские модификации:[accent] {1}\n[lightgray]Сначала нужно загрузить их.\nЭта модификация будет автоматически отключена. mod.enable = Вкл. mod.requiresrestart = Теперь игра закроется, чтобы применить изменения в модификациях. mod.reloadrequired = [scarlet]Необходим перезапуск diff --git a/core/assets/bundles/bundle_sr.properties b/core/assets/bundles/bundle_sr.properties index 57e10040b7..8bb1e32129 100644 --- a/core/assets/bundles/bundle_sr.properties +++ b/core/assets/bundles/bundle_sr.properties @@ -163,7 +163,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = Greške su nastale tokom učitavanja sadržaja. mod.noerrorplay = [scarlet]Imate modove sa greškama.[] Onemogućite te modove, ili ispravite greške. -mod.nowdisabled = [scarlet]Mod '{0}'nema potrebne zavisne modove:[accent] {1}\n[lightgray]Ove modove treba instalirati prvo.\nMod se automatski onemogućava. mod.enable = Omogući mod.requiresrestart = Igra će se zatvoriti da ažurira modove. mod.reloadrequired = [scarlet]Ponovno pokretanje potrebno diff --git a/core/assets/bundles/bundle_sv.properties b/core/assets/bundles/bundle_sv.properties index 2268e25ca8..941b7f4bf4 100644 --- a/core/assets/bundles/bundle_sv.properties +++ b/core/assets/bundles/bundle_sv.properties @@ -160,7 +160,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = Fel har inträffat under laddning av innehåll. mod.noerrorplay = [scarlet]Du har moddar med fel.[] Stäng antingen av de drabbade moddarna eller fixa felen innan du spelar. -mod.nowdisabled = [scarlet]Mod '{0}' saknar beroenden:[accent] {1}\n[lightgray]Dessa mods måste laddas ned först.\nDetta mod kommer att inaktiveras automatiskt. mod.enable = Aktivera mod.requiresrestart = Spelet kommer nu att stängas av för att tillämpa mod ändringarna. mod.reloadrequired = [scarlet]Omstart krävs diff --git a/core/assets/bundles/bundle_th.properties b/core/assets/bundles/bundle_th.properties index 91573f01ba..2b1ef434fb 100644 --- a/core/assets/bundles/bundle_th.properties +++ b/core/assets/bundles/bundle_th.properties @@ -163,7 +163,6 @@ mod.incompletedependencies.details = ม็อดนี้ไม่สามา mod.requiresversion = ต้องการเวอร์ชั่นเกม: [red]{0} mod.errors = มีข้อผิดพลาดเกิดขึ้นระหว่างโหลดเนื้อหา mod.noerrorplay = [scarlet]คุณมีม็อดที่มีข้อผิดพลาด[] กรุณาปิดม็อดนั้นๆ หรือแก้ไขข้อผิดพลาดก่อนที่จะเล่น -mod.nowdisabled = [scarlet]ม็อด '{0}' ขาดม็อดพื่งพา:[accent] {1}\n[lightgray]จำเป็นต้องโหลดม็อดพวกนี้ก่อน\nม็อดนี้จะถูกปิดใช้งานโดยอัตโนมัติ mod.enable = เปิดใช้งาน mod.requiresrestart = เกมจะปิดตัวลงเพื่อติดตั้งม็อด mod.reloadrequired = [scarlet]จำเป็นต้องรีโหลด diff --git a/core/assets/bundles/bundle_tk.properties b/core/assets/bundles/bundle_tk.properties index f2922470e8..2283a71fee 100644 --- a/core/assets/bundles/bundle_tk.properties +++ b/core/assets/bundles/bundle_tk.properties @@ -160,7 +160,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = Errors have occurred loading content. mod.noerrorplay = [scarlet]You have mods with errors.[] Either disable the affected mods or fix the errors before playing. -mod.nowdisabled = [scarlet]Mod '{0}' is missing dependencies:[accent] {1}\n[lightgray]These mods need to be downloaded first.\nThis mod will be automatically disabled. mod.enable = Enable mod.requiresrestart = The game will now close to apply the mod changes. mod.reloadrequired = [scarlet]Reload Required diff --git a/core/assets/bundles/bundle_tr.properties b/core/assets/bundles/bundle_tr.properties index 9a9ecead53..c721ab44ea 100644 --- a/core/assets/bundles/bundle_tr.properties +++ b/core/assets/bundles/bundle_tr.properties @@ -163,7 +163,6 @@ mod.incompletedependencies.details = Eksik veya yanlış bağlılıklardan dolay mod.requiresversion = Şu oyun sürümü gerekiyor: [red]{0} mod.errors = İçerik yüklenirken bir hata oluştu. mod.noerrorplay = [scarlet]Hatalı modlarınız var.[] Oynamadan önce bu modları devre dışı bırakın veya dosyadaki hataları düzeltin. -mod.nowdisabled = [scarlet]'{0}' modunun çalışması için gerekli olan modlardan bazıları bulunamadı:[accent] {1}\n[lightgray]Önce bu modların indirilmesi gerekmektedir.\nBu mod otomatik olarak devre dışı bırakılacaktır. mod.enable = Etkinleştir mod.requiresrestart = Oyun mod değişikliklerini uygulamak için kapatılacak. mod.reloadrequired = [scarlet]Yeniden Yükleme Gerekli diff --git a/core/assets/bundles/bundle_uk_UA.properties b/core/assets/bundles/bundle_uk_UA.properties index 24a8cf4738..223ae02b38 100644 --- a/core/assets/bundles/bundle_uk_UA.properties +++ b/core/assets/bundles/bundle_uk_UA.properties @@ -165,7 +165,6 @@ mod.incompletedependencies.details = Цей мод неможливо заван mod.requiresversion = Необхідна версія гри: [red]{0} mod.errors = Виникли помилки під час завантаження змісту. mod.noerrorplay = [red]Ви маєте модифікації з помилками.[] Або вимкніть проблемні модифікації, або виправте їх. -mod.nowdisabled = [red]Модифікації «{0}» не вистачає залежних модифікацій:[accent] {1}\n[lightgray]Ці модифікації потрібно завантажити спочатку.\nЦя модифікація буде автоматично вимкнена. mod.enable = Увімкнути mod.requiresrestart = А тепер гра закриється, щоби застосувати зміни модифікацій. mod.reloadrequired = [red]Потрібно перезавантаження diff --git a/core/assets/bundles/bundle_vi.properties b/core/assets/bundles/bundle_vi.properties index 7856f9339e..cbc5e31e80 100644 --- a/core/assets/bundles/bundle_vi.properties +++ b/core/assets/bundles/bundle_vi.properties @@ -167,7 +167,6 @@ mod.requiresversion = Yêu cầu phiên bản trò chơi: [red]{0} mod.errors = Đã xảy ra lỗi khi tải nội dung. mod.noerrorplay = [red]Bạn có mod bị lỗi.[]Tắt các mod bị lỗi hoặc sửa các lỗi trước khi chơi. -mod.nowdisabled = [red]Mod '{0}' cần mod này để chạy:[accent] {1}\n[lightgray]Trước tiên bạn cần tải các mod này xuống.\nBản mod này sẽ tự động tắt. mod.enable = Bật mod.requiresrestart = Trò chơi sẽ đóng để áp dụng các thay đổi của mod. mod.reloadrequired = [scarlet]Yêu cầu khởi động lại diff --git a/core/assets/bundles/bundle_zh_CN.properties b/core/assets/bundles/bundle_zh_CN.properties index a908d005a5..e7fa486b15 100644 --- a/core/assets/bundles/bundle_zh_CN.properties +++ b/core/assets/bundles/bundle_zh_CN.properties @@ -166,7 +166,6 @@ mod.requiresversion = 需要游戏版本: [red]{0} mod.errors = 读取内容时发生错误。 mod.noerrorplay = [scarlet]您的模组发生了错误。 []禁用相关模组或修复错误后才能进入游戏。 -mod.nowdisabled = [scarlet]“{0}”模组缺少依赖的其他模组:[accent]{1}\n[lightgray]需要先下载上述模组。 \n此模组现在将被自动禁用。 mod.enable = 启用 mod.requiresrestart = 游戏将退出以应用模组修改。 mod.reloadrequired = [scarlet]需要重启 diff --git a/core/assets/bundles/bundle_zh_TW.properties b/core/assets/bundles/bundle_zh_TW.properties index 049f543412..15796248d0 100644 --- a/core/assets/bundles/bundle_zh_TW.properties +++ b/core/assets/bundles/bundle_zh_TW.properties @@ -163,7 +163,6 @@ mod.incompletedependencies.details = This mod is unable to be loaded due to inva mod.requiresversion = Requires game version: [red]{0} mod.errors = 載入內容時發生錯誤 mod.noerrorplay = [scarlet]你使用了有問題的模組。[] 遊戲前請先停用相關模組或修正問題。 -mod.nowdisabled = [scarlet]「{0}」模組缺少依賴關係:[accent] {1}\n[lightgray]必須先下載這些模組。\n此模組將被自動停用。 mod.enable = 啟用 mod.requiresrestart = 遊戲將立即關閉以套用模組變更。 mod.reloadrequired = [scarlet]需要重新載入 From bfa329db1115c9665c532d7b01a7fc2184ac4007 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Mon, 22 Apr 2024 09:11:08 -0700 Subject: [PATCH 13/21] Incorrectly shows dialog when mods with missing dependencies are disabled --- core/src/mindustry/mod/Mods.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 5e3809144a..d05d3ec494 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -648,7 +648,7 @@ public class Mods implements Loadable{ } //show list of missing dependencies - if(mods.contains(LoadedMod::hasUnmetDependencies)){ + if(mods.contains(mod -> mod.shouldBeEnabled() && mod.hasUnmetDependencies())){ ui.loadfrag.hide(); new Dialog(""){{ setFillParent(true); From b167bcfbefb1f91e443c188dcd59831454cb270d Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Mon, 22 Apr 2024 09:17:28 -0700 Subject: [PATCH 14/21] Check for dependencies when importing a mod --- core/assets/bundles/bundle.properties | 1 + core/src/mindustry/mod/Mods.java | 34 +++++++++++++++---- core/src/mindustry/ui/dialogs/ModsDialog.java | 1 + 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 2f3e5d531b..38c7296c32 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -187,6 +187,7 @@ mod.dependencies.download = Auto-Import mod.dependencies.status = Import Results mod.dependencies.success = Successfully downloaded: mod.dependencies.failure = Failed to download: +mod.dependencies.imported = This mod requires dependencies. Download? about.button = About name = Name: diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index d05d3ec494..285e9e2526 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -680,17 +680,21 @@ public class Mods implements Loadable{ mods.each(mod -> mod.shouldBeEnabled() && mod.hasUnmetDependencies(), mod -> { mod.missingDependencies.each(toImport::addUnique); }); - Seq remaining = toImport.copy(); - ui.mods.importDependencies(remaining, () -> { - toImport.removeAll(remaining); - displayDependencyImportStatus(remaining, toImport); - }); + downloadDependencies(toImport, true); }).size(150, 50); }}.show(); } } - private void displayDependencyImportStatus(Seq failed, Seq success){ + private void downloadDependencies(Seq toImport, boolean startup){ + Seq remaining = toImport.copy(); + ui.mods.importDependencies(remaining, () -> { + toImport.removeAll(remaining); + displayDependencyImportStatus(remaining, toImport, startup); + }); + } + + private void displayDependencyImportStatus(Seq failed, Seq success, boolean startup){ new Dialog(""){{ setFillParent(true); cont.margin(15); @@ -726,7 +730,7 @@ public class Mods implements Loadable{ }).fillX(); cont.row(); - if(success.any()){ + if(startup && success.any()){ cont.image().width(300f).pad(2).height(4f).color(Color.lightGray); cont.row(); cont.add("@mods.reloadexit").center(); @@ -973,6 +977,22 @@ public class Mods implements Loadable{ return result; } + /** Checks if a newly imported mod's dependencies are already added. */ + public void checkImportDependencies(LoadedMod mod){ + if(mod.meta.dependencies.isEmpty()) return; + Seq missing = mod.meta.dependencies.select(m -> getMod(m) == null); + if(missing.isEmpty()) return; + StringBuilder list = new StringBuilder(); + for(int i = 0; i < missing.size; i++){ + if(i > 0) list.append("\n"); + list.append(missing.get(i)); + } + + ui.showConfirm("@mod.dependencies.imported", list.toString(), () -> { + downloadDependencies(missing, false); + }); + } + private boolean resolve(String element, ModResolutionContext context){ context.visited.add(element); for(final var dependency : context.dependencies.get(element)){ diff --git a/core/src/mindustry/ui/dialogs/ModsDialog.java b/core/src/mindustry/ui/dialogs/ModsDialog.java index dee0edc4b6..bd4cda3ef1 100644 --- a/core/src/mindustry/ui/dialogs/ModsDialog.java +++ b/core/src/mindustry/ui/dialogs/ModsDialog.java @@ -626,6 +626,7 @@ public class ModsDialog extends BaseDialog{ var mod = mods.importMod(file); mod.setRepo(repo); + mods.checkImportDependencies(mod); file.delete(); Core.app.post(() -> { From 15491afe498a4f044415d11f643379beaa5d6ae7 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Mon, 22 Apr 2024 09:42:13 -0700 Subject: [PATCH 15/21] Check all at once --- core/src/mindustry/mod/Mods.java | 102 +++++++++--------- core/src/mindustry/ui/dialogs/ModsDialog.java | 7 +- 2 files changed, 54 insertions(+), 55 deletions(-) diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 285e9e2526..7a406d968d 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -50,6 +50,7 @@ public class Mods implements Loadable{ private ModClassLoader mainLoader = new ModClassLoader(getClass().getClassLoader()); Seq mods = new Seq<>(); + private Seq newImports = new Seq<>(); private ObjectMap, ModMeta> metas = new ObjectMap<>(); private boolean requiresReload; @@ -422,6 +423,7 @@ public class Mods implements Loadable{ return; } mods.remove(mod); + newImports.remove(mod); mod.dispose(); requiresReload = true; } @@ -648,53 +650,57 @@ public class Mods implements Loadable{ } //show list of missing dependencies - if(mods.contains(mod -> mod.shouldBeEnabled() && mod.hasUnmetDependencies())){ + Seq toCheck = mods.select(mod -> mod.shouldBeEnabled() && mod.hasUnmetDependencies()); + if(!toCheck.isEmpty()){ ui.loadfrag.hide(); - new Dialog(""){{ - setFillParent(true); - cont.margin(15); - cont.add("@mod.dependencies.error").colspan(2); - cont.row(); - cont.image().width(300f).colspan(2).pad(2).height(4f).color(Color.scarlet); - cont.row(); - cont.pane(p -> { - mods.each(mod -> mod.shouldBeEnabled() && mod.hasUnmetDependencies(), mod -> { - p.add(mod.meta.displayName).wrap().growX().left().labelAlign(Align.left); - p.row(); - p.table(d -> { - mod.missingDependencies.each(dep -> { - d.add(dep).wrap().growX().left().labelAlign(Align.left); - d.row(); - }); - }).growX().padBottom(8f).padLeft(12f); - p.row(); - }); - }).fillX().colspan(2); - - cont.row(); - - cont.button("@ok", this::hide).size(150, 50); - cont.button("@mod.dependencies.download", () -> { - hide(); - Seq toImport = new Seq<>(); - mods.each(mod -> mod.shouldBeEnabled() && mod.hasUnmetDependencies(), mod -> { - mod.missingDependencies.each(toImport::addUnique); - }); - downloadDependencies(toImport, true); - }).size(150, 50); - }}.show(); + checkDependencies(toCheck); } } - private void downloadDependencies(Seq toImport, boolean startup){ + private void checkDependencies(Seq toCheck){ + new Dialog(""){{ + setFillParent(true); + cont.margin(15); + cont.add("@mod.dependencies.error").colspan(2); + cont.row(); + cont.image().width(300f).colspan(2).pad(2).height(4f).color(Color.scarlet); + cont.row(); + cont.pane(p -> { + toCheck.each(mod -> { + p.add(mod.meta.displayName).wrap().growX().left().labelAlign(Align.left); + p.row(); + p.table(d -> { + mod.missingDependencies.each(dep -> { + d.add(dep).wrap().growX().left().labelAlign(Align.left); + d.row(); + }); + }).growX().padBottom(8f).padLeft(12f); + p.row(); + }); + }).fillX().colspan(2); + + cont.row(); + + cont.button("@ok", this::hide).size(150, 50); + cont.button("@mod.dependencies.download", () -> { + hide(); + Seq toImport = new Seq<>(); + toCheck.each(mod -> mod.missingDependencies.each(toImport::addUnique)); + downloadDependencies(toImport); + }).size(150, 50); + }}.show(); + } + + private void downloadDependencies(Seq toImport){ Seq remaining = toImport.copy(); ui.mods.importDependencies(remaining, () -> { toImport.removeAll(remaining); - displayDependencyImportStatus(remaining, toImport, startup); + if(toImport.any()) requiresReload = true; + displayDependencyImportStatus(remaining, toImport); }); } - private void displayDependencyImportStatus(Seq failed, Seq success, boolean startup){ + private void displayDependencyImportStatus(Seq failed, Seq success){ new Dialog(""){{ setFillParent(true); cont.margin(15); @@ -730,7 +736,7 @@ public class Mods implements Loadable{ }).fillX(); cont.row(); - if(startup && success.any()){ + if(success.any()){ cont.image().width(300f).pad(2).height(4f).color(Color.lightGray); cont.row(); cont.add("@mods.reloadexit").center(); @@ -746,11 +752,13 @@ public class Mods implements Loadable{ }}.show(); } - private void reload(){ - ui.showInfoOnHidden("@mods.reloadexit", () -> { + public void reload(){ + if(newImports.any()){ + checkDependencies(newImports); + }else{ Log.info("Exiting to reload mods."); Core.app.exit(); - }); + } } public boolean hasContentErrors(){ @@ -978,19 +986,13 @@ public class Mods implements Loadable{ } /** Checks if a newly imported mod's dependencies are already added. */ - public void checkImportDependencies(LoadedMod mod){ + public void loadImportDependencies(LoadedMod mod){ if(mod.meta.dependencies.isEmpty()) return; Seq missing = mod.meta.dependencies.select(m -> getMod(m) == null); if(missing.isEmpty()) return; - StringBuilder list = new StringBuilder(); - for(int i = 0; i < missing.size; i++){ - if(i > 0) list.append("\n"); - list.append(missing.get(i)); - } - ui.showConfirm("@mod.dependencies.imported", list.toString(), () -> { - downloadDependencies(missing, false); - }); + mod.missingDependencies = missing; + newImports.add(mod); } private boolean resolve(String element, ModResolutionContext context){ diff --git a/core/src/mindustry/ui/dialogs/ModsDialog.java b/core/src/mindustry/ui/dialogs/ModsDialog.java index bd4cda3ef1..f69dce3b16 100644 --- a/core/src/mindustry/ui/dialogs/ModsDialog.java +++ b/core/src/mindustry/ui/dialogs/ModsDialog.java @@ -362,10 +362,7 @@ public class ModsDialog extends BaseDialog{ } private void reload(){ - ui.showInfoOnHidden("@mods.reloadexit", () -> { - Log.info("Exiting to reload mods."); - Core.app.exit(); - }); + ui.showInfoOnHidden("@mods.reloadexit", () -> mods.reload()); } private void showMod(LoadedMod mod){ @@ -626,7 +623,7 @@ public class ModsDialog extends BaseDialog{ var mod = mods.importMod(file); mod.setRepo(repo); - mods.checkImportDependencies(mod); + mods.loadImportDependencies(mod); file.delete(); Core.app.post(() -> { From 9e234444f1154570b21e3d478196945296364c84 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Mon, 22 Apr 2024 09:52:01 -0700 Subject: [PATCH 16/21] Less clunky Don't display the reload exit message before checking dependencies. --- core/src/mindustry/mod/Mods.java | 7 +++++-- core/src/mindustry/ui/dialogs/ModsDialog.java | 6 +----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 7a406d968d..bee900aa23 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -657,6 +657,7 @@ public class Mods implements Loadable{ } } + /** Assume mods in toCheck are missing dependencies. */ private void checkDependencies(Seq toCheck){ new Dialog(""){{ setFillParent(true); @@ -756,8 +757,10 @@ public class Mods implements Loadable{ if(newImports.any()){ checkDependencies(newImports); }else{ - Log.info("Exiting to reload mods."); - Core.app.exit(); + ui.showInfoOnHidden("@mods.reloadexit", () -> { + Log.info("Exiting to reload mods."); + Core.app.exit(); + }); } } diff --git a/core/src/mindustry/ui/dialogs/ModsDialog.java b/core/src/mindustry/ui/dialogs/ModsDialog.java index f69dce3b16..0ec929d3e7 100644 --- a/core/src/mindustry/ui/dialogs/ModsDialog.java +++ b/core/src/mindustry/ui/dialogs/ModsDialog.java @@ -93,7 +93,7 @@ public class ModsDialog extends BaseDialog{ hidden(() -> { if(mods.requiresReload()){ - reload(); + mods.reload(); } }); @@ -361,10 +361,6 @@ public class ModsDialog extends BaseDialog{ return null; } - private void reload(){ - ui.showInfoOnHidden("@mods.reloadexit", () -> mods.reload()); - } - private void showMod(LoadedMod mod){ BaseDialog dialog = new BaseDialog(mod.meta.displayName); From d21cab42a798994195aa157922500b67a57be227 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:13:55 -0700 Subject: [PATCH 17/21] Mention soft dependencies on install but not startup --- core/assets/bundles/bundle.properties | 4 ++- core/src/mindustry/mod/Mods.java | 50 ++++++++++++++++++++------- 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 38c7296c32..6c0ea8693d 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -183,7 +183,9 @@ mod.folder.missing = Only mods in folder form can be published on the workshop.\ mod.scripts.disable = Your device does not support mods with scripts. You must disable these mods to play the game. mod.dependencies.error = [scarlet]Mods are missing dependencies -mod.dependencies.download = Auto-Import +mod.dependencies.soft = (optional) +mod.dependencies.download = Import Required +mod.dependencies.downloadall = Import All mod.dependencies.status = Import Results mod.dependencies.success = Successfully downloaded: mod.dependencies.failure = Failed to download: diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index bee900aa23..8c72deecf2 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -533,13 +533,20 @@ public class Mods implements Loadable{ private void updateDependencies(LoadedMod mod){ mod.dependencies.clear(); mod.missingDependencies.clear(); + mod.missingSoftDependencies.clear(); mod.dependencies = mod.meta.dependencies.map(this::locateMod); + mod.softDependencies = mod.meta.softDependencies.map(this::locateMod); for(int i = 0; i < mod.dependencies.size; i++){ if(mod.dependencies.get(i) == null){ mod.missingDependencies.add(mod.meta.dependencies.get(i)); } } + for(int i = 0; i < mod.softDependencies.size; i++){ + if(mod.softDependencies.get(i) == null){ + mod.missingSoftDependencies.add(mod.meta.softDependencies.get(i)); + } + } } /** @return mods ordered in the correct way needed for dependencies. */ @@ -653,12 +660,12 @@ public class Mods implements Loadable{ Seq toCheck = mods.select(mod -> mod.shouldBeEnabled() && mod.hasUnmetDependencies()); if(!toCheck.isEmpty()){ ui.loadfrag.hide(); - checkDependencies(toCheck); + checkDependencies(toCheck, false); } } /** Assume mods in toCheck are missing dependencies. */ - private void checkDependencies(Seq toCheck){ + private void checkDependencies(Seq toCheck, boolean soft){ new Dialog(""){{ setFillParent(true); cont.margin(15); @@ -675,6 +682,12 @@ public class Mods implements Loadable{ d.add(dep).wrap().growX().left().labelAlign(Align.left); d.row(); }); + if(soft){ + mod.missingSoftDependencies.each(dep -> { + d.add(dep + " " + Core.bundle.get("mod.dependencies.soft")).wrap().growX().left().labelAlign(Align.left); + d.row(); + }); + } }).growX().padBottom(8f).padLeft(12f); p.row(); }); @@ -682,13 +695,22 @@ public class Mods implements Loadable{ cont.row(); - cont.button("@ok", this::hide).size(150, 50); - cont.button("@mod.dependencies.download", () -> { + cont.button("@cancel", this::hide).size(soft ? 100 : 150, 50); + cont.button(soft ? "@mod.dependencies.downloadall" : "@mod.dependencies.download", () -> { hide(); Seq toImport = new Seq<>(); toCheck.each(mod -> mod.missingDependencies.each(toImport::addUnique)); downloadDependencies(toImport); - }).size(150, 50); + }).size(soft ? 100 : 150, 50); + if(soft){ + cont.button("@mod.dependencies.downloadall", () -> { + hide(); + Seq toImport = new Seq<>(); + toCheck.each(mod -> mod.missingDependencies.each(toImport::addUnique)); + toCheck.each(mod -> mod.missingSoftDependencies.each(toImport::addUnique)); + downloadDependencies(toImport); + }).size(100, 50); + } }}.show(); } @@ -755,7 +777,7 @@ public class Mods implements Loadable{ public void reload(){ if(newImports.any()){ - checkDependencies(newImports); + checkDependencies(newImports, true); }else{ ui.showInfoOnHidden("@mods.reloadexit", () -> { Log.info("Exiting to reload mods."); @@ -990,12 +1012,10 @@ public class Mods implements Loadable{ /** Checks if a newly imported mod's dependencies are already added. */ public void loadImportDependencies(LoadedMod mod){ - if(mod.meta.dependencies.isEmpty()) return; - Seq missing = mod.meta.dependencies.select(m -> getMod(m) == null); - if(missing.isEmpty()) return; - - mod.missingDependencies = missing; - newImports.add(mod); + updateDependencies(mod); + if(mod.missingDependencies.any() || mod.missingSoftDependencies.any()){ + newImports.add(mod); + } } private boolean resolve(String element, ModResolutionContext context){ @@ -1168,8 +1188,12 @@ public class Mods implements Loadable{ public final ModMeta meta; /** This mod's dependencies as already-loaded mods. */ public Seq dependencies = new Seq<>(); - /** All missing dependencies of this mod as strings. */ + /** This mod's soft dependencies as already-loaded mods. */ + public Seq softDependencies = new Seq<>(); + /** All missing required dependencies of this mod as strings. */ public Seq missingDependencies = new Seq<>(); + /** All missing soft dependencies of this mod as strings. */ + public Seq missingSoftDependencies = new Seq<>(); /** Content with initialization code. */ public ObjectSet erroredContent = new ObjectSet<>(); /** Current state of this mod. */ From 3019eb24dc4616e0ebbe8550b4541b378fade46f Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:23:19 -0700 Subject: [PATCH 18/21] Slightly cleaner code --- core/src/mindustry/mod/Mods.java | 13 +++++-------- core/src/mindustry/ui/dialogs/ModsDialog.java | 1 - 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 8c72deecf2..e202a3ef52 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -117,6 +117,7 @@ public class Mods implements Loadable{ var loaded = loadMod(dest, true, true); mods.add(loaded); + newImports.add(loaded); //invalidate ordered mods cache lastOrderedMods = null; requiresReload = true; @@ -772,10 +773,14 @@ public class Mods implements Loadable{ } cont.button("@ok", this::hide).size(300, 50); + closeOnBack(); }}.show(); } public void reload(){ + newImports.each(this::updateDependencies); + newImports.remove(m -> m.missingDependencies.isEmpty() && m.softDependencies.isEmpty()); + if(newImports.any()){ checkDependencies(newImports, true); }else{ @@ -1010,14 +1015,6 @@ public class Mods implements Loadable{ return result; } - /** Checks if a newly imported mod's dependencies are already added. */ - public void loadImportDependencies(LoadedMod mod){ - updateDependencies(mod); - if(mod.missingDependencies.any() || mod.missingSoftDependencies.any()){ - newImports.add(mod); - } - } - private boolean resolve(String element, ModResolutionContext context){ context.visited.add(element); for(final var dependency : context.dependencies.get(element)){ diff --git a/core/src/mindustry/ui/dialogs/ModsDialog.java b/core/src/mindustry/ui/dialogs/ModsDialog.java index 0ec929d3e7..57ddbfe2bb 100644 --- a/core/src/mindustry/ui/dialogs/ModsDialog.java +++ b/core/src/mindustry/ui/dialogs/ModsDialog.java @@ -619,7 +619,6 @@ public class ModsDialog extends BaseDialog{ var mod = mods.importMod(file); mod.setRepo(repo); - mods.loadImportDependencies(mod); file.delete(); Core.app.post(() -> { From 6862e18cefe1e2560cde4b6e7b9e9ca6f267c6ac Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:29:47 -0700 Subject: [PATCH 19/21] Fix UI --- core/assets/bundles/bundle.properties | 3 ++- core/src/mindustry/mod/Mods.java | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 6c0ea8693d..d4a7c35097 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -184,7 +184,8 @@ mod.scripts.disable = Your device does not support mods with scripts. You must d mod.dependencies.error = [scarlet]Mods are missing dependencies mod.dependencies.soft = (optional) -mod.dependencies.download = Import Required +mod.dependencies.download = Import +mod.dependencies.downloadreq = Import Required mod.dependencies.downloadall = Import All mod.dependencies.status = Import Results mod.dependencies.success = Successfully downloaded: diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index e202a3ef52..3df79fc3bd 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -670,9 +670,10 @@ public class Mods implements Loadable{ new Dialog(""){{ setFillParent(true); cont.margin(15); - cont.add("@mod.dependencies.error").colspan(2); + int span = soft ? 3 : 2; + cont.add("@mod.dependencies.error").colspan(span); cont.row(); - cont.image().width(300f).colspan(2).pad(2).height(4f).color(Color.scarlet); + cont.image().width(300f).colspan(span).pad(2).height(4f).color(Color.scarlet); cont.row(); cont.pane(p -> { toCheck.each(mod -> { @@ -692,17 +693,17 @@ public class Mods implements Loadable{ }).growX().padBottom(8f).padLeft(12f); p.row(); }); - }).fillX().colspan(2); + }).fillX().colspan(span); cont.row(); - cont.button("@cancel", this::hide).size(soft ? 100 : 150, 50); - cont.button(soft ? "@mod.dependencies.downloadall" : "@mod.dependencies.download", () -> { + cont.button("@cancel", this::hide).size(150, 50); + cont.button(soft ? "@mod.dependencies.downloadreq" : "@mod.dependencies.download", () -> { hide(); Seq toImport = new Seq<>(); toCheck.each(mod -> mod.missingDependencies.each(toImport::addUnique)); downloadDependencies(toImport); - }).size(soft ? 100 : 150, 50); + }).size(150, 50); if(soft){ cont.button("@mod.dependencies.downloadall", () -> { hide(); @@ -710,7 +711,7 @@ public class Mods implements Loadable{ toCheck.each(mod -> mod.missingDependencies.each(toImport::addUnique)); toCheck.each(mod -> mod.missingSoftDependencies.each(toImport::addUnique)); downloadDependencies(toImport); - }).size(100, 50); + }).size(150, 50); } }}.show(); } From 189a794e58172b75107bbd8c1c0aa876b83a55dd Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:32:03 -0700 Subject: [PATCH 20/21] Don't separate if no soft dependencies --- core/src/mindustry/mod/Mods.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 3df79fc3bd..50124ad585 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -783,7 +783,7 @@ public class Mods implements Loadable{ newImports.remove(m -> m.missingDependencies.isEmpty() && m.softDependencies.isEmpty()); if(newImports.any()){ - checkDependencies(newImports, true); + checkDependencies(newImports, newImports.contains(m -> m.softDependencies.any())); }else{ ui.showInfoOnHidden("@mods.reloadexit", () -> { Log.info("Exiting to reload mods."); From cb99313b26f9f4e4a5e8873331088582ac0ad175 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Sat, 8 Feb 2025 20:49:35 -0800 Subject: [PATCH 21/21] oop --- core/assets/bundles/bundle_hu.properties | 1 - core/assets/bundles/bundle_pt_PT.properties | 1 - core/assets/bundles/bundle_zh_TW.properties | 1 - 3 files changed, 3 deletions(-) diff --git a/core/assets/bundles/bundle_hu.properties b/core/assets/bundles/bundle_hu.properties index 09afe2cb77..36e9cb5244 100644 --- a/core/assets/bundles/bundle_hu.properties +++ b/core/assets/bundles/bundle_hu.properties @@ -168,7 +168,6 @@ mod.requiresversion = Szükséges játékverzió: [red]{0}[] mod.errors = Hiba történt a tartalom betöltése közben. mod.noerrorplay = [red]Hibákkal rendelkező modjaid vannak.[] Kapcsold ki, vagy javítsd ki őket a játék elindítása előtt. -mod.nowdisabled = [red]A(z) „{0}” modnak nincs megfelelő függősége:[accent] {1}\n[lightgray]Ezeket előbb le kell tölteni.\nEz a mod automatikusan ki lesz kapcsolva. mod.enable = Engedélyezés mod.requiresrestart = A játék most kilép, hogy a módosítások érvénybe lépjenek a következő indításkor. mod.reloadrequired = [red]Újraindítás szükséges diff --git a/core/assets/bundles/bundle_pt_PT.properties b/core/assets/bundles/bundle_pt_PT.properties index 7119604a38..c623c3eef0 100644 --- a/core/assets/bundles/bundle_pt_PT.properties +++ b/core/assets/bundles/bundle_pt_PT.properties @@ -163,7 +163,6 @@ mod.incompletedependencies.details = Este mod não pôde ser carregado devido a mod.requiresversion = Requer a versão do jogo: [red]{0} mod.errors = Ocorreram erros ao carregar o conteúdo. mod.noerrorplay = [scarlet]Tens mods com erros.[] Desativa os mods afetados ou corrije os erros antes de jogar. -mod.nowdisabled = [scarlet]Mod '{0}' tem dependências em falta:[accent] {1}\n[lightgray]Estes mods precisam de ser baixados primeiro. Este mod será automaticamente desativado mod.enable = Ativar mod.requiresrestart = O jogo irá fechar para aplicar as alterações do mod. mod.reloadrequired = [scarlet]É necessario recarregar diff --git a/core/assets/bundles/bundle_zh_TW.properties b/core/assets/bundles/bundle_zh_TW.properties index 316460d853..866445b275 100644 --- a/core/assets/bundles/bundle_zh_TW.properties +++ b/core/assets/bundles/bundle_zh_TW.properties @@ -165,7 +165,6 @@ mod.incompletedependencies.details = 由於無效或缺失的依賴項,此模 mod.requiresversion = 需要遊戲版本:[red]{0} mod.errors = 載入內容時發生錯誤 mod.noerrorplay = [scarlet]您使用了有問題的模組。[] 遊戲前請先停用相關模組或修正問題。 -mod.nowdisabled = [scarlet]「{0}」模組缺少依賴關係:[accent] {1}\n[lightgray]必須先下載這些模組。\n此模組將被自動停用。 mod.enable = 啟用 mod.requiresrestart = 遊戲將立即關閉以套用模組變更。 mod.reloadrequired = [scarlet]需要重新載入