SHA256
Document Harmony Patches
This commit is contained in:
1 parent
8deb64fd4d
commit
d2bd655118
19 files changed
+499
-4
No files matched your search
@@ -3,9 +3,21 @@ using HarmonyLib;
|
||||
|
||||
namespace ADOFAIRenderer.Patch.Game;
|
||||
|
||||
/// <summary>
|
||||
/// Applies the configured color of the third (green, "wind") planet used by multi-planet levels.
|
||||
/// <para>
|
||||
/// Patched members: <c>PlanetarySystem.Init()</c>, which creates the planets including <c>planetGreen</c> (default color
|
||||
/// RGB 0.3, 0.7, 0.0); and <c>PlanetarySystem.ApplyMultiplanetColors()</c>, which recolors the extra planets
|
||||
/// (green, yellow, purple, ...) from the red/blue planet colors (skipped by the game when <c>GCS.staticPlanetColors</c> is set).
|
||||
/// Both postfixes reapply the override after the game has set its color.
|
||||
/// </para>
|
||||
/// <para>Active from stage Load until the stage returns to None. The fire/ice colors are handled by <see cref="PersistencePatch"/>.</para>
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(PlanetarySystem))]
|
||||
public static class PlanetarySystemPatch
|
||||
{
|
||||
/// <summary>Postfix of <c>PlanetarySystem.Init</c>: applies the wind planet color override to the new planets.</summary>
|
||||
/// <param name="__instance">The planetary system that was initialized.</param>
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch("Init")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
@@ -14,6 +26,8 @@ public static class PlanetarySystemPatch
|
||||
ApplyWindPlanetColor(__instance);
|
||||
}
|
||||
|
||||
/// <summary>Postfix of <c>PlanetarySystem.ApplyMultiplanetColors</c>: reapplies the wind planet color override.</summary>
|
||||
/// <param name="__instance">The planetary system whose extra planet colors were updated.</param>
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch("ApplyMultiplanetColors")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
@@ -22,6 +36,11 @@ public static class PlanetarySystemPatch
|
||||
ApplyWindPlanetColor(__instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets <c>planetGreen</c>'s renderer color to <c>AdvancedConfig.windPlanetColor</c> when a render is in progress
|
||||
/// (stage != None) and the override is set. Does nothing when the override is null or the planet does not exist.
|
||||
/// </summary>
|
||||
/// <param name="planetarySystem">The planetary system to update.</param>
|
||||
private static void ApplyWindPlanetColor(PlanetarySystem planetarySystem)
|
||||
{
|
||||
if (RenderManager.Instance == null || RenderManager.Instance.stage == RenderStage.None) return;
|
||||
|
||||
Reference in new issue
Block a user