diff --git a/QSB/Player/PlayerInfo.cs b/QSB/Player/PlayerInfo.cs index c7a314fd..c628b8da 100644 --- a/QSB/Player/PlayerInfo.cs +++ b/QSB/Player/PlayerInfo.cs @@ -94,6 +94,8 @@ public class PlayerInfo } private GameObject _body; + public ThrusterLightTracker ThrusterLightTracker; + public GameObject RoastingStick { get; set; } // Tools diff --git a/QSB/Player/QSBPlayerManager.cs b/QSB/Player/QSBPlayerManager.cs index e9506835..de3c2c94 100644 --- a/QSB/Player/QSBPlayerManager.cs +++ b/QSB/Player/QSBPlayerManager.cs @@ -89,7 +89,10 @@ public static class QSBPlayerManager => (Locator.GetFlashlight(), PlayerList.Where(x => x.FlashLight != null).Select(x => x.FlashLight)); public static (SurveyorProbe LocalProbe, IEnumerable RemoteProbes) GetPlayerProbes() - => new(Locator.GetProbe(), PlayerList.Where(x => x.Probe != null).Select(x => x.Probe)); + => (Locator.GetProbe(), PlayerList.Where(x => x.Probe != null).Select(x => x.Probe)); + + public static IEnumerable GetThrusterLightTrackers() + => PlayerList.Select(x => x.ThrusterLightTracker).Where(x => x != null); public static void ShowAllPlayers() => PlayerList.ForEach(x => x.SetVisible(true, 2)); diff --git a/QSB/PlayerBodySetup/Local/LocalPlayerCreation.cs b/QSB/PlayerBodySetup/Local/LocalPlayerCreation.cs index 4e08a4cf..17755bd1 100644 --- a/QSB/PlayerBodySetup/Local/LocalPlayerCreation.cs +++ b/QSB/PlayerBodySetup/Local/LocalPlayerCreation.cs @@ -29,6 +29,7 @@ public static class LocalPlayerCreation var playerModel = playerBody.Find("Traveller_HEA_Player_v2"); player.AnimationSync.InitLocal(playerModel); player.Body = playerBody.gameObject; + player.ThrusterLightTracker = player.Body.GetComponentInChildren(); // camera var cameraBody = Locator.GetPlayerCamera().gameObject.transform; diff --git a/QSB/PlayerBodySetup/Remote/RemotePlayerCreation.cs b/QSB/PlayerBodySetup/Remote/RemotePlayerCreation.cs index b0713fb9..d2f54a71 100644 --- a/QSB/PlayerBodySetup/Remote/RemotePlayerCreation.cs +++ b/QSB/PlayerBodySetup/Remote/RemotePlayerCreation.cs @@ -53,6 +53,7 @@ public static class RemotePlayerCreation DebugLog.DebugWrite($"SET UP PLAYER BODY"); player.Body = REMOTE_Player_Body; + player.ThrusterLightTracker = player.Body.GetComponentInChildren(); player.AnimationSync.InitRemote(REMOTE_Traveller_HEA_Player_v2.transform); diff --git a/QSB/QuantumSync/Patches/QuantumVisibilityPatches.cs b/QSB/QuantumSync/Patches/QuantumVisibilityPatches.cs index 8ddcc87c..78ceed00 100644 --- a/QSB/QuantumSync/Patches/QuantumVisibilityPatches.cs +++ b/QSB/QuantumSync/Patches/QuantumVisibilityPatches.cs @@ -68,8 +68,6 @@ public class QuantumVisibilityPatches : QSBPatch var point = __instance.transform.TransformPoint(__instance._localIlluminationOffset); var (localFlashlight, playerFlashlights) = QSBPlayerManager.GetPlayerFlashlights(); - var (localProbe, playerProbes) = QSBPlayerManager.GetPlayerProbes(); - if (localFlashlight.CheckIlluminationAtPoint(point, __instance._illuminationRadius)) { __result = true; @@ -82,6 +80,8 @@ public class QuantumVisibilityPatches : QSBPatch return false; } + var (localProbe, playerProbes) = QSBPlayerManager.GetPlayerProbes(); + if (localProbe != null && localProbe.IsLaunched() && localProbe.CheckIlluminationAtPoint(point, __instance._illuminationRadius)) @@ -97,7 +97,8 @@ public class QuantumVisibilityPatches : QSBPatch } // BUG : Implement checking for other player's thrusters! - if (Locator.GetThrusterLightTracker().CheckIlluminationAtPoint(point, __instance._illuminationRadius)) + if (QSBPlayerManager.GetThrusterLightTrackers() + .Any(x => x.CheckIlluminationAtPoint(point, __instance._illuminationRadius))) { __result = true; return false;