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