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 ++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 Archipelago/teleport.gd (limited to 'Archipelago') 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 -- cgit 1.4.1