From af26521d3da603d81641eed0d9d03ff72d298460 Mon Sep 17 00:00:00 2001 From: Dennis Ploeger Date: Thu, 21 Oct 2021 21:56:25 +0200 Subject: [PATCH] feat: Rewrote inventory handling basing on ESCItems (#417) Co-authored-by: Dennis Ploeger --- .../design/esc_inventory_item.svg | 27 ----- addons/escoria-core/design/icons.sketch | Bin 14814 -> 11267 bytes .../game/core-scripts/esc_inventory_item.gd | 96 ++-------------- .../game/core-scripts/esc_item.gd | 36 +++--- .../game/scenes/inventory/inventory_ui.gd | 22 ++-- .../library/inventory/esc_inventory_button.gd | 107 ++++++++++++++++++ .../inventory/esc_inventory_container.gd | 31 +++++ addons/escoria-core/plugin.gd | 10 ++ .../inventory/inventory_ui.tscn | 6 +- .../inventory/inventory_ui_container.gd | 39 ------- .../inventory/inventory_ui.tscn | 2 +- .../inventory/inventory_ui_container.gd | 37 ------ game/items/{escitems => inventory}/bottle.esc | 0 game/items/inventory/bottle.tscn | 13 --- .../{escitems => inventory}/empty_sheet.esc | 0 .../items => items/inventory}/empty_sheet.png | Bin game/items/inventory/empty_sheet.tscn | 14 --- .../{escitems => inventory}/filled_sheet.esc | 0 .../inventory}/filled_sheet.png | Bin game/items/inventory/filled_sheet.tscn | 14 --- game/items/{escitems => inventory}/pen.esc | 0 .../room05/items => items/inventory}/pen.png | Bin game/items/inventory/pen.tscn | 14 --- .../r5_empty_sheet.tscn | 11 +- .../r5_filled_sheet.tscn | 9 +- .../items/{escitems => inventory}/r5_pen.tscn | 11 +- .../{escitems => inventory}/r5_wrench.tscn | 11 +- .../{escitems => inventory}/r9_bottle.tscn | 7 +- game/items/{escitems => inventory}/wrench.esc | 2 +- .../items => items/inventory}/wrench.png | Bin game/items/inventory/wrench.tscn | 14 --- game/rooms/room05/room05.tscn | 12 +- game/rooms/room09/closet/magical_closet.tscn | 2 + game/rooms/room09/room09.tscn | 9 +- project.godot | 23 +++- 35 files changed, 244 insertions(+), 335 deletions(-) delete mode 100644 addons/escoria-core/design/esc_inventory_item.svg create mode 100644 addons/escoria-core/library/inventory/esc_inventory_button.gd create mode 100644 addons/escoria-core/library/inventory/esc_inventory_container.gd delete mode 100644 addons/escoria-ui-9verbs/inventory/inventory_ui_container.gd delete mode 100644 addons/escoria-ui-simplemouse/inventory/inventory_ui_container.gd rename game/items/{escitems => inventory}/bottle.esc (100%) delete mode 100644 game/items/inventory/bottle.tscn rename game/items/{escitems => inventory}/empty_sheet.esc (100%) rename game/{rooms/room05/items => items/inventory}/empty_sheet.png (100%) delete mode 100644 game/items/inventory/empty_sheet.tscn rename game/items/{escitems => inventory}/filled_sheet.esc (100%) rename game/{rooms/room05/items => items/inventory}/filled_sheet.png (100%) delete mode 100644 game/items/inventory/filled_sheet.tscn rename game/items/{escitems => inventory}/pen.esc (100%) rename game/{rooms/room05/items => items/inventory}/pen.png (100%) delete mode 100644 game/items/inventory/pen.tscn rename game/items/{escitems => inventory}/r5_empty_sheet.tscn (69%) rename game/items/{escitems => inventory}/r5_filled_sheet.tscn (71%) rename game/items/{escitems => inventory}/r5_pen.tscn (68%) rename game/items/{escitems => inventory}/r5_wrench.tscn (68%) rename game/items/{escitems => inventory}/r9_bottle.tscn (78%) rename game/items/{escitems => inventory}/wrench.esc (86%) rename game/{rooms/room05/items => items/inventory}/wrench.png (100%) delete mode 100644 game/items/inventory/wrench.tscn diff --git a/addons/escoria-core/design/esc_inventory_item.svg b/addons/escoria-core/design/esc_inventory_item.svg deleted file mode 100644 index a043c53a8..000000000 --- a/addons/escoria-core/design/esc_inventory_item.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - esc_inventory_item - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/addons/escoria-core/design/icons.sketch b/addons/escoria-core/design/icons.sketch index c3ef66466820c9644594de76168a12d4e7ee0e22..7db211c6a9f92f2d29917a3289ac6cd75fa36c39 100644 GIT binary patch delta 10181 zcmZ9yWl)_>(5{QSySuXpZoxIUySuylgS#)>U4n(+65QQw;hF@8U?G8%cYo*9K6_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dWha_&b_!<|T_&Sb>h~@5lC`XMCgyipc)Ox=Ju~xS zVk0ZR6kM{Zhg+6%sPNuzg?hgx106+dO(Gf->6*dg7!5f0^UgLV@$^RG>Ytf!M(KIT z(|-wcL6s=_#Vl#Qn0O3tS$|pDi0_|d#Hu9LD=8M^hZZfaUp*WDw^0~RlOH)h)In8Zc0@? z8Lk0^_0RJX^SruIO39xgp*XU?2%k|AzfIo|FV~y$8)USq&eVZZeR|XKEHHbVF*g@* zT&oPMwF!>lgKbLA`nm-fKypX%m(7!yjI;M#*6nFgi3jK6 zU}BS5V?@2?duz>ouEaPPh@s2kFv|QLxZnz6^dMukt{Zh&Z8iu2PGS;k)j1{ku8@v& z|9&yOAoeiJsT_-=#|539uVhOa6qJ(ZHA8+*Ho<=g&%`tk=QXhC@w#k)8vr#fK!VgW9WSTwK znVhy)nXk`tqb#$@LpIVsOcyArD3Opyr-bl7ev?XgrBj9cXVsRVLXQnjNS9zuPeAzpufqNb m{)aCE0F!hHxqlu0n|=S~&;Q=|zv`ADVTqm!I)LXN!~X$4+)-@+ diff --git a/addons/escoria-core/game/core-scripts/esc_inventory_item.gd b/addons/escoria-core/game/core-scripts/esc_inventory_item.gd index bc0b19040..fb0b8ed4c 100644 --- a/addons/escoria-core/game/core-scripts/esc_inventory_item.gd +++ b/addons/escoria-core/game/core-scripts/esc_inventory_item.gd @@ -1,95 +1,15 @@ -# The inventory representation of an ESC item if pickable -extends TextureButton -class_name ESCInventoryItem, \ - "res://addons/escoria-core/design/esc_inventory_item.svg" - - -# Signal emitted when the item was left clicked -# -# #### Parameters -# -# - item_id: Global ID of the clicked item -signal mouse_left_inventory_item(item_id) - -# Signal emitted when the item was right clicked -# -# #### Parameters -# -# - item_id: Global ID of the clicked item -signal mouse_right_inventory_item(item_id) - -# Signal emitted when the item was double clicked -# -# #### Parameters -# -# - item_id: Global ID of the clicked item -signal mouse_double_left_inventory_item(item_id) - -# Signal emitted when the item was focused -# -# #### Parameters -# -# - item_id: Global ID of the clicked item -signal inventory_item_focused(item_id) - -# Signal emitted when the item is not focused anymore -signal inventory_item_unfocused() +# Basic information about an inventory item +class_name ESCInventoryItem # Global ID of the ESCItem that uses this ESCInventoryItem -# Will be set by ESCItem automatically -var global_id - - -# Connect input handlers -func _ready(): - connect("gui_input", self, "_on_inventory_item_gui_input") - connect("mouse_entered", self, "_on_inventory_item_mouse_enter") - connect("mouse_exited", self, "_on_inventory_item_mouse_exit") - - -# Handle the gui input and emit the respective signals -# -# #### Parameters -# -# - event: The event received -func _on_inventory_item_gui_input(event: InputEvent): - if InputMap.has_action("switch_action_verb") \ - and event.is_action_pressed("switch_action_verb"): - if event.button_index == BUTTON_WHEEL_UP: - escoria.inputs_manager._on_mousewheel_action(-1) - elif event.button_index == BUTTON_WHEEL_DOWN: - escoria.inputs_manager._on_mousewheel_action(1) - if event is InputEventMouseButton: -# var p = get_global_mouse_position() - if event.doubleclick: - if event.button_index == BUTTON_LEFT: - emit_signal( - "mouse_double_left_inventory_item", - global_id, - event - ) - else: - if event.is_pressed(): - if event.button_index == BUTTON_LEFT: - emit_signal( - "mouse_left_inventory_item", - global_id, - event - ) - if event.button_index == BUTTON_RIGHT: - emit_signal( - "mouse_right_inventory_item", - global_id, - event - ) +var global_id: String = "" +# The texture for the item +var texture: Texture = null -# Handle mouse entering the item and send the respecitve signal -func _on_inventory_item_mouse_enter(): - emit_signal("inventory_item_focused", global_id) +func _init(p_item: ESCItem) -> void: + global_id = p_item.global_id + texture = p_item._get_inventory_texture() -# Handle mouse leaving the item and send the respecitve signal -func _on_inventory_item_mouse_exit(): - emit_signal("inventory_item_unfocused") diff --git a/addons/escoria-core/game/core-scripts/esc_item.gd b/addons/escoria-core/game/core-scripts/esc_item.gd index d8f67b2f8..9712dece0 100644 --- a/addons/escoria-core/game/core-scripts/esc_item.gd +++ b/addons/escoria-core/game/core-scripts/esc_item.gd @@ -103,9 +103,9 @@ export(bool) var combine_is_one_way = false # A false value is useful for items in the background, such as buttons. export(bool) var use_from_inventory_only = false -# Scene based on ESCInventoryItem used in inventory for the object if it is -# picked up, that displays and handles the item -export(PackedScene) var inventory_item_scene_file: PackedScene +# The visual representation for this item when its in the inventory +export(Texture) var inventory_texture: Texture = null \ + setget ,_get_inventory_texture # Color used for dialogs export(Color) var dialog_color = ColorN("white") @@ -124,25 +124,22 @@ export(float) var v_speed_damp: float = 1.0 export(NodePath) var animation_player_node: NodePath = "" \ setget _set_animation_player_node + # ESCAnimationsResource (for walking, idling...) var animations: ESCAnimationResource # Reference to the animation node (null if none was found) var animation_sprite = null -# Reference to the sprite node -var _sprite_node: Node = null - # Reference to the current terrain var terrain: ESCTerrain # Reference to this items collision shape node var collision: Node -# The representation of this item in the scene. Will -# be loaded, if inventory_item_scene_file is set. -var inventory_item: ESCInventoryItem = null setget ,_get_inventory_item +# Reference to the sprite node +var _sprite_node: Node = null # The movable subnode var _movable: ESCMovable = null @@ -464,15 +461,6 @@ func _update_terrain(rc: int, event_name: String) -> void: _movable.update_terrain(event_name) -# Get inventory item from the inventory item scene -# **Returns** The inventory item of this ESCitem -func _get_inventory_item() -> ESCInventoryItem: - if not inventory_item and inventory_item_scene_file: - inventory_item = inventory_item_scene_file.instance() - inventory_item.global_id = self.global_id - return inventory_item - - func _get_property_list(): var properties = [] properties.append({ @@ -505,3 +493,15 @@ func _set_animation_player_node(node_path: NodePath): ) animation_player_node = node_path + + +# Returns either the set inventory texture or the texture of a TextureRect +# found as a child if it is null +func _get_inventory_texture() -> Texture: + if inventory_texture == null: + for c in get_children(): + if c is TextureRect or c is Sprite: + return c.texture + return null + else: + return inventory_texture diff --git a/addons/escoria-core/game/scenes/inventory/inventory_ui.gd b/addons/escoria-core/game/scenes/inventory/inventory_ui.gd index c0e9d2e04..c44d4c24e 100644 --- a/addons/escoria-core/game/scenes/inventory/inventory_ui.gd +++ b/addons/escoria-core/game/scenes/inventory/inventory_ui.gd @@ -64,25 +64,26 @@ func add_new_item_by_id(item_id: String) -> void: "Check item's id in ESCORIA_ALL_ITEMS scene." ] ) - var item_inventory_button = ( - escoria.object_manager.get_object(item_id).node as ESCItem - ).inventory_item.duplicate() - item_inventory_button.global_id = item_id - items_ids_in_inventory[item_id] = item_inventory_button - get_node(inventory_ui_container).add_item(item_inventory_button) + + var inventory_item = ESCInventoryItem.new( + escoria.object_manager.get_object(item_id).node + ) + var inventory_item_button = get_node( + inventory_ui_container + ).add_item(inventory_item) + + items_ids_in_inventory[item_id] = inventory_item if not escoria.object_manager.has(item_id): escoria.object_manager.register_object( ESCObject.new( item_id, - item_inventory_button + inventory_item_button ), true ) - item_inventory_button.visible = true - - escoria.inputs_manager.register_inventory_item(item_inventory_button) + escoria.inputs_manager.register_inventory_item(inventory_item_button) # remove item fromInventory UI using its id set in its scene @@ -117,7 +118,6 @@ func remove_item_by_id(item_id: String) -> void: ) get_node(inventory_ui_container).remove_item(item_inventory_button) - item_inventory_button.queue_free() items_ids_in_inventory.erase(item_id) diff --git a/addons/escoria-core/library/inventory/esc_inventory_button.gd b/addons/escoria-core/library/inventory/esc_inventory_button.gd new file mode 100644 index 000000000..d9c08a5d8 --- /dev/null +++ b/addons/escoria-core/library/inventory/esc_inventory_button.gd @@ -0,0 +1,107 @@ +# The inventory representation of an ESC item if pickable (only used by +# the inventory components) +extends TextureButton +class_name ESCInventoryButton + + +# Signal emitted when the item was left clicked +# +# #### Parameters +# +# - item_id: Global ID of the clicked item +signal mouse_left_inventory_item(item_id) + +# Signal emitted when the item was right clicked +# +# #### Parameters +# +# - item_id: Global ID of the clicked item +signal mouse_right_inventory_item(item_id) + +# Signal emitted when the item was double clicked +# +# #### Parameters +# +# - item_id: Global ID of the clicked item +signal mouse_double_left_inventory_item(item_id) + +# Signal emitted when the item was focused +# +# #### Parameters +# +# - item_id: Global ID of the clicked item +signal inventory_item_focused(item_id) + +# Signal emitted when the item is not focused anymore +signal inventory_item_unfocused() + + +# Global ID of the ESCItem that uses this ESCInventoryItem +var global_id: String = "" + + +func _init(p_item: ESCInventoryItem) -> void: + global_id = p_item.global_id + texture_normal = p_item.texture + expand = true + stretch_mode = TextureButton.STRETCH_KEEP_ASPECT + + +func _process(_delta: float) -> void: + rect_size = ProjectSettings.get_setting("escoria/ui/inventory_item_size") + rect_min_size = ProjectSettings.get_setting( + "escoria/ui/inventory_item_size" + ) + +# Connect input handlers +func _ready(): + connect("gui_input", self, "_on_inventory_item_gui_input") + connect("mouse_entered", self, "_on_inventory_item_mouse_enter") + connect("mouse_exited", self, "_on_inventory_item_mouse_exit") + + +# Handle the gui input and emit the respective signals +# +# #### Parameters +# +# - event: The event received +func _on_inventory_item_gui_input(event: InputEvent): + if InputMap.has_action("switch_action_verb") \ + and event.is_action_pressed("switch_action_verb"): + if event.button_index == BUTTON_WHEEL_UP: + escoria.inputs_manager._on_mousewheel_action(-1) + elif event.button_index == BUTTON_WHEEL_DOWN: + escoria.inputs_manager._on_mousewheel_action(1) + if event is InputEventMouseButton: +# var p = get_global_mouse_position() + if event.doubleclick: + if event.button_index == BUTTON_LEFT: + emit_signal( + "mouse_double_left_inventory_item", + global_id, + event + ) + else: + if event.is_pressed(): + if event.button_index == BUTTON_LEFT: + emit_signal( + "mouse_left_inventory_item", + global_id, + event + ) + if event.button_index == BUTTON_RIGHT: + emit_signal( + "mouse_right_inventory_item", + global_id, + event + ) + + +# Handle mouse entering the item and send the respecitve signal +func _on_inventory_item_mouse_enter(): + emit_signal("inventory_item_focused", global_id) + + +# Handle mouse leaving the item and send the respecitve signal +func _on_inventory_item_mouse_exit(): + emit_signal("inventory_item_unfocused") diff --git a/addons/escoria-core/library/inventory/esc_inventory_container.gd b/addons/escoria-core/library/inventory/esc_inventory_container.gd new file mode 100644 index 000000000..13970380d --- /dev/null +++ b/addons/escoria-core/library/inventory/esc_inventory_container.gd @@ -0,0 +1,31 @@ +# Inventory container handler that acts as a base for UIs inventory containers +extends Control +class_name ESCInventoryContainer + + +# Get wether the inventory container currently is empty +# **Returns** Wether the container is empty or not +func is_empty() -> bool: + return get_child_count() > 0 + +# Add a new item into the container and return the control generated for it +# so its events can be handled by the inputs manager +# +# #### Parameters +# - inventory_item: Item to add +# **Returns** The button generated for the item +func add_item(inventory_item: ESCInventoryItem) -> ESCInventoryButton: + var button = ESCInventoryButton.new(inventory_item) + add_child(button) + return button + + +# Remove an item from the container +# +# #### Parameters +# - inventory_item: Item to remove +func remove_item(inventory_item: ESCInventoryItem): + for c in get_children(): + if c is ESCInventoryButton and c.global_id == inventory_item.global_id: + remove_child(c) + c.queue_free() diff --git a/addons/escoria-core/plugin.gd b/addons/escoria-core/plugin.gd index 842c7c6e5..411c92f24 100644 --- a/addons/escoria-core/plugin.gd +++ b/addons/escoria-core/plugin.gd @@ -98,6 +98,16 @@ func set_escoria_ui_settings(): "type": TYPE_STRING_ARRAY, "hint": PROPERTY_HINT_DIR }) + + if !ProjectSettings.has_setting("escoria/ui/inventory_item_size"): + ProjectSettings.set_setting( + "escoria/ui/inventory_item_size", + Vector2(72, 72) + ) + ProjectSettings.add_property_info({ + "name": "escoria/ui/inventory_item_size", + "type": TYPE_VECTOR2 + }) # Prepare the settings in the Escoria main category diff --git a/addons/escoria-ui-9verbs/inventory/inventory_ui.tscn b/addons/escoria-ui-9verbs/inventory/inventory_ui.tscn index 819eff21f..780109b97 100644 --- a/addons/escoria-ui-9verbs/inventory/inventory_ui.tscn +++ b/addons/escoria-ui-9verbs/inventory/inventory_ui.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=3 format=2] [ext_resource path="res://addons/escoria-core/game/scenes/inventory/inventory_ui.gd" type="Script" id=1] -[ext_resource path="res://addons/escoria-ui-9verbs/inventory/inventory_ui_container.gd" type="Script" id=3] +[ext_resource path="res://addons/escoria-core/library/inventory/esc_inventory_container.gd" type="Script" id=3] [node name="inventory_ui" type="PanelContainer"] margin_right = 600.0 @@ -17,10 +17,14 @@ margin_left = 7.0 margin_top = 7.0 margin_right = 593.0 margin_bottom = 168.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 [node name="GridContainer" type="GridContainer" parent="ScrollContainer"] margin_right = 586.0 +margin_bottom = 161.0 size_flags_horizontal = 3 +size_flags_vertical = 3 custom_constants/vseparation = 16 custom_constants/hseparation = 16 columns = 4 diff --git a/addons/escoria-ui-9verbs/inventory/inventory_ui_container.gd b/addons/escoria-ui-9verbs/inventory/inventory_ui_container.gd deleted file mode 100644 index 4bc3eee88..000000000 --- a/addons/escoria-ui-9verbs/inventory/inventory_ui_container.gd +++ /dev/null @@ -1,39 +0,0 @@ -extends Control - -""" -This script is totally user-defined. It does exactly what the user wants the -inventory to look like. It only requires 4 functions to be defined: - - is_empty() -> bool - - get_items() -> Array - - add_item(inventory_item: ESCInventoryItem) - - remove_item(inventory_item: ESCInventoryItem) -The user is free to implement these methods the way s-he likes. -""" - -var current_nodes_in_container = {} - -func is_empty() -> bool: - return get_child_count() > 0 - -func get_items() -> Array: - return current_nodes_in_container.keys() - -func add_item(inventory_item: ESCInventoryItem): - var center_container = CenterContainer.new() - center_container.size_flags_horizontal = SIZE_EXPAND_FILL - center_container.connect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter") - center_container.connect("mouse_exited", inventory_item, "_on_inventory_item_mouse_exit") -# center_container.connect("gui_input", self, "_on_gui_input", [inventory_item]) - center_container.add_child(inventory_item) - add_child(center_container) - current_nodes_in_container[inventory_item] = center_container - -func remove_item(inventory_item: ESCInventoryItem): - var node_to_remove = current_nodes_in_container[inventory_item] - current_nodes_in_container.erase(node_to_remove) - node_to_remove.disconnect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter") - node_to_remove.disconnect("mouse_exited", inventory_item, "_on_inventory_item_mouse_exit") -# node_to_remove.disconnect("pressed", self, "_on_gui_input") - remove_child(node_to_remove) - node_to_remove.queue_free() - diff --git a/addons/escoria-ui-simplemouse/inventory/inventory_ui.tscn b/addons/escoria-ui-simplemouse/inventory/inventory_ui.tscn index 0009a7158..ce2967d50 100644 --- a/addons/escoria-ui-simplemouse/inventory/inventory_ui.tscn +++ b/addons/escoria-ui-simplemouse/inventory/inventory_ui.tscn @@ -2,7 +2,7 @@ [ext_resource path="res://addons/escoria-ui-simplemouse/inventory/inventory_ui.gd" type="Script" id=1] [ext_resource path="res://addons/escoria-ui-simplemouse/images/inventory_bg.png" type="Texture" id=2] -[ext_resource path="res://addons/escoria-ui-simplemouse/inventory/inventory_ui_container.gd" type="Script" id=3] +[ext_resource path="res://addons/escoria-core/library/inventory/esc_inventory_container.gd" type="Script" id=3] [ext_resource path="res://addons/escoria-ui-simplemouse/images/frame.png" type="Texture" id=5] [ext_resource path="res://addons/escoria-ui-simplemouse/images/inventory_icon.png" type="Texture" id=6] diff --git a/addons/escoria-ui-simplemouse/inventory/inventory_ui_container.gd b/addons/escoria-ui-simplemouse/inventory/inventory_ui_container.gd deleted file mode 100644 index 422693a58..000000000 --- a/addons/escoria-ui-simplemouse/inventory/inventory_ui_container.gd +++ /dev/null @@ -1,37 +0,0 @@ -extends Control - -""" -This script is totally user-defined. It does exactly what the user wants the -inventory to look like. It only requires 4 functions to be defined: - - is_empty() -> bool - - get_items() -> Array - - add_item(inventory_item: ESCInventoryItem) - - remove_item(inventory_item: ESCInventoryItem) -The user is free to implement these methods the way s-he likes. -""" - -var current_nodes_in_container = {} - -func is_empty() -> bool: - return get_child_count() > 0 - -func get_items() -> Array: - return current_nodes_in_container.keys() - -func add_item(inventory_item: ESCInventoryItem): - var center_container = CenterContainer.new() - center_container.size_flags_horizontal = SIZE_EXPAND_FILL - center_container.connect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter") - center_container.connect("mouse_exited", inventory_item, "_on_inventory_item_mouse_exit") - center_container.add_child(inventory_item) - add_child(center_container) - current_nodes_in_container[inventory_item] = center_container - -func remove_item(inventory_item: ESCInventoryItem): - var node_to_remove = current_nodes_in_container[inventory_item] - current_nodes_in_container.erase(node_to_remove) - node_to_remove.disconnect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter") - node_to_remove.disconnect("mouse_exited", inventory_item, "_on_inventory_item_mouse_exit") - remove_child(node_to_remove) - node_to_remove.queue_free() - diff --git a/game/items/escitems/bottle.esc b/game/items/inventory/bottle.esc similarity index 100% rename from game/items/escitems/bottle.esc rename to game/items/inventory/bottle.esc diff --git a/game/items/inventory/bottle.tscn b/game/items/inventory/bottle.tscn deleted file mode 100644 index f4a3d8747..000000000 --- a/game/items/inventory/bottle.tscn +++ /dev/null @@ -1,13 +0,0 @@ -[gd_scene load_steps=3 format=2] - -[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_inventory_item.gd" type="Script" id=1] -[ext_resource path="res://game/items/textures/genericItem_color_127.png" type="Texture" id=2] - -[node name="bottle" type="TextureButton"] -margin_right = 50.0 -margin_bottom = 140.0 -texture_normal = ExtResource( 2 ) -script = ExtResource( 1 ) -__meta__ = { -"_edit_use_anchors_": false -} diff --git a/game/items/escitems/empty_sheet.esc b/game/items/inventory/empty_sheet.esc similarity index 100% rename from game/items/escitems/empty_sheet.esc rename to game/items/inventory/empty_sheet.esc diff --git a/game/rooms/room05/items/empty_sheet.png b/game/items/inventory/empty_sheet.png similarity index 100% rename from game/rooms/room05/items/empty_sheet.png rename to game/items/inventory/empty_sheet.png diff --git a/game/items/inventory/empty_sheet.tscn b/game/items/inventory/empty_sheet.tscn deleted file mode 100644 index 92987f9aa..000000000 --- a/game/items/inventory/empty_sheet.tscn +++ /dev/null @@ -1,14 +0,0 @@ -[gd_scene load_steps=3 format=2] - -[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_inventory_item.gd" type="Script" id=1] -[ext_resource path="res://game/items/textures/genericItem_color_038.png" type="Texture" id=2] - -[node name="empty_sheet" type="TextureButton"] -margin_right = 98.0 -margin_bottom = 124.0 -texture_normal = ExtResource( 2 ) -script = ExtResource( 1 ) -__meta__ = { -"_edit_use_anchors_": false -} -global_id = "r5_empty_sheet" diff --git a/game/items/escitems/filled_sheet.esc b/game/items/inventory/filled_sheet.esc similarity index 100% rename from game/items/escitems/filled_sheet.esc rename to game/items/inventory/filled_sheet.esc diff --git a/game/rooms/room05/items/filled_sheet.png b/game/items/inventory/filled_sheet.png similarity index 100% rename from game/rooms/room05/items/filled_sheet.png rename to game/items/inventory/filled_sheet.png diff --git a/game/items/inventory/filled_sheet.tscn b/game/items/inventory/filled_sheet.tscn deleted file mode 100644 index f594e9dd1..000000000 --- a/game/items/inventory/filled_sheet.tscn +++ /dev/null @@ -1,14 +0,0 @@ -[gd_scene load_steps=3 format=2] - -[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_inventory_item.gd" type="Script" id=1] -[ext_resource path="res://game/rooms/room05/items/filled_sheet.png" type="Texture" id=2] - -[node name="filled_sheet" type="TextureButton"] -margin_right = 88.0 -margin_bottom = 124.0 -texture_normal = ExtResource( 2 ) -script = ExtResource( 1 ) -__meta__ = { -"_edit_use_anchors_": false -} -global_id = "r5_filled_sheet" diff --git a/game/items/escitems/pen.esc b/game/items/inventory/pen.esc similarity index 100% rename from game/items/escitems/pen.esc rename to game/items/inventory/pen.esc diff --git a/game/rooms/room05/items/pen.png b/game/items/inventory/pen.png similarity index 100% rename from game/rooms/room05/items/pen.png rename to game/items/inventory/pen.png diff --git a/game/items/inventory/pen.tscn b/game/items/inventory/pen.tscn deleted file mode 100644 index 05f7fafeb..000000000 --- a/game/items/inventory/pen.tscn +++ /dev/null @@ -1,14 +0,0 @@ -[gd_scene load_steps=3 format=2] - -[ext_resource path="res://game/items/textures/genericItem_color_026.png" type="Texture" id=1] -[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_inventory_item.gd" type="Script" id=2] - -[node name="pen" type="TextureButton"] -margin_right = 42.0 -margin_bottom = 74.0 -texture_normal = ExtResource( 1 ) -script = ExtResource( 2 ) -__meta__ = { -"_edit_use_anchors_": false -} -global_id = "r5_pen" diff --git a/game/items/escitems/r5_empty_sheet.tscn b/game/items/inventory/r5_empty_sheet.tscn similarity index 69% rename from game/items/escitems/r5_empty_sheet.tscn rename to game/items/inventory/r5_empty_sheet.tscn index 9308e8bcd..6c028c992 100644 --- a/game/items/escitems/r5_empty_sheet.tscn +++ b/game/items/inventory/r5_empty_sheet.tscn @@ -1,23 +1,24 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=4 format=2] -[ext_resource path="res://game/items/inventory/empty_sheet.tscn" type="PackedScene" id=1] [ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=2] -[ext_resource path="res://game/rooms/room05/items/empty_sheet.png" type="Texture" id=3] +[ext_resource path="res://game/items/inventory/empty_sheet.png" type="Texture" id=3] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 86.9568, 115.211 ) [node name="empty_sheet" type="Area2D"] +pause_mode = 1 script = ExtResource( 2 ) global_id = "r5_empty_sheet" -esc_script = "res://game/items/escitems/empty_sheet.esc" +esc_script = "res://game/items/inventory/empty_sheet.esc" tooltip_name = "Empty sheet" default_action = "look" default_action_inventory = "look" combine_if_action_used_among = PoolStringArray( "use", "give" ) use_from_inventory_only = true -inventory_item_scene_file = ExtResource( 1 ) +inventory_texture = ExtResource( 3 ) dialog_color = Color( 1, 1, 1, 1 ) +animations = null [node name="sprite" type="Sprite" parent="."] texture = ExtResource( 3 ) diff --git a/game/items/escitems/r5_filled_sheet.tscn b/game/items/inventory/r5_filled_sheet.tscn similarity index 71% rename from game/items/escitems/r5_filled_sheet.tscn rename to game/items/inventory/r5_filled_sheet.tscn index a67fd85ca..d0fd4144b 100644 --- a/game/items/escitems/r5_filled_sheet.tscn +++ b/game/items/inventory/r5_filled_sheet.tscn @@ -1,22 +1,25 @@ [gd_scene load_steps=4 format=2] [ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=1] -[ext_resource path="res://game/items/inventory/filled_sheet.tscn" type="PackedScene" id=2] +[ext_resource path="res://game/items/inventory/filled_sheet.png" type="Texture" id=3] [sub_resource type="RectangleShape2D" id=1] [node name="filled_sheet" type="Area2D"] +pause_mode = 1 script = ExtResource( 1 ) global_id = "r5_filled_sheet" -esc_script = "res://game/items/escitems/filled_sheet.esc" +esc_script = "res://game/items/inventory/filled_sheet.esc" tooltip_name = "Filled sheet" combine_if_action_used_among = PoolStringArray( "use", "give" ) combine_is_one_way = true use_from_inventory_only = true -inventory_item_scene_file = ExtResource( 2 ) +inventory_texture = ExtResource( 3 ) dialog_color = Color( 1, 1, 1, 1 ) +animations = null [node name="sprite" type="Sprite" parent="."] +texture = ExtResource( 3 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource( 1 ) diff --git a/game/items/escitems/r5_pen.tscn b/game/items/inventory/r5_pen.tscn similarity index 68% rename from game/items/escitems/r5_pen.tscn rename to game/items/inventory/r5_pen.tscn index 26241fe74..007cebff7 100644 --- a/game/items/escitems/r5_pen.tscn +++ b/game/items/inventory/r5_pen.tscn @@ -1,23 +1,24 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=4 format=2] -[ext_resource path="res://game/rooms/room05/items/pen.png" type="Texture" id=1] -[ext_resource path="res://game/items/inventory/pen.tscn" type="PackedScene" id=2] +[ext_resource path="res://game/items/inventory/pen.png" type="Texture" id=1] [ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=3] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 51.8881, 43.8187 ) [node name="pen" type="Area2D"] +pause_mode = 1 script = ExtResource( 3 ) global_id = "r5_pen" -esc_script = "res://game/items/escitems/pen.esc" +esc_script = "res://game/items/inventory/pen.esc" tooltip_name = "Pen" default_action = "look" default_action_inventory = "look" combine_if_action_used_among = PoolStringArray( "use", "give" ) use_from_inventory_only = true -inventory_item_scene_file = ExtResource( 2 ) +inventory_texture = ExtResource( 1 ) dialog_color = Color( 1, 1, 1, 1 ) +animations = null [node name="sprite" type="Sprite" parent="."] texture = ExtResource( 1 ) diff --git a/game/items/escitems/r5_wrench.tscn b/game/items/inventory/r5_wrench.tscn similarity index 68% rename from game/items/escitems/r5_wrench.tscn rename to game/items/inventory/r5_wrench.tscn index fe42232ad..2d8687e94 100644 --- a/game/items/escitems/r5_wrench.tscn +++ b/game/items/inventory/r5_wrench.tscn @@ -1,23 +1,24 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=4 format=2] -[ext_resource path="res://game/items/inventory/wrench.tscn" type="PackedScene" id=1] [ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=2] -[ext_resource path="res://game/rooms/room05/items/wrench.png" type="Texture" id=3] +[ext_resource path="res://game/items/inventory/wrench.png" type="Texture" id=3] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 44.696, 49.0953 ) [node name="wrench" type="Area2D"] +pause_mode = 1 script = ExtResource( 2 ) global_id = "r5_wrench" -esc_script = "res://game/items/escitems/wrench.esc" +esc_script = "res://game/items/inventory/wrench.esc" tooltip_name = "Wrench" default_action = "look" default_action_inventory = "look" combine_if_action_used_among = PoolStringArray( "use" ) use_from_inventory_only = true -inventory_item_scene_file = ExtResource( 1 ) +inventory_texture = ExtResource( 3 ) dialog_color = Color( 1, 1, 1, 1 ) +animations = null [node name="sprite" type="Sprite" parent="."] texture = ExtResource( 3 ) diff --git a/game/items/escitems/r9_bottle.tscn b/game/items/inventory/r9_bottle.tscn similarity index 78% rename from game/items/escitems/r9_bottle.tscn rename to game/items/inventory/r9_bottle.tscn index b50e21936..851e39e99 100644 --- a/game/items/escitems/r9_bottle.tscn +++ b/game/items/inventory/r9_bottle.tscn @@ -1,7 +1,6 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://game/items/textures/genericItem_color_127.png" type="Texture" id=1] -[ext_resource path="res://game/items/inventory/bottle.tscn" type="PackedScene" id=2] [ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=3] [sub_resource type="RectangleShape2D" id=1] @@ -12,13 +11,13 @@ pause_mode = 1 z_index = 1 script = ExtResource( 3 ) global_id = "r9_bottle" -esc_script = "res://game/items/escitems/bottle.esc" +esc_script = "res://game/items/inventory/bottle.esc" tooltip_name = "Bottle" default_action = "pickup" default_action_inventory = "look" combine_if_action_used_among = PoolStringArray( "use" ) use_from_inventory_only = true -inventory_item_scene_file = ExtResource( 2 ) +inventory_texture = ExtResource( 1 ) dialog_color = Color( 1, 1, 1, 1 ) animations = null diff --git a/game/items/escitems/wrench.esc b/game/items/inventory/wrench.esc similarity index 86% rename from game/items/escitems/wrench.esc rename to game/items/inventory/wrench.esc index 8d8286c70..90ba4a05f 100755 --- a/game/items/escitems/wrench.esc +++ b/game/items/inventory/wrench.esc @@ -4,7 +4,7 @@ say player "It seems even more useful now that I picked it up." [i/r5_wrench] stop :pickup -set_global i/r5_wrench true +inventory_add r5_wrench set_active r5_wrench false diff --git a/game/rooms/room05/items/wrench.png b/game/items/inventory/wrench.png similarity index 100% rename from game/rooms/room05/items/wrench.png rename to game/items/inventory/wrench.png diff --git a/game/items/inventory/wrench.tscn b/game/items/inventory/wrench.tscn deleted file mode 100644 index daf92142a..000000000 --- a/game/items/inventory/wrench.tscn +++ /dev/null @@ -1,14 +0,0 @@ -[gd_scene load_steps=3 format=2] - -[ext_resource path="res://game/items/textures/genericItem_color_004.png" type="Texture" id=1] -[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_inventory_item.gd" type="Script" id=2] - -[node name="wrench" type="TextureButton"] -margin_right = 70.0 -margin_bottom = 88.0 -texture_normal = ExtResource( 1 ) -script = ExtResource( 2 ) -__meta__ = { -"_edit_use_anchors_": false -} -global_id = "r5_wrench" diff --git a/game/rooms/room05/room05.tscn b/game/rooms/room05/room05.tscn index 668f5dbe1..0000b3814 100644 --- a/game/rooms/room05/room05.tscn +++ b/game/rooms/room05/room05.tscn @@ -7,9 +7,9 @@ [ext_resource path="res://game/rooms/room05/item_wall/item_wall.tscn" type="PackedScene" id=5] [ext_resource path="res://addons/escoria-core/game/core-scripts/esc_room.gd" type="Script" id=6] [ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=7] -[ext_resource path="res://game/items/escitems/r5_wrench.tscn" type="PackedScene" id=8] -[ext_resource path="res://game/items/escitems/r5_empty_sheet.tscn" type="PackedScene" id=9] -[ext_resource path="res://game/items/escitems/r5_pen.tscn" type="PackedScene" id=10] +[ext_resource path="res://game/items/inventory/r5_wrench.tscn" type="PackedScene" id=8] +[ext_resource path="res://game/items/inventory/r5_empty_sheet.tscn" type="PackedScene" id=9] +[ext_resource path="res://game/items/inventory/r5_pen.tscn" type="PackedScene" id=10] [ext_resource path="res://addons/escoria-core/game/core-scripts/esc_location.gd" type="Script" id=11] [sub_resource type="NavigationPolygon" id=1] @@ -140,24 +140,18 @@ __meta__ = { } [node name="wrench" parent="Hotspots" instance=ExtResource( 8 )] -pause_mode = 1 position = Vector2( 257.269, 435.892 ) interaction_direction = 2 -animations = null [node name="Position2D" type="Position2D" parent="Hotspots/wrench"] position = Vector2( -77.4207, 0 ) script = ExtResource( 11 ) [node name="pen" parent="Hotspots" instance=ExtResource( 10 )] -pause_mode = 1 position = Vector2( 909.908, 443.451 ) -animations = null [node name="empty_sheet" parent="Hotspots" instance=ExtResource( 9 )] -pause_mode = 1 position = Vector2( 1059.84, 440.932 ) -animations = null [node name="player_start" type="Position2D" parent="."] position = Vector2( 76.7617, 437.649 ) diff --git a/game/rooms/room09/closet/magical_closet.tscn b/game/rooms/room09/closet/magical_closet.tscn index 8779fe146..ddf833e89 100644 --- a/game/rooms/room09/closet/magical_closet.tscn +++ b/game/rooms/room09/closet/magical_closet.tscn @@ -85,9 +85,11 @@ tracks/2/keys = { } [node name="closet" type="Area2D"] +pause_mode = 1 script = ExtResource( 1 ) default_action = "use" dialog_color = Color( 1, 1, 1, 1 ) +animations = null [node name="base" type="Line2D" parent="."] position = Vector2( 1.12247, 0 ) diff --git a/game/rooms/room09/room09.tscn b/game/rooms/room09/room09.tscn index 853d12f4f..6bc3e1094 100644 --- a/game/rooms/room09/room09.tscn +++ b/game/rooms/room09/room09.tscn @@ -10,7 +10,7 @@ [ext_resource path="res://game/rooms/room02/button/button.tscn" type="PackedScene" id=8] [ext_resource path="res://game/rooms/room09/r_door.tscn" type="PackedScene" id=9] [ext_resource path="res://game/items/textures/genericItem_color_127.png" type="Texture" id=10] -[ext_resource path="res://game/items/escitems/r9_bottle.tscn" type="PackedScene" id=11] +[ext_resource path="res://game/items/inventory/r9_bottle.tscn" type="PackedScene" id=11] [ext_resource path="res://addons/escoria-core/game/core-scripts/esc_location.gd" type="Script" id=12] [sub_resource type="NavigationPolygon" id=1] @@ -95,12 +95,10 @@ position = Vector2( 1198.65, 391.058 ) script = ExtResource( 12 ) [node name="r9_closet_left" parent="Hotspots" instance=ExtResource( 5 )] -pause_mode = 1 position = Vector2( 435.233, 64.1518 ) global_id = "r9_closet_left" esc_script = "res://game/rooms/room09/esc/closet_left.esc" tooltip_name = "Left closet" -animations = null [node name="Position2D" type="Position2D" parent="Hotspots/r9_closet_left"] position = Vector2( 69.9246, 318.898 ) @@ -118,12 +116,10 @@ position = Vector2( -26.727, 543.448 ) script = ExtResource( 12 ) [node name="r9_closet_middle" parent="Hotspots" instance=ExtResource( 5 )] -pause_mode = 1 position = Vector2( 572.963, 65.2113 ) global_id = "r9_closet_middle" esc_script = "res://game/rooms/room09/esc/closet_middle.esc" tooltip_name = "Middle closet" -animations = null [node name="Position2D" type="Position2D" parent="Hotspots/r9_closet_middle"] position = Vector2( 65.6867, 317.839 ) @@ -141,12 +137,10 @@ position = Vector2( -26.727, 543.448 ) script = ExtResource( 12 ) [node name="r9_closet_right" parent="Hotspots" instance=ExtResource( 5 )] -pause_mode = 1 position = Vector2( 710.693, 66.2707 ) global_id = "r9_closet_right" esc_script = "res://game/rooms/room09/esc/closet_right.esc" tooltip_name = "Right closet" -animations = null [node name="Position2D" type="Position2D" parent="Hotspots/r9_closet_right"] position = Vector2( 64.6273, 316.779 ) @@ -194,6 +188,7 @@ esc_script = "res://game/rooms/room09/esc/stand.esc" interaction_direction = 2 tooltip_name = "Stand" default_action = "look" +inventory_texture = ExtResource( 10 ) dialog_color = Color( 1, 1, 1, 1 ) animations = null diff --git a/project.godot b/project.godot index 30a33ed0c..6f95b9c54 100644 --- a/project.godot +++ b/project.godot @@ -215,6 +215,16 @@ _global_script_classes=[ { "path": "res://addons/escoria-core/game/scenes/inventory/inventory_ui.gd" }, { "base": "TextureButton", +"class": "ESCInventoryButton", +"language": "GDScript", +"path": "res://addons/escoria-core/library/inventory/esc_inventory_button.gd" +}, { +"base": "Control", +"class": "ESCInventoryContainer", +"language": "GDScript", +"path": "res://addons/escoria-core/library/inventory/esc_inventory_container.gd" +}, { +"base": "Reference", "class": "ESCInventoryItem", "language": "GDScript", "path": "res://addons/escoria-core/game/core-scripts/esc_inventory_item.gd" @@ -546,7 +556,9 @@ _global_script_class_icons={ "ESCGroup": "", "ESCInputsManager": "", "ESCInventory": "", -"ESCInventoryItem": "res://addons/escoria-core/design/esc_inventory_item.svg", +"ESCInventoryButton": "", +"ESCInventoryContainer": "", +"ESCInventoryItem": "", "ESCInventoryManager": "", "ESCItem": "res://addons/escoria-core/design/esc_item.svg", "ESCLocation": "res://addons/escoria-core/design/esc_location.svg", @@ -637,7 +649,7 @@ search_in_file_extensions=PoolStringArray( "gd", "shader", "esc" ) [editor_plugins] -enabled=PoolStringArray( "res://addons/escoria-core/plugin.cfg", "res://addons/escoria-ui-simplemouse/plugin.cfg" ) +enabled=PoolStringArray( "res://addons/escoria-core/plugin.cfg", "res://addons/escoria-ui-9verbs/plugin.cfg" ) [escoria] @@ -646,7 +658,7 @@ main/force_quit=true debug/terminate_on_warnings=false debug/terminate_on_errors=true debug/development_lang="en" -ui/tooltip_follows_mouse=true +ui/tooltip_follows_mouse=false ui/default_dialog_scene="res://game/ui/commons/dialogs/dialog_label.tscn" main/text_lang="fr_FR" main/voice_lang="fr_FR" @@ -658,13 +670,13 @@ main/command_directories=[ "res://addons/escoria-core/game/core-scripts/esc/comm debug/log_level="DEBUG" platform/skip_cache=false platform/skip_cache.mobile=true -ui/items_autoregister_path="res://game/items/escitems/" +ui/items_autoregister_path="res://game/items/inventory" main/game_version="0.1.0" main/savegames_path="res://saves/" main/settings_path="user://" main/escoria_version="" sound/speech_enabled=1 -ui/game_scene="res://addons/escoria-ui-simplemouse/game.tscn" +ui/game_scene="res://addons/escoria-ui-9verbs/game.tscn" ui/dialogs_chooser="res://game/ui/commons/dialogs/text_dialog_choice.tscn" sound/speech_folder="res://game/speech" sound/speech_extension="ogg" @@ -672,6 +684,7 @@ ui/default_transition="curtain" ui/transition_paths=[ "res://addons/escoria-core/game/scenes/transitions/shaders/" ] ui/main_menu_scene="res://game/ui/commons/main_menu/main_menu.tscn" ui/pause_menu_scene="res://game/ui/commons/pause_menu/pause_menu.tscn" +ui/inventory_item_size=Vector2( 72, 72 ) [input]