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

24 lines
646 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
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
{
2021-12-24 06:44:32 +00:00
var isGoingUp = __instance._goingToTheEnd;
var qsbElevator = __instance.GetWorldObject<QSBElevator>();
2021-12-24 06:44:32 +00:00
qsbElevator.SendMessage(new ElevatorMessage(isGoingUp));
2020-12-02 21:23:01 +00:00
}
}
2020-12-03 08:28:05 +00:00
}