Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2026-03-12 17:55:02 -04:00
5 changed files with 42 additions and 18 deletions

View File

@@ -85,6 +85,9 @@ public class UI implements ApplicationListener, Loadable{
private @Nullable Element lastAnnouncement; private @Nullable Element lastAnnouncement;
/** Maps popups to ids so that they can be removed or updated by id. */
private final ObjectMap<String, Table> popups = new ObjectMap<>();
public UI(){ public UI(){
Fonts.loadFonts(); Fonts.loadFonts();
} }
@@ -394,14 +397,21 @@ public class UI implements ApplicationListener, Loadable{
} }
/** Shows a label at some position on the screen. Does not fade. */ /** Shows a label at some position on the screen. Does not fade. */
public void showInfoPopup(String info, float duration, int align, int top, int left, int bottom, int right){ public void showInfoPopup(String info, @Nullable String id, float duration, int align, int top, int left, int bottom, int right){
Table table = new Table(); Table table = new Table();
if(id != null){
Table old = popups.put(id, table);
if (old != null) old.remove();
}
table.setFillParent(true); table.setFillParent(true);
table.touchable = Touchable.disabled; table.touchable = Touchable.disabled;
table.update(() -> { table.update(() -> {
if(state.isMenu()) table.remove(); if(state.isMenu()){
table.remove();
if(id != null) popups.remove(id);
}
}); });
table.actions(Actions.delay(duration), Actions.remove()); table.actions(Actions.delay(duration), Actions.remove(), Actions.run(() -> { if(id != null) popups.remove(id); }));
table.align(align).table(Styles.black3, t -> t.margin(4).add(info).style(Styles.outlineLabel)).pad(top, left, bottom, right); table.align(align).table(Styles.black3, t -> t.margin(4).add(info).style(Styles.outlineLabel)).pad(top, left, bottom, right);
Core.scene.add(table); Core.scene.add(table);
} }

View File

@@ -2,8 +2,8 @@ package mindustry.mod;
/** Mod listing as a data class. */ /** Mod listing as a data class. */
public class ModListing{ public class ModListing{
public String repo, name, internalName, subtitle, author, lastUpdated, description, minGameVersion; public String repo, name, internalName, author, lastUpdated, description, minGameVersion;
public boolean hasScripts, hasJava, iosCompatible; public boolean hasScripts, hasJava, iosCompatible, legacyCompatible;
public String[] contentTypes = {}; public String[] contentTypes = {};
public int stars; public int stars;

View File

@@ -1183,7 +1183,7 @@ public class Mods implements Loadable{
!skipModLoading() && !skipModLoading() &&
Core.settings.getBool("mod-" + baseName + "-enabled", true) && Core.settings.getBool("mod-" + baseName + "-enabled", true) &&
Version.isAtLeast(meta.minGameVersion) && Version.isAtLeast(meta.minGameVersion) &&
(meta.getMinMajor() >= minJavaModGameVersion || headless) && (meta.getMinMajor() >= minJavaModGameVersion || headless || meta.legacyCompatible) &&
!skipModCode && !skipModCode &&
initialize initialize
){ ){
@@ -1326,7 +1326,7 @@ public class Mods implements Loadable{
/** @return whether this mod is outdated, i.e. not compatible with v8. */ /** @return whether this mod is outdated, i.e. not compatible with v8. */
public boolean isOutdated(){ public boolean isOutdated(){
return getMinMajor() < (isJava() ? minJavaModGameVersion : minModGameVersion); return getMinMajor() < (isJava() ? minJavaModGameVersion : minModGameVersion) && !meta.legacyCompatible;
} }
public int getMinMajor(){ public int getMinMajor(){
@@ -1427,8 +1427,10 @@ public class Mods implements Loadable{
public float texturescale = 1.0f; public float texturescale = 1.0f;
/** If true, bleeding is skipped and no content icons are generated. */ /** If true, bleeding is skipped and no content icons are generated. */
public boolean pregenerated; public boolean pregenerated;
/** If set, load the mod content in this order by content names */ /** If set, load the mod content in this order by content names. */
public String[] contentOrder; public String[] contentOrder;
/** Mod from an older major version that is compatible with the latest one as well. */
public boolean legacyCompatible;
public String shortDescription(){ public String shortDescription(){
return Strings.truncate(subtitle == null ? (description == null || description.length() > maxModSubtitleLength ? "" : description) : subtitle, maxModSubtitleLength, "..."); return Strings.truncate(subtitle == null ? (description == null || description.length() > maxModSubtitleLength ? "" : description) : subtitle, maxModSubtitleLength, "...");

View File

@@ -122,10 +122,29 @@ public class Menus{
} }
@Remote(variants = Variant.both, unreliable = true) @Remote(variants = Variant.both, unreliable = true)
public static void infoPopup(String message, float duration, int align, int top, int left, int bottom, int right){ public static void infoPopup(String message, @Nullable String id, float duration, int align, int top, int left, int bottom, int right){
if(message == null) return; if(message == null) return;
ui.showInfoPopup(message, duration, align, top, left, bottom, right); ui.showInfoPopup(message, id, duration, align, top, left, bottom, right);
}
@Remote(variants = Variant.both)
public static void infoPopupReliable(String message, @Nullable String id, float duration, int align, int top, int left, int bottom, int right){
infoPopup(message, id, duration, align, top, left, bottom, right);
}
/** @deprecated Prefer variants with ids to stop flickering popups. */
@Deprecated
@Remote(variants = Variant.both, unreliable = true)
public static void infoPopup(String message, float duration, int align, int top, int left, int bottom, int right){
infoPopup(message, null, duration, align, top, left, bottom, right);
}
/** @deprecated Prefer variants with ids to stop flickering popups. */
@Deprecated
@Remote(variants = Variant.both)
public static void infoPopupReliable(String message, float duration, int align, int top, int left, int bottom, int right){
infoPopup(message, duration, align, top, left, bottom, right);
} }
@Remote(variants = Variant.both, unreliable = true) @Remote(variants = Variant.both, unreliable = true)
@@ -135,13 +154,6 @@ public class Menus{
ui.showLabel(message, duration, worldx, worldy); ui.showLabel(message, duration, worldx, worldy);
} }
@Remote(variants = Variant.both)
public static void infoPopupReliable(String message, float duration, int align, int top, int left, int bottom, int right){
if(message == null) return;
ui.showInfoPopup(message, duration, align, top, left, bottom, right);
}
@Remote(variants = Variant.both) @Remote(variants = Variant.both)
public static void labelReliable(String message, float duration, float worldx, float worldy){ public static void labelReliable(String message, float duration, float worldx, float worldy){
label(message, duration, worldx, worldy); label(message, duration, worldx, worldy);

View File

@@ -544,7 +544,7 @@ public class ModsDialog extends BaseDialog{
"\n[lightgray]\uE809 " + mod.stars + "\n[lightgray]\uE809 " + mod.stars +
(!Version.isAtLeast(mod.minGameVersion) ? "\n" + Core.bundle.format("mod.requiresversion", mod.minGameVersion) : (!Version.isAtLeast(mod.minGameVersion) ? "\n" + Core.bundle.format("mod.requiresversion", mod.minGameVersion) :
((mod.hasJava && Strings.parseDouble(mod.minGameVersion, 0) < minJavaModGameVersion) ? "\n" + Core.bundle.get("mod.incompatiblemod") : "")); ((mod.hasJava && Strings.parseDouble(mod.minGameVersion, 0) < minJavaModGameVersion && !mod.legacyCompatible) ? "\n" + Core.bundle.get("mod.incompatiblemod") : ""));
con.add(infoText).width(358f).wrap().grow().pad(4f, 2f, 4f, 6f).top().left().labelAlign(Align.topLeft); con.add(infoText).width(358f).wrap().grow().pad(4f, 2f, 4f, 6f).top().left().labelAlign(Align.topLeft);