From ce3643f0b3990a3ba84f6f4b05223d14b2cbb24b Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Wed, 8 Feb 2023 19:35:13 -0800 Subject: [PATCH] Make type not required if the template already provides one (#8257) Such as with missile units --- core/src/mindustry/mod/ContentParser.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index 506df53c1b..645b188042 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -461,12 +461,13 @@ public class ContentParser{ } var typeVal = value.get("type"); + if(unit.constructor == null || typeVal != null){ + if(typeVal != null && !typeVal.isString()){ + throw new RuntimeException("Unit '" + name + "' has an incorrect type. Types must be strings."); + } - if(typeVal != null && !typeVal.isString()){ - throw new RuntimeException("Unit '" + name + "' has an incorrect type. Types must be strings."); + unit.constructor = unitType(typeVal); } - - unit.constructor = unitType(typeVal); }else{ unit = locate(ContentType.unit, name); }