about summary refs log tree commit diff stats
path: root/Archipelago/client.gd
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-04-27 12:13:38 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2024-04-27 12:13:38 -0400
commit47755e9e28f9b8866d3c41866910594e2d8c979a (patch)
tree488df5471f58eb0c6a1f7f872a17aa0ebe07231e /Archipelago/client.gd
parent4302e550cde189d8bc1d111e81270ed7960ad77c (diff)
parent0c25dc87e5ad9c8c8c2ff0ef5ac6502b166bc405 (diff)
downloadlingo-archipelago-47755e9e28f9b8866d3c41866910594e2d8c979a.tar.gz
lingo-archipelago-47755e9e28f9b8866d3c41866910594e2d8c979a.tar.bz2
lingo-archipelago-47755e9e28f9b8866d3c41866910594e2d8c979a.zip
Merge branch 'main' into panels
Diffstat (limited to 'Archipelago/client.gd')
-rw-r--r--Archipelago/client.gd153
1 files changed, 88 insertions, 65 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 6fe2cab..0944352 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd
@@ -7,6 +7,7 @@ var SCRIPT_multiplayer
7var SCRIPT_mypainting 7var SCRIPT_mypainting
8var SCRIPT_notifier 8var SCRIPT_notifier
9var SCRIPT_panel 9var SCRIPT_panel
10var SCRIPT_pilgrimage_terminator
10var SCRIPT_uuid 11var SCRIPT_uuid
11 12
12var ap_server = "" 13var ap_server = ""
@@ -15,55 +16,24 @@ var ap_pass = ""
15var confusify_world = false 16var confusify_world = false
16var enable_multiplayer = false 17var enable_multiplayer = false
17var track_player = false 18var track_player = false
19var connection_history = []
18 20
19const my_version = "2.1.1" 21const my_version = "3.0.1"
20const ap_version = {"major": 0, "minor": 4, "build": 5, "class": "Version"} 22const ap_version = {"major": 0, "minor": 4, "build": 6, "class": "Version"}
21const color_items = [ 23const color_items = [
22 "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow" 24 "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow"
23] 25]
24const door_progressive_items = { 26const door_progressive_items = {
25 "Progressive Orange Tower": 27 "Progressive Orange Tower":
26 [ 28 ["Second Floor", "Third Floor", "Fourth Floor", "Fifth Floor", "Sixth Floor", "Seventh Floor"],
27 {"item": "Orange Tower - Second Floor", "display": "Second Floor"},
28 {"item": "Orange Tower - Third Floor", "display": "Third Floor"},
29 {"item": "Orange Tower - Fourth Floor", "display": "Fourth Floor"},
30 {"item": "Orange Tower - Fifth Floor", "display": "Fifth Floor"},
31 {"item": "Orange Tower - Sixth Floor", "display": "Sixth Floor"},
32 {"item": "Orange Tower - Seventh Floor", "display": "Seventh Floor"},
33 ],
34 "Progressive Art Gallery": 29 "Progressive Art Gallery":
35 [ 30 ["Second Floor", "Third Floor", "Fourth Floor", "Fifth Floor", "Exit"],
36 {"item": "Art Gallery - Second Floor", "display": "Second Floor"}, 31 "Progressive Hallway Room": ["First Door", "Second Door", "Third Door", "Fourth Door"],
37 {"item": "Art Gallery - Third Floor", "display": "Third Floor"}, 32 "Progressive Fearless": ["Second Floor", "Third Floor"],
38 {"item": "Art Gallery - Fourth Floor", "display": "Fourth Floor"},
39 {"item": "Art Gallery - Fifth Floor", "display": "Fifth Floor"},
40 {"item": "Art Gallery - Exit", "display": "Exit"},
41 ],
42 "Progressive Hallway Room":
43 [
44 {"item": "Outside The Agreeable - Hallway Door", "display": "First Door"},
45 {"item": "Hallway Room (2) - Exit", "display": "Second Door"},
46 {"item": "Hallway Room (3) - Exit", "display": "Third Door"},
47 {"item": "Hallway Room (4) - Exit", "display": "Fourth Door"},
48 ],
49 "Progressive Fearless":
50 [
51 {"item": "The Fearless (First Floor) - Second Floor", "display": "Second Floor"},
52 {"item": "The Fearless (Second Floor) - Third Floor", "display": "Third Floor"},
53 ],
54 "Progressive Colorful": 33 "Progressive Colorful":
55 [ 34 ["White", "Black", "Red", "Yellow", "Blue", "Purple", "Orange", "Green", "Brown", "Gray"],
56 {"item": "The Colorful - White Door", "display": "White"}, 35 "Progressive Pilgrimage":
57 {"item": "The Colorful - Black Door", "display": "Black"}, 36 ["1 Sunwarp", "2 Sunwarp", "3 Sunwarp", "4 Sunwarp", "5 Sunwarp", "6 Sunwarp"]
58 {"item": "The Colorful - Red Door", "display": "Red"},
59 {"item": "The Colorful - Yellow Door", "display": "Yellow"},
60 {"item": "The Colorful - Blue Door", "display": "Blue"},
61 {"item": "The Colorful - Purple Door", "display": "Purple"},
62 {"item": "The Colorful - Orange Door", "display": "Orange"},
63 {"item": "The Colorful - Green Door", "display": "Green"},
64 {"item": "The Colorful - Brown Door", "display": "Brown"},
65 {"item": "The Colorful - Gray Door", "display": "Gray"},
66 ]
67} 37}
68const panel_progressive_items = { 38const panel_progressive_items = {
69 "Progressive Hallway Room": 39 "Progressive Hallway Room":
@@ -103,6 +73,7 @@ const panel_progressive_items = {
103const kTHE_END = 0 73const kTHE_END = 0
104const kTHE_MASTER = 1 74const kTHE_MASTER = 1
105const kLEVEL_2 = 2 75const kLEVEL_2 = 2
76const kPILGRIMAGE = 3
106 77
107const kNO_PANEL_SHUFFLE = 0 78const kNO_PANEL_SHUFFLE = 0
108const kREARRANGE_PANELS = 1 79const kREARRANGE_PANELS = 1
@@ -115,6 +86,12 @@ const kCLASSIFICATION_REMOTE_NORMAL = 0
115const kCLASSIFICATION_REMOTE_REDUCED = 1 86const kCLASSIFICATION_REMOTE_REDUCED = 1
116const kCLASSIFICATION_REMOTE_INSANITY = 2 87const kCLASSIFICATION_REMOTE_INSANITY = 2
117 88
89const kSUNWARP_ACCESS_NORMAL = 0
90const kSUNWARP_ACCESS_DISABLED = 1
91const kSUNWARP_ACCESS_UNLOCK = 2
92const kSUNWARP_ACCESS_INDIVIDUAL = 3
93const kSUNWARP_ACCESS_PROGRESSIVE = 4
94
118var _client = WebSocketClient.new() 95var _client = WebSocketClient.new()
119var _should_process = false 96var _should_process = false
120var _initiated_disconnect = false 97var _initiated_disconnect = false
@@ -148,10 +125,17 @@ var _panel_door_shuffle = false
148var _color_shuffle = false 125var _color_shuffle = false
149var _panel_shuffle = 0 # none, rearrange 126var _panel_shuffle = 0 # none, rearrange
150var _painting_shuffle = false 127var _painting_shuffle = false
128var _sunwarp_access = 0 # normal, disabled, unlock, progressive
151var _mastery_achievements = 21 129var _mastery_achievements = 21
152var _level_2_requirement = 223 130var _level_2_requirement = 223
153var _location_classification_bit = 0 131var _location_classification_bit = 0
154var _early_color_hallways = false 132var _early_color_hallways = false
133var _pilgrimage_compatibility = false # set to true for pre-0.4.6
134var _pilgrimage_enabled = false
135var _pilgrimage_allows_roof_access = false
136var _pilgrimage_allows_paintings = false
137var _sunwarp_shuffle = false
138var _sunwarp_mapping = []
155var _slot_seed = 0 139var _slot_seed = 0
156 140
157var _map_loaded = false 141var _map_loaded = false
@@ -197,6 +181,8 @@ func _init():
197 enable_multiplayer = data[5] 181 enable_multiplayer = data[5]
198 if data.size() > 6: 182 if data.size() > 6:
199 track_player = data[6] 183 track_player = data[6]
184 if data.size() > 7:
185 connection_history = data[7]
200 186
201 processDatapackages() 187 processDatapackages()
202 188
@@ -325,6 +311,10 @@ func _on_data():
325 _painting_shuffle = _slot_data["shuffle_paintings"] 311 _painting_shuffle = _slot_data["shuffle_paintings"]
326 if _slot_data.has("shuffle_panels"): 312 if _slot_data.has("shuffle_panels"):
327 _panel_shuffle = _slot_data["shuffle_panels"] 313 _panel_shuffle = _slot_data["shuffle_panels"]
314 if _slot_data.has("sunwarp_access"):
315 _sunwarp_access = _slot_data["sunwarp_access"]
316 else:
317 _sunwarp_access = kSUNWARP_ACCESS_NORMAL
328 if _slot_data.has("seed"): 318 if _slot_data.has("seed"):
329 _slot_seed = _slot_data["seed"] 319 _slot_seed = _slot_data["seed"]
330 if _slot_data.has("painting_entrance_to_exit"): 320 if _slot_data.has("painting_entrance_to_exit"):
@@ -342,6 +332,25 @@ func _on_data():
342 _location_classification_bit = kCLASSIFICATION_LOCAL_INSANITY 332 _location_classification_bit = kCLASSIFICATION_LOCAL_INSANITY
343 if _slot_data.has("early_color_hallways"): 333 if _slot_data.has("early_color_hallways"):
344 _early_color_hallways = _slot_data["early_color_hallways"] 334 _early_color_hallways = _slot_data["early_color_hallways"]
335 if _slot_data.has("enable_pilgrimage"):
336 _pilgrimage_enabled = _slot_data["enable_pilgrimage"]
337 else:
338 _pilgrimage_compatibility = true
339 _pilgrimage_enabled = true
340 if _slot_data.has("pilgrimage_allows_roof_access"):
341 _pilgrimage_allows_roof_access = _slot_data["pilgrimage_allows_roof_access"]
342 else:
343 _pilgrimage_allows_roof_access = true
344 if _slot_data.has("pilgrimage_allows_paintings"):
345 _pilgrimage_allows_paintings = _slot_data["pilgrimage_allows_paintings"]
346 else:
347 _pilgrimage_allows_paintings = true
348 if _slot_data.has("shuffle_sunwarps"):
349 _sunwarp_shuffle = _slot_data["shuffle_sunwarps"]
350 else:
351 _sunwarp_shuffle = false
352 if _slot_data.has("sunwarp_permutation"):
353 _sunwarp_mapping = _slot_data["sunwarp_permutation"]
345 354
346 if track_player: 355 if track_player:
347 setValue("PlayerPos", {"x": 0, "z": 0}) 356 setValue("PlayerPos", {"x": 0, "z": 0})
@@ -527,7 +536,8 @@ func saveSettings():
527 _datapackages, 536 _datapackages,
528 confusify_world, 537 confusify_world,
529 enable_multiplayer, 538 enable_multiplayer,
530 track_player 539 track_player,
540 connection_history
531 ] 541 ]
532 file.store_var(data, true) 542 file.store_var(data, true)
533 file.close() 543 file.close()
@@ -730,26 +740,35 @@ func processItem(item, index, from, flags):
730 if painting_node != null: 740 if painting_node != null:
731 painting_node.get_node("Script").movePainting() 741 painting_node.get_node("Script").movePainting()
732 742
743 if gamedata.warp_ids_by_item_id.has(int(item)):
744 var warpsNode = get_tree().get_root().get_node("Spatial/Warps")
745 for warp_id in gamedata.warp_ids_by_item_id[int(item)]:
746 warpsNode.get_node(warp_id).unlock_warp()
747
733 # Handle progressive items. 748 # Handle progressive items.
734 if _door_shuffle and item_name in door_progressive_items.keys(): 749 var is_progressive_door = int(item) in gamedata.door_items_by_progressive_id
735 if not item_name in _progressive_progress: 750 var is_progressive_panel = int(item) in gamedata.panel_items_by_progressive_id
736 _progressive_progress[item_name] = 0 751 var progitems = null
737 752
738 if _progressive_progress[item_name] < door_progressive_items[item_name].size(): 753 if is_progressive_door and is_progressive_panel:
739 var subitem_name = door_progressive_items[item_name][_progressive_progress[item_name]]["item"] 754 if _door_shuffle:
740 global._print(subitem_name) 755 progitems = gamedata.door_items_by_progressive_id[int(item)]
741 processItem(_item_name_to_id[subitem_name], null, null, null) 756 else:
742 _progressive_progress[item_name] += 1 757 progitems = gamedata.panel_items_by_progressive_id[int(item)]
743 758 elif is_progressive_door:
744 if _panel_door_shuffle and item_name in panel_progressive_items.keys(): 759 progitems = gamedata.door_items_by_progressive_id[int(item)]
745 if not item_name in _progressive_progress: 760 elif is_progressive_panel:
746 _progressive_progress[item_name] = 0 761 progitems = gamedata.panel_items_by_progressive_id[int(item)]
747 762
748 if _progressive_progress[item_name] < panel_progressive_items[item_name].size(): 763 if progitems != null:
749 var subitem_name = panel_progressive_items[item_name][_progressive_progress[item_name]]["item"] 764 if not int(item) in _progressive_progress:
750 global._print(subitem_name) 765 _progressive_progress[int(item)] = 0
751 processItem(_item_name_to_id[subitem_name], null, null, null) 766
752 _progressive_progress[item_name] += 1 767 if _progressive_progress[int(item)] < progitems.size():
768 var subitem_id = progitems[_progressive_progress[int(item)]]
769 global._print("Subitem: %d" % subitem_id)
770 processItem(subitem_id, null, null, null)
771 _progressive_progress[int(item)] += 1
753 772
754 if _color_shuffle and color_items.has(_item_id_to_name[item]): 773 if _color_shuffle and color_items.has(_item_id_to_name[item]):
755 var lcol = _item_id_to_name[item].to_lower() 774 var lcol = _item_id_to_name[item].to_lower()
@@ -763,11 +782,11 @@ func processItem(item, index, from, flags):
763 saveLocaldata() 782 saveLocaldata()
764 783
765 if _door_shuffle and item_name in door_progressive_items: 784 if _door_shuffle and item_name in door_progressive_items:
766 var subitem = door_progressive_items[item_name][_progressive_progress[item_name] - 1] 785 var subitem = door_progressive_items[item_name][_progressive_progress[int(item)] - 1]
767 item_name += " (%s)" % subitem["display"] 786 item_name += " (%s)" % subitem["display"]
768 787
769 if _panel_door_shuffle and item_name in panel_progressive_items: 788 if _panel_door_shuffle and item_name in panel_progressive_items:
770 var subitem = panel_progressive_items[item_name][_progressive_progress[item_name] - 1] 789 var subitem = panel_progressive_items[item_name][_progressive_progress[int(item)] - 1]
771 item_name += " (%s)" % subitem["display"] 790 item_name += " (%s)" % subitem["display"]
772 791
773 var player_name = "Unknown" 792 var player_name = "Unknown"
@@ -804,6 +823,10 @@ func paintingIsVanilla(painting):
804 return !$Gamedata.mentioned_paintings.has(painting) 823 return !$Gamedata.mentioned_paintings.has(painting)
805 824
806 825
826func warpIsVanilla(warp):
827 return !$Gamedata.mentioned_warps.has(warp)
828
829
807func evaluateSolvability(): 830func evaluateSolvability():
808 emit_signal("evaluate_solvability") 831 emit_signal("evaluate_solvability")
809 832
@@ -849,5 +872,5 @@ func compareVersion(lhs, rhs):
849 return lhs["major"] < rhs["major"] 872 return lhs["major"] < rhs["major"]
850 873
851 874
852func wasGeneratedBeforeVersion(rhs): 875func wasGeneratedBeforeVersion(major, minor, build):
853 return compareVersion(_gen_version, rhs) 876 return compareVersion(_gen_version, {"major": major, "minor": minor, "build": build})