Update ItemSlots to combine images correctly
This commit is contained in:
@@ -109,6 +109,32 @@ namespace Interactions
|
|||||||
if ((heldItemData == null && _currentlySlottedItemObject != null)
|
if ((heldItemData == null && _currentlySlottedItemObject != null)
|
||||||
|| (heldItemData != null && _currentlySlottedItemObject != null))
|
|| (heldItemData != null && _currentlySlottedItemObject != null))
|
||||||
{
|
{
|
||||||
|
// If both held and slotted items exist, attempt combination via follower (reuse existing logic from Pickup)
|
||||||
|
if (heldItemData != null && _currentlySlottedItemData != null)
|
||||||
|
{
|
||||||
|
var slottedPickup = _currentlySlottedItemObject?.GetComponent<Pickup>();
|
||||||
|
if (slottedPickup != null)
|
||||||
|
{
|
||||||
|
var comboResult = FollowerController.TryCombineItems(slottedPickup, out var combinationResultItem);
|
||||||
|
if (combinationResultItem != null && comboResult == FollowerController.CombinationResult.Successful)
|
||||||
|
{
|
||||||
|
// Combination succeeded: fire slot-removed events and clear internals (don't call SlotItem to avoid duplicate events)
|
||||||
|
onItemSlotRemoved?.Invoke();
|
||||||
|
OnItemSlotRemoved?.Invoke(_currentlySlottedItemData);
|
||||||
|
_currentState = ItemSlotState.None;
|
||||||
|
|
||||||
|
// Clear internal references and visuals
|
||||||
|
_currentlySlottedItemObject = null;
|
||||||
|
_currentlySlottedItemData = null;
|
||||||
|
UpdateSlottedSprite();
|
||||||
|
|
||||||
|
Interactable.BroadcastInteractionComplete(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No combination (or not applicable) -> perform normal swap/pickup behavior
|
||||||
FollowerController.TryPickupItem(_currentlySlottedItemObject, _currentlySlottedItemData, false);
|
FollowerController.TryPickupItem(_currentlySlottedItemObject, _currentlySlottedItemData, false);
|
||||||
onItemSlotRemoved?.Invoke();
|
onItemSlotRemoved?.Invoke();
|
||||||
OnItemSlotRemoved?.Invoke(_currentlySlottedItemData);
|
OnItemSlotRemoved?.Invoke(_currentlySlottedItemData);
|
||||||
|
|||||||
Reference in New Issue
Block a user