Skip to content

Commit

Permalink
fix moon succ loop?
Browse files Browse the repository at this point in the history
  • Loading branch information
misternebula committed Nov 12, 2023
1 parent 366da20 commit 2814f18
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion QSB/QuantumSync/Patches/Common/QuantumMoonPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,16 @@ public static bool CheckPlayerFogProximity(QuantumMoon __instance)
}
else
{
var shouldStayAtEye = __instance._hasSunCollapsed || __instance.IsLockedByProbeSnapshot();
var anyoneInMoon = QSBPlayerManager.PlayerList.Any(x => x.IsInMoon && !x.IsLocalPlayer);
var playersWhoCanSeeMoon = QuantumManager.IsVisibleUsingCameraFrustum((ShapeVisibilityTracker)__instance._visibilityTracker, true).PlayersWhoCanSee;
var shipInFog = GetShipInFog(__instance);

var shouldStayAtEye =
__instance._hasSunCollapsed ||
__instance.IsLockedByProbeSnapshot() ||
anyoneInMoon ||
playersWhoCanSeeMoon.Any(x => !(shipInFog && x.IsInShip) && !GetTransformInFog(__instance, x.CameraBody.transform));

var vector = Locator.GetPlayerTransform().position - __instance.transform.position;
Locator.GetPlayerBody().SetVelocity(__instance._moonBody.GetPointVelocity(Locator.GetPlayerTransform().position) - vector.normalized * 5f);
var offset = shouldStayAtEye ? 80f : __instance._fogRadius - 1f;
Expand Down

0 comments on commit 2814f18

Please sign in to comment.