remove the temp patches lol clay

This commit is contained in:
JohnCorby 2022-07-15 14:55:04 -07:00
parent c73a393f97
commit a9a51d00da

View File

@ -10,117 +10,6 @@ using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Body
{
[HarmonyPatch]
static class Patch
{
// SkinnedMeshRenderer.SetBlendShapeWeight
[HarmonyPrefix]
[HarmonyPatch(typeof(PlayerFogWarpDetector), nameof(PlayerFogWarpDetector.LateUpdate))]
public static bool LateUpdate(PlayerFogWarpDetector __instance)
{
// if (PlanetaryFogController.GetActiveFogSphere() == null)
//{
// return false;
//}
float num = __instance._targetFogFraction;
if (PlayerState.IsInsideShip())
{
num = Mathf.Max(__instance._shipFogDetector.GetTargetFogFraction(), num);
}
if (num < __instance._fogFraction)
{
float num2 = (__instance._closestFogWarp.UseFastFogFade() ? 1f : 0.2f);
__instance._fogFraction = Mathf.MoveTowards(__instance._fogFraction, num, Time.deltaTime * num2);
}
else
{
__instance._fogFraction = num;
}
if (__instance._targetFogColorWarpVolume != __instance._closestFogWarp)
{
__instance._targetFogColorWarpVolume = __instance._closestFogWarp;
__instance._startColorCrossfadeTime = Time.time;
__instance._startCrossfadeColor = __instance._fogColor;
}
if (__instance._targetFogColorWarpVolume != null)
{
Color fogColor = __instance._targetFogColorWarpVolume.GetFogColor();
if (__instance._fogFraction <= 0f)
{
__instance._fogColor = fogColor;
}
else
{
float t = Mathf.InverseLerp(__instance._startColorCrossfadeTime, __instance._startColorCrossfadeTime + 1f, Time.time);
__instance._fogColor = Color.Lerp(__instance._startCrossfadeColor, fogColor, t);
}
__instance._fogColor = new Color(__instance._fogColor.r, __instance._fogColor.g, __instance._fogColor.b);
}
if (__instance._playerEffectBubbleController != null)
{
__instance._playerEffectBubbleController.SetFogFade(__instance._fogFraction, __instance._fogColor);
}
if (__instance._shipLandingCamEffectBubbleController != null)
{
__instance._shipLandingCamEffectBubbleController.SetFogFade(__instance._fogFraction, __instance._fogColor);
}
return false;
}
// FogWarpBubbleController.SetFogFade
[HarmonyPrefix]
[HarmonyPatch(typeof(FogWarpEffectBubbleController), nameof(FogWarpEffectBubbleController.SetFogFade))]
public static bool FogWarpBubbleController_SetFogFade(FogWarpEffectBubbleController __instance, float fogAlpha, Color fogColor)
{
if (__instance._effectBubbleRenderer.sharedMaterial != null)
{
Color value = fogColor;
value.a = fogAlpha;
__instance._matPropBlock.SetColor(__instance._propID_Color, value);
__instance._effectBubbleRenderer.SetPropertyBlock(__instance._matPropBlock);
}
__instance._visible = __instance._effectBubbleRenderer.sharedMaterial != null && fogAlpha > 0f;
if (__instance._targetCamera == null)
{
__instance._effectBubbleRenderer.enabled = __instance._visible;
Logger.Log($"Setting camera effect renderer to {__instance._visible}");
}
// Logger.Log($"{__instance.gameObject.transform.GetPath()} _visible: {__instance._visible} set alpha to {fogAlpha} and set color ot {fogColor}");
return false;
}
// note: I would just make this a one line postfix function, but CheckWarpProximity() does extra stuff that we really don't want to run twice
// so we have to completely override this function to support scaling ;-;
[HarmonyPrefix]
[HarmonyPatch(typeof(FogWarpDetector), nameof(FogWarpDetector.FixedUpdate))]
public static void FixedUpdate(FogWarpDetector __instance)
{
__instance._targetFogFraction = 0f;
__instance._closestFogWarp = null;
float num = float.PositiveInfinity;
for (int i = 0; i < __instance._warpVolumes.Count; i++)
{
if (!__instance._warpVolumes[i].IsProbeOnly() || __instance._name == FogWarpDetector.Name.Probe)
{
FogWarpVolume fogWarpVolume = __instance._warpVolumes[i];
float num2 = Mathf.Abs(fogWarpVolume.CheckWarpProximity(__instance));
float b = Mathf.Clamp01(1f - Mathf.Abs(num2) / fogWarpVolume.GetFogThickness());
__instance._targetFogFraction = Mathf.Max(__instance._targetFogFraction, b);
if (num2 < num)
{
num = num2;
__instance._closestFogWarp = fogWarpVolume;
}
}
}
}
}
// TODO: in order to fix fog screen effect for scaling nodes, I need to replace all InnerFogWarpVolume and OuterFogWarpVolume instances with NHInner/OuterFogWarpVolume and on those two classes, implement GetFogThickness(){ return 50*scale; }}
// TODO: StreamingHandler.SetUpStreaming() for all FogWarpEffectBubbleController objects
// TODO: add the "don't see me" effect