From de5eb04ed014770558b546e02c91ce6eb262f652 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 28 Feb 2024 11:41:00 -0500 Subject: Fix sunwarp access --- util/generate_gamedata.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'util') diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index 1cce003..4c530f1 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb @@ -11,6 +11,7 @@ CLASSIFICATION_INSANITY = 4 panel_to_id = {} door_groups = {} +warp_groups = {} panel_output = [] door_ids_by_item_id = {} @@ -163,6 +164,11 @@ config.each do |room_name, room_data| internal_warp_ids = door["warp_id"] end + if door.include? "group" + warp_groups[door["group"]] ||= Set[] + warp_groups[door["group"]].merge(internal_warp_ids) + end + warp_ids_by_item_id[item_id] = internal_warp_ids mentioned_warps.merge(internal_warp_ids) end @@ -176,6 +182,11 @@ door_groups.each do |group_name, door_ids| door_ids_by_item_id[item_id] = door_ids.to_a end +warp_groups.each do |group_name, warp_ids| + item_id = ids_config["door_groups"][group_name] + warp_ids_by_item_id[item_id] = warp_ids.to_a +end + File.open(outputpath, "w") do |f| f.write "extends Node\n\nvar panels = [" f.write(panel_output.map do |panel| -- cgit 1.4.1 From c45ca7725a9d77f29e8675182c3aff7b661b5c40 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 2 Mar 2024 13:18:33 -0500 Subject: Added sunwarp shuffling --- Archipelago/client.gd | 6 +++++ Archipelago/load.gd | 64 +++++++++++++++++++++++++++++++++++++++++++++++ util/generate_gamedata.rb | 17 ++++++++++++- 3 files changed, 86 insertions(+), 1 deletion(-) (limited to 'util') diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 964c642..b3668d7 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -136,6 +136,8 @@ var _early_color_hallways = false var _pilgrimage_enabled = false var _pilgrimage_allows_roof_access = false var _pilgrimage_allows_paintings = false +var _sunwarp_shuffle = false +var _sunwarp_mapping = [] var _slot_seed = 0 var _map_loaded = false @@ -322,6 +324,10 @@ func _on_data(): _pilgrimage_allows_roof_access = _slot_data["pilgrimage_allows_roof_access"] if _slot_data.has("pilgrimage_allows_paintings"): _pilgrimage_allows_paintings = _slot_data["pilgrimage_allows_paintings"] + if _slot_data.has("shuffle_sunwarps"): + _sunwarp_shuffle = _slot_data["shuffle_sunwarps"] + if _slot_data.has("sunwarp_permutation"): + _sunwarp_mapping = _slot_data["sunwarp_permutation"] _puzzle_skips = 0 diff --git a/Archipelago/load.gd b/Archipelago/load.gd index bca0742..0750247 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd @@ -566,6 +566,58 @@ func _load(): terminator.add_child(terminator_shape) get_node("Decorations").add_child(terminator) + + if apclient._sunwarp_shuffle: + # Sunwarps 1 and 6 are rotated differently from the rest, so we have to fix that. + get_node("Decorations/Teleporter Windows/localmap").rotation_degrees.y = 0 + get_node("Decorations/Teleporter Windows/localmap2").rotation_degrees.y = 0 + get_node("Decorations/Teleporter Windows/localmap11").rotation_degrees.y = 0 + get_node("Decorations/Teleporter Windows/localmap12").rotation_degrees.y = 0 + get_node("Decorations/Teleporter Windows/localmap13").rotation_degrees.y = -90 + + get_node("Warps/Teleporter Warps/Sunwarp_enter_1").translation.x = 19.5 + get_node("Warps/Teleporter Warps/Sunwarp_exit_1").translation.x = -15.5 + get_node("Warps/Teleporter Warps/Sunwarp_enter_6").translation.x = 4.5 + get_node("Warps/Teleporter Warps/Sunwarp_exit_6").translation.x = -37.5 + get_node("Warps/Teleporter Warps/Sunwarp_exit_7").translation.z = 23.5 + + # Change the sunwarps in accordance with the mapping. + var sw_orig_translations = [] + var sw_text_translations = [] + var sw_text_rotations = [] + for i in range(1,7): + sw_orig_translations.append(get_node("Warps/Teleporter Warps/Sunwarp_enter_%d" % i).translation) + sw_text_translations.append(get_node("Decorations/Signs/Sunwarp Numbers/enter_%d" % i).translation) + sw_text_rotations.append(get_node("Decorations/Signs/Sunwarp Numbers/enter_%d" % i).rotation_degrees) + for i in range(1,7): + sw_orig_translations.append(get_node("Warps/Teleporter Warps/Sunwarp_exit_%d" % i).translation) + sw_text_translations.append(get_node("Decorations/Signs/Sunwarp Numbers/exit_%d" % i).translation) + sw_text_rotations.append(get_node("Decorations/Signs/Sunwarp Numbers/exit_%d" % i).rotation_degrees) + + var sw_enter_indicators = [4, 5, 6, 12, 7, 10] + for i in range(1,7): + get_node("Warps/Teleporter Warps/Sunwarp_enter_%d" % i).translation = sw_orig_translations[apclient._sunwarp_mapping[i-1]] + get_node("Warps/Teleporter Warps/Sunwarp_exit_%d" % i).translation = sw_orig_translations[apclient._sunwarp_mapping[i+5]] + + get_node("Decorations/Signs/Sunwarp Numbers/enter_%d" % i).translation = sw_text_translations[apclient._sunwarp_mapping[i-1]] + get_node("Decorations/Signs/Sunwarp Numbers/enter_%d" % i).rotation_degrees = sw_text_rotations[apclient._sunwarp_mapping[i-1]] + + get_node("Decorations/Signs/Sunwarp Numbers/exit_%d" % i).translation = sw_text_translations[apclient._sunwarp_mapping[i+5]] + get_node("Decorations/Signs/Sunwarp Numbers/exit_%d" % i).rotation_degrees = sw_text_rotations[apclient._sunwarp_mapping[i+5]] + + var enter_rot = _dir_to_int(gamedata.sunwarps[apclient._sunwarp_mapping[i-1]]["orientation"]) * 90 + var exit_rot = _dir_to_int(gamedata.sunwarps[apclient._sunwarp_mapping[i+5]]["orientation"]) * 90 + var final_rot = enter_rot - exit_rot + if final_rot < 0: + final_rot += 360 + get_node("Warps/Teleporter Warps/Sunwarp_enter_%d" % i).rotate = str(final_rot) + + var sw_enter_indicator_pos = gamedata.sunwarps[apclient._sunwarp_mapping[i-1]]["entrance_indicator_pos"] + var sw_enter_indicator = get_node("Decorations/Signs/Welcome Back Signs/Sign%d" % sw_enter_indicators[i-1]) + sw_enter_indicator.translation.x = sw_enter_indicator_pos[0] + sw_enter_indicator.translation.y = sw_enter_indicator_pos[1] + sw_enter_indicator.translation.z = sw_enter_indicator_pos[2] + sw_enter_indicator.rotation_degrees.y = (enter_rot * -1) + 180 # Create the effects node. var effects_script = apclient.SCRIPT_effects @@ -666,3 +718,15 @@ func set_small_gridmap_tile(x, y, z, tile): func archipelago_disconnected(reason): messages.showMessage(reason) + + +func _dir_to_int(dir): + if dir == "north": + return 0 + elif dir == "west": + return 1 + elif dir == "south": + return 2 + elif dir == "east": + return 3 + return 4 diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index 4c530f1..7674277 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb @@ -19,6 +19,7 @@ painting_ids_by_item_id = {} warp_ids_by_item_id = {} panel_ids_by_location_id = {} classification_by_location_id = {} +sunwarps = Array.new(12) {Hash.new} mentioned_doors = Set[] mentioned_paintings = Set[] mentioned_warps = Set[] @@ -91,6 +92,16 @@ config.each do |room_name, room_data| painting_output[painting["id"]] = painting end end + + if room_data.include? "sunwarps" + room_data["sunwarps"].each do |sunwarp| + index = sunwarp["dots"] - 1 + if sunwarp["direction"] == "exit" then + index += 6 + end + sunwarps[index] = sunwarp + end + end end config.each do |room_name, room_data| @@ -238,5 +249,9 @@ File.open(outputpath, "w") do |f| f.write(classification_by_location_id.map do |location_id, classification| "#{location_id}:#{classification}" end.join(",")) - f.write "}" + f.write "}\nvar sunwarps = [" + f.write(sunwarps.map do |sunwarp| + "{\"orientation\":\"#{sunwarp["orientation"]}\",\"entrance_indicator_pos\":#{sunwarp["entrance_indicator_pos"].to_s}}" + end.join(",")) + f.write "]" end -- cgit 1.4.1 From 139ecb09dcb49177d1fa39baaf8e378e3009fc76 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 18 Apr 2024 17:42:35 -0400 Subject: Reapply "Added support for warp items (including sunwarps)" This reverts commit 17572f8cd5945536eccffbbe832517d75993c03f. --- Archipelago/client.gd | 26 ++++++++++++++++++++++++++ Archipelago/settings_screen.gd | 1 + Archipelago/teleport.gd | 24 ++++++++++++++++++++++++ util/generate_gamedata.rb | 24 ++++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 Archipelago/teleport.gd (limited to 'util') diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 8abc42c..d93b2ed 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -64,6 +64,15 @@ const progressive_items = { {"item": "The Colorful - Green Door", "display": "Green"}, {"item": "The Colorful - Brown Door", "display": "Brown"}, {"item": "The Colorful - Gray Door", "display": "Gray"}, + ], + "Progressive Pilgrimage": + [ + {"item": "Hub Room - 1 Sunwarp", "display": "1 Sunwarp"}, + {"item": "Orange Tower Fourth Floor - 2 Sunwarp", "display": "2 Sunwarp"}, + {"item": "Orange Tower Third Floor - 3 Sunwarp", "display": "3 Sunwarp"}, + {"item": "Orange Tower First Floor - 4 Sunwarp", "display": "4 Sunwarp"}, + {"item": "Orange Tower Fourth Floor - 5 Sunwarp", "display": "5 Sunwarp"}, + {"item": "Outside The Agreeable - 6 Sunwarp", "display": "6 Sunwarp"}, ] } @@ -82,6 +91,11 @@ const kCLASSIFICATION_REMOTE_NORMAL = 0 const kCLASSIFICATION_REMOTE_REDUCED = 1 const kCLASSIFICATION_REMOTE_INSANITY = 2 +const kSUNWARP_ACCESS_NORMAL = 0 +const kSUNWARP_ACCESS_DISABLED = 1 +const kSUNWARP_ACCESS_UNLOCK = 2 +const kSUNWARP_ACCESS_PROGRESSIVE = 3 + var _client = WebSocketClient.new() var _should_process = false var _initiated_disconnect = false @@ -114,6 +128,7 @@ var _door_shuffle = false var _color_shuffle = false var _panel_shuffle = 0 # none, rearrange var _painting_shuffle = false +var _sunwarp_access = 0 # normal, disabled, unlock, progressive var _mastery_achievements = 21 var _level_2_requirement = 223 var _location_classification_bit = 0 @@ -288,6 +303,8 @@ func _on_data(): _painting_shuffle = _slot_data["shuffle_paintings"] if _slot_data.has("shuffle_panels"): _panel_shuffle = _slot_data["shuffle_panels"] + if _slot_data.has("sunwarp_access"): + _sunwarp_access = _slot_data["sunwarp_access"] if _slot_data.has("seed"): _slot_seed = _slot_data["seed"] if _slot_data.has("painting_entrance_to_exit"): @@ -687,6 +704,11 @@ func processItem(item, index, from, flags): painting_node = fake_parent_node.get_node_or_null(painting_id) if painting_node != null: painting_node.get_node("Script").movePainting() + + if gamedata.warp_ids_by_item_id.has(int(item)): + var warpsNode = get_tree().get_root().get_node("Spatial/Warps") + for warp_id in gamedata.warp_ids_by_item_id[int(item)]: + warpsNode.get_node(warp_id).unlock_warp() # Handle progressive items. if item_name in progressive_items.keys(): @@ -748,6 +770,10 @@ func paintingIsVanilla(painting): return !$Gamedata.mentioned_paintings.has(painting) +func warpIsVanilla(warp): + return !$Gamedata.mentioned_warps.has(warp) + + func evaluateSolvability(): emit_signal("evaluate_solvability") diff --git a/Archipelago/settings_screen.gd b/Archipelago/settings_screen.gd index 453e3bf..dce9b70 100644 --- a/Archipelago/settings_screen.gd +++ b/Archipelago/settings_screen.gd @@ -52,6 +52,7 @@ func _ready(): installScriptExtension(ResourceLoader.load("user://maps/Archipelago/panelInput.gd")) installScriptExtension(ResourceLoader.load("user://maps/Archipelago/pause_menu.gd")) installScriptExtension(ResourceLoader.load("user://maps/Archipelago/player.gd")) + installScriptExtension(ResourceLoader.load("user://maps/Archipelago/teleport.gd")) installScriptExtension(ResourceLoader.load("user://maps/Archipelago/worldTransporter.gd")) var apclient = global.get_node("Archipelago") diff --git a/Archipelago/teleport.gd b/Archipelago/teleport.gd new file mode 100644 index 0000000..d322722 --- /dev/null +++ b/Archipelago/teleport.gd @@ -0,0 +1,24 @@ +extends "res://scripts/teleport.gd" + +var _unlocked = true + + +func _ready(): + var apclient = global.get_node("Archipelago") + if apclient._door_shuffle and !apclient.warpIsVanilla(self.get_parent().name + "/" + self.name): + if self.get_parent().name == "Teleporter Warps": + if apclient._sunwarp_access != apclient.kSUNWARP_ACCESS_NORMAL: + _unlocked = false + else: + _unlocked = false + + ._ready() + + +func _body_entered(var body): + if _unlocked: + ._body_entered(body) + + +func unlock_warp(): + _unlocked = true diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index f63e062..8275ab7 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb @@ -15,10 +15,12 @@ door_groups = {} panel_output = [] door_ids_by_item_id = {} painting_ids_by_item_id = {} +warp_ids_by_item_id = {} panel_ids_by_location_id = {} classification_by_location_id = {} mentioned_doors = Set[] mentioned_paintings = Set[] +mentioned_warps = Set[] painting_output = {} ids_config = YAML.load_file(idspath) @@ -152,6 +154,18 @@ config.each do |room_name, room_data| painting_ids_by_item_id[item_id] = internal_painting_ids mentioned_paintings.merge(internal_painting_ids) end + + if door.include? "warp_id" + internal_warp_ids = [] + if door["warp_id"].kind_of? String + internal_warp_ids = [door["warp_id"]] + else + internal_warp_ids = door["warp_id"] + end + + warp_ids_by_item_id[item_id] = internal_warp_ids + mentioned_warps.merge(internal_warp_ids) + end end end end @@ -181,6 +195,12 @@ File.open(outputpath, "w") do |f| "\"#{painting_id}\"" end.join(",") + "]" end.join(",")) + f.write "}\nvar warp_ids_by_item_id = {" + f.write(warp_ids_by_item_id.map do |item_id, warp_ids| + "#{item_id}:[" + warp_ids.map do |warp_id| + "\"#{warp_id}\"" + end.join(",") + "]" + end.join(",")) f.write "}\nvar panel_ids_by_location_id = {" f.write(panel_ids_by_location_id.map do |location_id, panel_ids| "#{location_id}:[" + panel_ids.map do |panel_id| @@ -195,6 +215,10 @@ File.open(outputpath, "w") do |f| f.write(mentioned_paintings.map do |painting_id| "\"#{painting_id}\"" end.join(",")) + f.write "]\nvar mentioned_warps = [" + f.write(mentioned_warps.map do |warp_id| + "\"#{warp_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 34602a22dd85a675a91adcecb93972876ec518fd Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 22 Apr 2024 14:11:05 -0400 Subject: Make progression items resistant to renames --- Archipelago/client.gd | 74 +++++++++++------------------------------------ util/generate_gamedata.rb | 21 +++++++++++++- 2 files changed, 37 insertions(+), 58 deletions(-) (limited to 'util') diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 2229916..853be2d 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -25,56 +25,15 @@ const color_items = [ ] const progressive_items = { "Progressive Orange Tower": - [ - {"item": "Orange Tower - Second Floor", "display": "Second Floor"}, - {"item": "Orange Tower - Third Floor", "display": "Third Floor"}, - {"item": "Orange Tower - Fourth Floor", "display": "Fourth Floor"}, - {"item": "Orange Tower - Fifth Floor", "display": "Fifth Floor"}, - {"item": "Orange Tower - Sixth Floor", "display": "Sixth Floor"}, - {"item": "Orange Tower - Seventh Floor", "display": "Seventh Floor"}, - ], + ["Second Floor", "Third Floor", "Fourth Floor", "Fifth Floor", "Sixth Floor", "Seventh Floor"], "Progressive Art Gallery": - [ - {"item": "Art Gallery - Second Floor", "display": "Second Floor"}, - {"item": "Art Gallery - Third Floor", "display": "Third Floor"}, - {"item": "Art Gallery - Fourth Floor", "display": "Fourth Floor"}, - {"item": "Art Gallery - Fifth Floor", "display": "Fifth Floor"}, - {"item": "Art Gallery - Exit", "display": "Exit"}, - ], - "Progressive Hallway Room": - [ - {"item": "Hallway Room (1) - Exit", "display": "First Door"}, - {"item": "Hallway Room (2) - Exit", "display": "Second Door"}, - {"item": "Hallway Room (3) - Exit", "display": "Third Door"}, - {"item": "Hallway Room (4) - Exit", "display": "Fourth Door"}, - ], - "Progressive Fearless": - [ - {"item": "The Fearless (First Floor) - Second Floor", "display": "Second Floor"}, - {"item": "The Fearless (Second Floor) - Third Floor", "display": "Third Floor"}, - ], + ["Second Floor", "Third Floor", "Fourth Floor", "Fifth Floor", "Exit"], + "Progressive Hallway Room": ["First Door", "Second Door", "Third Door", "Fourth Door"], + "Progressive Fearless": ["Second Floor", "Third Floor"], "Progressive Colorful": - [ - {"item": "The Colorful - White Door", "display": "White"}, - {"item": "The Colorful - Black Door", "display": "Black"}, - {"item": "The Colorful - Red Door", "display": "Red"}, - {"item": "The Colorful - Yellow Door", "display": "Yellow"}, - {"item": "The Colorful - Blue Door", "display": "Blue"}, - {"item": "The Colorful - Purple Door", "display": "Purple"}, - {"item": "The Colorful - Orange Door", "display": "Orange"}, - {"item": "The Colorful - Green Door", "display": "Green"}, - {"item": "The Colorful - Brown Door", "display": "Brown"}, - {"item": "The Colorful - Gray Door", "display": "Gray"}, - ], + ["White", "Black", "Red", "Yellow", "Blue", "Purple", "Orange", "Green", "Brown", "Gray"], "Progressive Pilgrimage": - [ - {"item": "1 Sunwarp", "display": "1 Sunwarp"}, - {"item": "2 Sunwarp", "display": "2 Sunwarp"}, - {"item": "3 Sunwarp", "display": "3 Sunwarp"}, - {"item": "4 Sunwarp", "display": "4 Sunwarp"}, - {"item": "5 Sunwarp", "display": "5 Sunwarp"}, - {"item": "6 Sunwarp", "display": "6 Sunwarp"}, - ] + ["1 Sunwarp", "2 Sunwarp", "3 Sunwarp", "4 Sunwarp", "5 Sunwarp", "6 Sunwarp"] } const kTHE_END = 0 @@ -741,15 +700,16 @@ func processItem(item, index, from, flags): warpsNode.get_node(warp_id).unlock_warp() # Handle progressive items. - if item_name in progressive_items.keys(): - if not item_name in _progressive_progress: - _progressive_progress[item_name] = 0 + if int(item) in gamedata.items_by_progressive_id.keys(): + if not int(item) in _progressive_progress: + _progressive_progress[int(item)] = 0 - if _progressive_progress[item_name] < progressive_items[item_name].size(): - var subitem_name = 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 _progressive_progress[int(item)] < gamedata.items_by_progressive_id[int(item)].size(): + var subitems = gamedata.items_by_progressive_id[int(item)] + var subitem_id = subitems[_progressive_progress[int(item)]] + global._print("Subitem: %d" % subitem_id) + processItem(subitem_id, null, null, null) + _progressive_progress[int(item)] += 1 if _color_shuffle and color_items.has(_item_id_to_name[item]): var lcol = _item_id_to_name[item].to_lower() @@ -763,8 +723,8 @@ func processItem(item, index, from, flags): saveLocaldata() if item_name in progressive_items: - var subitem = progressive_items[item_name][_progressive_progress[item_name] - 1] - item_name += " (%s)" % subitem["display"] + var subitem = progressive_items[item_name][_progressive_progress[int(item)] - 1] + item_name += " (%s)" % subitem var player_name = "Unknown" if _player_name_by_slot.has(from): diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index cf57395..1f18b7e 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb @@ -24,6 +24,7 @@ mentioned_doors = Set[] mentioned_paintings = Set[] mentioned_warps = Set[] painting_output = {} +items_by_progressive_id = {} ids_config = YAML.load_file(idspath) @@ -102,6 +103,20 @@ config.each do |room_name, room_data| sunwarps[index] = sunwarp end end + + if room_data.include? "progression" + room_data["progression"].each do |progressive_item_name, progression| + progressive_id = ids_config["progression"][progressive_item_name] + items_by_progressive_id[progressive_id] = [] + + progression.each do |item| + item_room_name = (item.kind_of? Hash) ? item["room"] : room_name + item_item_name = (item.kind_of? Hash) ? item["door"] : item + + items_by_progressive_id[progressive_id] << ids_config["doors"][item_room_name][item_item_name]["item"] + end + end + end end config.each do |room_name, room_data| @@ -253,5 +268,9 @@ File.open(outputpath, "w") do |f| f.write(sunwarps.map do |sunwarp| "{\"orientation\":\"#{sunwarp["orientation"]}\",\"entrance_indicator_pos\":#{sunwarp["entrance_indicator_pos"].to_s}}" end.join(",")) - f.write "]" + f.write "]\nvar items_by_progressive_id = {" + f.write(items_by_progressive_id.map do |item_id, progression_ids| + "#{item_id}:[" + progression_ids.map(&:to_s).join(",") + "]" + end.join(",")) + f.write "}" end -- cgit 1.4.1