SHA256
36 lines
1.6 KiB
C#
36 lines
1.6 KiB
C#
using ADOFAIRenderer.Core;
|
|
using HarmonyLib;
|
|
|
|
namespace ADOFAIRenderer.Patch.Game;
|
|
|
|
/// <summary>
|
|
/// Prevents the end portal from being spawned on level tiles for the "non-tile" render option.
|
|
/// <para>
|
|
/// Patched member: <c>scrFloor.SpawnPortalParticles()</c>, which instantiates the animated portal prefab
|
|
/// (<c>scrPortalParticles</c>: glow, particles, cap and icon) as a child of the floor. The game calls it from
|
|
/// <c>scrLevelMaker</c>, <c>scrController</c> and <c>scrFloor</c> for the portal floor.
|
|
/// </para>
|
|
/// <para>
|
|
/// Active from stage Load when <c>AdvancedConfig.NonTile</c> is enabled, and only for floors that belong to
|
|
/// <c>scrLevelMaker.listFloors</c> (the level's tiles). See <see cref="scnGamePatch.ProcessFloors"/> for the other tile renderers.
|
|
/// </para>
|
|
/// </summary>
|
|
[HarmonyPatch(typeof(scrFloor))]
|
|
// ReSharper disable once InconsistentNaming
|
|
public class scrFloorPatch
|
|
{
|
|
/// <summary>Prefix of <c>scrFloor.SpawnPortalParticles</c>.</summary>
|
|
/// <param name="__instance">The floor that would receive the portal.</param>
|
|
/// <returns>True to run the original method (spawn the portal); false to skip it (non-tile render, level floor).</returns>
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch("SpawnPortalParticles")]
|
|
// ReSharper disable once InconsistentNaming
|
|
public static bool SkipPortalSpawn(scrFloor __instance)
|
|
{
|
|
if (!scrLevelMaker.instance.listFloors.Contains(__instance)) return true;
|
|
|
|
var nonTile = RenderManager.Instance.stage >= RenderStage.Load &&
|
|
RenderManager.Instance.Configuration.AdvancedConfig.NonTile;
|
|
return !nonTile;
|
|
}
|
|
} |