Make type not required if the template already provides one (#8257)

Such as with missile units
This commit is contained in:
MEEPofFaith
2023-02-08 19:35:13 -08:00
committed by GitHub
parent f1fb7d8098
commit ce3643f0b3

View File

@@ -461,12 +461,13 @@ public class ContentParser{
} }
var typeVal = value.get("type"); 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()){ unit.constructor = unitType(typeVal);
throw new RuntimeException("Unit '" + name + "' has an incorrect type. Types must be strings.");
} }
unit.constructor = unitType(typeVal);
}else{ }else{
unit = locate(ContentType.unit, name); unit = locate(ContentType.unit, name);
} }