diff --git a/Scenes/ActionPointList.gd b/Scenes/ActionPointList.gd index d516cdf8..1b1dd32f 100644 --- a/Scenes/ActionPointList.gd +++ b/Scenes/ActionPointList.gd @@ -14,26 +14,53 @@ func _ready(): func update_ap_list(): if is_inside_tree() == false: return # Fixes an annoying crash-on-exit. - clear() - - var count_ap = 0 - + + var action_points = [] for id in get_tree().get_nodes_in_group("ActionPoint"): if id.is_queued_for_deletion() == false: - add_item("Action Point " + str(id.pointNumber)) - count_ap += 1 + action_points.append(id) + action_points.sort_custom(self, "sort_action_points") + + var hero_gates = [] + for id in get_tree().get_nodes_in_group("Thing"): + if id.is_queued_for_deletion() == false: + if id.is_in_group("HeroGate"): + hero_gates.append(id) + hero_gates.sort_custom(self, "sort_hero_gates") - var lines = clamp(count_ap, 1, lines_to_show) + for id in action_points: + add_item("Action Point " + str(id.pointNumber)) + for id in hero_gates: + add_item("Hero Gate " + str(id.herogateNumber)) + + + var lines = clamp(action_points.size(), 1, lines_to_show) get_parent().get_parent().rect_min_size.y = 9 + (lines * item_height) + + yield(get_tree(),'idle_frame') + get_parent().set_deferred("scroll_vertical",1000000) + +func sort_action_points(a, b): + return a.pointNumber < b.pointNumber +func sort_hero_gates(a, b): + return a.herogateNumber < b.herogateNumber func _on_item_selected(idx): var txt = get_item_text(idx) - txt = txt.replace("Action Point ", "") - for id in get_tree().get_nodes_in_group("ActionPoint"): - if id.pointNumber == int(txt): - oInspector.inspect_something(id) + + if txt.begins_with("Action Point "): + txt = txt.replace("Action Point ", "") + for id in get_tree().get_nodes_in_group("ActionPoint"): + if id.pointNumber == int(txt): + oInspector.inspect_something(id) + elif txt.begins_with("Hero Gate "): + txt = txt.replace("Hero Gate ", "") + for id in get_tree().get_nodes_in_group("Thing"): + if id.is_in_group("HeroGate"): + if id.herogateNumber == int(txt): + oInspector.inspect_something(id) if is_instance_valid(oInspector.inspectingInstance): oCamera2D.center_camera_on_point(oInspector.inspectingInstance.position) diff --git a/Scenes/Inspector.gd b/Scenes/Inspector.gd index 4f2bb035..4c8a3e14 100644 --- a/Scenes/Inspector.gd +++ b/Scenes/Inspector.gd @@ -29,7 +29,8 @@ func set_inspector_instance(setval): if is_instance_valid(setval): setval.instance_was_selected() oPropertiesWindow.oPropertiesTabs.current_tab = 0 - if setval.is_in_group("ActionPoint"): + + if setval.is_in_group("ActionPoint") or setval.is_in_group("HeroGate"): pass else: oActionPointList.unselect_all() diff --git a/Scenes/Instances.gd b/Scenes/Instances.gd index 31f574b5..c364d8e0 100644 --- a/Scenes/Instances.gd +++ b/Scenes/Instances.gd @@ -563,7 +563,7 @@ func get_free_index_number(): func get_free_hero_gate_number(): var listOfHeroGateNumbers = [] for id in get_tree().get_nodes_in_group("Thing"): - if id.thingType == Things.TYPE.OBJECT and id.subtype == 49: # Hero gate + if id.is_in_group("HeroGate"): listOfHeroGateNumbers.append(id.herogateNumber) var newNumber = 1 @@ -594,7 +594,7 @@ func return_dungeon_heart(ownership): func return_hero_gate(number): for id in get_tree().get_nodes_in_group("Thing"): - if id.thingType == Things.TYPE.OBJECT and id.subtype == 49: # Hero gate + if id.is_in_group("HeroGate"): if id.herogateNumber == number: return id return null diff --git a/Scenes/ThingInstance.gd b/Scenes/ThingInstance.gd index f2e10d16..84e7e81c 100644 --- a/Scenes/ThingInstance.gd +++ b/Scenes/ThingInstance.gd @@ -5,6 +5,7 @@ onready var oInspector = Nodelist.list["oInspector"] onready var oInstances = Nodelist.list["oInstances"] onready var oThingDetails = Nodelist.list["oThingDetails"] onready var oPickThingWindow = Nodelist.list["oPickThingWindow"] +onready var oActionPointList = Nodelist.list["oActionPointList"] #onready var oSelection = $'../../Selector/Selection' #onready var oInstanceOwnership = $'../../OverheadOwnership/InstanceOwnership' @@ -70,6 +71,12 @@ func _enter_tree(): add_to_group("TreasuryGold") elif subtype in Things.LIST_OF_SPELLBOOKS: add_to_group("Spellbook") + elif subtype == 49: + add_to_group("HeroGate") + yield(get_tree(),'idle_frame') + if oActionPointList: + oActionPointList.update_ap_list() + Things.TYPE.CREATURE: add_to_group("Creature") var oCamera2D = Nodelist.list["oCamera2D"]