respawn effect

This commit is contained in:
JohnCorby 2022-06-07 22:07:39 -07:00
parent d86b6c41ab
commit 7773ade3bd
3 changed files with 40 additions and 4 deletions

View File

@ -0,0 +1,13 @@
using QSB.Messaging;
using QSB.Patches;
using QSB.WorldSync;
namespace QSB.ModelShip.Messages;
internal class RespawnModelShipMessage : QSBMessage<bool>
{
public RespawnModelShipMessage(bool playEffects) : base(playEffects) { }
public override void OnReceiveRemote() =>
QSBPatch.RemoteCall(() => QSBWorldSync.GetUnityObject<RemoteFlightConsole>().RespawnModelShip(Data));
}

View File

@ -8,9 +8,9 @@ using QSB.WorldSync;
namespace QSB.ModelShip.Messages;
internal class UseFlightConsole : QSBMessage<bool>
internal class UseFlightConsoleMessage : QSBMessage<bool>
{
static UseFlightConsole()
static UseFlightConsoleMessage()
{
GlobalMessenger<OWRigidbody>.AddListener(OWEvents.EnterRemoteFlightConsole, _ => Handler(true));
GlobalMessenger.AddListener(OWEvents.ExitRemoteFlightConsole, () => Handler(false));
@ -20,11 +20,11 @@ internal class UseFlightConsole : QSBMessage<bool>
{
if (PlayerTransformSync.LocalInstance != null)
{
new UseFlightConsole(active).Send();
new UseFlightConsoleMessage(active).Send();
}
}
private UseFlightConsole(bool active) : base(active) { }
private UseFlightConsoleMessage(bool active) : base(active) { }
public override void OnReceiveLocal()
{

View File

@ -0,0 +1,23 @@
using HarmonyLib;
using QSB.Messaging;
using QSB.ModelShip.Messages;
using QSB.Patches;
namespace QSB.ModelShip.Patches;
public class ModelShipPatches : QSBPatch
{
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
[HarmonyPrefix]
[HarmonyPatch(typeof(RemoteFlightConsole), nameof(RemoteFlightConsole.RespawnModelShip))]
private static void RemoteFlightConsole_RespawnModelShip(bool playEffects)
{
if (Remote)
{
return;
}
new RespawnModelShipMessage(playEffects).Send();
}
}