From 3dc880b18277e4587aeb167f1f831bc8f1b9bf48 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 11 Sep 2023 16:52:39 -0400 Subject: Use static item/location IDs --- Archipelago/client.gd | 8 ++++---- Archipelago/load.gd | 41 +++++++++++++++++++---------------------- 2 files changed, 23 insertions(+), 26 deletions(-) (limited to 'Archipelago') diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 9f15506..068f300 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -588,16 +588,16 @@ func processItem(item, index, from, flags): if _item_id_to_name.has(item): item_name = _item_id_to_name[item] - if gamedata.door_ids_by_item_id.has(item_name): + if gamedata.door_ids_by_item_id.has(int(item)): var doorsNode = get_tree().get_root().get_node("Spatial/Doors") - for door_id in gamedata.door_ids_by_item_id[item_name]: + for door_id in gamedata.door_ids_by_item_id[int(item)]: doorsNode.get_node(door_id).openDoor() - if gamedata.painting_ids_by_item_id.has(item_name): + if gamedata.painting_ids_by_item_id.has(int(item)): var real_parent_node = get_tree().get_root().get_node("Spatial/Decorations/Paintings") var fake_parent_node = get_tree().get_root().get_node_or_null("Spatial/AP_Paintings") - for painting_id in gamedata.painting_ids_by_item_id[item_name]: + for painting_id in gamedata.painting_ids_by_item_id[int(item)]: var painting_node = real_parent_node.get_node_or_null(painting_id) if painting_node != null: painting_node.movePainting() diff --git a/Archipelago/load.gd b/Archipelago/load.gd index 876910b..d2977dd 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd @@ -114,28 +114,25 @@ func _load(): var panels_parent = self.get_node("Panels") var location_script = ResourceLoader.load("user://maps/Archipelago/location.gd") for location_id in gamedata.panel_ids_by_location_id.keys(): - if apclient._location_name_to_id.has(location_id): - var location = location_script.new() - location.ap_id = int(apclient._location_name_to_id[location_id]) - location.name = "AP_location_%d" % location.ap_id - location.classification = gamedata.classification_by_location_id[location_id] - self.add_child(location) - - var panels = gamedata.panel_ids_by_location_id[location_id] - location.total = panels.size() - - for panel in panels: - var that_panel - if panel.begins_with("EndPanel"): - that_panel = self.get_node("Decorations").get_node(panel) - else: - that_panel = panels_parent.get_node(panel) - - that_panel.get_node("Viewport/GUI/Panel/TextEdit").connect( - "answer_correct", location, "handle_correct" - ) - else: - global._print("Could not find location ID for %s" % location_id) + var location = location_script.new() + location.ap_id = location_id + location.name = "AP_location_%d" % location.ap_id + location.classification = gamedata.classification_by_location_id[location_id] + self.add_child(location) + + var panels = gamedata.panel_ids_by_location_id[location_id] + location.total = panels.size() + + for panel in panels: + var that_panel + if panel.begins_with("EndPanel"): + that_panel = self.get_node("Decorations").get_node(panel) + else: + that_panel = panels_parent.get_node(panel) + + that_panel.get_node("Viewport/GUI/Panel/TextEdit").connect( + "answer_correct", location, "handle_correct" + ) # HOT CRUSTS should be at eye-level, have a yellow block behind it, and # not vanish when solved. -- cgit 1.4.1