diff --git a/plugin_template/swinfo.json b/plugin_template/swinfo.json index adfb8cb..c8f9e12 100644 --- a/plugin_template/swinfo.json +++ b/plugin_template/swinfo.json @@ -5,7 +5,7 @@ "name": "Patch Manager", "description": "A mod for generic patching needs similar to KSP 1's Module Manager.", "source": "https://github.com/KSP2Community/PatchManager", - "version": "0.10.0", + "version": "0.10.1", "version_check": "https://raw.githubusercontent.com/KSP2Community/PatchManager/main/plugin_template/swinfo.json", "ksp2_version": { "min": "0.2.0", diff --git a/src/PatchManager.Parts/Modifiables/PartModifiable.cs b/src/PatchManager.Parts/Modifiables/PartModifiable.cs index 8d0eb90..938169a 100644 --- a/src/PatchManager.Parts/Modifiables/PartModifiable.cs +++ b/src/PatchManager.Parts/Modifiables/PartModifiable.cs @@ -23,14 +23,18 @@ public override DataValue GetFieldValue(string fieldName) var repl = fieldName.Replace("PartComponent", ""); if (JToken is not JObject jObject) return DataValue.Null; - if(!jObject.ContainsKey("serializedPartModules")) + if (!jObject.ContainsKey("serializedPartModules")) return DataValue.Null; foreach (var module in jObject["serializedPartModules"]) { - if (module is not JObject moduleObject)continue; + if (module is not JObject moduleObject) continue; if (moduleObject.ContainsKey("Name") && ((string)moduleObject["Name"])!.Replace("PartComponent", "") == repl) return DataValue.FromJToken(module); } + + if (jObject.TryGetValue(fieldName, out var value)) + return DataValue.FromJToken(value); + return DataValue.Null; }