fix(action_manager): use items, closes #111
This commit is contained in:
@@ -55,9 +55,8 @@ func _get_event_to_queue(
|
|||||||
or combine_with):
|
or combine_with):
|
||||||
# or (combine_with && action in combine_with.node.combine_when_selected_action_is_in)):
|
# or (combine_with && action in combine_with.node.combine_when_selected_action_is_in)):
|
||||||
|
|
||||||
# Check if object must be in inventory to be used
|
# Check if object is in inventory or is not required to be in inventory to be used
|
||||||
if target.node.use_from_inventory_only:
|
if escoria.inventory_manager.inventory_has(target.global_id) or not target.node.use_from_inventory_only:
|
||||||
if escoria.inventory_manager.inventory_has(target.global_id):
|
|
||||||
# Player has item in inventory, we check the element to use on
|
# Player has item in inventory, we check the element to use on
|
||||||
if combine_with:
|
if combine_with:
|
||||||
var do_combine = true
|
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 clicked object needs a combination, and current target is set, then perform the combination.
|
||||||
if need_combine and current_target:
|
if need_combine and current_target:
|
||||||
event_to_queue = _get_event_to_queue(current_action, current_tool, 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
|
# If clicked object needs a combination then we need to wait for the target.
|
||||||
# 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.
|
|
||||||
elif need_combine:
|
elif need_combine:
|
||||||
set_action_input_state(ACTION_INPUT_STATE.AWAITING_TARGET_ITEM)
|
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.
|
# If clicked object doesn't need a combination, then we simply run the action.
|
||||||
else:
|
else:
|
||||||
event_to_queue = _get_event_to_queue(current_action, obj)
|
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
|
# Note that `event_to_queue` may still be null, but we do need to start the
|
||||||
# player walking towards the destination.
|
# player walking towards the destination.
|
||||||
if current_action and not event_to_queue:
|
if current_action and not event_to_queue:
|
||||||
clear_current_action()
|
# MODIFIED FOR RETURN TO MONKEY UI
|
||||||
|
# clear_current_action()
|
||||||
action_finished.emit()
|
action_finished.emit()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -5,4 +5,4 @@ func set_cursor(texture: Texture) -> void:
|
|||||||
|
|
||||||
func clear_cursor():
|
func clear_cursor():
|
||||||
Input.set_custom_mouse_cursor(null)
|
Input.set_custom_mouse_cursor(null)
|
||||||
escoria.action_manager.clear_current_tool()
|
# escoria.action_manager.clear_current_tool()
|
||||||
|
|||||||
Reference in New Issue
Block a user