2020-08-12 21:58:29 +02:00
|
|
|
|
using OWML.ModHelper.Events;
|
2020-12-14 16:24:52 +00:00
|
|
|
|
using QSB.Events;
|
2020-12-14 20:31:31 +01:00
|
|
|
|
using QSB.Patches;
|
2020-08-12 21:58:29 +02:00
|
|
|
|
|
|
|
|
|
namespace QSB.ElevatorSync
|
|
|
|
|
{
|
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);
|
|
|
|
|
GlobalMessenger<int, bool>.FireEvent(EventNames.QSBStartLift, id, isGoingUp);
|
|
|
|
|
}
|
2020-11-03 21:11:10 +00:00
|
|
|
|
|
2020-12-02 21:23:01 +00:00
|
|
|
|
public override void DoPatches()
|
|
|
|
|
{
|
2020-12-14 16:24:52 +00:00
|
|
|
|
QSBCore.Helper.HarmonyHelper.AddPostfix<Elevator>("StartLift", typeof(ElevatorPatches), nameof(StartLift));
|
2020-12-02 21:23:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-12-03 08:28:05 +00:00
|
|
|
|
}
|