aboutsummaryrefslogtreecommitdiff
path: root/scripts/gui_turret_detail.gd
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gui_turret_detail.gd')
-rw-r--r--scripts/gui_turret_detail.gd37
1 files changed, 29 insertions, 8 deletions
diff --git a/scripts/gui_turret_detail.gd b/scripts/gui_turret_detail.gd
index df89c14..f895a6e 100644
--- a/scripts/gui_turret_detail.gd
+++ b/scripts/gui_turret_detail.gd
@@ -2,6 +2,7 @@ extends Panel
var hbox_labels
var hbox_global
+var _turret_holder : Node
var _turret_values : Resource = load("res://scenes/gui/gui_turret_values.tscn")
var load_turrets : Node
@@ -9,11 +10,14 @@ var gui : Control
func _fetch ():
if gui == null: gui = get_parent()
- if hbox_labels != null: return;
+ if load_turrets != null: return;
+
+ var root = get_tree().root.get_node("world")
+ _turret_holder = root.get_node("turrets")
+
hbox_labels = $"hbox_global/hbox_labels"
hbox_global = $"hbox_global"
- var root = get_tree().root.get_child(0)
load_turrets = root.get_node("saveload").get_node("load_turrets")
if !load_turrets.loaded: yield(load_turrets, "done_loading")
@@ -46,12 +50,29 @@ func _process(delta):
var info = null;
- var hovering = gui.bottom_bar.turret_picker.hovering
- if gui.player.highlight != null:
- info = gui.player.highlight.info
- elif gui.player.sel.type == "turrets":
- info = load_turrets.info[gui.player.sel.name]
- elif hovering != "":
+ var hovering = null
+ if gui.control.state == Globals.PlayerState.PICK and \
+ gui.control.statetype == Globals.StateType.TURRET and \
+ gui.bottom_bar.picker.hovering != "":
+ hovering = gui.bottom_bar.picker.hovering
+
+ var highlight = null
+ if gui.control.state == Globals.PlayerState.EDIT and \
+ gui.control.statetype == Globals.StateType.TURRET:
+ var turret_name = gui.control.editing_turret
+ highlight = _turret_holder.get_node(turret_name)
+
+ var placing = null
+ if gui.control.state == Globals.PlayerState.PLACE and \
+ gui.control.statetype == Globals.StateType.TURRET and \
+ gui.control.selected != "":
+ placing = gui.control.selected
+
+ if highlight != null:
+ info = highlight.info
+ elif placing != null:
+ info = load_turrets.info[placing]
+ elif hovering != null:
info = load_turrets.info[hovering]
elif gui.player.placer.colliding \
and "turrets" in gui.player.placer.colliding_group: