extends ColorRect var key var clicked = false @onready var texture_rect: TextureRect = $TextureRect var hover_tween func _on_mouse_handler_clicked() -> void: clicked = true if hover_tween: hover_tween.kill() hover_tween = create_tween() hover_tween.set_ease(Tween.EASE_OUT) hover_tween.set_trans(Tween.TRANS_BACK) hover_tween.tween_property(self, "scale", Vector2.ONE * 0.95, 0.25) func _on_mouse_handler_hovered() -> void: if hover_tween: hover_tween.kill() hover_tween = create_tween() hover_tween.set_ease(Tween.EASE_OUT) hover_tween.set_trans(Tween.TRANS_BACK) hover_tween.tween_property(self, "scale", Vector2.ONE * 1.05, 0.25) func _on_mouse_handler_unhovered() -> void: if clicked: #Triggerer.trigger("drag_building", { "key": key }) Persister.persist_data("drag_mode", true) Persister.persist_data("building_mode", true) Persister.persist_data("building_key", key) clicked = false if hover_tween: hover_tween.kill() hover_tween = create_tween() hover_tween.set_ease(Tween.EASE_OUT) hover_tween.set_trans(Tween.TRANS_QUAD) hover_tween.tween_property(self, "scale", Vector2.ONE, 0.25) func _on_mouse_handler_released() -> void: if clicked: #Triggerer.trigger("select_building", { "key": key }) Persister.persist_data("drag_mode", false) Persister.persist_data("building_mode", true) Persister.persist_data("building_key", key) clicked = false if hover_tween: hover_tween.kill() hover_tween = create_tween() hover_tween.set_ease(Tween.EASE_OUT) hover_tween.set_trans(Tween.TRANS_BACK) hover_tween.tween_property(self, "scale", Vector2.ONE, 0.25)