29 lines
666 B
C#
Raw Normal View History

using HarmonyLib;
2021-12-23 22:44:32 -08:00
using QSB.ElevatorSync.Messages;
2021-02-24 10:45:25 +00:00
using QSB.ElevatorSync.WorldObjects;
2021-12-23 22:44:32 -08:00
using QSB.Messaging;
2020-12-14 20:31:31 +01:00
using QSB.Patches;
2021-02-24 10:45:25 +00:00
using QSB.WorldSync;
2020-08-12 21:58:29 +02:00
2022-03-02 19:46:33 -08:00
namespace QSB.ElevatorSync.Patches;
[HarmonyPatch]
public class ElevatorPatches : QSBPatch
2020-08-12 21:58:29 +02:00
{
2022-03-02 19:46:33 -08:00
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
2022-03-02 19:46:33 -08:00
[HarmonyPostfix]
[HarmonyPatch(typeof(Elevator), nameof(Elevator.StartLift))]
public static void Elevator_StartLift(Elevator __instance)
{
2022-03-22 10:56:41 -07:00
if (Remote)
{
return;
}
2022-03-02 19:46:33 -08:00
var isGoingUp = __instance._goingToTheEnd;
var qsbElevator = __instance.GetWorldObject<QSBElevator>();
qsbElevator.SendMessage(new ElevatorMessage(isGoingUp));
2020-12-02 21:23:01 +00:00
}
2022-03-22 10:56:41 -07:00
}