From dc4e8a5671f905213442b8d43b450505ce8db0ea Mon Sep 17 00:00:00 2001 From: siimav Date: Thu, 12 Sep 2024 01:40:13 +0300 Subject: [PATCH] Restore ignitor resources on vessel repair --- .../RP0/SpaceCenter/Projects/VesselRepairProject.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/RP0/SpaceCenter/Projects/VesselRepairProject.cs b/Source/RP0/SpaceCenter/Projects/VesselRepairProject.cs index 0a30fdc8ab..4078dbb653 100644 --- a/Source/RP0/SpaceCenter/Projects/VesselRepairProject.cs +++ b/Source/RP0/SpaceCenter/Projects/VesselRepairProject.cs @@ -64,7 +64,7 @@ public bool ApplyRepairs() try { - ResetIgnitionsOnVessel(v); + ResetMERFsOnVessel(v); } catch { @@ -80,11 +80,19 @@ public bool ApplyRepairs() } } - private static void ResetIgnitionsOnVessel(Vessel v) + private static void ResetMERFsOnVessel(Vessel v) { foreach (var merf in v.FindPartModulesImplementing()) { merf.ResetIgnitions(); + + foreach (ModuleResource ignRes in merf.ignitionResources) + { + if (merf.part.Resources.Get(ignRes.id) is PartResource res) + { + res.amount = res.maxAmount; + } + } } } }