Elevator initializer no longer sticks in place

Revert of previous commit (c61d228fd8690ae72533b1792a112523b81b4d93)

The person who initialized the elevator will drift in front of the elevator again. This is base game behavior.
This commit is contained in:
Moonstone Studios 2023-10-28 18:36:47 -07:00
parent c61d228fd8
commit 3ce50935c6
No known key found for this signature in database
GPG Key ID: 049449FDBA649F3E

View File

@ -3,7 +3,6 @@ using QSB.ElevatorSync.Messages;
using QSB.ElevatorSync.WorldObjects;
using QSB.Messaging;
using QSB.Patches;
using QSB.Utility;
using QSB.WorldSync;
namespace QSB.ElevatorSync.Patches;
@ -26,22 +25,4 @@ public class ElevatorPatches : QSBPatch
var qsbElevator = __instance.GetWorldObject<QSBElevator>();
qsbElevator.SendMessage(new ElevatorMessage(isGoingUp));
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Elevator), nameof(Elevator.AttachPlayerAndStartLift))]
public static void Elevator_AttachPlayerAndStartLift(Elevator __instance)
{
// attach player to their current position instead of gliding them
// to the attach point.
var attachPoint = __instance._attachPoint;
var qsbElevator = __instance.GetWorldObject<QSBElevator>();
attachPoint.transform.position = Locator.GetPlayerTransform().position;
// Runs when the lift/elevator is done moving.
// Reset the position of the attach point.
Delay.RunWhen(() => !__instance.enabled, () =>
{
attachPoint.transform.localPosition = qsbElevator.originalAttachPosition;
});
}
}