diff --git a/QSB/ElevatorSync/WorldObjects/QSBElevator.cs b/QSB/ElevatorSync/WorldObjects/QSBElevator.cs index fc543f11..3d3443cd 100644 --- a/QSB/ElevatorSync/WorldObjects/QSBElevator.cs +++ b/QSB/ElevatorSync/WorldObjects/QSBElevator.cs @@ -12,16 +12,23 @@ namespace QSB.ElevatorSync.WorldObjects; public class QSBElevator : WorldObject { private OWTriggerVolume _elevatorTrigger; - private bool IsLogLift => Name == "LogLift"; - // Used by log lift to reset attach position + // Used to reset attach position. This is in local space. public Vector3 originalAttachPosition; public override async UniTask Init(CancellationToken ct) { var boxShape = AttachedObject.gameObject.GetAddComponent(); boxShape.center = new Vector3(0, 1.75f, 0.25f); - boxShape.size = new Vector3(3, 3.5f, 3); + + if (Name == "LogLift") + { + boxShape.size = new Vector3(5, 3.5f, 8); + } + else + { + boxShape.size = new Vector3(3, 3.5f, 3); + } _elevatorTrigger = AttachedObject.gameObject.GetAddComponent(); originalAttachPosition = AttachedObject._attachPoint.transform.localPosition; @@ -41,11 +48,7 @@ public class QSBElevator : WorldObject if (_elevatorTrigger.IsTrackingObject(Locator.GetPlayerDetector())) { var attachPoint = AttachedObject._attachPoint; - if (IsLogLift) - { - attachPoint.transform.position = Locator.GetPlayerTransform().position; - QSBCore.Helper.Console.WriteLine($"Moved the anchor point to {attachPoint.transform.position}"); - } + attachPoint.transform.position = Locator.GetPlayerTransform().position; attachPoint.AttachPlayer(); if (Locator.GetPlayerSuit().IsWearingSuit() && Locator.GetPlayerSuit().IsTrainingSuit()) @@ -55,16 +58,14 @@ public class QSBElevator : WorldObject } AttachedObject.StartLift(); - - if (IsLogLift) + + // Runs when the lift/elevator is done moving. + // Reset the position of the attach point. + Delay.RunWhen(() => !AttachedObject.enabled, () => { - // Runs when the lift is done moving. - // Reset the position of the attach point. - Delay.RunWhen(() => !AttachedObject.enabled, () => - { - AttachedObject._attachPoint.transform.localPosition = originalAttachPosition; - }); - } + AttachedObject._attachPoint.transform.localPosition = originalAttachPosition; + }); + } private void SetDirection(bool isGoingUp) @@ -76,9 +77,6 @@ public class QSBElevator : WorldObject public override void DisplayLines() { - //Popcron.Gizmos.Sphere(AttachedObject._attachPoint.transform.position, 0.5f, Color.blue); - //Popcron.Gizmos.Sphere(originalAttachPosition, 0.5f, Color.magenta); - var boxShape = (BoxShape)_elevatorTrigger._shape; Popcron.Gizmos.Cube( ShapeUtil.Box.CalcWorldSpaceCenter(boxShape), diff --git a/QSB/SectorSync/QSBSectorManager.cs b/QSB/SectorSync/QSBSectorManager.cs index 735f7f49..00fa5d47 100644 --- a/QSB/SectorSync/QSBSectorManager.cs +++ b/QSB/SectorSync/QSBSectorManager.cs @@ -104,10 +104,9 @@ public class QSBSectorManager : WorldObjectManager // just create a sphere at the attach point lol // since players will be moved there when riding the elevator // -- - // The log lift needs the attach point on the game object itself to + // The attach point on the game object itself to // sync player attachment properly. - var go = elevator.name == "LogLift" ? elevator.gameObject : elevator._attachPoint.gameObject; - FakeSector.Create(go, + FakeSector.Create(elevator.gameObject, elevator.GetComponentInParent(), x => {