quantum-space-buddies/QSB/ElevatorSync/Patches/ElevatorPatches.cs

23 lines
631 B
C#
Raw Normal View History

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