class_name Holdable extends Node ## Component for holdable elements @export var hold_distance := 1.0 @export var controller: RigidBody3D func _ready() -> void: if not controller: controller = get_parent() as RigidBody3D assert(controller, "Holdable %s must be a child of a RigidBody3D" % str(self)) controller.add_user_signal(Interactive.SELECT_SIGNAL) controller.connect(Interactive.SELECT_SIGNAL, select) controller.add_user_signal(Interactive.ACTIVATE_SIGNAL) controller.connect(Interactive.ACTIVATE_SIGNAL, activate) func select() -> void: Player.instance.hud.hold_hud.select_prop() func activate() -> void: if not Player.instance.hold_component.holding_object(): Player.instance.hold_component.attach(controller, hold_distance)