Eyes Work nicely now, switching items is a bit iffy though
This commit is contained in:
@@ -44,8 +44,40 @@ namespace Interactions
|
||||
var allowed = config?.allowedItems ?? new List<PickupItemData>();
|
||||
var forbidden = config?.forbiddenItems ?? new List<PickupItemData>();
|
||||
|
||||
if ((heldItemData == null && _currentlySlottedItemObject != null)
|
||||
|| (heldItemData != null && _currentlySlottedItemObject != null))
|
||||
if (heldItemData != null && _currentlySlottedItemObject != null)
|
||||
{
|
||||
// Remove the currently slotted item
|
||||
FollowerController.TryPickupItem(_currentlySlottedItemObject, _currentlySlottedItemData);
|
||||
_currentlySlottedItemObject = null;
|
||||
_currentlySlottedItemData = null;
|
||||
onItemSlotRemoved?.Invoke();
|
||||
UpdateSlottedSprite();
|
||||
|
||||
// Now slot the held item and check correctness
|
||||
if (forbidden.Contains(heldItemData))
|
||||
{
|
||||
DebugUIMessage.Show("Can't place that here.");
|
||||
onForbiddenItemSlotted?.Invoke();
|
||||
Interactable.BroadcastInteractionComplete(false);
|
||||
return;
|
||||
}
|
||||
|
||||
SlotItem(heldItemObj, heldItemData);
|
||||
if (allowed.Contains(heldItemData))
|
||||
{
|
||||
onCorrectItemSlotted?.Invoke();
|
||||
Interactable.BroadcastInteractionComplete(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugUIMessage.Show("I'm not sure this works.");
|
||||
onIncorrectItemSlotted?.Invoke();
|
||||
Interactable.BroadcastInteractionComplete(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (heldItemData == null && _currentlySlottedItemObject != null)
|
||||
{
|
||||
FollowerController.TryPickupItem(_currentlySlottedItemObject, _currentlySlottedItemData);
|
||||
_currentlySlottedItemObject = null;
|
||||
|
||||
Reference in New Issue
Block a user