From e448f5b318f05cae1b40a949e11ef2d7fb613645 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 15 Apr 2024 11:39:52 -0400 Subject: Implemented panels mode door shuffle --- Archipelago/client.gd | 70 ++++++++++++++++++++++++++++++++++++++++++----- Archipelago/load.gd | 2 ++ Archipelago/panel.gd | 9 +++++- util/generate_gamedata.rb | 38 +++++++++++++++++++++++++ 4 files changed, 111 insertions(+), 8 deletions(-) diff --git a/Archipelago/client.gd b/Archipelago/client.gd index f15afe6..cafe2f9 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -21,7 +21,7 @@ const ap_version = {"major": 0, "minor": 4, "build": 5, "class": "Version"} const color_items = [ "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow" ] -const progressive_items = { +const door_progressive_items = { "Progressive Orange Tower": [ {"item": "Orange Tower - Second Floor", "display": "Second Floor"}, @@ -65,6 +65,40 @@ const progressive_items = { {"item": "The Colorful - Gray Door", "display": "Gray"}, ] } +const panel_progressive_items = { + "Progressive Hallway Room": + [ + {"item": "Hallway Room - First Room Panels", "display": "First Door"}, + {"item": "Hallway Room - Second Room Panels", "display": "Second Door"}, + {"item": "Hallway Room - Third Room Panels", "display": "Third Door"}, + {"item": "Hallway Room - WHEEL", "display": "Fourth Door"}, + ], + "Progressive Colorful": + [ + {"item": "The Colorful - BEGIN (Panel)", "display": "White"}, + {"item": "The Colorful - FOUND (Panel)", "display": "Black"}, + {"item": "The Colorful - LOAF (Panel)", "display": "Red"}, + {"item": "The Colorful - CREAM (Panel)", "display": "Yellow"}, + {"item": "The Colorful - SUN (Panel)", "display": "Blue"}, + {"item": "The Colorful - SPOON (Panel)", "display": "Purple"}, + {"item": "The Colorful - LETTERS (Panel)", "display": "Orange"}, + {"item": "The Colorful - WALLS (Panel)", "display": "Green"}, + {"item": "The Colorful - IRON (Panel)", "display": "Brown"}, + {"item": "The Colorful - OBSTACLE (Panel)", "display": "Gray"}, + ], + "Progressive Number Hunt": + [ + {"item": "Two Panels", "display": "Two"}, + {"item": "Three Panels", "display": "Three"}, + {"item": "Four Panels", "display": "Four"}, + {"item": "Five Panels", "display": "Five"}, + {"item": "Six Panels", "display": "Six"}, + {"item": "Seven Panels", "display": "Seven"}, + {"item": "Eight Panels", "display": "Eight"}, + {"item": "Nine Panels", "display": "Nine"}, + {"item": "Outside The Undeterred - ZERO (Panel)", "display": "Zero"}, + ] +} const kTHE_END = 0 const kTHE_MASTER = 1 @@ -109,6 +143,7 @@ var _localdata_file = "" var _death_link = false var _victory_condition = 0 # THE END, THE MASTER, LEVEL 2 var _door_shuffle = false +var _panel_door_shuffle = false var _color_shuffle = false var _panel_shuffle = 0 # none, rearrange var _painting_shuffle = false @@ -278,7 +313,8 @@ func _on_data(): if _slot_data.has("shuffle_colors"): _color_shuffle = _slot_data["shuffle_colors"] if _slot_data.has("shuffle_doors"): - _door_shuffle = (_slot_data["shuffle_doors"] > 0) + _door_shuffle = (_slot_data["shuffle_doors"] == 2) + _panel_door_shuffle = (_slot_data["shuffle_doors"] == 1) if _slot_data.has("shuffle_paintings"): _painting_shuffle = _slot_data["shuffle_paintings"] if _slot_data.has("shuffle_panels"): @@ -668,6 +704,12 @@ func processItem(item, index, from, flags): for door_id in gamedata.door_ids_by_item_id[int(item)]: doorsNode.get_node(door_id).openDoor() + if gamedata.panel_ids_by_item_id.has(int(item)): + var panelsNode = get_tree().get_root().get_node("Spatial/Panels") + for panel_id in gamedata.panel_ids_by_item_id[int(item)]: + panelsNode.get_node(panel_id).get_node("AP_Panel").locked = false + emit_signal("evaluate_solvability") + 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") @@ -683,12 +725,22 @@ func processItem(item, index, from, flags): painting_node.get_node("Script").movePainting() # Handle progressive items. - if item_name in progressive_items.keys(): + if _door_shuffle and item_name in door_progressive_items.keys(): + if not item_name in _progressive_progress: + _progressive_progress[item_name] = 0 + + if _progressive_progress[item_name] < door_progressive_items[item_name].size(): + var subitem_name = door_progressive_items[item_name][_progressive_progress[item_name]]["item"] + global._print(subitem_name) + processItem(_item_name_to_id[subitem_name], null, null, null) + _progressive_progress[item_name] += 1 + + if _panel_door_shuffle and item_name in panel_progressive_items.keys(): if not item_name in _progressive_progress: _progressive_progress[item_name] = 0 - if _progressive_progress[item_name] < progressive_items[item_name].size(): - var subitem_name = progressive_items[item_name][_progressive_progress[item_name]]["item"] + if _progressive_progress[item_name] < panel_progressive_items[item_name].size(): + var subitem_name = panel_progressive_items[item_name][_progressive_progress[item_name]]["item"] global._print(subitem_name) processItem(_item_name_to_id[subitem_name], null, null, null) _progressive_progress[item_name] += 1 @@ -704,8 +756,12 @@ func processItem(item, index, from, flags): _last_new_item = index saveLocaldata() - if item_name in progressive_items: - var subitem = progressive_items[item_name][_progressive_progress[item_name] - 1] + if _door_shuffle and item_name in door_progressive_items: + var subitem = door_progressive_items[item_name][_progressive_progress[item_name] - 1] + item_name += " (%s)" % subitem["display"] + + if _panel_door_shuffle and item_name in panel_progressive_items: + var subitem = panel_progressive_items[item_name][_progressive_progress[item_name] - 1] item_name += " (%s)" % subitem["display"] var player_name = "Unknown" diff --git a/Archipelago/load.gd b/Archipelago/load.gd index 566ee39..82f8e94 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd @@ -568,6 +568,8 @@ func _load(): var script_instance = panel_script.new() script_instance.name = "AP_Panel" script_instance.data = panel + if apclient._panel_door_shuffle and gamedata.mentioned_panels.has(panel["id"]): + script_instance.locked = true panel_node.add_child(script_instance) apclient.connect("evaluate_solvability", script_instance, "evaluate_solvability") diff --git a/Archipelago/panel.gd b/Archipelago/panel.gd index aec18e8..0e8f1df 100644 --- a/Archipelago/panel.gd +++ b/Archipelago/panel.gd @@ -5,6 +5,7 @@ var orig_text = "" var atbash_text = "" var orig_color = Color(0, 0, 0, 0) var solvable = true +var locked = false const kAtbashPre = "abcdefghijklmnopqrstuvwxyz1234567890+-" const kAtbashPost = "zyxwvutsrqponmlkjihgfedcba0987654321-+" @@ -45,7 +46,13 @@ func evaluate_solvability(): missing.append(color) solvable = false - if solvable: + if locked: + self.get_parent().get_node("Viewport/GUI/Panel/Label").text = "Locked" + self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").editable = false + self.get_parent().get_node("Quad").get_surface_material(0).albedo_color = Color( + 0.2, 0.7, 0.7 + ) + elif solvable: if effects.atbash_remaining > 0: self.get_parent().get_node("Viewport/GUI/Panel/Label").text = atbash_text else: diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index f63e062..a3f9ba5 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb @@ -11,14 +11,17 @@ CLASSIFICATION_INSANITY = 4 panel_to_id = {} door_groups = {} +panel_groups = {} panel_output = [] door_ids_by_item_id = {} painting_ids_by_item_id = {} +panel_ids_by_item_id = {} panel_ids_by_location_id = {} classification_by_location_id = {} mentioned_doors = Set[] mentioned_paintings = Set[] +mentioned_panels = Set[] painting_output = {} ids_config = YAML.load_file(idspath) @@ -155,6 +158,26 @@ config.each do |room_name, room_data| end end end + + if room_data.include? "panel_doors" + room_data["panel_doors"].each do |panel_door_name, panel_door| + item_id = ids_config["panel_doors"][room_name][panel_door_name] + + panel_ids_by_item_id[item_id] = panel_door["panels"].map do |panel_identifier| + other_room_name = (panel_identifier.kind_of? String) ? room_name : panel_identifier["room"] + other_panel_name = (panel_identifier.kind_of? String) ? panel_identifier : panel_identifier["panel"] + + config[other_room_name]["panels"][other_panel_name]["id"] + end + + mentioned_panels.merge(panel_ids_by_item_id[item_id]) + + if panel_door.include? "panel_group" + panel_groups[panel_door["panel_group"]] ||= Set[] + panel_groups[panel_door["panel_group"]].merge(panel_ids_by_item_id[item_id]) + end + end + end end door_groups.each do |group_name, door_ids| @@ -162,6 +185,11 @@ door_groups.each do |group_name, door_ids| door_ids_by_item_id[item_id] = door_ids.to_a end +panel_groups.each do |group_name, panel_ids| + item_id = ids_config["panel_groups"][group_name] + panel_ids_by_item_id[item_id] = panel_ids.to_a +end + File.open(outputpath, "w") do |f| f.write "extends Node\n\nvar panels = [" f.write(panel_output.map do |panel| @@ -175,6 +203,12 @@ File.open(outputpath, "w") do |f| "\"#{door_id}\"" end.join(",") + "]" end.join(",")) + f.write "}\nvar panel_ids_by_item_id = {" + f.write(panel_ids_by_item_id.map do |item_id, panel_ids| + "#{item_id}:[" + panel_ids.map do |panel_id| + "\"#{panel_id}\"" + end.join(",") + "]" + end.join(",")) f.write "}\nvar painting_ids_by_item_id = {" f.write(painting_ids_by_item_id.map do |item_id, painting_ids| "#{item_id}:[" + painting_ids.map do |painting_id| @@ -195,6 +229,10 @@ File.open(outputpath, "w") do |f| f.write(mentioned_paintings.map do |painting_id| "\"#{painting_id}\"" end.join(",")) + f.write "]\nvar mentioned_panels = [" + f.write(mentioned_panels.map do |panel_id| + "\"#{panel_id}\"" + end.join(",")) f.write "]\nvar paintings = {" f.write(painting_output.map do |painting_id, painting| "\"#{painting_id}\":{\"orientation\":\"#{painting["orientation"]}\",\"move\":#{painting.include? "move" and painting["move"]}}" -- cgit 1.4.1 From 49d7ff22aae922ef081bac1aa2a4b47b2b079166 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 15 Apr 2024 12:56:19 -0400 Subject: Backwards compatibility for games genned before panels mode options changes --- Archipelago/client.gd | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Archipelago/client.gd b/Archipelago/client.gd index cafe2f9..63c82f4 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -128,6 +128,7 @@ var _item_name_to_id = {} # LINGO only var _location_name_to_id = {} # LINGO only var _remote_version = {"major": 0, "minor": 0, "build": 0} +var _gen_version = {"major": 0, "minor": 0, "build": 0} # TODO: caching per MW/slot, reset between connections var _authenticated = false @@ -265,6 +266,7 @@ func _on_data(): if cmd == "RoomInfo": _seed = message["seed_name"] _remote_version = message["version"] + _gen_version = message["generator_version"] var needed_games = [] for game in message["datapackage_checksums"].keys(): @@ -313,8 +315,13 @@ func _on_data(): if _slot_data.has("shuffle_colors"): _color_shuffle = _slot_data["shuffle_colors"] if _slot_data.has("shuffle_doors"): - _door_shuffle = (_slot_data["shuffle_doors"] == 2) - _panel_door_shuffle = (_slot_data["shuffle_doors"] == 1) + # TODO: This assumes that panels mode will be releaed in 0.4.6, which is untrue. + if wasGeneratedBeforeVersion({"major": 0, "minor": 4, "build": 6}): + _door_shuffle = (_slot_data["shuffle_doors"] > 0) + _panel_door_shuffle = false + else: + _door_shuffle = (_slot_data["shuffle_doors"] == 2) + _panel_door_shuffle = (_slot_data["shuffle_doors"] == 1) if _slot_data.has("shuffle_paintings"): _painting_shuffle = _slot_data["shuffle_paintings"] if _slot_data.has("shuffle_panels"): @@ -831,3 +838,17 @@ func colorForItemType(flags): return "#d63a22" else: # filler return "#14de9e" + + +func compareVersion(lhs, rhs): + if lhs["major"] == rhs["major"]: + if lhs["minor"] == rhs["minor"]: + return lhs["build"] < rhs["build"] + else: + return lhs["minor"] < rhs["minor"] + else: + return lhs["major"] < rhs["major"] + + +func wasGeneratedBeforeVersion(rhs): + return compareVersion(_gen_version, rhs) -- cgit 1.4.1 From 4302e550cde189d8bc1d111e81270ed7960ad77c Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 16 Apr 2024 16:29:02 -0400 Subject: Better compatibility mode --- Archipelago/client.gd | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 63c82f4..6fe2cab 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -315,13 +315,12 @@ func _on_data(): if _slot_data.has("shuffle_colors"): _color_shuffle = _slot_data["shuffle_colors"] if _slot_data.has("shuffle_doors"): - # TODO: This assumes that panels mode will be releaed in 0.4.6, which is untrue. - if wasGeneratedBeforeVersion({"major": 0, "minor": 4, "build": 6}): - _door_shuffle = (_slot_data["shuffle_doors"] > 0) - _panel_door_shuffle = false - else: + if _slot_data.has("group_doors"): _door_shuffle = (_slot_data["shuffle_doors"] == 2) _panel_door_shuffle = (_slot_data["shuffle_doors"] == 1) + else: + _door_shuffle = (_slot_data["shuffle_doors"] > 0) + _panel_door_shuffle = false if _slot_data.has("shuffle_paintings"): _painting_shuffle = _slot_data["shuffle_paintings"] if _slot_data.has("shuffle_panels"): -- cgit 1.4.1 From 5c22b3c8d1268310553dd4ef78141dbf43d9da18 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 27 Apr 2024 12:15:48 -0400 Subject: Fixed panel progressive items --- Archipelago/client.gd | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 0944352..e5e930f 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -36,38 +36,11 @@ const door_progressive_items = { ["1 Sunwarp", "2 Sunwarp", "3 Sunwarp", "4 Sunwarp", "5 Sunwarp", "6 Sunwarp"] } const panel_progressive_items = { - "Progressive Hallway Room": - [ - {"item": "Hallway Room - First Room Panels", "display": "First Door"}, - {"item": "Hallway Room - Second Room Panels", "display": "Second Door"}, - {"item": "Hallway Room - Third Room Panels", "display": "Third Door"}, - {"item": "Hallway Room - WHEEL", "display": "Fourth Door"}, - ], + "Progressive Hallway Room": ["First Door", "Second Door", "Third Door", "Fourth Door"], "Progressive Colorful": - [ - {"item": "The Colorful - BEGIN (Panel)", "display": "White"}, - {"item": "The Colorful - FOUND (Panel)", "display": "Black"}, - {"item": "The Colorful - LOAF (Panel)", "display": "Red"}, - {"item": "The Colorful - CREAM (Panel)", "display": "Yellow"}, - {"item": "The Colorful - SUN (Panel)", "display": "Blue"}, - {"item": "The Colorful - SPOON (Panel)", "display": "Purple"}, - {"item": "The Colorful - LETTERS (Panel)", "display": "Orange"}, - {"item": "The Colorful - WALLS (Panel)", "display": "Green"}, - {"item": "The Colorful - IRON (Panel)", "display": "Brown"}, - {"item": "The Colorful - OBSTACLE (Panel)", "display": "Gray"}, - ], + ["White", "Black", "Red", "Yellow", "Blue", "Purple", "Orange", "Green", "Brown", "Gray"], "Progressive Number Hunt": - [ - {"item": "Two Panels", "display": "Two"}, - {"item": "Three Panels", "display": "Three"}, - {"item": "Four Panels", "display": "Four"}, - {"item": "Five Panels", "display": "Five"}, - {"item": "Six Panels", "display": "Six"}, - {"item": "Seven Panels", "display": "Seven"}, - {"item": "Eight Panels", "display": "Eight"}, - {"item": "Nine Panels", "display": "Nine"}, - {"item": "Outside The Undeterred - ZERO (Panel)", "display": "Zero"}, - ] + ["Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Zero"] } const kTHE_END = 0 -- cgit 1.4.1 From 60f8b6a0a1db6275453689a40d2432ec0f3ee0cb Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 27 Apr 2024 12:35:08 -0400 Subject: Fixed progressive item name display --- Archipelago/client.gd | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Archipelago/client.gd b/Archipelago/client.gd index e5e930f..c0b5366 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -722,16 +722,21 @@ func processItem(item, index, from, flags): var is_progressive_door = int(item) in gamedata.door_items_by_progressive_id var is_progressive_panel = int(item) in gamedata.panel_items_by_progressive_id var progitems = null + var prognames = null if is_progressive_door and is_progressive_panel: if _door_shuffle: progitems = gamedata.door_items_by_progressive_id[int(item)] + prognames = door_progressive_items else: progitems = gamedata.panel_items_by_progressive_id[int(item)] + prognames = panel_progressive_items elif is_progressive_door: progitems = gamedata.door_items_by_progressive_id[int(item)] + prognames = door_progressive_items elif is_progressive_panel: progitems = gamedata.panel_items_by_progressive_id[int(item)] + prognames = panel_progressive_items if progitems != null: if not int(item) in _progressive_progress: @@ -741,6 +746,7 @@ func processItem(item, index, from, flags): var subitem_id = progitems[_progressive_progress[int(item)]] global._print("Subitem: %d" % subitem_id) processItem(subitem_id, null, null, null) + item_name += " (%s)" % prognames[item_name][_progressive_progress[int(item)]] _progressive_progress[int(item)] += 1 if _color_shuffle and color_items.has(_item_id_to_name[item]): @@ -754,14 +760,6 @@ func processItem(item, index, from, flags): _last_new_item = index saveLocaldata() - if _door_shuffle and item_name in door_progressive_items: - var subitem = door_progressive_items[item_name][_progressive_progress[int(item)] - 1] - item_name += " (%s)" % subitem["display"] - - if _panel_door_shuffle and item_name in panel_progressive_items: - var subitem = panel_progressive_items[item_name][_progressive_progress[int(item)] - 1] - item_name += " (%s)" % subitem["display"] - var player_name = "Unknown" if _player_name_by_slot.has(from): player_name = _player_name_by_slot[from] -- cgit 1.4.1 From fad5732724e672735062502d94300c36551148de Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 29 Apr 2024 10:25:20 -0400 Subject: Added new progressive panel doors --- Archipelago/client.gd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Archipelago/client.gd b/Archipelago/client.gd index c0b5366..0f1c651 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -40,7 +40,9 @@ const panel_progressive_items = { "Progressive Colorful": ["White", "Black", "Red", "Yellow", "Blue", "Purple", "Orange", "Green", "Brown", "Gray"], "Progressive Number Hunt": - ["Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Zero"] + ["Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Zero"], + "Progressive Symmetry Room": ["Near Far", "Warts Straw", "Leaf Feel"], + "Progressive Suits Area": ["Words Sword", "Lost", "Amen Name"] } const kTHE_END = 0 -- cgit 1.4.1 From 0e10801d335a52d3e88ad02a5f3ff9784a53a119 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 1 May 2024 16:00:34 -0400 Subject: Prevent puzzle skipping locked panels --- Archipelago/panel.gd | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Archipelago/panel.gd b/Archipelago/panel.gd index 9d30455..ce632c5 100644 --- a/Archipelago/panel.gd +++ b/Archipelago/panel.gd @@ -40,25 +40,27 @@ func evaluate_solvability(): solvable = true var missing = [] - if apclient._color_shuffle: + if locked: + solvable = false + elif apclient._color_shuffle: for color in data["color"]: if not apclient._has_colors.has(color): missing.append(color) solvable = false - if locked: - self.get_parent().get_node("Viewport/GUI/Panel/Label").text = "Locked" - self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").editable = false - self.get_parent().get_node("Quad").get_surface_material(0).albedo_color = Color( - 0.2, 0.7, 0.7 - ) - elif solvable: + if solvable: if effects.atbash_remaining > 0: self.get_parent().get_node("Viewport/GUI/Panel/Label").text = atbash_text else: self.get_parent().get_node("Viewport/GUI/Panel/Label").text = orig_text self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").editable = true self.get_parent().get_node("Quad").get_surface_material(0).albedo_color = orig_color + elif locked: + self.get_parent().get_node("Viewport/GUI/Panel/Label").text = "Locked" + self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").editable = false + self.get_parent().get_node("Quad").get_surface_material(0).albedo_color = Color( + 0.2, 0.7, 0.7 + ) else: var missing_text = "Missing: " for thing in missing: -- cgit 1.4.1 From 9ef676bab06b08f12e6fc8c8e2b56db70cea5ac3 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 16 Jul 2024 14:01:49 -0400 Subject: Set beta version --- Archipelago/client.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 325418f..a990fa2 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -18,7 +18,7 @@ var enable_multiplayer = false var track_player = false var connection_history = [] -const my_version = "4.0.2" +const my_version = "panels-beta6" const ap_version = {"major": 0, "minor": 5, "build": 0, "class": "Version"} const color_items = [ "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow" -- cgit 1.4.1