make da thrusters work

This commit is contained in:
JohnCorby 2022-03-07 13:25:41 -08:00
parent 350fc7e2ed
commit 39cdc960da
5 changed files with 12 additions and 4 deletions

View File

@ -94,6 +94,8 @@ public class PlayerInfo
}
private GameObject _body;
public ThrusterLightTracker ThrusterLightTracker;
public GameObject RoastingStick { get; set; }
// Tools

View File

@ -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<QSBProbe> 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<ThrusterLightTracker> GetThrusterLightTrackers()
=> PlayerList.Select(x => x.ThrusterLightTracker).Where(x => x != null);
public static void ShowAllPlayers()
=> PlayerList.ForEach(x => x.SetVisible(true, 2));

View File

@ -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<ThrusterLightTracker>();
// camera
var cameraBody = Locator.GetPlayerCamera().gameObject.transform;

View File

@ -53,6 +53,7 @@ public static class RemotePlayerCreation
DebugLog.DebugWrite($"SET UP PLAYER BODY");
player.Body = REMOTE_Player_Body;
player.ThrusterLightTracker = player.Body.GetComponentInChildren<ThrusterLightTracker>();
player.AnimationSync.InitRemote(REMOTE_Traveller_HEA_Player_v2.transform);

View File

@ -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;