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 22:35:13 -05:00
committed by GitHub
parent f1fb7d8098
commit ce3643f0b3
+5 -4
View File
@@ -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);
}