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

22 lines
710 B
C#
Raw Normal View History

2020-12-20 10:56:15 +00:00
using OWML.Utils;
2020-12-14 16:24:52 +00:00
using QSB.Events;
2020-12-14 19:31:31 +00:00
using QSB.Patches;
2020-08-12 19:58:29 +00:00
namespace QSB.ElevatorSync.Patches
2020-08-12 19:58:29 +00:00
{
2020-12-02 21:23:01 +00:00
public class ElevatorPatches : QSBPatch
{
public override QSBPatchTypes Type => QSBPatchTypes.OnModStart;
2020-11-03 21:11:10 +00:00
2020-12-02 21:23:01 +00:00
public static void StartLift(Elevator __instance)
{
var isGoingUp = __instance.GetValue<bool>("_goingToTheEnd");
var id = ElevatorManager.Instance.GetId(__instance);
2021-02-10 19:34:41 +00:00
QSBEventManager.FireEvent(EventNames.QSBStartLift, id, isGoingUp);
2020-12-02 21:23:01 +00:00
}
2020-11-03 21:11:10 +00:00
2020-12-18 20:28:22 +00:00
public override void DoPatches() => QSBCore.Helper.HarmonyHelper.AddPostfix<Elevator>("StartLift", typeof(ElevatorPatches), nameof(StartLift));
2021-02-09 17:18:01 +00:00
public override void DoUnpatches() => QSBCore.Helper.HarmonyHelper.Unpatch<Elevator>("StartLift");
2020-12-02 21:23:01 +00:00
}
2020-12-03 08:28:05 +00:00
}