ile-de-test/addons/waterways/gui/water_system_menu.gd
2024-01-26 21:00:32 +01:00

26 lines
637 B
GDScript

# Copyright © 2023 Kasper Arnklit Frandsen - MIT License
# See `LICENSE.md` included in the source distribution for details.
@tool
extends MenuButton
signal generate_system_maps
enum RIVER_MENU {
GENERATE_SYSTEM_MAPS
}
func _enter_tree() -> void:
get_popup().clear()
get_popup().connect("id_pressed", Callable(self, "_menu_item_selected"))
get_popup().add_item("Generate System Maps")
func _exit_tree() -> void:
get_popup().disconnect("id_pressed", Callable(self, "_menu_item_selected"))
func _menu_item_selected(index : int) -> void:
match index:
RIVER_MENU.GENERATE_SYSTEM_MAPS:
emit_signal("generate_system_maps")