Eyes Work nicely now, switching items is a bit iffy though

This commit is contained in:
DamianCorazza
2025-09-12 10:30:49 +02:00
parent 9b590ca6ec
commit afd3bc3863

View File

@@ -44,8 +44,40 @@ namespace Interactions
var allowed = config?.allowedItems ?? new List<PickupItemData>(); var allowed = config?.allowedItems ?? new List<PickupItemData>();
var forbidden = config?.forbiddenItems ?? new List<PickupItemData>(); var forbidden = config?.forbiddenItems ?? new List<PickupItemData>();
if ((heldItemData == null && _currentlySlottedItemObject != null) if (heldItemData != null && _currentlySlottedItemObject != null)
|| (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); FollowerController.TryPickupItem(_currentlySlottedItemObject, _currentlySlottedItemData);
_currentlySlottedItemObject = null; _currentlySlottedItemObject = null;