17 lines
488 B
GDScript
17 lines
488 B
GDScript
extends Button
|
|
|
|
|
|
var reagent: Reagent
|
|
|
|
func _ready() -> void:
|
|
text = reagent.substance.get_formula()
|
|
|
|
func _on_button_down() -> void:
|
|
var scene = reagent.storage.instantiate()
|
|
if scene is DraggableObject:
|
|
scene.dragged = true
|
|
scene.mouse_in = true
|
|
scene.get_node("SubstanceData").substance = reagent.substance
|
|
get_tree().current_scene.add_child(scene)
|
|
var camera = get_viewport().get_camera_3d()
|
|
scene.global_position = camera.project_position(get_global_mouse_position(),1.8)
|