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

24 lines
659 B
C#
Raw Normal View History

using HarmonyLib;
using OWML.Utils;
2021-02-24 10:45:25 +00:00
using QSB.ElevatorSync.WorldObjects;
2020-12-14 16:24:52 +00:00
using QSB.Events;
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
namespace QSB.ElevatorSync.Patches
2020-08-12 19:58:29 +00:00
{
[HarmonyPatch]
2020-12-02 21:23:01 +00:00
public class ElevatorPatches : QSBPatch
{
2021-03-25 21:10:20 +00:00
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
2020-11-03 21:11:10 +00:00
[HarmonyPostfix]
[HarmonyPatch(typeof(Elevator), nameof(Elevator.StartLift))]
2021-06-18 20:54:32 +00:00
public static void Elevator_StartLift(Elevator __instance)
2020-12-02 21:23:01 +00:00
{
var isGoingUp = __instance.GetValue<bool>("_goingToTheEnd");
2021-11-01 15:49:00 +00:00
var id = QSBWorldSync.GetIdFromUnity<QSBElevator>(__instance);
2021-02-10 19:34:41 +00:00
QSBEventManager.FireEvent(EventNames.QSBStartLift, id, isGoingUp);
2020-12-02 21:23:01 +00:00
}
}
2020-12-03 08:28:05 +00:00
}