Skip to content

Commit

Permalink
Fixed mod dependencies default
Browse files Browse the repository at this point in the history
Also fixed that hard dependencies without a mod version were ignored
  • Loading branch information
Bilka2 committed Dec 31, 2022
1 parent 6c8e040 commit cf8aa7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions FactorioDataWrapper/config.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"trailer",
"extreme-gui",
"trailer-launch",
"trailer-switch",
"GIF_Tool"
]
}
9 changes: 5 additions & 4 deletions FactorioDataWrapper/src/com/demod/factorio/ModInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ public ModInfo(JSONObject json) {
homepage = json.optString("homepage", "");
description = json.optString("description", "");
JSONArray dependenciesJson = json.optJSONArray("dependencies");
if (dependenciesJson == null)
{
dependenciesJson = new JSONArray();
if (dependenciesJson == null) {
dependenciesJson = new JSONArray("[\"base\"]");
}
for (int i = 0; i < dependenciesJson.length(); i++) {
String depString = dependenciesJson.getString(i);
String[] depSplit = depString.split("\\s");
if (depSplit.length == 2) {
if (depSplit.length == 1) {
dependencies.add(new Dependency(false, depSplit[0], null, null));
} else if (depSplit.length == 2) {
dependencies.add(new Dependency(true, depSplit[1], null, null));
} else if (depSplit.length == 3) {
dependencies.add(new Dependency(false, depSplit[0], depSplit[1], depSplit[2]));
Expand Down

0 comments on commit cf8aa7a

Please sign in to comment.