mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-01 03:32:38 +00:00
respawn effect
This commit is contained in:
parent
d86b6c41ab
commit
7773ade3bd
13
QSB/ModelShip/Messages/RespawnModelShipMessage.cs
Normal file
13
QSB/ModelShip/Messages/RespawnModelShipMessage.cs
Normal 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));
|
||||
}
|
@ -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()
|
||||
{
|
23
QSB/ModelShip/Patches/ModelShipPatches.cs
Normal file
23
QSB/ModelShip/Patches/ModelShipPatches.cs
Normal 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();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user