diff options
author | jacopograndi <jacopo.grandi@outlook.it> | 2022-01-16 17:14:36 +0100 |
---|---|---|
committer | jacopograndi <jacopo.grandi@outlook.it> | 2022-01-16 17:14:36 +0100 |
commit | 5781b7dad68c3e01d83365f73b0d35d9e5252f97 (patch) | |
tree | dada65ab375ed8287b33e6ffe023f5df5e666d24 /scripts/gui_bottom_bar.gd | |
parent | 8e5358aaefa1df729ffc02047e53b62705d6b3b1 (diff) |
control system
Diffstat (limited to 'scripts/gui_bottom_bar.gd')
-rw-r--r-- | scripts/gui_bottom_bar.gd | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/scripts/gui_bottom_bar.gd b/scripts/gui_bottom_bar.gd index 0a7b7b8..bd63a51 100644 --- a/scripts/gui_bottom_bar.gd +++ b/scripts/gui_bottom_bar.gd @@ -1,41 +1,41 @@ extends Control -var _in_editor : bool -var voxel_picker : Control -var map_tool_picker : Control -var turret_picker : Control - -var _load_turrets : Node +var editor_bar : Control +var picker : Control var gui : Control func _fetch (): if gui == null: gui = get_parent() - if voxel_picker == null: voxel_picker = $voxels - if map_tool_picker == null: map_tool_picker = $map_tools - if turret_picker == null: turret_picker = $turrets - - var root = get_tree().root.get_child(0) - if _load_turrets == null: - _load_turrets = root.get_node("saveload").get_node("load_turrets") - -func build (): - _fetch() - turret_picker.build(_load_turrets.get_base_turrets()) - voxel_picker.build() - map_tool_picker.build() + if editor_bar == null: editor_bar = $editor_bar + if picker == null: picker = $picker func refresh (in_editor : bool): _fetch() - _in_editor = in_editor - if _in_editor: - voxel_picker.visible = true - map_tool_picker.visible = true + if in_editor: + editor_bar.visible = true else: - voxel_picker.visible = false - map_tool_picker.visible = false + editor_bar.visible = false - turret_picker.refresh(gui.player.sel) - voxel_picker.refresh(gui.player.sel) - map_tool_picker.refresh(gui.player.sel) + picker.refresh() + +func _on_turrets_button_up(): + gui.control.do(Globals.PlayerActions.CHANGE_TYPE, + { "statetype": Globals.StateType.TURRET }) + +func _on_path_button_up(): + gui.control.do(Globals.PlayerActions.CHANGE_TYPE, + { "statetype": Globals.StateType.PATH }) + +func _on_attach_button_up(): + gui.control.do(Globals.PlayerActions.CHANGE_TYPE, + { "statetype": Globals.StateType.ATTACH }) + +func _on_voxel_button_up(): + gui.control.do(Globals.PlayerActions.CHANGE_TYPE, + { "statetype": Globals.StateType.VOXEL }) + +func _on_palette_button_up(): + gui.control.do(Globals.PlayerActions.CHANGE_TYPE, + { "statetype": Globals.StateType.VOXEL_PALETTE }) |