mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-22 12:39:51 +00:00
add eye proxy moon stuffz
This commit is contained in:
parent
c8daf252f2
commit
96fd427bfb
49
QSB/QuantumSync/Events/EyeProxyMoonStateChangeMessage.cs
Normal file
49
QSB/QuantumSync/Events/EyeProxyMoonStateChangeMessage.cs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
using QSB.Messaging;
|
||||||
|
using QSB.QuantumSync.WorldObjects;
|
||||||
|
using QSB.Utility;
|
||||||
|
using QSB.WorldSync;
|
||||||
|
using QuantumUNET.Transport;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace QSB.QuantumSync.Events
|
||||||
|
{
|
||||||
|
internal class EyeProxyMoonStateChangeMessage : QSBWorldObjectMessage<QSBEyeProxyQuantumMoon>
|
||||||
|
{
|
||||||
|
private bool Active;
|
||||||
|
private float Angle;
|
||||||
|
|
||||||
|
public EyeProxyMoonStateChangeMessage(QSBEyeProxyQuantumMoon moon, bool active, float angle)
|
||||||
|
{
|
||||||
|
ObjectId = moon.ObjectId;
|
||||||
|
Active = active;
|
||||||
|
Angle = angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EyeProxyMoonStateChangeMessage() { }
|
||||||
|
|
||||||
|
public override void Deserialize(QNetworkReader reader)
|
||||||
|
{
|
||||||
|
base.Deserialize(reader);
|
||||||
|
Active = reader.ReadBoolean();
|
||||||
|
Angle = reader.ReadSingle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Serialize(QNetworkWriter writer)
|
||||||
|
{
|
||||||
|
base.Serialize(writer);
|
||||||
|
writer.Write(Active);
|
||||||
|
writer.Write(Angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnReceiveRemote()
|
||||||
|
{
|
||||||
|
DebugLog.DebugWrite($"Get moon state active:{Active} angle:{Angle}");
|
||||||
|
var moon = QSBWorldSync.GetWorldFromId<QSBEyeProxyQuantumMoon>(ObjectId);
|
||||||
|
moon.AttachedObject._moonStateRoot.SetActive(Active);
|
||||||
|
if (Angle != -1f)
|
||||||
|
{
|
||||||
|
moon.AttachedObject.transform.localEulerAngles = new Vector3(0f, Angle, 0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using QSB.Patches;
|
using QSB.Patches;
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
namespace QSB.QuantumSync.Patches
|
namespace QSB.QuantumSync.Patches
|
||||||
{
|
{
|
||||||
@ -12,11 +11,16 @@ namespace QSB.QuantumSync.Patches
|
|||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(QuantumMoon), nameof(QuantumMoon.Start))]
|
[HarmonyPatch(typeof(QuantumMoon), nameof(QuantumMoon.Start))]
|
||||||
public static void QuantumMoon_Start(QuantumMoon __instance)
|
public static void QuantumMoon_Start(QuantumMoon __instance)
|
||||||
=> __instance.GetType().GetMethod("SetSurfaceState", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { -1 });
|
=> __instance.SetSurfaceState(-1);
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(QuantumMoon), nameof(QuantumMoon.ChangeQuantumState))]
|
[HarmonyPatch(typeof(QuantumMoon), nameof(QuantumMoon.ChangeQuantumState))]
|
||||||
public static bool QuantumMoon_ChangeQuantumState()
|
public static bool QuantumMoon_ChangeQuantumState()
|
||||||
=> false;
|
=> false;
|
||||||
|
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(EyeProxyQuantumMoon), nameof(EyeProxyQuantumMoon.ChangeQuantumState))]
|
||||||
|
public static bool EyeProxyQuantumMoon_ChangeQuantumState()
|
||||||
|
=> false;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -32,11 +32,7 @@ namespace QSB.QuantumSync.Patches
|
|||||||
public static bool SocketedQuantumObject_ChangeQuantumState(
|
public static bool SocketedQuantumObject_ChangeQuantumState(
|
||||||
SocketedQuantumObject __instance,
|
SocketedQuantumObject __instance,
|
||||||
ref bool __result,
|
ref bool __result,
|
||||||
bool skipInstantVisibilityCheck,
|
bool skipInstantVisibilityCheck)
|
||||||
List<QuantumSocket> ____childSockets,
|
|
||||||
List<QuantumSocket> ____socketList,
|
|
||||||
ref QuantumSocket ____recentlyObscuredSocket,
|
|
||||||
QuantumSocket ____occupiedSocket)
|
|
||||||
{
|
{
|
||||||
if (WorldObjectManager.AllObjectsReady)
|
if (WorldObjectManager.AllObjectsReady)
|
||||||
{
|
{
|
||||||
@ -47,7 +43,7 @@ namespace QSB.QuantumSync.Patches
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var socket in ____childSockets)
|
foreach (var socket in __instance._childSockets)
|
||||||
{
|
{
|
||||||
if (socket.IsOccupied())
|
if (socket.IsOccupied())
|
||||||
{
|
{
|
||||||
@ -56,7 +52,7 @@ namespace QSB.QuantumSync.Patches
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (____socketList.Count <= 1)
|
if (__instance._socketList.Count <= 1)
|
||||||
{
|
{
|
||||||
DebugLog.ToConsole($"Error - Not enough quantum sockets in list for {__instance.name}!", MessageType.Error);
|
DebugLog.ToConsole($"Error - Not enough quantum sockets in list for {__instance.name}!", MessageType.Error);
|
||||||
__result = false;
|
__result = false;
|
||||||
@ -64,7 +60,7 @@ namespace QSB.QuantumSync.Patches
|
|||||||
}
|
}
|
||||||
|
|
||||||
var list = new List<QuantumSocket>();
|
var list = new List<QuantumSocket>();
|
||||||
foreach (var socket in ____socketList)
|
foreach (var socket in __instance._socketList)
|
||||||
{
|
{
|
||||||
if (!socket.IsOccupied() && socket.IsActive())
|
if (!socket.IsOccupied() && socket.IsActive())
|
||||||
{
|
{
|
||||||
@ -78,19 +74,19 @@ namespace QSB.QuantumSync.Patches
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (____recentlyObscuredSocket != null)
|
if (__instance._recentlyObscuredSocket != null)
|
||||||
{
|
{
|
||||||
__instance.GetType().GetMethod("MoveToSocket", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { ____recentlyObscuredSocket });
|
__instance.MoveToSocket(__instance._recentlyObscuredSocket);
|
||||||
____recentlyObscuredSocket = null;
|
__instance._recentlyObscuredSocket = null;
|
||||||
__result = true;
|
__result = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var occupiedSocket = ____occupiedSocket;
|
var occupiedSocket = __instance._occupiedSocket;
|
||||||
for (var i = 0; i < 20; i++)
|
for (var i = 0; i < 20; i++)
|
||||||
{
|
{
|
||||||
var index = UnityEngine.Random.Range(0, list.Count);
|
var index = Random.Range(0, list.Count);
|
||||||
__instance.GetType().GetMethod("MoveToSocket", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { list[index] });
|
__instance.MoveToSocket(list[index]);
|
||||||
if (skipInstantVisibilityCheck)
|
if (skipInstantVisibilityCheck)
|
||||||
{
|
{
|
||||||
__result = true;
|
__result = true;
|
||||||
@ -98,7 +94,7 @@ namespace QSB.QuantumSync.Patches
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool socketNotSuitable;
|
bool socketNotSuitable;
|
||||||
var isSocketIlluminated = (bool)__instance.GetType().GetMethod("CheckIllumination", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, null);
|
var isSocketIlluminated = __instance.CheckIllumination();
|
||||||
|
|
||||||
var playersEntangled = QuantumManager.GetEntangledPlayers(__instance);
|
var playersEntangled = QuantumManager.GetEntangledPlayers(__instance);
|
||||||
if (playersEntangled.Count() != 0)
|
if (playersEntangled.Count() != 0)
|
||||||
@ -108,7 +104,7 @@ namespace QSB.QuantumSync.Patches
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var checkVisInstant = (bool)__instance.GetType().GetMethod("CheckVisibilityInstantly", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, null);
|
var checkVisInstant = __instance.CheckVisibilityInstantly();
|
||||||
if (isSocketIlluminated)
|
if (isSocketIlluminated)
|
||||||
{
|
{
|
||||||
// socket not suitable if object is visible
|
// socket not suitable if object is visible
|
||||||
@ -134,7 +130,7 @@ namespace QSB.QuantumSync.Patches
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__instance.GetType().GetMethod("MoveToSocket", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { occupiedSocket });
|
__instance.MoveToSocket(occupiedSocket);
|
||||||
__result = false;
|
__result = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -179,9 +175,6 @@ namespace QSB.QuantumSync.Patches
|
|||||||
[HarmonyPatch(typeof(QuantumShuffleObject), nameof(QuantumShuffleObject.ChangeQuantumState))]
|
[HarmonyPatch(typeof(QuantumShuffleObject), nameof(QuantumShuffleObject.ChangeQuantumState))]
|
||||||
public static bool QuantumShuffleObject_ChangeQuantumState(
|
public static bool QuantumShuffleObject_ChangeQuantumState(
|
||||||
QuantumShuffleObject __instance,
|
QuantumShuffleObject __instance,
|
||||||
ref List<int> ____indexList,
|
|
||||||
ref Vector3[] ____localPositions,
|
|
||||||
ref Transform[] ____shuffledObjects,
|
|
||||||
ref bool __result)
|
ref bool __result)
|
||||||
{
|
{
|
||||||
QSBQuantumShuffleObject shuffleWorldObject = default;
|
QSBQuantumShuffleObject shuffleWorldObject = default;
|
||||||
@ -194,19 +187,19 @@ namespace QSB.QuantumSync.Patches
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
____indexList.Clear();
|
__instance._indexList.Clear();
|
||||||
____indexList = Enumerable.Range(0, ____localPositions.Length).ToList();
|
__instance._indexList = Enumerable.Range(0, __instance._localPositions.Length).ToList();
|
||||||
for (var i = 0; i < ____indexList.Count; ++i)
|
for (var i = 0; i < __instance._indexList.Count; ++i)
|
||||||
{
|
{
|
||||||
var random = UnityEngine.Random.Range(i, ____indexList.Count);
|
var random = Random.Range(i, __instance._indexList.Count);
|
||||||
var temp = ____indexList[i];
|
var temp = __instance._indexList[i];
|
||||||
____indexList[i] = ____indexList[random];
|
__instance._indexList[i] = __instance._indexList[random];
|
||||||
____indexList[random] = temp;
|
__instance._indexList[random] = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var j = 0; j < ____shuffledObjects.Length; j++)
|
for (var j = 0; j < __instance._shuffledObjects.Length; j++)
|
||||||
{
|
{
|
||||||
____shuffledObjects[j].localPosition = ____localPositions[____indexList[j]];
|
__instance._shuffledObjects[j].localPosition = __instance._localPositions[__instance._indexList[j]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WorldObjectManager.AllObjectsReady)
|
if (WorldObjectManager.AllObjectsReady)
|
||||||
@ -214,7 +207,7 @@ namespace QSB.QuantumSync.Patches
|
|||||||
QSBEventManager.FireEvent(
|
QSBEventManager.FireEvent(
|
||||||
EventNames.QSBQuantumShuffle,
|
EventNames.QSBQuantumShuffle,
|
||||||
shuffleWorldObject.ObjectId,
|
shuffleWorldObject.ObjectId,
|
||||||
____indexList.ToArray());
|
__instance._indexList.ToArray());
|
||||||
__result = true;
|
__result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +216,7 @@ namespace QSB.QuantumSync.Patches
|
|||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(MultiStateQuantumObject), nameof(MultiStateQuantumObject.Start))]
|
[HarmonyPatch(typeof(MultiStateQuantumObject), nameof(MultiStateQuantumObject.Start))]
|
||||||
public static bool MultiStateQuantumObject_Start(MultiStateQuantumObject __instance, Sector ____sector, bool ____collapseOnStart)
|
public static bool MultiStateQuantumObject_Start(MultiStateQuantumObject __instance)
|
||||||
{
|
{
|
||||||
if (!WorldObjectManager.AllObjectsReady)
|
if (!WorldObjectManager.AllObjectsReady)
|
||||||
{
|
{
|
||||||
@ -244,12 +237,12 @@ namespace QSB.QuantumSync.Patches
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (____sector == null)
|
if (__instance._sector == null)
|
||||||
{
|
{
|
||||||
__instance.CheckEnabled();
|
__instance.CheckEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (____collapseOnStart)
|
if (__instance._collapseOnStart)
|
||||||
{
|
{
|
||||||
__instance.Collapse(true);
|
__instance.Collapse(true);
|
||||||
}
|
}
|
||||||
@ -313,9 +306,9 @@ namespace QSB.QuantumSync.Patches
|
|||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(QuantumShrine), nameof(QuantumShrine.IsPlayerInDarkness))]
|
[HarmonyPatch(typeof(QuantumShrine), nameof(QuantumShrine.IsPlayerInDarkness))]
|
||||||
public static bool QuantumShrine_IsPlayerInDarkness(ref bool __result, Light[] ____lamps, float ____fadeFraction, bool ____isProbeInside, NomaiGateway ____gate)
|
public static bool QuantumShrine_IsPlayerInDarkness(QuantumShrine __instance, ref bool __result)
|
||||||
{
|
{
|
||||||
foreach (var lamp in ____lamps)
|
foreach (var lamp in __instance._lamps)
|
||||||
{
|
{
|
||||||
if (lamp.intensity > 0f)
|
if (lamp.intensity > 0f)
|
||||||
{
|
{
|
||||||
@ -353,8 +346,8 @@ namespace QSB.QuantumSync.Patches
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BUG : make this *really* check for all players - check other probes and other jetpacks!
|
// BUG : make this *really* check for all players - check other probes and other jetpacks!
|
||||||
__result = ____gate.GetOpenFraction() == 0f
|
__result = __instance._gate.GetOpenFraction() == 0f
|
||||||
&& !____isProbeInside
|
&& !__instance._isProbeInside
|
||||||
&& Locator.GetThrusterLightTracker().GetLightRange() <= 0f;
|
&& Locator.GetThrusterLightTracker().GetLightRange() <= 0f;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -371,22 +364,19 @@ namespace QSB.QuantumSync.Patches
|
|||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(QuantumShrine), nameof(QuantumShrine.OnEntry))]
|
[HarmonyPatch(typeof(QuantumShrine), nameof(QuantumShrine.OnEntry))]
|
||||||
public static bool QuantumShrine_OnEntry(
|
public static bool QuantumShrine_OnEntry(
|
||||||
GameObject hitObj,
|
QuantumShrine __instance,
|
||||||
ref bool ____isPlayerInside,
|
GameObject hitObj)
|
||||||
ref bool ____fading,
|
|
||||||
OWLightController ____exteriorLightController,
|
|
||||||
ref bool ____isProbeInside)
|
|
||||||
{
|
{
|
||||||
if (hitObj.CompareTag("PlayerDetector"))
|
if (hitObj.CompareTag("PlayerDetector"))
|
||||||
{
|
{
|
||||||
____isPlayerInside = true;
|
__instance._isPlayerInside = true;
|
||||||
____fading = true;
|
__instance._fading = true;
|
||||||
____exteriorLightController.FadeTo(0f, 1f);
|
__instance._exteriorLightController.FadeTo(0f, 1f);
|
||||||
QSBEventManager.FireEvent(EventNames.QSBEnterShrine);
|
QSBEventManager.FireEvent(EventNames.QSBEnterShrine);
|
||||||
}
|
}
|
||||||
else if (hitObj.CompareTag("ProbeDetector"))
|
else if (hitObj.CompareTag("ProbeDetector"))
|
||||||
{
|
{
|
||||||
____isProbeInside = true;
|
__instance._isProbeInside = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -395,22 +385,19 @@ namespace QSB.QuantumSync.Patches
|
|||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(QuantumShrine), nameof(QuantumShrine.OnExit))]
|
[HarmonyPatch(typeof(QuantumShrine), nameof(QuantumShrine.OnExit))]
|
||||||
public static bool QuantumShrine_OnExit(
|
public static bool QuantumShrine_OnExit(
|
||||||
GameObject hitObj,
|
QuantumShrine __instance,
|
||||||
ref bool ____isPlayerInside,
|
GameObject hitObj)
|
||||||
ref bool ____fading,
|
|
||||||
OWLightController ____exteriorLightController,
|
|
||||||
ref bool ____isProbeInside)
|
|
||||||
{
|
{
|
||||||
if (hitObj.CompareTag("PlayerDetector"))
|
if (hitObj.CompareTag("PlayerDetector"))
|
||||||
{
|
{
|
||||||
____isPlayerInside = false;
|
__instance._isPlayerInside = false;
|
||||||
____fading = true;
|
__instance._fading = true;
|
||||||
____exteriorLightController.FadeTo(1f, 1f);
|
__instance._exteriorLightController.FadeTo(1f, 1f);
|
||||||
QSBEventManager.FireEvent(EventNames.QSBExitShrine);
|
QSBEventManager.FireEvent(EventNames.QSBExitShrine);
|
||||||
}
|
}
|
||||||
else if (hitObj.CompareTag("ProbeDetector"))
|
else if (hitObj.CompareTag("ProbeDetector"))
|
||||||
{
|
{
|
||||||
____isProbeInside = false;
|
__instance._isProbeInside = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -418,68 +405,52 @@ namespace QSB.QuantumSync.Patches
|
|||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(QuantumMoon), nameof(QuantumMoon.CheckPlayerFogProximity))]
|
[HarmonyPatch(typeof(QuantumMoon), nameof(QuantumMoon.CheckPlayerFogProximity))]
|
||||||
public static bool QuantumMoon_CheckPlayerFogProximity(
|
public static bool QuantumMoon_CheckPlayerFogProximity(QuantumMoon __instance)
|
||||||
QuantumMoon __instance,
|
|
||||||
int ____stateIndex,
|
|
||||||
float ____eyeStateFogOffset,
|
|
||||||
ref bool ____isPlayerInside,
|
|
||||||
float ____fogRadius,
|
|
||||||
float ____fogThickness,
|
|
||||||
float ____fogRolloffDistance,
|
|
||||||
string ____revealFactID,
|
|
||||||
OWRigidbody ____moonBody,
|
|
||||||
bool ____hasSunCollapsed,
|
|
||||||
Transform ____vortexReturnPivot,
|
|
||||||
OWAudioSource ____vortexAudio,
|
|
||||||
ref int ____collapseToIndex,
|
|
||||||
VisibilityTracker ____visibilityTracker,
|
|
||||||
QuantumFogEffectBubbleController ____playerFogBubble,
|
|
||||||
QuantumFogEffectBubbleController ____shipLandingCamFogBubble)
|
|
||||||
{
|
{
|
||||||
var playerDistance = Vector3.Distance(__instance.transform.position, Locator.GetPlayerCamera().transform.position);
|
var playerDistance = Vector3.Distance(__instance.transform.position, Locator.GetPlayerCamera().transform.position);
|
||||||
var fogOffset = (____stateIndex != 5) ? 0f : ____eyeStateFogOffset;
|
var fogOffset = (__instance._stateIndex != 5) ? 0f : __instance._eyeStateFogOffset;
|
||||||
var distanceFromFog = playerDistance - (____fogRadius + fogOffset);
|
var distanceFromFog = playerDistance - (__instance._fogRadius + fogOffset);
|
||||||
var fogAlpha = 0f;
|
var fogAlpha = 0f;
|
||||||
if (!____isPlayerInside)
|
if (!__instance._isPlayerInside)
|
||||||
{
|
{
|
||||||
fogAlpha = Mathf.InverseLerp(____fogThickness + ____fogRolloffDistance, ____fogThickness, distanceFromFog);
|
fogAlpha = Mathf.InverseLerp(__instance._fogThickness + __instance._fogRolloffDistance, __instance._fogThickness, distanceFromFog);
|
||||||
if (distanceFromFog < 0f)
|
if (distanceFromFog < 0f)
|
||||||
{
|
{
|
||||||
if ((bool)__instance.GetType().GetMethod("IsLockedByProbeSnapshot", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, null) || QuantumManager.IsVisibleUsingCameraFrustum((ShapeVisibilityTracker)____visibilityTracker, true).Item1)
|
if (__instance.IsLockedByProbeSnapshot() || QuantumManager.IsVisibleUsingCameraFrustum((ShapeVisibilityTracker)__instance._visibilityTracker, true).Item1)
|
||||||
{
|
{
|
||||||
____isPlayerInside = true;
|
__instance._isPlayerInside = true;
|
||||||
__instance.GetType().GetMethod("SetSurfaceState", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { ____stateIndex });
|
__instance.SetSurfaceState(__instance._stateIndex);
|
||||||
Locator.GetShipLogManager().RevealFact(____revealFactID, true, true);
|
Locator.GetShipLogManager().RevealFact(__instance._revealFactID, true, true);
|
||||||
QSBEventManager.FireEvent("PlayerEnterQuantumMoon");
|
QSBEventManager.FireEvent("PlayerEnterQuantumMoon");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__instance.GetType().GetMethod("Collapse", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { true });
|
__instance.Collapse(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (____isPlayerInside)
|
else if (__instance._isPlayerInside)
|
||||||
{
|
{
|
||||||
fogAlpha = Mathf.InverseLerp(-____fogThickness - ____fogRolloffDistance, -____fogThickness, distanceFromFog);
|
fogAlpha = Mathf.InverseLerp(-__instance._fogThickness - __instance._fogRolloffDistance, -__instance._fogThickness, distanceFromFog);
|
||||||
if (distanceFromFog >= 0f)
|
if (distanceFromFog >= 0f)
|
||||||
{
|
{
|
||||||
if (____stateIndex != 5)
|
if (__instance._stateIndex != 5)
|
||||||
{
|
{
|
||||||
____isPlayerInside = false;
|
__instance._isPlayerInside = false;
|
||||||
if (!(bool)__instance.GetType().GetMethod("IsLockedByProbeSnapshot", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, null) && !QuantumManager.IsVisibleUsingCameraFrustum((ShapeVisibilityTracker)____visibilityTracker, true).Item1)
|
if (!__instance.IsLockedByProbeSnapshot() && !QuantumManager.IsVisibleUsingCameraFrustum((ShapeVisibilityTracker)__instance._visibilityTracker, true).Item1)
|
||||||
{
|
{
|
||||||
__instance.GetType().GetMethod("Collapse", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { true });
|
__instance.Collapse(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
__instance.GetType().GetMethod("SetSurfaceState", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { -1 });
|
__instance.SetSurfaceState(-1);
|
||||||
QSBEventManager.FireEvent("PlayerExitQuantumMoon");
|
QSBEventManager.FireEvent("PlayerExitQuantumMoon");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var vector = Locator.GetPlayerTransform().position - __instance.transform.position;
|
var vector = Locator.GetPlayerTransform().position - __instance.transform.position;
|
||||||
Locator.GetPlayerBody().SetVelocity(____moonBody.GetPointVelocity(Locator.GetPlayerTransform().position) - (vector.normalized * 5f));
|
Locator.GetPlayerBody().SetVelocity(__instance._moonBody.GetPointVelocity(Locator.GetPlayerTransform().position) - (vector.normalized * 5f));
|
||||||
var d = 80f;
|
var d = 80f;
|
||||||
Locator.GetPlayerBody().SetPosition(__instance.transform.position + (____vortexReturnPivot.up * d));
|
Locator.GetPlayerBody().SetPosition(__instance.transform.position + (__instance._vortexReturnPivot.up * d));
|
||||||
if (!Physics.autoSyncTransforms)
|
if (!Physics.autoSyncTransforms)
|
||||||
{
|
{
|
||||||
Physics.SyncTransforms();
|
Physics.SyncTransforms();
|
||||||
@ -487,15 +458,15 @@ namespace QSB.QuantumSync.Patches
|
|||||||
|
|
||||||
var component = Locator.GetPlayerCamera().GetComponent<PlayerCameraController>();
|
var component = Locator.GetPlayerCamera().GetComponent<PlayerCameraController>();
|
||||||
component.SetDegreesY(component.GetMinDegreesY());
|
component.SetDegreesY(component.GetMinDegreesY());
|
||||||
____vortexAudio.SetLocalVolume(0f);
|
__instance._vortexAudio.SetLocalVolume(0f);
|
||||||
____collapseToIndex = 1;
|
__instance._collapseToIndex = 1;
|
||||||
__instance.GetType().GetMethod("Collapse", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { true });
|
__instance.Collapse(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
____playerFogBubble.SetFogAlpha(fogAlpha);
|
__instance._playerFogBubble.SetFogAlpha(fogAlpha);
|
||||||
____shipLandingCamFogBubble.SetFogAlpha(fogAlpha);
|
__instance._shipLandingCamFogBubble.SetFogAlpha(fogAlpha);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using QSB.Events;
|
using QSB.Events;
|
||||||
|
using QSB.Messaging;
|
||||||
using QSB.Patches;
|
using QSB.Patches;
|
||||||
using QSB.Player;
|
using QSB.Player;
|
||||||
|
using QSB.QuantumSync.Events;
|
||||||
|
using QSB.QuantumSync.WorldObjects;
|
||||||
|
using QSB.Utility;
|
||||||
|
using QSB.WorldSync;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -12,6 +17,37 @@ namespace QSB.QuantumSync.Patches
|
|||||||
{
|
{
|
||||||
public override QSBPatchTypes Type => QSBPatchTypes.OnServerClientConnect;
|
public override QSBPatchTypes Type => QSBPatchTypes.OnServerClientConnect;
|
||||||
|
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(EyeProxyQuantumMoon), nameof(EyeProxyQuantumMoon.ChangeQuantumState))]
|
||||||
|
public static bool EyeProxyQuantumMoon_ChangeQuantumState(EyeProxyQuantumMoon __instance, ref bool __result, bool skipInstantVisibilityCheck)
|
||||||
|
{
|
||||||
|
if (TimeLoop.GetSecondsRemaining() > 0f && Random.value > 0.3f)
|
||||||
|
{
|
||||||
|
__instance._moonStateRoot.SetActive(false);
|
||||||
|
DebugLog.DebugWrite($"Disable");
|
||||||
|
new EyeProxyMoonStateChangeMessage(QSBWorldSync.GetWorldFromUnity<QSBEyeProxyQuantumMoon>(__instance), false, -1f).Send();
|
||||||
|
__result = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
__instance._moonStateRoot.SetActive(true);
|
||||||
|
for (var i = 0; i < 20; i++)
|
||||||
|
{
|
||||||
|
var angle = Random.Range(0f, 360f);
|
||||||
|
__instance.transform.localEulerAngles = new Vector3(0f, angle, 0f);
|
||||||
|
if (skipInstantVisibilityCheck || !__instance.CheckVisibilityInstantly())
|
||||||
|
{
|
||||||
|
DebugLog.DebugWrite($"Send active angle:{angle}");
|
||||||
|
new EyeProxyMoonStateChangeMessage(QSBWorldSync.GetWorldFromUnity<QSBEyeProxyQuantumMoon>(__instance), true, angle).Send();
|
||||||
|
__result = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
__result = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This patch used to be different, but that one completely broke Solanum's NomaiTextLines.
|
* This patch used to be different, but that one completely broke Solanum's NomaiTextLines.
|
||||||
* I have no idea why, and I fixed it by just writing this patch again.
|
* I have no idea why, and I fixed it by just writing this patch again.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user