mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-03-28 05:37:19 +00:00
fix cellevator
This commit is contained in:
parent
3705ea45cc
commit
41013b62ed
@ -1,13 +1,10 @@
|
||||
using QSB.EchoesOfTheEye.Prisoner.WorldObjects;
|
||||
using QSB.Messaging;
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.Prisoner.Messages;
|
||||
|
||||
internal class CellevatorCallMessage : QSBWorldObjectMessage<QSBPrisonCellElevator, int>
|
||||
{
|
||||
public CellevatorCallMessage(int floorIndex) : base(floorIndex) { }
|
||||
|
||||
public override void OnReceiveRemote() =>
|
||||
QSBPatch.RemoteCall(() => WorldObject.AttachedObject.CallElevatorToFloor(Data));
|
||||
public override void OnReceiveRemote() => WorldObject.AttachedObject.CallElevatorToFloor(Data);
|
||||
}
|
||||
|
@ -13,25 +13,26 @@ public class CellevatorPatches : QSBPatch
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(nameof(PrisonCellElevator.CallElevatorToFloor))]
|
||||
public static void CallElevatorToFloor(PrisonCellElevator __instance, int floorIndex)
|
||||
[HarmonyPatch(nameof(PrisonCellElevator.CallToTopFloor))]
|
||||
public static void CallToTopFloor(PrisonCellElevator __instance)
|
||||
{
|
||||
if (Remote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (__instance._targetFloorIndex == floorIndex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!QSBWorldSync.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
__instance.GetWorldObject<QSBPrisonCellElevator>()
|
||||
.SendMessage(new CellevatorCallMessage(floorIndex));
|
||||
.SendMessage(new CellevatorCallMessage(1));
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(nameof(PrisonCellElevator.CallToBottomFloor))]
|
||||
public static void CallToBottomFloor(PrisonCellElevator __instance)
|
||||
{
|
||||
if (!QSBWorldSync.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
__instance.GetWorldObject<QSBPrisonCellElevator>()
|
||||
.SendMessage(new CellevatorCallMessage(0));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user