fix hiding players

This commit is contained in:
Mister_Nebula 2021-03-01 09:44:36 +00:00
parent 810485c77c
commit 9e242219da
3 changed files with 14 additions and 2 deletions

View File

@ -122,7 +122,12 @@ namespace QSB.Player
public static void ChangePlayerVisibility(uint playerId, bool visible)
{
var player = GetPlayer(playerId);
foreach (var renderer in player.Body.GetComponents<Renderer>())
if (player.Body == null)
{
DebugLog.ToConsole($"Warning - Player {playerId} has a null body!", MessageType.Warning);
return;
}
foreach (var renderer in player.Body.GetComponentsInChildren<Renderer>())
{
renderer.enabled = visible;
}

View File

@ -1,6 +1,6 @@
using QSB.Events;
using QSB.Patches;
using QSB.Utility;
using QSB.Player;
using UnityEngine;
namespace QSB.StatueSync.Patches
@ -17,6 +17,10 @@ namespace QSB.StatueSync.Patches
public static bool Statue_Update(bool ____waitForPlayerGrounded)
{
if (StatueManager.Instance.HasStartedStatueLocally)
{
return true;
}
if (!____waitForPlayerGrounded || !Locator.GetPlayerController().IsGrounded())
{
return true;
@ -28,6 +32,7 @@ namespace QSB.StatueSync.Patches
timberHearth.InverseTransformPoint(playerBody.position),
Quaternion.Inverse(timberHearth.rotation) * playerBody.rotation,
Locator.GetPlayerCamera().GetComponent<PlayerCameraController>().GetDegreesY());
QSBPlayerManager.HideAllPlayers();
return true;
}
}

View File

@ -7,6 +7,7 @@ namespace QSB.StatueSync
internal class StatueManager : MonoBehaviour
{
public static StatueManager Instance { get; private set; }
public bool HasStartedStatueLocally;
private void Awake()
{
@ -22,6 +23,7 @@ namespace QSB.StatueSync
private IEnumerator BeginRemoteUplinkSequence(Vector3 position, Quaternion rotation, float cameraDegrees)
{
HasStartedStatueLocally = true;
var cameraEffectController = Locator.GetPlayerCamera().GetComponent<PlayerCameraEffectController>();
cameraEffectController.CloseEyes(0.5f);
OWInput.ChangeInputMode(InputMode.None);