protected override bool OnControllerInteraction(VRInteraction.InteractionEvent action, GameObject interactable, HandManager hand) { /* Make sure our toolbelt is actually setup */ if (toolbelt == null) { return(false); } /* Is the interactable a toolbelt slot? */ PlayerToolbeltSlot slot = interactable.GetComponent <PlayerToolbeltSlot>(); if (slot == null || !slot.GetSocketManager().hasAuthority) { return(false); } /* This has to be a pickup action */ if (!SojournItem.IsPickupEvent(action)) { return(false); } if (debug) { Debug.Log("PlayerToolbeltManager Client: The player is attempting to pickup something from our toolbelt slot."); } /* The slot must be occupied */ if (!slot.IsOccupied()) { if (debug) { Debug.LogError("PlayerToolbeltManager Client: This toolbelt slot isn't occupied!"); } return(false); } /* Get the object that's in the slot we're interacting with */ GameObject toolbeltItemObj = slot.GetAttachedObject(); if (toolbeltItemObj == null) { throw new System.Exception("Why is there no attached item if this slot is occupied?"); } /* Convert the object to an item */ SojournItem toolbeltItem = toolbeltItemObj.GetComponent <SojournItem>(); if (toolbeltItem == null) { throw new System.Exception("Why is this object attached to the toolbelt but it's not an item!!"); } /* If the hand isn't empty, swap the items */ if (hand.IsHoldingSomething()) { if (debug) { Debug.LogWarning("PlayerToolbeltManager Client: The player is already holding something so we'll swap items"); } /* We have to do the swap on the server */ //CmdSwapItems(hand.netId, slot.GetSocketManager().netId, slot.socketNumber); /* We swapped items */ return(true); } if (debug) { Debug.Log("PlayerToolbeltManager Client: We weren't holding something, so we're just picking up the object"); } /* Pickup the item from the toolbelt */ CmdPickupItem(hand.netId, slot.GetSocketManager().netId, slot.GetSocketNumber()); /* We picked up the object */ return(true); }