Skip to content

Commit

Permalink
Restore ignitor resources on vessel repair
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav committed Sep 11, 2024
1 parent 0fa9e61 commit dc4e8a5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Source/RP0/SpaceCenter/Projects/VesselRepairProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public bool ApplyRepairs()

try
{
ResetIgnitionsOnVessel(v);
ResetMERFsOnVessel(v);
}
catch
{
Expand All @@ -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<ModuleEnginesRF>())
{
merf.ResetIgnitions();

foreach (ModuleResource ignRes in merf.ignitionResources)
{
if (merf.part.Resources.Get(ignRes.id) is PartResource res)
{
res.amount = res.maxAmount;
}
}
}
}
}
Expand Down

0 comments on commit dc4e8a5

Please sign in to comment.