about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--Archipelago/client.gd70
-rw-r--r--Archipelago/load.gd2
-rw-r--r--Archipelago/panel.gd9
-rw-r--r--util/generate_gamedata.rb38
4 files changed, 111 insertions, 8 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index f15afe6..cafe2f9 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd
@@ -21,7 +21,7 @@ const ap_version = {"major": 0, "minor": 4, "build": 5, "class": "Version"}
21const color_items = [ 21const color_items = [
22 "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow" 22 "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow"
23] 23]
24const progressive_items = { 24const door_progressive_items = {
25 "Progressive Orange Tower": 25 "Progressive Orange Tower":
26 [ 26 [
27 {"item": "Orange Tower - Second Floor", "display": "Second Floor"}, 27 {"item": "Orange Tower - Second Floor", "display": "Second Floor"},
@@ -65,6 +65,40 @@ const progressive_items = {
65 {"item": "The Colorful - Gray Door", "display": "Gray"}, 65 {"item": "The Colorful - Gray Door", "display": "Gray"},
66 ] 66 ]
67} 67}
68const panel_progressive_items = {
69 "Progressive Hallway Room":
70 [
71 {"item": "Hallway Room - First Room Panels", "display": "First Door"},
72 {"item": "Hallway Room - Second Room Panels", "display": "Second Door"},
73 {"item": "Hallway Room - Third Room Panels", "display": "Third Door"},
74 {"item": "Hallway Room - WHEEL", "display": "Fourth Door"},
75 ],
76 "Progressive Colorful":
77 [
78 {"item": "The Colorful - BEGIN (Panel)", "display": "White"},
79 {"item": "The Colorful - FOUND (Panel)", "display": "Black"},
80 {"item": "The Colorful - LOAF (Panel)", "display": "Red"},
81 {"item": "The Colorful - CREAM (Panel)", "display": "Yellow"},
82 {"item": "The Colorful - SUN (Panel)", "display": "Blue"},
83 {"item": "The Colorful - SPOON (Panel)", "display": "Purple"},
84 {"item": "The Colorful - LETTERS (Panel)", "display": "Orange"},
85 {"item": "The Colorful - WALLS (Panel)", "display": "Green"},
86 {"item": "The Colorful - IRON (Panel)", "display": "Brown"},
87 {"item": "The Colorful - OBSTACLE (Panel)", "display": "Gray"},
88 ],
89 "Progressive Number Hunt":
90 [
91 {"item": "Two Panels", "display": "Two"},
92 {"item": "Three Panels", "display": "Three"},
93 {"item": "Four Panels", "display": "Four"},
94 {"item": "Five Panels", "display": "Five"},
95 {"item": "Six Panels", "display": "Six"},
96 {"item": "Seven Panels", "display": "Seven"},
97 {"item": "Eight Panels", "display": "Eight"},
98 {"item": "Nine Panels", "display": "Nine"},
99 {"item": "Outside The Undeterred - ZERO (Panel)", "display": "Zero"},
100 ]
101}
68 102
69const kTHE_END = 0 103const kTHE_END = 0
70const kTHE_MASTER = 1 104const kTHE_MASTER = 1
@@ -109,6 +143,7 @@ var _localdata_file = ""
109var _death_link = false 143var _death_link = false
110var _victory_condition = 0 # THE END, THE MASTER, LEVEL 2 144var _victory_condition = 0 # THE END, THE MASTER, LEVEL 2
111var _door_shuffle = false 145var _door_shuffle = false
146var _panel_door_shuffle = false
112var _color_shuffle = false 147var _color_shuffle = false
113var _panel_shuffle = 0 # none, rearrange 148var _panel_shuffle = 0 # none, rearrange
114var _painting_shuffle = false 149var _painting_shuffle = false
@@ -278,7 +313,8 @@ func _on_data():
278 if _slot_data.has("shuffle_colors"): 313 if _slot_data.has("shuffle_colors"):
279 _color_shuffle = _slot_data["shuffle_colors"] 314 _color_shuffle = _slot_data["shuffle_colors"]
280 if _slot_data.has("shuffle_doors"): 315 if _slot_data.has("shuffle_doors"):
281 _door_shuffle = (_slot_data["shuffle_doors"] > 0) 316 _door_shuffle = (_slot_data["shuffle_doors"] == 2)
317 _panel_door_shuffle = (_slot_data["shuffle_doors"] == 1)
282 if _slot_data.has("shuffle_paintings"): 318 if _slot_data.has("shuffle_paintings"):
283 _painting_shuffle = _slot_data["shuffle_paintings"] 319 _painting_shuffle = _slot_data["shuffle_paintings"]
284 if _slot_data.has("shuffle_panels"): 320 if _slot_data.has("shuffle_panels"):
@@ -668,6 +704,12 @@ func processItem(item, index, from, flags):
668 for door_id in gamedata.door_ids_by_item_id[int(item)]: 704 for door_id in gamedata.door_ids_by_item_id[int(item)]:
669 doorsNode.get_node(door_id).openDoor() 705 doorsNode.get_node(door_id).openDoor()
670 706
707 if gamedata.panel_ids_by_item_id.has(int(item)):
708 var panelsNode = get_tree().get_root().get_node("Spatial/Panels")
709 for panel_id in gamedata.panel_ids_by_item_id[int(item)]:
710 panelsNode.get_node(panel_id).get_node("AP_Panel").locked = false
711 emit_signal("evaluate_solvability")
712
671 if gamedata.painting_ids_by_item_id.has(int(item)): 713 if gamedata.painting_ids_by_item_id.has(int(item)):
672 var real_parent_node = get_tree().get_root().get_node("Spatial/Decorations/Paintings") 714 var real_parent_node = get_tree().get_root().get_node("Spatial/Decorations/Paintings")
673 var fake_parent_node = get_tree().get_root().get_node_or_null("Spatial/AP_Paintings") 715 var fake_parent_node = get_tree().get_root().get_node_or_null("Spatial/AP_Paintings")
@@ -683,12 +725,22 @@ func processItem(item, index, from, flags):
683 painting_node.get_node("Script").movePainting() 725 painting_node.get_node("Script").movePainting()
684 726
685 # Handle progressive items. 727 # Handle progressive items.
686 if item_name in progressive_items.keys(): 728 if _door_shuffle and item_name in door_progressive_items.keys():
729 if not item_name in _progressive_progress:
730 _progressive_progress[item_name] = 0
731
732 if _progressive_progress[item_name] < door_progressive_items[item_name].size():
733 var subitem_name = door_progressive_items[item_name][_progressive_progress[item_name]]["item"]
734 global._print(subitem_name)
735 processItem(_item_name_to_id[subitem_name], null, null, null)
736 _progressive_progress[item_name] += 1
737
738 if _panel_door_shuffle and item_name in panel_progressive_items.keys():
687 if not item_name in _progressive_progress: 739 if not item_name in _progressive_progress:
688 _progressive_progress[item_name] = 0 740 _progressive_progress[item_name] = 0
689 741
690 if _progressive_progress[item_name] < progressive_items[item_name].size(): 742 if _progressive_progress[item_name] < panel_progressive_items[item_name].size():
691 var subitem_name = progressive_items[item_name][_progressive_progress[item_name]]["item"] 743 var subitem_name = panel_progressive_items[item_name][_progressive_progress[item_name]]["item"]
692 global._print(subitem_name) 744 global._print(subitem_name)
693 processItem(_item_name_to_id[subitem_name], null, null, null) 745 processItem(_item_name_to_id[subitem_name], null, null, null)
694 _progressive_progress[item_name] += 1 746 _progressive_progress[item_name] += 1
@@ -704,8 +756,12 @@ func processItem(item, index, from, flags):
704 _last_new_item = index 756 _last_new_item = index
705 saveLocaldata() 757 saveLocaldata()
706 758
707 if item_name in progressive_items: 759 if _door_shuffle and item_name in door_progressive_items:
708 var subitem = progressive_items[item_name][_progressive_progress[item_name] - 1] 760 var subitem = door_progressive_items[item_name][_progressive_progress[item_name] - 1]
761 item_name += " (%s)" % subitem["display"]
762
763 if _panel_door_shuffle and item_name in panel_progressive_items:
764 var subitem = panel_progressive_items[item_name][_progressive_progress[item_name] - 1]
709 item_name += " (%s)" % subitem["display"] 765 item_name += " (%s)" % subitem["display"]
710 766
711 var player_name = "Unknown" 767 var player_name = "Unknown"
diff --git a/Archipelago/load.gd b/Archipelago/load.gd index 566ee39..82f8e94 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd
@@ -568,6 +568,8 @@ func _load():
568 var script_instance = panel_script.new() 568 var script_instance = panel_script.new()
569 script_instance.name = "AP_Panel" 569 script_instance.name = "AP_Panel"
570 script_instance.data = panel 570 script_instance.data = panel
571 if apclient._panel_door_shuffle and gamedata.mentioned_panels.has(panel["id"]):
572 script_instance.locked = true
571 panel_node.add_child(script_instance) 573 panel_node.add_child(script_instance)
572 apclient.connect("evaluate_solvability", script_instance, "evaluate_solvability") 574 apclient.connect("evaluate_solvability", script_instance, "evaluate_solvability")
573 575
diff --git a/Archipelago/panel.gd b/Archipelago/panel.gd index aec18e8..0e8f1df 100644 --- a/Archipelago/panel.gd +++ b/Archipelago/panel.gd
@@ -5,6 +5,7 @@ var orig_text = ""
5var atbash_text = "" 5var atbash_text = ""
6var orig_color = Color(0, 0, 0, 0) 6var orig_color = Color(0, 0, 0, 0)
7var solvable = true 7var solvable = true
8var locked = false
8 9
9const kAtbashPre = "abcdefghijklmnopqrstuvwxyz1234567890+-" 10const kAtbashPre = "abcdefghijklmnopqrstuvwxyz1234567890+-"
10const kAtbashPost = "zyxwvutsrqponmlkjihgfedcba0987654321-+" 11const kAtbashPost = "zyxwvutsrqponmlkjihgfedcba0987654321-+"
@@ -45,7 +46,13 @@ func evaluate_solvability():
45 missing.append(color) 46 missing.append(color)
46 solvable = false 47 solvable = false
47 48
48 if solvable: 49 if locked:
50 self.get_parent().get_node("Viewport/GUI/Panel/Label").text = "Locked"
51 self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").editable = false
52 self.get_parent().get_node("Quad").get_surface_material(0).albedo_color = Color(
53 0.2, 0.7, 0.7
54 )
55 elif solvable:
49 if effects.atbash_remaining > 0: 56 if effects.atbash_remaining > 0:
50 self.get_parent().get_node("Viewport/GUI/Panel/Label").text = atbash_text 57 self.get_parent().get_node("Viewport/GUI/Panel/Label").text = atbash_text
51 else: 58 else:
diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index f63e062..a3f9ba5 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb
@@ -11,14 +11,17 @@ CLASSIFICATION_INSANITY = 4
11 11
12panel_to_id = {} 12panel_to_id = {}
13door_groups = {} 13door_groups = {}
14panel_groups = {}
14 15
15panel_output = [] 16panel_output = []
16door_ids_by_item_id = {} 17door_ids_by_item_id = {}
17painting_ids_by_item_id = {} 18painting_ids_by_item_id = {}
19panel_ids_by_item_id = {}
18panel_ids_by_location_id = {} 20panel_ids_by_location_id = {}
19classification_by_location_id = {} 21classification_by_location_id = {}
20mentioned_doors = Set[] 22mentioned_doors = Set[]
21mentioned_paintings = Set[] 23mentioned_paintings = Set[]
24mentioned_panels = Set[]
22painting_output = {} 25painting_output = {}
23 26
24ids_config = YAML.load_file(idspath) 27ids_config = YAML.load_file(idspath)
@@ -155,6 +158,26 @@ config.each do |room_name, room_data|
155 end 158 end
156 end 159 end
157 end 160 end
161
162 if room_data.include? "panel_doors"
163 room_data["panel_doors"].each do |panel_door_name, panel_door|
164 item_id = ids_config["panel_doors"][room_name][panel_door_name]
165
166 panel_ids_by_item_id[item_id] = panel_door["panels"].map do |panel_identifier|
167 other_room_name = (panel_identifier.kind_of? String) ? room_name : panel_identifier["room"]
168 other_panel_name = (panel_identifier.kind_of? String) ? panel_identifier : panel_identifier["panel"]
169
170 config[other_room_name]["panels"][other_panel_name]["id"]
171 end
172
173 mentioned_panels.merge(panel_ids_by_item_id[item_id])
174
175 if panel_door.include? "panel_group"
176 panel_groups[panel_door["panel_group"]] ||= Set[]
177 panel_groups[panel_door["panel_group"]].merge(panel_ids_by_item_id[item_id])
178 end
179 end
180 end
158end 181end
159 182
160door_groups.each do |group_name, door_ids| 183door_groups.each do |group_name, door_ids|
@@ -162,6 +185,11 @@ door_groups.each do |group_name, door_ids|
162 door_ids_by_item_id[item_id] = door_ids.to_a 185 door_ids_by_item_id[item_id] = door_ids.to_a
163end 186end
164 187
188panel_groups.each do |group_name, panel_ids|
189 item_id = ids_config["panel_groups"][group_name]
190 panel_ids_by_item_id[item_id] = panel_ids.to_a
191end
192
165File.open(outputpath, "w") do |f| 193File.open(outputpath, "w") do |f|
166 f.write "extends Node\n\nvar panels = [" 194 f.write "extends Node\n\nvar panels = ["
167 f.write(panel_output.map do |panel| 195 f.write(panel_output.map do |panel|
@@ -175,6 +203,12 @@ File.open(outputpath, "w") do |f|
175 "\"#{door_id}\"" 203 "\"#{door_id}\""
176 end.join(",") + "]" 204 end.join(",") + "]"
177 end.join(",")) 205 end.join(","))
206 f.write "}\nvar panel_ids_by_item_id = {"
207 f.write(panel_ids_by_item_id.map do |item_id, panel_ids|
208 "#{item_id}:[" + panel_ids.map do |panel_id|
209 "\"#{panel_id}\""
210 end.join(",") + "]"
211 end.join(","))
178 f.write "}\nvar painting_ids_by_item_id = {" 212 f.write "}\nvar painting_ids_by_item_id = {"
179 f.write(painting_ids_by_item_id.map do |item_id, painting_ids| 213 f.write(painting_ids_by_item_id.map do |item_id, painting_ids|
180 "#{item_id}:[" + painting_ids.map do |painting_id| 214 "#{item_id}:[" + painting_ids.map do |painting_id|
@@ -195,6 +229,10 @@ File.open(outputpath, "w") do |f|
195 f.write(mentioned_paintings.map do |painting_id| 229 f.write(mentioned_paintings.map do |painting_id|
196 "\"#{painting_id}\"" 230 "\"#{painting_id}\""
197 end.join(",")) 231 end.join(","))
232 f.write "]\nvar mentioned_panels = ["
233 f.write(mentioned_panels.map do |panel_id|
234 "\"#{panel_id}\""
235 end.join(","))
198 f.write "]\nvar paintings = {" 236 f.write "]\nvar paintings = {"
199 f.write(painting_output.map do |painting_id, painting| 237 f.write(painting_output.map do |painting_id, painting|
200 "\"#{painting_id}\":{\"orientation\":\"#{painting["orientation"]}\",\"move\":#{painting.include? "move" and painting["move"]}}" 238 "\"#{painting_id}\":{\"orientation\":\"#{painting["orientation"]}\",\"move\":#{painting.include? "move" and painting["move"]}}"