about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--Archipelago/client.gd153
-rw-r--r--Archipelago/load.gd110
-rw-r--r--Archipelago/mypainting.gd5
-rw-r--r--Archipelago/painting.gd10
-rw-r--r--Archipelago/painting_eye.gd16
-rw-r--r--Archipelago/painting_scenery.gd10
-rw-r--r--Archipelago/panel.gd2
-rw-r--r--Archipelago/pilgrimage_terminator.gd11
-rw-r--r--Archipelago/settings_screen.gd35
-rw-r--r--Archipelago/teleport.gd27
-rw-r--r--CHANGELOG.md43
-rw-r--r--README.md62
-rw-r--r--archipelago.tscn25
-rw-r--r--util/generate_gamedata.rb88
14 files changed, 481 insertions, 116 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})
diff --git a/Archipelago/load.gd b/Archipelago/load.gd index 82f8e94..6ce4749 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd
@@ -96,18 +96,19 @@ func _load():
96 96
97 wanderer_achieve.translation = Vector3(-51, -33, 35) # way under the map 97 wanderer_achieve.translation = Vector3(-51, -33, 35) # way under the map
98 98
99 # Turn THE COLORFUL into a cdp.
100 var real_colorful = panels_parent.get_node("Countdown Panels/Panel_colorful_colorful")
101 var cdp_auto_scene = load("res://nodes/panel_countdown_auto.tscn") 99 var cdp_auto_scene = load("res://nodes/panel_countdown_auto.tscn")
102 var colorful_cdp = cdp_auto_scene.instance() 100 if !apclient.wasGeneratedBeforeVersion(0, 4, 5):
103 colorful_cdp.name = "CountdownPanel_colorful" 101 # Turn THE COLORFUL into a cdp.
104 colorful_cdp.replace_with = "../../Panels/Countdown Panels/Panel_colorful_colorful" 102 var real_colorful = panels_parent.get_node("Countdown Panels/Panel_colorful_colorful")
105 colorful_cdp.panels = "../../Panels/Doorways Room" 103 var colorful_cdp = cdp_auto_scene.instance()
106 colorful_cdp.translation = real_colorful.translation 104 colorful_cdp.name = "CountdownPanel_colorful"
107 colorful_cdp.rotation = real_colorful.rotation 105 colorful_cdp.replace_with = "../../Panels/Countdown Panels/Panel_colorful_colorful"
108 get_node("CountdownPanels").add_child(colorful_cdp) 106 colorful_cdp.panels = "../../Panels/Doorways Room"
109 real_colorful.translation = Vector3(-51, -35, 35) # way under the map 107 colorful_cdp.translation = real_colorful.translation
110 get_node("Doors/Doorway Room Doors/Door_gray2").queue_free() 108 colorful_cdp.rotation = real_colorful.rotation
109 get_node("CountdownPanels").add_child(colorful_cdp)
110 real_colorful.translation = Vector3(-51, -35, 35) # way under the map
111 get_node("Doors/Doorway Room Doors/Door_gray2").queue_free()
111 112
112 # Set up The Master to be variable. 113 # Set up The Master to be variable.
113 var old_master_cdp = get_node("CountdownPanels/CountdownPanel_countdown_16") 114 var old_master_cdp = get_node("CountdownPanels/CountdownPanel_countdown_16")
@@ -353,6 +354,8 @@ func _load():
353 victory_condition = "the master" 354 victory_condition = "the master"
354 elif apclient._victory_condition == apclient.kLEVEL_2: 355 elif apclient._victory_condition == apclient.kLEVEL_2:
355 victory_condition = "level 2" 356 victory_condition = "level 2"
357 elif apclient._victory_condition == apclient.kPILGRIMAGE:
358 victory_condition = "pilgrimage"
356 359
357 set_static_panel("Entry Room/Panel_this_this", victory_condition) 360 set_static_panel("Entry Room/Panel_this_this", victory_condition)
358 set_static_panel("Entry Room/Panel_hidden_hidden", "hewwo") 361 set_static_panel("Entry Room/Panel_hidden_hidden", "hewwo")
@@ -584,11 +587,84 @@ func _load():
584 level_2.get_node("Viewport/GUI/Panel/TextEdit").connect( 587 level_2.get_node("Viewport/GUI/Panel/TextEdit").connect(
585 "answer_correct", apclient, "completedGoal" 588 "answer_correct", apclient, "completedGoal"
586 ) 589 )
590 elif apclient._victory_condition == apclient.kPILGRIMAGE:
591 var pilgrim_panel = self.get_node("Panels/Lingo Room/Panel_pilgrim")
592 pilgrim_panel.get_node("Viewport/GUI/Panel/TextEdit").connect(
593 "answer_correct", apclient, "completedGoal"
594 )
587 else: 595 else:
588 var the_end = self.get_node("Decorations/EndPanel/Panel_end_end") 596 var the_end = self.get_node("Decorations/EndPanel/Panel_end_end")
589 the_end.get_node("Viewport/GUI/Panel/TextEdit").connect( 597 the_end.get_node("Viewport/GUI/Panel/TextEdit").connect(
590 "answer_correct", apclient, "completedGoal" 598 "answer_correct", apclient, "completedGoal"
591 ) 599 )
600
601 # If pilgrimage does not allow roof access, add a node on the Crossroads
602 # Roof Access stairs that disables it.
603 if !apclient._pilgrimage_allows_roof_access:
604 var terminator = apclient.SCRIPT_pilgrimage_terminator.new()
605 terminator.name = "RoofAccessPilgrimageTerminator"
606 terminator.translation.x = -36
607 terminator.translation.y = 3
608 terminator.translation.z = -35
609
610 var terminator_shape = CollisionShape.new()
611 terminator_shape.shape = BoxShape.new()
612 terminator_shape.shape.extents.x = 0.1
613
614 terminator.add_child(terminator_shape)
615 get_node("Decorations").add_child(terminator)
616
617 if apclient._sunwarp_shuffle:
618 # Sunwarps 1 and 6 are rotated differently from the rest, so we have to fix that.
619 get_node("Decorations/Teleporter Windows/localmap").rotation_degrees.y = 0
620 get_node("Decorations/Teleporter Windows/localmap2").rotation_degrees.y = 0
621 get_node("Decorations/Teleporter Windows/localmap11").rotation_degrees.y = 0
622 get_node("Decorations/Teleporter Windows/localmap12").rotation_degrees.y = 0
623 get_node("Decorations/Teleporter Windows/localmap13").rotation_degrees.y = -90
624
625 get_node("Warps/Teleporter Warps/Sunwarp_enter_1").translation.x = 19.5
626 get_node("Warps/Teleporter Warps/Sunwarp_exit_1").translation.x = -15.5
627 get_node("Warps/Teleporter Warps/Sunwarp_enter_6").translation.x = 4.5
628 get_node("Warps/Teleporter Warps/Sunwarp_exit_6").translation.x = -37.5
629 get_node("Warps/Teleporter Warps/Sunwarp_exit_7").translation.z = 23.5
630
631 # Change the sunwarps in accordance with the mapping.
632 var sw_orig_translations = []
633 var sw_text_translations = []
634 var sw_text_rotations = []
635 for i in range(1,7):
636 sw_orig_translations.append(get_node("Warps/Teleporter Warps/Sunwarp_enter_%d" % i).translation)
637 sw_text_translations.append(get_node("Decorations/Signs/Sunwarp Numbers/enter_%d" % i).translation)
638 sw_text_rotations.append(get_node("Decorations/Signs/Sunwarp Numbers/enter_%d" % i).rotation_degrees)
639 for i in range(1,7):
640 sw_orig_translations.append(get_node("Warps/Teleporter Warps/Sunwarp_exit_%d" % i).translation)
641 sw_text_translations.append(get_node("Decorations/Signs/Sunwarp Numbers/exit_%d" % i).translation)
642 sw_text_rotations.append(get_node("Decorations/Signs/Sunwarp Numbers/exit_%d" % i).rotation_degrees)
643
644 var sw_enter_indicators = [4, 5, 6, 12, 7, 10]
645 for i in range(1,7):
646 get_node("Warps/Teleporter Warps/Sunwarp_enter_%d" % i).translation = sw_orig_translations[apclient._sunwarp_mapping[i-1]]
647 get_node("Warps/Teleporter Warps/Sunwarp_exit_%d" % i).translation = sw_orig_translations[apclient._sunwarp_mapping[i+5]]
648
649 get_node("Decorations/Signs/Sunwarp Numbers/enter_%d" % i).translation = sw_text_translations[apclient._sunwarp_mapping[i-1]]
650 get_node("Decorations/Signs/Sunwarp Numbers/enter_%d" % i).rotation_degrees = sw_text_rotations[apclient._sunwarp_mapping[i-1]]
651
652 get_node("Decorations/Signs/Sunwarp Numbers/exit_%d" % i).translation = sw_text_translations[apclient._sunwarp_mapping[i+5]]
653 get_node("Decorations/Signs/Sunwarp Numbers/exit_%d" % i).rotation_degrees = sw_text_rotations[apclient._sunwarp_mapping[i+5]]
654
655 var enter_rot = _dir_to_int(gamedata.sunwarps[apclient._sunwarp_mapping[i-1]]["orientation"]) * 90
656 var exit_rot = _dir_to_int(gamedata.sunwarps[apclient._sunwarp_mapping[i+5]]["orientation"]) * 90
657 var final_rot = enter_rot - exit_rot
658 if final_rot < 0:
659 final_rot += 360
660 get_node("Warps/Teleporter Warps/Sunwarp_enter_%d" % i).rotate = str(final_rot)
661
662 var sw_enter_indicator_pos = gamedata.sunwarps[apclient._sunwarp_mapping[i-1]]["entrance_indicator_pos"]
663 var sw_enter_indicator = get_node("Decorations/Signs/Welcome Back Signs/Sign%d" % sw_enter_indicators[i-1])
664 sw_enter_indicator.translation.x = sw_enter_indicator_pos[0]
665 sw_enter_indicator.translation.y = sw_enter_indicator_pos[1]
666 sw_enter_indicator.translation.z = sw_enter_indicator_pos[2]
667 sw_enter_indicator.rotation_degrees.y = (enter_rot * -1) + 180
592 668
593 # Create the effects node. 669 # Create the effects node.
594 var effects_script = apclient.SCRIPT_effects 670 var effects_script = apclient.SCRIPT_effects
@@ -719,3 +795,15 @@ func set_small_gridmap_tile(x, y, z, tile):
719 795
720func archipelago_disconnected(reason): 796func archipelago_disconnected(reason):
721 messages.showMessage(reason) 797 messages.showMessage(reason)
798
799
800func _dir_to_int(dir):
801 if dir == "north":
802 return 0
803 elif dir == "west":
804 return 1
805 elif dir == "south":
806 return 2
807 elif dir == "east":
808 return 3
809 return 4
diff --git a/Archipelago/mypainting.gd b/Archipelago/mypainting.gd index 5e9c703..999b122 100644 --- a/Archipelago/mypainting.gd +++ b/Archipelago/mypainting.gd
@@ -86,6 +86,11 @@ func _looked_at(body, painting):
86 body.rotate_y(3 * PI / 2) 86 body.rotate_y(3 * PI / 2)
87 body.velocity = body.velocity.rotated(Vector3(0, 1, 0), 3 * PI / 2) 87 body.velocity = body.velocity.rotated(Vector3(0, 1, 0), 3 * PI / 2)
88 88
89 var apclient = global.get_node("Archipelago")
90 if !apclient._pilgrimage_allows_paintings:
91 global.sunwarp = 1
92 body.get_node("pivot/camera/sunwarp_background").visible = false
93
89 94
90func _dir_to_int(dir): 95func _dir_to_int(dir):
91 if dir == "north": 96 if dir == "north":
diff --git a/Archipelago/painting.gd b/Archipelago/painting.gd new file mode 100644 index 0000000..adc8337 --- /dev/null +++ b/Archipelago/painting.gd
@@ -0,0 +1,10 @@
1extends "res://scripts/painting.gd"
2
3func _looked_at(var body, var painting):
4 ._looked_at(body, painting)
5
6 if body.is_in_group("player") && (painting.get_name() == self.get_name()):
7 var apclient = global.get_node("Archipelago")
8 if !apclient._pilgrimage_allows_paintings:
9 global.sunwarp = 1
10 body.get_node("pivot/camera/sunwarp_background").visible = false
diff --git a/Archipelago/painting_eye.gd b/Archipelago/painting_eye.gd index 53d42b5..b2e6973 100644 --- a/Archipelago/painting_eye.gd +++ b/Archipelago/painting_eye.gd
@@ -3,9 +3,23 @@ extends "res://scripts/painting_eye.gd"
3 3
4func _answer_correct(): 4func _answer_correct():
5 var apclient = global.get_node("Archipelago") 5 var apclient = global.get_node("Archipelago")
6 if not apclient._door_shuffle or apclient.paintingIsVanilla(self.name): 6 if !apclient._pilgrimage_compatibility and get_name() == "pilgrim_painting2":
7 # When pilgrimage is enabled, the HOT CRUST panel should actually move the sun painting.
8 if apclient._pilgrimage_enabled:
9 movePainting()
10 elif not apclient._door_shuffle or apclient.paintingIsVanilla(self.name):
7 ._answer_correct() 11 ._answer_correct()
8 12
9 13
10func movePainting(): 14func movePainting():
11 ._answer_correct() 15 ._answer_correct()
16
17
18func _looked_at(var body, var painting):
19 ._looked_at(body, painting)
20
21 if body.is_in_group("player") && (painting.get_name() == self.get_name()):
22 var apclient = global.get_node("Archipelago")
23 if !apclient._pilgrimage_allows_paintings:
24 global.sunwarp = 1
25 body.get_node("pivot/camera/sunwarp_background").visible = false
diff --git a/Archipelago/painting_scenery.gd b/Archipelago/painting_scenery.gd index f49d602..1186e2f 100644 --- a/Archipelago/painting_scenery.gd +++ b/Archipelago/painting_scenery.gd
@@ -9,3 +9,13 @@ func _answer_correct():
9 9
10func movePainting(): 10func movePainting():
11 ._answer_correct() 11 ._answer_correct()
12
13
14func _looked_at(var body, var painting):
15 ._looked_at(body, painting)
16
17 if body.is_in_group("player") && (painting.get_name() == self.get_name()):
18 var apclient = global.get_node("Archipelago")
19 if !apclient._pilgrimage_allows_paintings:
20 global.sunwarp = 1
21 body.get_node("pivot/camera/sunwarp_background").visible = false
diff --git a/Archipelago/panel.gd b/Archipelago/panel.gd index 0e8f1df..9d30455 100644 --- a/Archipelago/panel.gd +++ b/Archipelago/panel.gd
@@ -23,7 +23,7 @@ func _ready():
23 else: 23 else:
24 atbash_text += old_char 24 atbash_text += old_char
25 25
26 self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").connect( 26 var _ignore = self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").connect(
27 "answer_correct", self, "answer_correct" 27 "answer_correct", self, "answer_correct"
28 ) 28 )
29 29
diff --git a/Archipelago/pilgrimage_terminator.gd b/Archipelago/pilgrimage_terminator.gd new file mode 100644 index 0000000..29db2ee --- /dev/null +++ b/Archipelago/pilgrimage_terminator.gd
@@ -0,0 +1,11 @@
1extends Area
2
3
4func _ready():
5 var _connected = self.connect("body_entered", self, "_body_entered")
6
7
8func _body_entered(body):
9 if body.is_in_group("player"):
10 global.sunwarp = 1
11 body.get_node("pivot/camera/sunwarp_background").visible = false
diff --git a/Archipelago/settings_screen.gd b/Archipelago/settings_screen.gd index de64214..79fdcc3 100644 --- a/Archipelago/settings_screen.gd +++ b/Archipelago/settings_screen.gd
@@ -30,6 +30,8 @@ func _ready():
30 apclient_instance.SCRIPT_mypainting = load("user://maps/Archipelago/mypainting.gd") 30 apclient_instance.SCRIPT_mypainting = load("user://maps/Archipelago/mypainting.gd")
31 apclient_instance.SCRIPT_notifier = load("user://maps/Archipelago/notifier.gd") 31 apclient_instance.SCRIPT_notifier = load("user://maps/Archipelago/notifier.gd")
32 apclient_instance.SCRIPT_panel = load("user://maps/Archipelago/panel.gd") 32 apclient_instance.SCRIPT_panel = load("user://maps/Archipelago/panel.gd")
33 var pilg_term = load("user://maps/Archipelago/pilgrimage_terminator.gd")
34 apclient_instance.SCRIPT_pilgrimage_terminator = pilg_term
33 apclient_instance.SCRIPT_uuid = load("user://maps/Archipelago/vendor/uuid.gd") 35 apclient_instance.SCRIPT_uuid = load("user://maps/Archipelago/vendor/uuid.gd")
34 36
35 var apdata = ResourceLoader.load("user://maps/Archipelago/gamedata.gd") 37 var apdata = ResourceLoader.load("user://maps/Archipelago/gamedata.gd")
@@ -45,6 +47,7 @@ func _ready():
45 # Let's also inject any scripts we need to inject now. 47 # Let's also inject any scripts we need to inject now.
46 installScriptExtension(apclient_instance.SCRIPT_doorControl) 48 installScriptExtension(apclient_instance.SCRIPT_doorControl)
47 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/load.gd")) 49 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/load.gd"))
50 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/painting.gd"))
48 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/painting_eye.gd")) 51 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/painting_eye.gd"))
49 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/painting_scenery.gd")) 52 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/painting_scenery.gd"))
50 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/panelLevelSwitch.gd")) 53 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/panelLevelSwitch.gd"))
@@ -52,6 +55,7 @@ func _ready():
52 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/panelInput.gd")) 55 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/panelInput.gd"))
53 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/pause_menu.gd")) 56 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/pause_menu.gd"))
54 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/player.gd")) 57 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/player.gd"))
58 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/teleport.gd"))
55 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/worldTransporter.gd")) 59 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/worldTransporter.gd"))
56 60
57 var apclient = global.get_node("Archipelago") 61 var apclient = global.get_node("Archipelago")
@@ -67,6 +71,19 @@ func _ready():
67 self.get_node("Panel/multiplayer_box").pressed = apclient.enable_multiplayer 71 self.get_node("Panel/multiplayer_box").pressed = apclient.enable_multiplayer
68 self.get_node("Panel/position_box").pressed = apclient.track_player 72 self.get_node("Panel/position_box").pressed = apclient.track_player
69 73
74 var history_box = get_node("Panel/connection_history")
75 if apclient.connection_history.empty():
76 history_box.disabled = true
77 else:
78 history_box.disabled = false
79
80 var i = 0
81 for details in apclient.connection_history:
82 history_box.get_popup().add_item("%s (%s)" % [details[1], details[0]], i)
83 i += 1
84
85 history_box.get_popup().connect("id_pressed", self, "historySelected")
86
70 # Show client version. 87 # Show client version.
71 self.get_node("Panel/title").text = "ARCHIPELAGO (%s)" % apclient.my_version 88 self.get_node("Panel/title").text = "ARCHIPELAGO (%s)" % apclient.my_version
72 89
@@ -109,6 +126,15 @@ func connectionStatus(message):
109func connectionSuccessful(): 126func connectionSuccessful():
110 var apclient = global.get_node("Archipelago") 127 var apclient = global.get_node("Archipelago")
111 128
129 # Save connection details
130 var connection_details = [apclient.ap_server, apclient.ap_user, apclient.ap_pass]
131 if apclient.connection_history.has(connection_details):
132 apclient.connection_history.erase(connection_details)
133 apclient.connection_history.push_front(connection_details)
134 if apclient.connection_history.size() > 10:
135 apclient.connection_history.resize(10)
136 apclient.saveSettings()
137
112 # Switch to LL1 138 # Switch to LL1
113 Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) 139 Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
114 global.save_file = apclient.getSaveFileName() 140 global.save_file = apclient.getSaveFileName()
@@ -130,3 +156,12 @@ func connectionUnsuccessful(error_message):
130 popup.popup_exclusive = true 156 popup.popup_exclusive = true
131 popup.get_ok().visible = true 157 popup.get_ok().visible = true
132 popup.popup_centered() 158 popup.popup_centered()
159
160
161func historySelected(index):
162 var apclient = global.get_node("Archipelago")
163 var details = apclient.connection_history[index]
164
165 self.get_node("Panel/server_box").text = details[0]
166 self.get_node("Panel/player_box").text = details[1]
167 self.get_node("Panel/password_box").text = details[2]
diff --git a/Archipelago/teleport.gd b/Archipelago/teleport.gd new file mode 100644 index 0000000..532f081 --- /dev/null +++ b/Archipelago/teleport.gd
@@ -0,0 +1,27 @@
1extends "res://scripts/teleport.gd"
2
3var _unlocked = true
4
5
6func _ready():
7 var apclient = global.get_node("Archipelago")
8 if self.get_parent().name == "Teleporter Warps":
9 if apclient._sunwarp_access != apclient.kSUNWARP_ACCESS_NORMAL:
10 _unlocked = false
11 elif apclient._door_shuffle and !apclient.warpIsVanilla(self.get_parent().name + "/" + self.name):
12 _unlocked = false
13
14
15func _body_entered(body):
16 if _unlocked:
17 ._body_entered(body)
18
19 if body.is_in_group("player"):
20 var apclient = global.get_node("Archipelago")
21 if !apclient._pilgrimage_enabled:
22 global.sunwarp = 1
23 body.get_node("pivot/camera/sunwarp_background").visible = false
24
25
26func unlock_warp():
27 _unlocked = true
diff --git a/CHANGELOG.md b/CHANGELOG.md index 70cea6d..de47cb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md
@@ -1,5 +1,48 @@
1# lingo-archipelago Releases 1# lingo-archipelago Releases
2 2
3## v3.0.1 - 2024-04-22
4
5- Fixed issue where Progressive Hallway Room did not work properly on worlds
6 generated on Archipelago 0.4.5 or earlier.
7
8Download:
9[lingo-archipelago-v3.0.1.zip](https://files.fourisland.com/releases/lingo-archipelago/lingo-archipelago-v3.0.1.zip)<br/>
10Source: [v3.0.1](https://code.fourisland.com/lingo-archipelago/tag/?h=v3.0.1)
11
12## v3.0.0 - 2024-04-22
13
14- [Archipelago 0.4.6](https://github.com/ArchipelagoMW/Archipelago/releases/tag/0.4.6)
15 has been released! This includes a major update for Lingo: The Pilgrim Update!
16 - The pilgrimage can now be disabled entirely.
17 - When enabled, the pilgrimage uses real logic to determine whether it is
18 possible, rather than a specific route.
19 - You can now specify whether paintings and/or roof access are allowed for the
20 pilgrimage.
21 - You can lock access to sunwarps behind item keys, like door shuffle.
22 - Sunwarps can be shuffled, similar to painting shuffle.
23 - Pilgrimage has been added as a win condition.
24- This update should retain backwards compatibility with Archipelago 0.4.5
25 worlds. World generated in Archipelago 0.4.4 will likely continue to have
26 minor problems, and it is best to downpatch to v1.2.1 if you need to play an
27 older world.
28
29Download:
30[lingo-archipelago-v3.0.0.zip](https://files.fourisland.com/releases/lingo-archipelago/lingo-archipelago-v3.0.0.zip)<br/>
31Source: [v3.0.0](https://code.fourisland.com/lingo-archipelago/tag/?h=v3.0.0)
32
33## v2.2.0 - 2024-04-17
34
35- The last ten connections are now saved in a list so that you can easily switch
36 between concurrent multiworlds.
37- THE COLORFUL is no longer turned into a countdown panel if the multiworld was
38 generated before Archipelago 0.4.5. This should improve backwards
39 compatibility, but a v1.x.x version is still the most accurate way to play an
40 older multiworld.
41
42Download:
43[lingo-archipelago-v2.2.0.zip](https://files.fourisland.com/releases/lingo-archipelago/lingo-archipelago-v2.2.0.zip)<br/>
44Source: [v2.2.0](https://code.fourisland.com/lingo-archipelago/tag/?h=v2.2.0)
45
3## v2.1.1 - 2024-04-11 46## v2.1.1 - 2024-04-11
4 47
5- Added some debug logging. 48- Added some debug logging.
diff --git a/README.md b/README.md index 68580e8..a242f95 100644 --- a/README.md +++ b/README.md
@@ -87,6 +87,10 @@ pick and choose which ones you would like to use.
87- **Painting shuffle**: This randomizes the appearance of the paintings in the 87- **Painting shuffle**: This randomizes the appearance of the paintings in the
88 game, as well as which of them are warps, and the locations that they warp you 88 game, as well as which of them are warps, and the locations that they warp you
89 to. It is the equivalent of an entrance randomizer in another game. 89 to. It is the equivalent of an entrance randomizer in another game.
90- **Sunwarp shuffle**: This randomizes the six pairs of sunwarps. The pairing of
91 the warps can change, whether a warp is an entrance or an exit can change, and
92 the numbering can change. You can also specify whether access to the sunwarps
93 should be locked behind receiving certain items.
90 94
91## Frequently Asked Questions 95## Frequently Asked Questions
92 96
@@ -155,33 +159,31 @@ to WELCOME BACK.
155 159
156### What about the pilgrimage? 160### What about the pilgrimage?
157 161
158The intended method of reaching the Pilgrim Room in the base game is known as 162You can enable or disable the pilgrimage in the world options. It defaults to
159"doing a pilgrimage". It involves entering each sunwarp in order without using 163disabled. When disabled, it is impossible to perform a pilgrimage (although the
160any non-painting warps in between. This is difficult to map out properly in AP 164sunwarps will still work, as long as you haven't disabled them too). The Sun
161logic, so we only consider one specific path through the map to be the canonical 165Painting will be added to the item pool, even if you do not have door shuffle
162pilgrimage route. Accessing the Pilgrim Room by pilgrimage is only in logic if 166on, so that you can still access the Pilgrim Antechamber.
163this specific route is available to you: 167
164 168When the pilgrimage is enabled, you are required to perform a pilgrimage in
165- From the Starting Room, proceed through the Second Room and into the Hub Room. 169order to access the Pilgrim Antechamber (although the Pilgrim Room itself may
166 Enter the first sunwarp. 170still be accessible through The Seeker if you have door shuffle on). The Sun
167- From the Crossroads, use the front tower entrance (the one nearest The 171Painting will not be added to the pool, and will behave as it does in vanilla
168 Discerning; not the one next to Sword/Words). Go through the Hot Crusts Door 172(in that it only moves when you solve HOT CRUST inside the Pilgrim Antechamber).
169 and enter the second sunwarp. 173It is non-trivial to determine whether you are able to perform a pilgrimage at
170- Enter the third sunwarp immediately after. 174any given state, but logic will expect you to be able to figure this out. There
171- Proceed past The Initiated and through the shortcut door back to the Hub Room. 175are options that let you determine whether or not paintings and/or the roof
172 Go through the shortcut door to the tower's first floor and enter the fourth 176access stairs in Crossroads will disable a pilgrimage. When sunwarps are
173 sunwarp. 177shuffled, your pilgrimage must take the new numbering of the warps into
174- Use the shortcut to the Directional Gallery (the one outside The Undeterred; 178consideration. The tracker is able to tell you whether or not the Pilgrim
175 not the one further down the hallway where the Number Hunt is), pass through 179Antechamber is accessible (as long as there is an otherwise accessible check
176 the Salt Pepper Door, and return to the Hub Room. Use the nearby entrance to 180inside it), but it can't tell you what your pilgrimage path should be. If you
177 the Crossroads and proceed to the fifth sunwarp. 181are lost, you can check your world's spoiler log for direction on the pilgrimage
178- Use the door that takes you to The Steady, and then the one that takes you to 182path to take.
179 The Bearer, and then the one that takes you to The Initiated. Return to the 183
180 Hub Room once more, and enter The Tenacious via the shortcut that opens upon 184In previous versions of the randomizer, there was a "canonical pilgrimage" that
181 solving the palindromes. Use the top-right door to access the area Outside the 185involved following a specific path in order to reach the Pilgrim Antechamber.
182 Agreeable, and enter the final sunwarp. 186This is no longer relevant, because all possible pilgrimage paths are now in
183 187logic, but you can still see the old route
184This route can be seen 188[starting at 2:47 in this video](https://youtu.be/8GfuDRRswdA?t=167) for
185[starting at 2:47 in this video](https://youtu.be/8GfuDRRswdA?t=167). Note that 189reference.
186this will almost never be required if door shuffle is enabled, as one of the
187other entrances to the room will usually be available sooner.
diff --git a/archipelago.tscn b/archipelago.tscn index f0b8ab9..f063af9 100644 --- a/archipelago.tscn +++ b/archipelago.tscn
@@ -86,9 +86,9 @@ align = 2
86 86
87[node name="credit5" parent="Panel" instance=ExtResource( 1 )] 87[node name="credit5" parent="Panel" instance=ExtResource( 1 )]
88margin_left = 1239.0 88margin_left = 1239.0
89margin_top = 271.0 89margin_top = 422.0
90margin_right = 1829.0 90margin_right = 1829.0
91margin_bottom = 335.0 91margin_bottom = 486.0
92custom_fonts/font = ExtResource( 2 ) 92custom_fonts/font = ExtResource( 2 )
93custom_styles/normal = SubResource( 1 ) 93custom_styles/normal = SubResource( 1 )
94text = "OPTIONS" 94text = "OPTIONS"
@@ -155,9 +155,9 @@ margin_bottom = 58.0
155 155
156[node name="confusing_box" type="CheckBox" parent="Panel"] 156[node name="confusing_box" type="CheckBox" parent="Panel"]
157margin_left = 1227.0 157margin_left = 1227.0
158margin_top = 351.0 158margin_top = 502.0
159margin_right = 1832.0 159margin_right = 1832.0
160margin_bottom = 439.0 160margin_bottom = 590.0
161custom_fonts/font = ExtResource( 6 ) 161custom_fonts/font = ExtResource( 6 )
162custom_icons/checked = ExtResource( 8 ) 162custom_icons/checked = ExtResource( 8 )
163custom_icons/unchecked = ExtResource( 7 ) 163custom_icons/unchecked = ExtResource( 7 )
@@ -165,9 +165,9 @@ text = "Make world more confusing"
165 165
166[node name="multiplayer_box" type="CheckBox" parent="Panel"] 166[node name="multiplayer_box" type="CheckBox" parent="Panel"]
167margin_left = 1227.0 167margin_left = 1227.0
168margin_top = 461.0 168margin_top = 612.0
169margin_right = 1832.0 169margin_right = 1832.0
170margin_bottom = 549.0 170margin_bottom = 700.0
171custom_fonts/font = ExtResource( 6 ) 171custom_fonts/font = ExtResource( 6 )
172custom_icons/checked = ExtResource( 8 ) 172custom_icons/checked = ExtResource( 8 )
173custom_icons/unchecked = ExtResource( 7 ) 173custom_icons/unchecked = ExtResource( 7 )
@@ -175,13 +175,22 @@ text = "Show other players"
175 175
176[node name="position_box" type="CheckBox" parent="Panel"] 176[node name="position_box" type="CheckBox" parent="Panel"]
177margin_left = 1227.0 177margin_left = 1227.0
178margin_top = 571.0 178margin_top = 722.0
179margin_right = 1832.0 179margin_right = 1832.0
180margin_bottom = 654.0 180margin_bottom = 810.0
181custom_fonts/font = ExtResource( 6 ) 181custom_fonts/font = ExtResource( 6 )
182custom_icons/checked = ExtResource( 8 ) 182custom_icons/checked = ExtResource( 8 )
183custom_icons/unchecked = ExtResource( 7 ) 183custom_icons/unchecked = ExtResource( 7 )
184text = "Send position to tracker" 184text = "Send position to tracker"
185 185
186[node name="connection_history" type="MenuButton" parent="Panel"]
187margin_left = 1239.0
188margin_top = 276.0
189margin_right = 1829.0
190margin_bottom = 372.0
191custom_fonts/font = ExtResource( 6 )
192text = "connection history"
193flat = false
194
186[connection signal="pressed" from="Panel/connect_button" to="Panel/connect_button" method="_connect_pressed"] 195[connection signal="pressed" from="Panel/connect_button" to="Panel/connect_button" method="_connect_pressed"]
187[connection signal="pressed" from="Panel/quit_button" to="Panel/quit_button" method="_back_pressed"] 196[connection signal="pressed" from="Panel/quit_button" to="Panel/quit_button" method="_back_pressed"]
diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index a3f9ba5..4f9dfd7 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb
@@ -12,17 +12,23 @@ CLASSIFICATION_INSANITY = 4
12panel_to_id = {} 12panel_to_id = {}
13door_groups = {} 13door_groups = {}
14panel_groups = {} 14panel_groups = {}
15warp_groups = {}
15 16
16panel_output = [] 17panel_output = []
17door_ids_by_item_id = {} 18door_ids_by_item_id = {}
18painting_ids_by_item_id = {} 19painting_ids_by_item_id = {}
19panel_ids_by_item_id = {} 20panel_ids_by_item_id = {}
21warp_ids_by_item_id = {}
20panel_ids_by_location_id = {} 22panel_ids_by_location_id = {}
21classification_by_location_id = {} 23classification_by_location_id = {}
24sunwarps = Array.new(12) {Hash.new}
22mentioned_doors = Set[] 25mentioned_doors = Set[]
23mentioned_paintings = Set[] 26mentioned_paintings = Set[]
24mentioned_panels = Set[] 27mentioned_panels = Set[]
28mentioned_warps = Set[]
25painting_output = {} 29painting_output = {}
30door_items_by_progressive_id = {}
31panel_items_by_progressive_id = {}
26 32
27ids_config = YAML.load_file(idspath) 33ids_config = YAML.load_file(idspath)
28 34
@@ -91,6 +97,44 @@ config.each do |room_name, room_data|
91 painting_output[painting["id"]] = painting 97 painting_output[painting["id"]] = painting
92 end 98 end
93 end 99 end
100
101 if room_data.include? "sunwarps"
102 room_data["sunwarps"].each do |sunwarp|
103 index = sunwarp["dots"] - 1
104 if sunwarp["direction"] == "exit" then
105 index += 6
106 end
107 sunwarps[index] = sunwarp
108 end
109 end
110
111 if room_data.include? "progression"
112 room_data["progression"].each do |progressive_item_name, pdata|
113 progressive_id = ids_config["progression"][progressive_item_name]
114
115 if pdata.include? "doors"
116 door_items_by_progressive_id[progressive_id] = []
117
118 pdata["doors"].each do |item|
119 item_room_name = (item.kind_of? Hash) ? item["room"] : room_name
120 item_item_name = (item.kind_of? Hash) ? item["door"] : item
121
122 door_items_by_progressive_id[progressive_id] << ids_config["doors"][item_room_name][item_item_name]["item"]
123 end
124 end
125
126 if pdata.include? "panel_doors"
127 panel_items_by_progressive_id[progressive_id] = []
128
129 pdata["panel_doors"].each do |item|
130 item_room_name = (item.kind_of? Hash) ? item["room"] : room_name
131 item_item_name = (item.kind_of? Hash) ? item["panel_door"] : item
132
133 panel_items_by_progressive_id[progressive_id] << ids_config["panel_doors"][item_room_name][item_item_name]
134 end
135 end
136 end
137 end
94end 138end
95 139
96config.each do |room_name, room_data| 140config.each do |room_name, room_data|
@@ -155,6 +199,23 @@ config.each do |room_name, room_data|
155 painting_ids_by_item_id[item_id] = internal_painting_ids 199 painting_ids_by_item_id[item_id] = internal_painting_ids
156 mentioned_paintings.merge(internal_painting_ids) 200 mentioned_paintings.merge(internal_painting_ids)
157 end 201 end
202
203 if door.include? "warp_id"
204 internal_warp_ids = []
205 if door["warp_id"].kind_of? String
206 internal_warp_ids = [door["warp_id"]]
207 else
208 internal_warp_ids = door["warp_id"]
209 end
210
211 if door.include? "door_group"
212 warp_groups[door["door_group"]] ||= Set[]
213 warp_groups[door["door_group"]].merge(internal_warp_ids)
214 end
215
216 warp_ids_by_item_id[item_id] = internal_warp_ids
217 mentioned_warps.merge(internal_warp_ids)
218 end
158 end 219 end
159 end 220 end
160 end 221 end
@@ -190,6 +251,11 @@ panel_groups.each do |group_name, panel_ids|
190 panel_ids_by_item_id[item_id] = panel_ids.to_a 251 panel_ids_by_item_id[item_id] = panel_ids.to_a
191end 252end
192 253
254warp_groups.each do |group_name, warp_ids|
255 item_id = ids_config["door_groups"][group_name]
256 warp_ids_by_item_id[item_id] = warp_ids.to_a
257end
258
193File.open(outputpath, "w") do |f| 259File.open(outputpath, "w") do |f|
194 f.write "extends Node\n\nvar panels = [" 260 f.write "extends Node\n\nvar panels = ["
195 f.write(panel_output.map do |panel| 261 f.write(panel_output.map do |panel|
@@ -215,6 +281,12 @@ File.open(outputpath, "w") do |f|
215 "\"#{painting_id}\"" 281 "\"#{painting_id}\""
216 end.join(",") + "]" 282 end.join(",") + "]"
217 end.join(",")) 283 end.join(","))
284 f.write "}\nvar warp_ids_by_item_id = {"
285 f.write(warp_ids_by_item_id.map do |item_id, warp_ids|
286 "#{item_id}:[" + warp_ids.map do |warp_id|
287 "\"#{warp_id}\""
288 end.join(",") + "]"
289 end.join(","))
218 f.write "}\nvar panel_ids_by_location_id = {" 290 f.write "}\nvar panel_ids_by_location_id = {"
219 f.write(panel_ids_by_location_id.map do |location_id, panel_ids| 291 f.write(panel_ids_by_location_id.map do |location_id, panel_ids|
220 "#{location_id}:[" + panel_ids.map do |panel_id| 292 "#{location_id}:[" + panel_ids.map do |panel_id|
@@ -233,6 +305,10 @@ File.open(outputpath, "w") do |f|
233 f.write(mentioned_panels.map do |panel_id| 305 f.write(mentioned_panels.map do |panel_id|
234 "\"#{panel_id}\"" 306 "\"#{panel_id}\""
235 end.join(",")) 307 end.join(","))
308 f.write "]\nvar mentioned_warps = ["
309 f.write(mentioned_warps.map do |warp_id|
310 "\"#{warp_id}\""
311 end.join(","))
236 f.write "]\nvar paintings = {" 312 f.write "]\nvar paintings = {"
237 f.write(painting_output.map do |painting_id, painting| 313 f.write(painting_output.map do |painting_id, painting|
238 "\"#{painting_id}\":{\"orientation\":\"#{painting["orientation"]}\",\"move\":#{painting.include? "move" and painting["move"]}}" 314 "\"#{painting_id}\":{\"orientation\":\"#{painting["orientation"]}\",\"move\":#{painting.include? "move" and painting["move"]}}"
@@ -241,5 +317,17 @@ File.open(outputpath, "w") do |f|
241 f.write(classification_by_location_id.map do |location_id, classification| 317 f.write(classification_by_location_id.map do |location_id, classification|
242 "#{location_id}:#{classification}" 318 "#{location_id}:#{classification}"
243 end.join(",")) 319 end.join(","))
320 f.write "}\nvar sunwarps = ["
321 f.write(sunwarps.map do |sunwarp|
322 "{\"orientation\":\"#{sunwarp["orientation"]}\",\"entrance_indicator_pos\":#{sunwarp["entrance_indicator_pos"].to_s}}"
323 end.join(","))
324 f.write "]\nvar door_items_by_progressive_id = {"
325 f.write(door_items_by_progressive_id.map do |item_id, progression_ids|
326 "#{item_id}:[" + progression_ids.map(&:to_s).join(",") + "]"
327 end.join(","))
328 f.write "}\nvar panel_items_by_progressive_id = {"
329 f.write(panel_items_by_progressive_id.map do |item_id, progression_ids|
330 "#{item_id}:[" + progression_ids.map(&:to_s).join(",") + "]"
331 end.join(","))
244 f.write "}" 332 f.write "}"
245end 333end