39 lines
998 B
C#
Raw Normal View History

2022-04-29 14:32:44 +01:00
using HarmonyLib;
2022-05-11 10:39:18 -07:00
using QSB.EchoesOfTheEye.Prisoner.Messages;
2022-04-29 14:32:44 +01:00
using QSB.EchoesOfTheEye.Prisoner.WorldObjects;
2022-05-11 10:39:18 -07:00
using QSB.Messaging;
2022-04-29 14:32:44 +01:00
using QSB.Patches;
using QSB.WorldSync;
namespace QSB.EchoesOfTheEye.Prisoner.Patches;
[HarmonyPatch(typeof(PrisonCellElevator))]
public class CellevatorPatches : QSBPatch
{
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
[HarmonyPrefix]
2022-08-15 14:24:48 -07:00
[HarmonyPatch(nameof(PrisonCellElevator.CallToTopFloor))]
public static void CallToTopFloor(PrisonCellElevator __instance)
2022-04-29 14:32:44 +01:00
{
2022-08-15 14:24:48 -07:00
if (!QSBWorldSync.AllObjectsReady)
2022-05-11 10:39:18 -07:00
{
return;
}
2022-08-15 14:24:48 -07:00
__instance.GetWorldObject<QSBPrisonCellElevator>()
.SendMessage(new CellevatorCallMessage(1));
}
2022-05-11 10:39:18 -07:00
2022-08-15 14:24:48 -07:00
[HarmonyPrefix]
[HarmonyPatch(nameof(PrisonCellElevator.CallToBottomFloor))]
public static void CallToBottomFloor(PrisonCellElevator __instance)
{
2022-05-11 10:39:18 -07:00
if (!QSBWorldSync.AllObjectsReady)
{
return;
}
__instance.GetWorldObject<QSBPrisonCellElevator>()
2022-08-15 14:24:48 -07:00
.SendMessage(new CellevatorCallMessage(0));
2022-04-29 14:32:44 +01:00
}
}