fix(action_manager): use items, closes #111

This commit is contained in:
2025-09-02 12:47:34 +02:00
parent 4fcc62e176
commit 2c42dff6e5
2 changed files with 68 additions and 74 deletions

View File

@@ -55,9 +55,8 @@ func _get_event_to_queue(
or combine_with):
# or (combine_with && action in combine_with.node.combine_when_selected_action_is_in)):
# Check if object must be in inventory to be used
if target.node.use_from_inventory_only:
if escoria.inventory_manager.inventory_has(target.global_id):
# Check if object is in inventory or is not required to be in inventory to be used
if escoria.inventory_manager.inventory_has(target.global_id) or not target.node.use_from_inventory_only:
# Player has item in inventory, we check the element to use on
if combine_with:
var do_combine = true
@@ -256,18 +255,12 @@ func perform_inputevent_on_object(
# If clicked object needs a combination, and current target is set, then perform the combination.
if need_combine and current_target:
event_to_queue = _get_event_to_queue(current_action, current_tool, current_target)
# If clicked object needs a combination but can only be used from inventory, then we need to wait
# for the target.
elif obj.node.use_from_inventory_only \
and escoria.inventory_manager.inventory_has(obj.global_id) \
and need_combine:
current_tool = obj
set_action_input_state(ACTION_INPUT_STATE.AWAITING_TARGET_ITEM)
return
# If clicked object needs a combination and doesn't require to be in inventory,
# then we need to wait for the target.
# If clicked object needs a combination then we need to wait for the target.
elif need_combine:
set_action_input_state(ACTION_INPUT_STATE.AWAITING_TARGET_ITEM)
# If object is in inventory make it current tool.
if escoria.inventory_manager.inventory_has(obj.global_id):
current_tool = obj
# If clicked object doesn't need a combination, then we simply run the action.
else:
event_to_queue = _get_event_to_queue(current_action, obj)
@@ -276,7 +269,8 @@ func perform_inputevent_on_object(
# Note that `event_to_queue` may still be null, but we do need to start the
# player walking towards the destination.
if current_action and not event_to_queue:
clear_current_action()
# MODIFIED FOR RETURN TO MONKEY UI
# clear_current_action()
action_finished.emit()
return

View File

@@ -5,4 +5,4 @@ func set_cursor(texture: Texture) -> void:
func clear_cursor():
Input.set_custom_mouse_cursor(null)
escoria.action_manager.clear_current_tool()
# escoria.action_manager.clear_current_tool()