mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-25 22:58:47 +07:00
Added min-game-version 105 enforcement
This commit is contained in:
parent
6787bbdc05
commit
c03e3f56aa
@ -114,6 +114,7 @@ mod.disable = Disable
|
||||
mod.content = Content:
|
||||
mod.delete.error = Unable to delete mod. File may be in use.
|
||||
mod.requiresversion = [scarlet]Requires min game version: [accent]{0}
|
||||
mod.outdated = [scarlet]Not compatible with V6 (no min-game-version: 105)
|
||||
mod.missingdependencies = [scarlet]Missing dependencies: {0}
|
||||
mod.erroredcontent = [scarlet]Content Errors
|
||||
mod.errors = Errors have occurred loading content.
|
||||
|
@ -1210,6 +1210,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
if(sensor == LAccess.y) return y;
|
||||
if(sensor == LAccess.team) return team.id;
|
||||
if(sensor == LAccess.health) return health;
|
||||
if(sensor == LAccess.maxHealth) return maxHealth();
|
||||
if(sensor == LAccess.efficiency) return efficiency();
|
||||
if(sensor == LAccess.rotation) return rotation;
|
||||
if(sensor == LAccess.totalItems && items != null) return items.total();
|
||||
|
@ -75,6 +75,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
||||
if(sensor == LAccess.totalItems) return stack().amount;
|
||||
if(sensor == LAccess.rotation) return rotation;
|
||||
if(sensor == LAccess.health) return health;
|
||||
if(sensor == LAccess.maxHealth) return maxHealth;
|
||||
if(sensor == LAccess.x) return x;
|
||||
if(sensor == LAccess.y) return y;
|
||||
if(sensor == LAccess.team) return team.id;
|
||||
|
@ -15,6 +15,7 @@ public enum LAccess{
|
||||
powerNetIn,
|
||||
powerNetOut,
|
||||
health,
|
||||
maxHealth,
|
||||
heat,
|
||||
efficiency,
|
||||
rotation,
|
||||
|
@ -493,7 +493,9 @@ public class LExecutor{
|
||||
//this should avoid any garbage allocation
|
||||
Var v = exec.vars[value];
|
||||
if(v.isobj && value != 0){
|
||||
String strValue = v.objval instanceof String ? (String)v.objval : v.objval == null ? "null" :
|
||||
String strValue =
|
||||
v.objval == null ? "null" :
|
||||
v.objval instanceof String ? (String)v.objval :
|
||||
v.objval instanceof Content ? "[content]" :
|
||||
v.objval instanceof Building ? "[building]" :
|
||||
v.objval instanceof Unit ? "[unit]" :
|
||||
|
@ -707,14 +707,51 @@ public class Mods implements Loadable{
|
||||
|
||||
/** @return whether this mod is supported by the game verison */
|
||||
public boolean isSupported(){
|
||||
if(Version.build <= 0 || meta.minGameVersion == null) return true;
|
||||
if(meta.minGameVersion.contains(".")){
|
||||
String[] split = meta.minGameVersion.split("\\.");
|
||||
if(isOutdated()) return false;
|
||||
|
||||
int major = getMinMinor(), minor = getMinMinor();
|
||||
|
||||
if(Version.build <= 0) return true;
|
||||
|
||||
return Version.build >= major && Version.revision >= minor;
|
||||
}
|
||||
|
||||
/** @return whether this mod is outdated, e.g. not compatible with v6. */
|
||||
public boolean isOutdated(){
|
||||
//must be at least 105 to indicate v6 compat
|
||||
return getMinMinor() < 105;
|
||||
}
|
||||
|
||||
public int getMinMajor(){
|
||||
int major = 0;
|
||||
|
||||
String ver = meta.minGameVersion == null ? "0" : meta.minGameVersion;
|
||||
|
||||
if(ver.contains(".")){
|
||||
String[] split = ver.split("\\.");
|
||||
if(split.length == 2){
|
||||
return Version.build >= Strings.parseInt(split[0], 0) && Version.revision >= Strings.parseInt(split[1], 0);
|
||||
major = Strings.parseInt(split[0], 0);
|
||||
}
|
||||
}else{
|
||||
major = Strings.parseInt(ver, 0);
|
||||
}
|
||||
|
||||
return major;
|
||||
}
|
||||
|
||||
public int getMinMinor(){
|
||||
int minor = 0;
|
||||
|
||||
String ver = meta.minGameVersion == null ? "0" : meta.minGameVersion;
|
||||
|
||||
if(ver.contains(".")){
|
||||
String[] split = ver.split("\\.");
|
||||
if(split.length == 2){
|
||||
return Strings.parseInt(split[1], 0);
|
||||
}
|
||||
}
|
||||
return Version.build >= Strings.parseInt(meta.minGameVersion, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -792,7 +829,7 @@ public class Mods implements Loadable{
|
||||
|
||||
/** Mod metadata information.*/
|
||||
public static class ModMeta{
|
||||
public String name, displayName, author, description, version, main, minGameVersion;
|
||||
public String name, displayName, author, description, version, main, minGameVersion = "0";
|
||||
public Seq<String> dependencies = Seq.with();
|
||||
/** Hidden mods are only server-side or client-side, and do not support adding new content. */
|
||||
public boolean hidden;
|
||||
|
@ -162,11 +162,17 @@ public class ModsDialog extends BaseDialog{
|
||||
}}).size(h - 8f).padTop(-8f).padLeft(-8f).padRight(8f);
|
||||
|
||||
title.table(text -> {
|
||||
text.add("" + mod.meta.displayName() + "\n[lightgray]v" + mod.meta.version + (mod.enabled() ? "" : "\n" + Core.bundle.get("mod.disabled") + ""))
|
||||
boolean hideDisabled = !mod.isSupported() || mod.hasUnmetDependencies() || mod.hasContentErrors();
|
||||
|
||||
text.add("" + mod.meta.displayName() + "\n[lightgray]v" + mod.meta.version + (mod.enabled() || hideDisabled ? "" : "\n" + Core.bundle.get("mod.disabled") + ""))
|
||||
.wrap().top().width(300f).growX().left();
|
||||
|
||||
text.row();
|
||||
if(!mod.isSupported()){
|
||||
|
||||
if(mod.isOutdated()){
|
||||
text.labelWrap("@mod.outdated").growX();
|
||||
text.row();
|
||||
}else if(!mod.isSupported()){
|
||||
text.labelWrap(Core.bundle.format("mod.requiresversion", mod.meta.minGameVersion)).growX();
|
||||
text.row();
|
||||
}else if(mod.hasUnmetDependencies()){
|
||||
|
@ -170,11 +170,11 @@ public class DesktopLauncher extends ClientLauncher{
|
||||
String finalMessage = Strings.getFinalMesage(e);
|
||||
String total = Strings.getCauses(e).toString();
|
||||
|
||||
if(total.contains("Couldn't create window") || total.contains("OpenGL 2.0 or higher") || total.toLowerCase().contains("pixel format") || total.contains("GLEW")){
|
||||
if(total.contains("Couldn't create window") || total.contains("OpenGL 2.0 or higher") || total.toLowerCase().contains("pixel format") || total.contains("GLEW")|| total.contains("unsupported combination of formats")){
|
||||
|
||||
dialog.get(() -> message(
|
||||
total.contains("Couldn't create window") ? "A graphics initialization error has occured! Try to update your graphics drivers:\n" + finalMessage :
|
||||
"Your graphics card does not support OpenGL 2.0 with the framebuffer_object extension!\n" +
|
||||
"Your graphics card does not support the right OpenGL features.\n" +
|
||||
"Try to update your graphics drivers. If this doesn't work, your computer may not support Mindustry.\n\n" +
|
||||
"Full message: " + finalMessage));
|
||||
badGPU = true;
|
||||
|
Loading…
Reference in New Issue
Block a user