-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nuke the DynamicBatteryStorage VesselModule (#2866)
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Linq; | ||
using UnityEngine; | ||
|
||
namespace RealismOverhaul | ||
{ | ||
/// <summary> | ||
/// DynamicBatteryStorage is supposed to disable itself in presence of Kerbalism but the implementation is flawed. | ||
/// In addition to Kerbalism, the mod is also known to cause issues with ROTanks and RealFuels. | ||
/// The code below will remove the problematic VesselModule. | ||
/// </summary> | ||
[KSPAddon(KSPAddon.Startup.Instantly, true)] | ||
internal class DynamicBatteryStorageNuker : MonoBehaviour | ||
{ | ||
internal void Start() | ||
{ | ||
var la = AssemblyLoader.loadedAssemblies.FirstOrDefault(a => a.assembly.GetName().Name == "DynamicBatteryStorage"); | ||
if (la != null) | ||
{ | ||
var type = la.assembly.GetType("DynamicBatteryStorage.ModuleDynamicBatteryStorage"); | ||
bool removed = VesselModuleManager.RemoveModuleOfType(type); | ||
if (!removed) | ||
{ | ||
Debug.Log("[RealismOverhaul] Detected DynamicBatteryStorage as installed but failed to remove its VesselModule"); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters