From 7fa002c626b1f6ac9b683935a24ee2237f137cef Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 5 Sep 2023 09:41:04 -0400 Subject: [PATCH] Support for JSON planets without a parent --- core/src/mindustry/entities/comp/UnitComp.java | 1 + core/src/mindustry/mod/ContentParser.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index 2209e0fee3..662da29f4a 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -268,6 +268,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I kill(); } } + case shield -> shield = Math.max((float)value, 0f); case x -> x = World.unconv((float)value); case y -> y = World.unconv((float)value); case rotation -> rotation = (float)value; diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index 2a7012f2b3..8bb9efb643 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -596,7 +596,7 @@ public class ContentParser{ ContentType.planet, (TypeParser)(mod, name, value) -> { if(value.isString()) return locate(ContentType.planet, name); - Planet parent = locate(ContentType.planet, value.getString("parent")); + Planet parent = locate(ContentType.planet, value.getString("parent", "")); Planet planet = new Planet(mod + "-" + name, parent, value.getFloat("radius", 1f), value.getInt("sectorSize", 0)); if(value.has("mesh")){