Allow mods to mark themselves as legacy compatible meaning that mods from v7 which still work in v8 can continue to use an old repo and work in both versions. (#11752)

This commit is contained in:
buthed010203
2026-03-12 17:03:10 -04:00
committed by GitHub
parent 04465c4abc
commit 16bbcb62e6
3 changed files with 8 additions and 6 deletions

View File

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

View File

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