diff --git a/gymkhana/addons/escoria-ui-return-monkey-island/esc_item_with_tooltip.gd b/gymkhana/addons/escoria-ui-return-monkey-island/esc_item_with_tooltip.gd index 50cfeecb..618b3ae0 100644 --- a/gymkhana/addons/escoria-ui-return-monkey-island/esc_item_with_tooltip.gd +++ b/gymkhana/addons/escoria-ui-return-monkey-island/esc_item_with_tooltip.gd @@ -28,6 +28,11 @@ export(Array) var target_when_selected_action_is_in = [] # If item is countable (E.g. money) marks the quantity export(int) var count = 0 +# ESCItemComponents children of this node +var components: Dictionary = {} + +var custom_data: Dictionary = {} + # If item is countable (E.g. money) marks which texture to use depending of count value. # Each element is a Dictionary with start and texture keys: # [ @@ -96,13 +101,13 @@ func _input(event): if(!active): highlight(false) - func has_component(key: String)->bool: - return components.has(key) +func has_component(key: String)->bool: + return components.has(key) - func get_component(key: String): - if(has_component(key)): - return components[key] - return null +func get_component(key: String): + if(has_component(key)): + return components[key] + return null func register_components(): for child in get_children(): @@ -110,4 +115,3 @@ func register_components(): child = child as ESCItemComponent components[child.get_component_type()] = child child.register(custom_data) - \ No newline at end of file diff --git a/project.godot b/project.godot index 8110f636..c40307ff 100644 --- a/project.godot +++ b/project.godot @@ -284,6 +284,11 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://addons/escoria-core/game/core-scripts/esc_item.gd" }, { +"base": "Node", +"class": "ESCItemComponent", +"language": "GDScript", +"path": "res://gymkhana/addons/escoria-ui-return-monkey-island/item_components/ESCItemComponent.gd" +}, { "base": "Resource", "class": "ESCItemCountManager", "language": "GDScript", @@ -785,6 +790,7 @@ _global_script_class_icons={ "ESCInventoryItem": "", "ESCInventoryManager": "", "ESCItem": "res://addons/escoria-core/design/esc_item.svg", +"ESCItemComponent": "", "ESCItemCountManager": "", "ESCItemWithTooltip": "res://addons/escoria-core/design/esc_item.svg", "ESCLocation": "res://addons/escoria-core/design/esc_location.svg",