From ad8243c74c1d718b94a2a4bf4f0fa56d4c9dbb45 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 6 Feb 2024 13:32:24 -0500 Subject: Randomize sunwarps --- randomizer/load.gd | 41 +++++++++++++++++++++++++++++++++++++++++ randomizer/randomizer.gd | 9 +++++++++ 2 files changed, 50 insertions(+) (limited to 'randomizer') diff --git a/randomizer/load.gd b/randomizer/load.gd index 55e4efc..456e135 100644 --- a/randomizer/load.gd +++ b/randomizer/load.gd @@ -214,6 +214,47 @@ func _load(): if !randomizer.steady._door_mapping.has(door.name) and door.name != "Door_hint": door.remap(["../../../Panels/Countdown Panels/Panel_steady_steady"]) + # 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 + + # Randomize the sunwarps. + var sw_orig_translations = [] + var sw_rotations = [0, 0, 90, 180, 0, 0, 0, 90, 270, 270, 0, 0] + 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) + for i in range (1,7): + get_node("Warps/Teleporter Warps/Sunwarp_enter_%d" % i).translation = sw_orig_translations[randomizer.sunwarps[i-1]-1] + get_node("Warps/Teleporter Warps/Sunwarp_exit_%d" % i).translation = sw_orig_translations[randomizer.sunwarps[i+5]-1] + + get_node("Decorations/Signs/Sunwarp Numbers/enter_%d" % i).translation = sw_text_translations[randomizer.sunwarps[i-1]-1] + get_node("Decorations/Signs/Sunwarp Numbers/enter_%d" % i).rotation_degrees = sw_text_rotations[randomizer.sunwarps[i-1]-1] + + get_node("Decorations/Signs/Sunwarp Numbers/exit_%d" % i).translation = sw_text_translations[randomizer.sunwarps[i+5]-1] + get_node("Decorations/Signs/Sunwarp Numbers/exit_%d" % i).rotation_degrees = sw_text_rotations[randomizer.sunwarps[i+5]-1] + + var final_rot = sw_rotations[randomizer.sunwarps[i-1]-1] - sw_rotations[randomizer.sunwarps[i+5]-1] + if final_rot < 0: + final_rot += 360 + get_node("Warps/Teleporter Warps/Sunwarp_enter_%d" % i).rotate = str(final_rot) + # Proceed with the rest of the load. global._print("Hooked Load End") ._load() diff --git a/randomizer/randomizer.gd b/randomizer/randomizer.gd index 681567d..2d26208 100644 --- a/randomizer/randomizer.gd +++ b/randomizer/randomizer.gd @@ -7,6 +7,8 @@ var SCRIPT_steady var generator var steady +var sunwarps + var thread = Thread.new() signal finished_randomizing @@ -29,6 +31,13 @@ func _thread_func(gen_seed): steady = SCRIPT_steady.new() steady.generate(rng) + var iota = range(1, 13) + sunwarps = [] + while not iota.empty(): + var i = rng.randi_range(0, iota.size() - 1) + sunwarps.append(iota[i]) + iota.remove(i) + emit_signal("finished_randomizing") -- cgit 1.4.1