fix: combine items without use_from_inventory_only

This commit is contained in:
2023-03-09 19:22:41 +01:00
parent ad4acae88d
commit 56bf73b639
5 changed files with 47 additions and 62 deletions

View File

@@ -60,15 +60,6 @@ func _get_event_to_queue(
if escoria.inventory_manager.inventory_has(target.global_id): 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
if combine_with.node is ESCItem \
and combine_with.node.use_from_inventory_only\
and not escoria.inventory_manager.inventory_has(
combine_with.global_id
):
do_combine = false
if do_combine:
var target_event = "%s %s" % [ var target_event = "%s %s" % [
action, action,
combine_with.global_id combine_with.global_id
@@ -110,19 +101,6 @@ func _get_event_to_queue(
self, self,
"Invalid action: " + str(errors) "Invalid action: " + str(errors)
) )
else:
escoria.logger.warn(
self,
"Invalid action on item: " +
(
"Trying to combine object %s with %s, "+
"but %s is not in inventory."
) % [
target.global_id,
combine_with.global_id,
combine_with.global_id
]
)
else: else:
escoria.logger.warn( escoria.logger.warn(
self, self,

View File

@@ -58,8 +58,11 @@ signal tooltip_size_updated
# Connect relevant functions # Connect relevant functions
func _ready(): func _ready():
escoria.main.connect("room_ready", self, "_on_room_ready") if escoria.main.connect("room_ready", self, "_on_room_ready") != 0:
escoria.action_manager.connect("action_changed", self, "_on_action_selected") escoria.logger.error(self, "Error connecting room_ready with _on_room_ready")
if escoria.action_manager.connect("action_changed", self, "_on_action_selected") != 0:
escoria.logger.error(self, "Error connecting action_changed with _on_action_selected")
# Set the color of the label # Set the color of the label

View File

@@ -86,7 +86,7 @@ func _ready():
escoria.action_manager = ESCActionManagerMonkey.new() escoria.action_manager = ESCActionManagerMonkey.new()
if $tooltip_layer/tooltip.connect("tooltip_size_updated", self, "update_tooltip_following_mouse_position", [tooltip_node]) != 0: if $tooltip_layer/tooltip.connect("tooltip_size_updated", self, "update_tooltip_following_mouse_position", [tooltip_node]) != 0:
escoria.logger.error(self, "Error connecting tooltip_size_updated") escoria.logger.error(self, "Error connecting tooltip_size_updated with update_tooltip_following_mouse_position")
func _enter_tree(): func _enter_tree():
var room_selector_parent = $CanvasLayer/ui/HBoxContainer/VBoxContainer var room_selector_parent = $CanvasLayer/ui/HBoxContainer/VBoxContainer
@@ -419,6 +419,9 @@ func correctPosition(tooltip: ESCRichTooltip, size: Vector2, mouse_position: Vec
func _on_event_done(return_code: int, _event_name: String): func _on_event_done(return_code: int, _event_name: String):
escoria.logger.info(self, "EVENT DONE! code=" + String(return_code)) escoria.logger.info(self, "EVENT DONE! code=" + String(return_code))
# Reset mouse cursor (should be not needed, but avoids not resetting the cursor on bugs)
Input.set_custom_mouse_cursor(null)
# Show tooltips, they were hidden while performing action # Show tooltips, they were hidden while performing action
$tooltip_layer/tooltip.update_tooltip_text() $tooltip_layer/tooltip.update_tooltip_text()

View File

@@ -6,7 +6,7 @@ play_snd res://game/sfx/sounds/doorOpen_2.ogg
change_scene "res://gymkhana/rooms/interior_cocina/interior_cocina.tscn" change_scene "res://gymkhana/rooms/interior_cocina/interior_cocina.tscn"
:action3 bombona2 :action3 bombona2
say player "He usado la 'bombona' con la puerta" say player "¿Cómo se usa una bómbona con una puerta?"
:action4 bombona2 :action4 bombona2
say player "No creo que les haga gracia" say player "No creo que les haga gracia"

View File

@@ -3,7 +3,8 @@ say current_player "Tiene pinta de que fuma"
:action2 :action2
> [whatsapp_blocked] > [whatsapp_blocked]
say current_player "Hola..." say current_player "Hola"
say current_player "..."
say current_player "No me escucha, parece que me tiene bloqueado" say current_player "No me escucha, parece que me tiene bloqueado"
stop stop