Fix fog fading occurring for bramble seeds

This commit is contained in:
TerrificTrifid 2023-02-22 13:08:09 -06:00
parent 68c8972b66
commit 12e6fc56ee
2 changed files with 3 additions and 7 deletions

View File

@ -245,7 +245,7 @@ namespace NewHorizons.Builder.Props
// Set the seed/node specific scales and other stuff // Set the seed/node specific scales and other stuff
if (config.isSeed) if (config.isSeed)
{ {
innerFogWarpVolume._exitRadius /= 1.8f; //innerFogWarpVolume._exitRadius /= 1.8f;
brambleNode.FindChild("PointLight_DB_FogLight").GetComponent<Light>().range *= config.scale; brambleNode.FindChild("PointLight_DB_FogLight").GetComponent<Light>().range *= config.scale;
brambleNode.FindChild("Prefab_SeedPunctureVolume (2)").GetComponent<CompoundShape>().enabled = true; brambleNode.FindChild("Prefab_SeedPunctureVolume (2)").GetComponent<CompoundShape>().enabled = true;
fogLight._maxVisibleDistance = float.PositiveInfinity; // Prefab does have working foglight aside from this fogLight._maxVisibleDistance = float.PositiveInfinity; // Prefab does have working foglight aside from this

View File

@ -4,23 +4,19 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Patches namespace NewHorizons.Patches
{ {
[HarmonyPatch] [HarmonyPatch]
public static class BramblePatches public static class BramblePatches
{ {
//
// this file is not great. the real solution to the issues these patches address should be solved by replacing bramble nodes' InnerFogWarpVolume
// components with a custom NHInnerFogWarpVolume component, and implement the below functions as overrides in the NHInnerFogWarpVolume class
// that would fix the issue of seeds having inappropriate screen fog
//
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(SphericalFogWarpVolume), nameof(SphericalFogWarpVolume.IsProbeOnly))] [HarmonyPatch(typeof(SphericalFogWarpVolume), nameof(SphericalFogWarpVolume.IsProbeOnly))]
public static bool SphericalFogWarpVolume_IsProbeOnly(SphericalFogWarpVolume __instance, ref bool __result) public static bool SphericalFogWarpVolume_IsProbeOnly(SphericalFogWarpVolume __instance, ref bool __result)
{ {
__result = false; __result = Mathf.Approximately(__instance._exitRadius / __instance._warpRadius, 2f); // Check the ratio between these to determine if seed, instead of just < 10
return false; return false;
} }