Better mod state errors

This commit is contained in:
Anuken 2022-10-20 20:01:43 -04:00
parent f3a5c149a6
commit 55bc0846ae
3 changed files with 59 additions and 24 deletions

View File

@ -144,11 +144,19 @@ mod.multiplayer.compatible = [gray]Multiplayer Compatible
mod.disable = Disable
mod.content = Content:
mod.delete.error = Unable to delete mod. File may be in use.
mod.requiresversion = [red]Requires min game version: [accent]{0}
mod.outdatedv7 = [red]Incompatible with V7 (no minGameVersion: 136)
mod.incompatiblegame = [red]Outdated Game
mod.incompatiblemod = [red]Incompatible
mod.blacklisted = [red]Unsupported
mod.missingdependencies = [red]Missing dependencies: {0}
mod.unmetdependencies = [red]Unmet Dependencies
mod.erroredcontent = [red]Content Errors
mod.requiresversion.details = Requires game version: [accent]{0}[]\nYour game is outdated. This mod requires a newer version of the game (possibly a beta/alpha release) to function.
mod.outdatedv7.details = This mod is incompatible with the latest version of the game. The author must update it, and add [accent]minGameVersion: 136[] to its [accent]mod.json[] file.
mod.blacklisted.details = This mod has been manually blacklisted for causing crashes or other issues with this version of the game. Do not use it.
mod.missingdependencies.details = This mod is missing dependencies: {0}
mod.erroredcontent.details = This game caused errors when loading. Ask the mod author to fix them.
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.

View File

@ -228,6 +228,11 @@ public class ModsDialog extends BaseDialog{
t.top().left();
t.margin(12f);
String stateDetails = getStateDetails(item);
if(stateDetails != null){
t.addListener(new Tooltip(f -> f.background(Styles.black8).margin(4f).add(stateDetails).growX().width(400f).wrap()));
}
t.defaults().left().top();
t.table(title1 -> {
title1.left();
@ -254,26 +259,9 @@ public class ModsDialog extends BaseDialog{
text.row();
String tooltip = null;
if(item.isOutdated()){
text.labelWrap("@mod.outdatedv7").growX();
text.row();
}else if(item.isBlacklisted()){
text.labelWrap("@mod.blacklisted").growX();
text.row();
}else if(!item.isSupported()){
text.labelWrap(Core.bundle.format("mod.requiresversion", item.meta.minGameVersion)).growX();
text.row();
}else if(item.hasUnmetDependencies()){
text.labelWrap(Core.bundle.format("mod.missingdependencies", item.missingDependencies.toString(", "))).growX();
t.row();
}else if(item.hasContentErrors()){
text.labelWrap("@mod.erroredcontent").growX();
text.row();
}else if(item.meta.hidden){
text.labelWrap("@mod.multiplayer.compatible").growX();
text.row();
String state = getStateText(item);
if(state != null){
text.labelWrap(state).growX().row();
}
}).top().growX();
@ -334,6 +322,38 @@ public class ModsDialog extends BaseDialog{
cont.row();
}
private @Nullable String getStateText(LoadedMod item){
if(item.isOutdated()){
return "@mod.incompatiblemod";
}else if(item.isBlacklisted()){
return "@mod.blacklisted";
}else if(!item.isSupported()){
return "@mod.incompatiblegame";
}else if(item.hasUnmetDependencies()){
return "@mod.unmetdependencies";
}else if(item.hasContentErrors()){
return "@mod.erroredcontent";
}else if(item.meta.hidden){
return "@mod.multiplayer.compatible";
}
return null;
}
private @Nullable String getStateDetails(LoadedMod item){
if(item.isOutdated()){
return "@mod.outdatedv7.details";
}else if(item.isBlacklisted()){
return "@mod.blacklisted.details";
}else if(!item.isSupported()){
return Core.bundle.format("mod.requiresversion.details", item.meta.minGameVersion);
}else if(item.hasUnmetDependencies()){
return Core.bundle.format("mod.missingdependencies.details", item.missingDependencies.toString(", "));
}else if(item.hasContentErrors()){
return "@mod.erroredcontent.details";
}
return null;
}
private void reload(){
ui.showInfoOnHidden("@mods.reloadexit", () -> {
Log.info("Exiting to reload mods.");
@ -378,6 +398,13 @@ public class ModsDialog extends BaseDialog{
desc.row();
}
String state = getStateDetails(mod);
if(state != null){
desc.add("@mod.disabled").padTop(13f).padBottom(-6f).row();
desc.add(state).growX().wrap().row();
}
}).width(400f);
Seq<UnlockableContent> all = Seq.with(content.getContentMap()).<Content>flatten().select(c -> c.minfo.mod == mod && c instanceof UnlockableContent).as();

View File

@ -25,4 +25,4 @@ org.gradle.caching=true
#used for slow jitpack builds; TODO see if this actually works
org.gradle.internal.http.socketTimeout=100000
org.gradle.internal.http.connectionTimeout=100000
archash=8793e01874
archash=5a1cbb8b59