From b2b098573ef5bcd03d61e827d11b969460d992af Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 31 Jan 2024 15:23:08 -0500 Subject: Added support for warp items (including sunwarps) --- 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 diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 3541016..db79e15 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -62,6 +62,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"}, ] } @@ -80,6 +89,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 @@ -111,6 +125,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 @@ -276,6 +291,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"): @@ -632,6 +649,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(): @@ -693,6 +715,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 2cabe09..0ae218e 100644 --- a/Archipelago/settings_screen.gd +++ b/Archipelago/settings_screen.gd @@ -46,6 +46,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 5e03655..1cce003 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