2021-02-28 14:43:05 +00:00
|
|
|
|
using QSB.Events;
|
|
|
|
|
using QSB.Patches;
|
2021-03-01 09:44:36 +00:00
|
|
|
|
using QSB.Player;
|
2021-02-28 14:43:05 +00:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace QSB.StatueSync.Patches
|
|
|
|
|
{
|
2021-02-28 15:29:09 +00:00
|
|
|
|
internal class StatuePatches : QSBPatch
|
2021-02-28 14:43:05 +00:00
|
|
|
|
{
|
2021-02-28 19:39:38 +00:00
|
|
|
|
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
2021-02-28 14:43:05 +00:00
|
|
|
|
|
2021-02-28 15:29:09 +00:00
|
|
|
|
public override void DoPatches()
|
2021-06-18 21:54:32 +01:00
|
|
|
|
=> Prefix(nameof(MemoryUplinkTrigger_Update));
|
2021-02-28 14:43:05 +00:00
|
|
|
|
|
2021-06-18 21:54:32 +01:00
|
|
|
|
public static bool MemoryUplinkTrigger_Update(bool ____waitForPlayerGrounded)
|
2021-02-28 14:43:05 +00:00
|
|
|
|
{
|
2021-03-01 09:44:36 +00:00
|
|
|
|
if (StatueManager.Instance.HasStartedStatueLocally)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2021-06-18 22:38:32 +01:00
|
|
|
|
|
2021-02-28 14:43:05 +00:00
|
|
|
|
if (!____waitForPlayerGrounded || !Locator.GetPlayerController().IsGrounded())
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2021-06-18 22:38:32 +01:00
|
|
|
|
|
2021-02-28 14:43:05 +00:00
|
|
|
|
var playerBody = Locator.GetPlayerBody().transform;
|
|
|
|
|
var timberHearth = Locator.GetAstroObject(AstroObject.Name.TimberHearth).transform;
|
|
|
|
|
QSBEventManager.FireEvent(
|
|
|
|
|
EventNames.QSBStartStatue,
|
2021-02-28 15:29:09 +00:00
|
|
|
|
timberHearth.InverseTransformPoint(playerBody.position),
|
|
|
|
|
Quaternion.Inverse(timberHearth.rotation) * playerBody.rotation,
|
2021-02-28 14:43:05 +00:00
|
|
|
|
Locator.GetPlayerCamera().GetComponent<PlayerCameraController>().GetDegreesY());
|
2021-03-01 09:44:36 +00:00
|
|
|
|
QSBPlayerManager.HideAllPlayers();
|
2021-02-28 14:43:05 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|