From 67ba6e2914bdc3bc52d4f2f1b12b5860a7bb8bf0 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 6 Feb 2025 16:21:53 -0500 Subject: [PATCH] Closes #8520 --- core/src/mindustry/mod/ContentParser.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index 0395da4e09..ec7fa3280b 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -1,9 +1,6 @@ package mindustry.mod; import arc.*; -import arc.assets.*; -import arc.assets.loaders.MusicLoader.*; -import arc.assets.loaders.SoundLoader.*; import arc.audio.*; import arc.files.*; import arc.func.*; @@ -642,6 +639,19 @@ public class ContentParser{ value.remove("sector"); value.remove("planet"); + if(value.has("rules")){ + JsonValue r = value.remove("rules"); + if(!r.isObject()) throw new RuntimeException("Rules must be an object!"); + out.rules = rules -> { + try{ + //Use standard JSON, this is not content-parser relevant + JsonIO.json.readFields(rules, r); + }catch(Throwable e){ //Try not to crash here, as that would be catastrophic and confusing + Log.err(e); + } + }; + } + readFields(out, value); }); return out; @@ -698,7 +708,7 @@ public class ContentParser{ throw new RuntimeException("Team field missing."); } value.remove("team"); - + if(locate(ContentType.team, name) != null){ entry = locate(ContentType.team, name); readBundle(ContentType.team, name, value);