-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove stock part tags that aren't relevant in RO context (#2980)
- Loading branch information
Showing
3 changed files
with
46 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,19 @@ | ||
using HarmonyLib; | ||
using KSP.UI.Screens; | ||
|
||
namespace RealismOverhaul.Harmony | ||
{ | ||
[HarmonyPatch(typeof(BasePartCategorizer))] | ||
internal class PatchBasePartCategorizer | ||
{ | ||
/// <summary> | ||
/// Called through GameEvents.onLanguageSwitched | ||
/// </summary> | ||
[HarmonyPostfix] | ||
[HarmonyPatch("LoadAutoTags")] | ||
internal static void LoadAutoTags() | ||
{ | ||
PartTagNuker.NukeTags(); | ||
} | ||
} | ||
} |
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,25 @@ | ||
using KSP.UI.Screens; | ||
using UnityEngine; | ||
|
||
namespace RealismOverhaul | ||
{ | ||
/// <summary> | ||
/// Removes stock part tags that aren't relevant in RO context. | ||
/// Cannot be done in a Harmony patch because the relevant code runs before plugins are initialized. | ||
/// </summary> | ||
[KSPAddon(KSPAddon.Startup.Instantly, true)] | ||
internal class PartTagNuker : MonoBehaviour | ||
{ | ||
internal void Start() | ||
{ | ||
NukeTags(); | ||
} | ||
|
||
internal static void NukeTags() | ||
{ | ||
BasePartCategorizer.size0Tags = BasePartCategorizer.size1Tags = BasePartCategorizer.size1p5Tags = | ||
BasePartCategorizer.size2Tags = BasePartCategorizer.size3Tags = BasePartCategorizer.size4Tags = | ||
BasePartCategorizer.srfTags = BasePartCategorizer.radialTag = new string[0]; | ||
} | ||
} | ||
} |
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