Merge branch 'gymkhana/main' of git.fosil.eu:gymkhana/gymkhana into gymkhana/main
This commit is contained in:
@@ -12,4 +12,5 @@ var texture: Texture = null
|
||||
func _init(p_item: ESCItem) -> void:
|
||||
global_id = p_item.global_id
|
||||
texture = p_item._get_inventory_texture()
|
||||
p_item.register_components()
|
||||
|
||||
|
||||
@@ -68,6 +68,8 @@ func _ready():
|
||||
##outline.offset = Vector2(1,1)
|
||||
collision.add_child(outline)
|
||||
outline.hide()
|
||||
register_components()
|
||||
|
||||
|
||||
func _process(_delta) -> void:
|
||||
if(is_interactive == false):
|
||||
@@ -93,3 +95,19 @@ func _input(event):
|
||||
elif (event.is_action_released("ui_show_hints")):
|
||||
if(!active):
|
||||
highlight(false)
|
||||
|
||||
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 register_components():
|
||||
for child in get_children():
|
||||
if(child is ESCItemComponent):
|
||||
child = child as ESCItemComponent
|
||||
components[child.get_component_type()] = child
|
||||
child.register(custom_data)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
extends Node
|
||||
class_name ESCItemComponent
|
||||
|
||||
var _custom_data: Dictionary
|
||||
|
||||
func get_global_id():
|
||||
return self.get_parent().global_id
|
||||
|
||||
func get_component_type():
|
||||
pass
|
||||
|
||||
func register(custom_data: Dictionary):
|
||||
pass
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user