extends Node

var add_amount: float

func _on_interaction_interacted(with: DraggableObject) -> void:
	if with.is_in_group("flask"):
		var subs: RuntimeSubstanceData = RuntimeSubstanceData.new()
		subs.amount = add_amount
		subs.substance = $"../../SubstanceData".substance
		subs.temperature = 20
		subs.is_solution = subs.substance.is_solution
		with.get_node("%Inventory").add_substance(subs)
		$"../HBoxContainer/SpinBox".value = 0
		
		GuiSignalBus.push("В пробирку залито %s мг. %s" % [str(subs.amount),subs.substance.get_formula()])


func _on_progress_bar_value_changed(value: float) -> void:
	$"../HBoxContainer/SpinBox".set_value_no_signal(value)
	add_amount = value


func _on_spin_box_value_changed(value: float) -> void:
	$"../HBoxContainer/ProgressBar".set_value_no_signal(value)
	add_amount = value
