From 84f4fc2db8b7ada36faa5341cb7bee17750f1a07 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 8 Dec 2024 16:14:53 -0500 Subject: Add workaround for 0.5.1 number hunt logic bug --- Archipelago/client.gd | 16 ++++++++- Archipelago/extradata.gd | 84 ++++++++++++++++++++++++++++++++++++++++++++++++ Archipelago/load.gd | 14 ++++++++ 3 files changed, 113 insertions(+), 1 deletion(-) (limited to 'Archipelago') diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 8f9d3e0..99be37a 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -779,8 +779,14 @@ func processItem(item, index, from, flags): doorsNode.get_node(door_id).openDoor() if gamedata.panel_ids_by_item_id.has(int(item)): + var panel_ids = gamedata.panel_ids_by_item_id[int(item)] + if wasGeneratedOnVersion(0, 5, 1): + var extradata = get_node("Extradata") + if extradata.panels_mode_051_panel_fixes.has(int(item)): + panel_ids = extradata.panels_mode_051_panel_fixes[int(item)] + var panelsNode = get_tree().get_root().get_node("Spatial/Panels") - for panel_id in gamedata.panel_ids_by_item_id[int(item)]: + for panel_id in panel_ids: panelsNode.get_node(panel_id).get_node("AP_Panel").locked = false emit_signal("evaluate_solvability") @@ -990,3 +996,11 @@ func compareVersion(lhs, rhs): func wasGeneratedBeforeVersion(major, minor, build): return compareVersion(_gen_version, {"major": major, "minor": minor, "build": build}) + + +func wasGeneratedOnVersion(major, minor, build): + return ( + _gen_version["major"] == major + and _gen_version["minor"] == minor + and _gen_version["build"] == build + ) diff --git a/Archipelago/extradata.gd b/Archipelago/extradata.gd index 89c41d2..2e26eb2 100644 --- a/Archipelago/extradata.gd +++ b/Archipelago/extradata.gd @@ -93,3 +93,87 @@ var proxies = { "Open Areas/Panel_rise_horizon": ["Open Areas/Panel_son_horizon"], "Open Areas/Panel_son_sunrise": ["Open Areas/Panel_rise_sunrise"] } + +var panels_mode_051_panel_fixes = { + 444647: + [ + "Backside Room/Panel_three_three", + "Backside Room/Panel_three_three_2", + "Backside Room/Panel_three_three_3", + "Backside Room/Panel_four_four_3", + "Backside Room/Panel_four_four_2", + "Backside Room/Panel_four_four_4" + ], + 444648: + [ + "Backside Room/Panel_four_four", + "Backside Room/Panel_five_five_5", + "Backside Room/Panel_five_five_4" + ], + 444649: + [ + "Backside Room/Panel_five_five", + "Backside Room/Panel_five_five_3", + "Backside Room/Panel_five_five_2", + "Backside Room/Panel_six_six_4" + ], + 444650: + [ + "Backside Room/Panel_six_six", + "Backside Room/Panel_six_six_3", + "Backside Room/Panel_six_six_2", + "Backside Room/Panel_six_six_5", + "Backside Room/Panel_six_six_6", + "Backside Room/Panel_seven_seven_5", + "Backside Room/Panel_seven_seven_6" + ], + 444651: + [ + "Backside Room/Panel_seven_seven", + "Backside Room/Panel_seven_seven_2", + "Backside Room/Panel_seven_seven_7", + "Backside Room/Panel_seven_seven_3", + "Backside Room/Panel_seven_seven_4", + "Backside Room/Panel_eight_eight_8", + "Backside Room/Panel_eight_eight_5", + "Backside Room/Panel_eight_eight_3", + "Backside Room/Panel_eight_eight_7" + ], + 444652: + [ + "Backside Room/Panel_eight_eight", + "Backside Room/Panel_eight_eight_2", + "Backside Room/Panel_eight_eight_4", + "Backside Room/Panel_eight_eight_6", + "Backside Room/Panel_nine_nine_3", + "Backside Room/Panel_nine_nine_8", + "Backside Room/Panel_nine_nine_4", + "Backside Room/Panel_nine_nine_5", + "Backside Room/Panel_nine_nine_2" + ], + 444653: + [ + "Backside Room/Panel_nine_nine", + "Backside Room/Panel_nine_nine_6", + "Backside Room/Panel_nine_nine_8", + "Backside Room/Panel_nine_nine_9", + "Backside Room/Panel_nine_nine_7" + ] +} + +var panels_mode_051_door_fixes = { + "Door_four_hider": ["Door_four_hider_3", "Door_four_hider_4", "Door_four_hider_2"], + "Door_five_hider": ["Door_five_hider_4", "Door_five_hider_5"], + "Door_six_hider": ["Door_six_hider_4"], + "Door_seven_hider": ["Door_seven_hider_6", "Door_seven_hider_5"], + "Door_eight_hider": + ["Door_eight_hider_7", "Door_eight_hider_8", "Door_eight_hider_3", "Door_eight_hider_5"], + "Door_nine_hider": + [ + "Door_nine_hider_3", + "Door_nine_hider_8", + "Door_nine_hider_4", + "Door_nine_hider_5", + "Door_nine_hider_2" + ] +} diff --git a/Archipelago/load.gd b/Archipelago/load.gd index 4811b47..e593548 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd @@ -551,6 +551,20 @@ func _load(): proxynode.exact_proxy = true proxynode.request_ready() oldparent.add_child(proxynode) + + # If the world was generated on 0.5.1, apply the hotfix for the number hunt doors. + if apclient.wasGeneratedOnVersion(0, 5, 1): + var number_hunt_parent = get_node("Doors/Count Up Room Area Doors") + var extradata_051_fix = apclient.get_node("Extradata").panels_mode_051_door_fixes + for template_door_path in extradata_051_fix: + var template_door = number_hunt_parent.get_node(template_door_path) + var impacted_doors = extradata_051_fix[template_door_path] + for impacted_door_path in impacted_doors: + var impacted_door = number_hunt_parent.get_node(impacted_door_path) + var copied_door = impacted_door.duplicate() + copied_door.panels = template_door.panels + number_hunt_parent.add_child(copied_door) + impacted_door.queue_free() # Attach a script to every panel so that we can do things like conditionally # disable them. -- cgit 1.4.1