diff --git a/Source/Player/VRController.cs b/Source/Player/VRController.cs index 098b0a0a..125c1978 100644 --- a/Source/Player/VRController.cs +++ b/Source/Player/VRController.cs @@ -135,11 +135,8 @@ private void OnInteractPerformed(InputAction.CallbackContext context) return; // Handle belt bag item - if (PlayerController.currentlyHeldObjectServer is BeltBagItem bag) - { - BeginBagTool(bag); + if (PlayerController.currentlyHeldObjectServer is BeltBagItem bag && TryBagTool(bag)) return; - } // Here we try and pickup the item if it's possible if (!PlayerController.activatingItem && !VRSession.Instance.LocalPlayer.PlayerController.isPlayerDead) @@ -373,17 +370,19 @@ private void BeginGrabObject() GrabItem(hit.collider.transform.gameObject.GetComponent()); } - private void BeginBagTool(BeltBagItem bag) + private bool TryBagTool(BeltBagItem bag) { var ray = new Ray(InteractOrigin.position, InteractOrigin.forward); if (!ray.Raycast(out var hit, 4, 1073742144)) - return; + return false; var item = hit.collider.GetComponent(); if (item == null || item == PlayerController.currentlyHeldObjectServer || !CanBeInsertedIntoBag(item)) - return; + return false; bag.TryAddObjectToBag(item); + + return true; } public void GrabItem(GrabbableObject item) @@ -439,6 +438,6 @@ public void GrabItem(GrabbableObject item) private static bool CanBeInsertedIntoBag(GrabbableObject item) { return !item.itemProperties.isScrap && !item.isHeld && !item.isHeldByEnemy && - item.itemProperties.itemId != 123984 && item.itemProperties.itemId != 819501; + item.itemProperties.itemId is not (123984 or 819501); } } \ No newline at end of file