about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--Archipelago/client.gd57
-rw-r--r--Archipelago/load.gd2
-rw-r--r--Archipelago/panel.gd11
-rw-r--r--util/generate_gamedata.rb75
4 files changed, 125 insertions, 20 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index aa50069..325418f 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd
@@ -23,7 +23,7 @@ const ap_version = {"major": 0, "minor": 5, "build": 0, "class": "Version"}
23const color_items = [ 23const color_items = [
24 "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow" 24 "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow"
25] 25]
26const progressive_items = { 26const door_progressive_items = {
27 "Progressive Orange Tower": 27 "Progressive Orange Tower":
28 ["Second Floor", "Third Floor", "Fourth Floor", "Fifth Floor", "Sixth Floor", "Seventh Floor"], 28 ["Second Floor", "Third Floor", "Fourth Floor", "Fifth Floor", "Sixth Floor", "Seventh Floor"],
29 "Progressive Art Gallery": 29 "Progressive Art Gallery":
@@ -35,6 +35,15 @@ const progressive_items = {
35 "Progressive Pilgrimage": 35 "Progressive Pilgrimage":
36 ["1 Sunwarp", "2 Sunwarp", "3 Sunwarp", "4 Sunwarp", "5 Sunwarp", "6 Sunwarp"] 36 ["1 Sunwarp", "2 Sunwarp", "3 Sunwarp", "4 Sunwarp", "5 Sunwarp", "6 Sunwarp"]
37} 37}
38const panel_progressive_items = {
39 "Progressive Hallway Room": ["First Door", "Second Door", "Third Door", "Fourth Door"],
40 "Progressive Colorful":
41 ["White", "Black", "Red", "Yellow", "Blue", "Purple", "Orange", "Green", "Brown", "Gray"],
42 "Progressive Number Hunt":
43 ["Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Zero"],
44 "Progressive Symmetry Room": ["Near Far", "Warts Straw", "Leaf Feel"],
45 "Progressive Suits Area": ["Words Sword", "Lost", "Amen Name"]
46}
38 47
39const kTHE_END = 0 48const kTHE_END = 0
40const kTHE_MASTER = 1 49const kTHE_MASTER = 1
@@ -89,6 +98,7 @@ var _localdata_file = ""
89var _death_link = false 98var _death_link = false
90var _victory_condition = 0 # THE END, THE MASTER, LEVEL 2 99var _victory_condition = 0 # THE END, THE MASTER, LEVEL 2
91var _door_shuffle = false 100var _door_shuffle = false
101var _panel_door_shuffle = false
92var _color_shuffle = false 102var _color_shuffle = false
93var _panel_shuffle = 0 # none, rearrange 103var _panel_shuffle = 0 # none, rearrange
94var _painting_shuffle = false 104var _painting_shuffle = false
@@ -275,9 +285,15 @@ func _on_data():
275 _color_shuffle = _slot_data["shuffle_colors"] 285 _color_shuffle = _slot_data["shuffle_colors"]
276 286
277 if _slot_data.has("shuffle_doors"): 287 if _slot_data.has("shuffle_doors"):
278 _door_shuffle = (_slot_data["shuffle_doors"] > 0) 288 if _slot_data.has("group_doors"):
289 _door_shuffle = (_slot_data["shuffle_doors"] == 2)
290 _panel_door_shuffle = (_slot_data["shuffle_doors"] == 1)
291 else:
292 _door_shuffle = (_slot_data["shuffle_doors"] > 0)
293 _panel_door_shuffle = false
279 else: 294 else:
280 _door_shuffle = false 295 _door_shuffle = false
296 _panel_door_shuffle = false
281 297
282 if _slot_data.has("shuffle_paintings"): 298 if _slot_data.has("shuffle_paintings"):
283 _painting_shuffle = _slot_data["shuffle_paintings"] 299 _painting_shuffle = _slot_data["shuffle_paintings"]
@@ -727,6 +743,12 @@ func processItem(item, index, from, flags):
727 for door_id in gamedata.door_ids_by_item_id[int(item)]: 743 for door_id in gamedata.door_ids_by_item_id[int(item)]:
728 doorsNode.get_node(door_id).openDoor() 744 doorsNode.get_node(door_id).openDoor()
729 745
746 if gamedata.panel_ids_by_item_id.has(int(item)):
747 var panelsNode = get_tree().get_root().get_node("Spatial/Panels")
748 for panel_id in gamedata.panel_ids_by_item_id[int(item)]:
749 panelsNode.get_node(panel_id).get_node("AP_Panel").locked = false
750 emit_signal("evaluate_solvability")
751
730 if gamedata.painting_ids_by_item_id.has(int(item)): 752 if gamedata.painting_ids_by_item_id.has(int(item)):
731 var real_parent_node = get_tree().get_root().get_node("Spatial/Decorations/Paintings") 753 var real_parent_node = get_tree().get_root().get_node("Spatial/Decorations/Paintings")
732 var fake_parent_node = get_tree().get_root().get_node_or_null("Spatial/AP_Paintings") 754 var fake_parent_node = get_tree().get_root().get_node_or_null("Spatial/AP_Paintings")
@@ -747,15 +769,34 @@ func processItem(item, index, from, flags):
747 warpsNode.get_node(warp_id).unlock_warp() 769 warpsNode.get_node(warp_id).unlock_warp()
748 770
749 # Handle progressive items. 771 # Handle progressive items.
750 if int(item) in gamedata.items_by_progressive_id.keys(): 772 var is_progressive_door = int(item) in gamedata.door_items_by_progressive_id
773 var is_progressive_panel = int(item) in gamedata.panel_items_by_progressive_id
774 var progitems = null
775 var prognames = null
776
777 if is_progressive_door and is_progressive_panel:
778 if _door_shuffle:
779 progitems = gamedata.door_items_by_progressive_id[int(item)]
780 prognames = door_progressive_items
781 else:
782 progitems = gamedata.panel_items_by_progressive_id[int(item)]
783 prognames = panel_progressive_items
784 elif is_progressive_door:
785 progitems = gamedata.door_items_by_progressive_id[int(item)]
786 prognames = door_progressive_items
787 elif is_progressive_panel:
788 progitems = gamedata.panel_items_by_progressive_id[int(item)]
789 prognames = panel_progressive_items
790
791 if progitems != null:
751 if not int(item) in _progressive_progress: 792 if not int(item) in _progressive_progress:
752 _progressive_progress[int(item)] = 0 793 _progressive_progress[int(item)] = 0
753 794
754 if _progressive_progress[int(item)] < gamedata.items_by_progressive_id[int(item)].size(): 795 if _progressive_progress[int(item)] < progitems.size():
755 var subitems = gamedata.items_by_progressive_id[int(item)] 796 var subitem_id = progitems[_progressive_progress[int(item)]]
756 var subitem_id = subitems[_progressive_progress[int(item)]]
757 global._print("Subitem: %d" % subitem_id) 797 global._print("Subitem: %d" % subitem_id)
758 processItem(subitem_id, null, null, null) 798 processItem(subitem_id, null, null, null)
799 item_name += " (%s)" % prognames[item_name][_progressive_progress[int(item)]]
759 _progressive_progress[int(item)] += 1 800 _progressive_progress[int(item)] += 1
760 801
761 if _color_shuffle and color_items.has(_item_id_to_name["Lingo"][item]): 802 if _color_shuffle and color_items.has(_item_id_to_name["Lingo"][item]):
@@ -769,10 +810,6 @@ func processItem(item, index, from, flags):
769 _last_new_item = index 810 _last_new_item = index
770 saveLocaldata() 811 saveLocaldata()
771 812
772 if item_name in progressive_items:
773 var subitem = progressive_items[item_name][_progressive_progress[int(item)] - 1]
774 item_name += " (%s)" % subitem
775
776 var player_name = "Unknown" 813 var player_name = "Unknown"
777 if _player_name_by_slot.has(from): 814 if _player_name_by_slot.has(from):
778 player_name = _player_name_by_slot[from] 815 player_name = _player_name_by_slot[from]
diff --git a/Archipelago/load.gd b/Archipelago/load.gd index 931dfde..9b20e6d 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd
@@ -564,6 +564,8 @@ func _load():
564 var script_instance = panel_script.new() 564 var script_instance = panel_script.new()
565 script_instance.name = "AP_Panel" 565 script_instance.name = "AP_Panel"
566 script_instance.data = panel 566 script_instance.data = panel
567 if apclient._panel_door_shuffle and gamedata.mentioned_panels.has(panel["id"]):
568 script_instance.locked = true
567 panel_node.add_child(script_instance) 569 panel_node.add_child(script_instance)
568 apclient.connect("evaluate_solvability", script_instance, "evaluate_solvability") 570 apclient.connect("evaluate_solvability", script_instance, "evaluate_solvability")
569 571
diff --git a/Archipelago/panel.gd b/Archipelago/panel.gd index fc5963a..ce632c5 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-+"
@@ -39,7 +40,9 @@ func evaluate_solvability():
39 solvable = true 40 solvable = true
40 var missing = [] 41 var missing = []
41 42
42 if apclient._color_shuffle: 43 if locked:
44 solvable = false
45 elif apclient._color_shuffle:
43 for color in data["color"]: 46 for color in data["color"]:
44 if not apclient._has_colors.has(color): 47 if not apclient._has_colors.has(color):
45 missing.append(color) 48 missing.append(color)
@@ -52,6 +55,12 @@ func evaluate_solvability():
52 self.get_parent().get_node("Viewport/GUI/Panel/Label").text = orig_text 55 self.get_parent().get_node("Viewport/GUI/Panel/Label").text = orig_text
53 self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").editable = true 56 self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").editable = true
54 self.get_parent().get_node("Quad").get_surface_material(0).albedo_color = orig_color 57 self.get_parent().get_node("Quad").get_surface_material(0).albedo_color = orig_color
58 elif locked:
59 self.get_parent().get_node("Viewport/GUI/Panel/Label").text = "Locked"
60 self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").editable = false
61 self.get_parent().get_node("Quad").get_surface_material(0).albedo_color = Color(
62 0.2, 0.7, 0.7
63 )
55 else: 64 else:
56 var missing_text = "Missing: " 65 var missing_text = "Missing: "
57 for thing in missing: 66 for thing in missing:
diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index ce8df43..83099ad 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb
@@ -12,20 +12,24 @@ CLASSIFICATION_SMALL_SPHERE_ONE = 8
12 12
13panel_to_id = {} 13panel_to_id = {}
14door_groups = {} 14door_groups = {}
15panel_groups = {}
15warp_groups = {} 16warp_groups = {}
16 17
17panel_output = [] 18panel_output = []
18door_ids_by_item_id = {} 19door_ids_by_item_id = {}
19painting_ids_by_item_id = {} 20painting_ids_by_item_id = {}
21panel_ids_by_item_id = {}
20warp_ids_by_item_id = {} 22warp_ids_by_item_id = {}
21panel_ids_by_location_id = {} 23panel_ids_by_location_id = {}
22classification_by_location_id = {} 24classification_by_location_id = {}
23sunwarps = Array.new(12) {Hash.new} 25sunwarps = Array.new(12) {Hash.new}
24mentioned_doors = Set[] 26mentioned_doors = Set[]
25mentioned_paintings = Set[] 27mentioned_paintings = Set[]
28mentioned_panels = Set[]
26mentioned_warps = Set[] 29mentioned_warps = Set[]
27painting_output = {} 30painting_output = {}
28items_by_progressive_id = {} 31door_items_by_progressive_id = {}
32panel_items_by_progressive_id = {}
29 33
30ids_config = YAML.load_file(idspath) 34ids_config = YAML.load_file(idspath)
31 35
@@ -110,15 +114,29 @@ config.each do |room_name, room_data|
110 end 114 end
111 115
112 if room_data.include? "progression" 116 if room_data.include? "progression"
113 room_data["progression"].each do |progressive_item_name, progression| 117 room_data["progression"].each do |progressive_item_name, pdata|
114 progressive_id = ids_config["progression"][progressive_item_name] 118 progressive_id = ids_config["progression"][progressive_item_name]
115 items_by_progressive_id[progressive_id] = []
116 119
117 progression.each do |item| 120 if pdata.include? "doors"
118 item_room_name = (item.kind_of? Hash) ? item["room"] : room_name 121 door_items_by_progressive_id[progressive_id] = []
119 item_item_name = (item.kind_of? Hash) ? item["door"] : item
120 122
121 items_by_progressive_id[progressive_id] << ids_config["doors"][item_room_name][item_item_name]["item"] 123 pdata["doors"].each do |item|
124 item_room_name = (item.kind_of? Hash) ? item["room"] : room_name
125 item_item_name = (item.kind_of? Hash) ? item["door"] : item
126
127 door_items_by_progressive_id[progressive_id] << ids_config["doors"][item_room_name][item_item_name]["item"]
128 end
129 end
130
131 if pdata.include? "panel_doors"
132 panel_items_by_progressive_id[progressive_id] = []
133
134 pdata["panel_doors"].each do |item|
135 item_room_name = (item.kind_of? Hash) ? item["room"] : room_name
136 item_item_name = (item.kind_of? Hash) ? item["panel_door"] : item
137
138 panel_items_by_progressive_id[progressive_id] << ids_config["panel_doors"][item_room_name][item_item_name]
139 end
122 end 140 end
123 end 141 end
124 end 142 end
@@ -206,6 +224,26 @@ config.each do |room_name, room_data|
206 end 224 end
207 end 225 end
208 end 226 end
227
228 if room_data.include? "panel_doors"
229 room_data["panel_doors"].each do |panel_door_name, panel_door|
230 item_id = ids_config["panel_doors"][room_name][panel_door_name]
231
232 panel_ids_by_item_id[item_id] = panel_door["panels"].map do |panel_identifier|
233 other_room_name = (panel_identifier.kind_of? String) ? room_name : panel_identifier["room"]
234 other_panel_name = (panel_identifier.kind_of? String) ? panel_identifier : panel_identifier["panel"]
235
236 config[other_room_name]["panels"][other_panel_name]["id"]
237 end
238
239 mentioned_panels.merge(panel_ids_by_item_id[item_id])
240
241 if panel_door.include? "panel_group"
242 panel_groups[panel_door["panel_group"]] ||= Set[]
243 panel_groups[panel_door["panel_group"]].merge(panel_ids_by_item_id[item_id])
244 end
245 end
246 end
209end 247end
210 248
211door_groups.each do |group_name, door_ids| 249door_groups.each do |group_name, door_ids|
@@ -213,6 +251,11 @@ door_groups.each do |group_name, door_ids|
213 door_ids_by_item_id[item_id] = door_ids.to_a 251 door_ids_by_item_id[item_id] = door_ids.to_a
214end 252end
215 253
254panel_groups.each do |group_name, panel_ids|
255 item_id = ids_config["panel_groups"][group_name]
256 panel_ids_by_item_id[item_id] = panel_ids.to_a
257end
258
216warp_groups.each do |group_name, warp_ids| 259warp_groups.each do |group_name, warp_ids|
217 item_id = ids_config["door_groups"][group_name] 260 item_id = ids_config["door_groups"][group_name]
218 warp_ids_by_item_id[item_id] = warp_ids.to_a 261 warp_ids_by_item_id[item_id] = warp_ids.to_a
@@ -231,6 +274,12 @@ File.open(outputpath, "w") do |f|
231 "\"#{door_id}\"" 274 "\"#{door_id}\""
232 end.join(",") + "]" 275 end.join(",") + "]"
233 end.join(",")) 276 end.join(","))
277 f.write "}\nvar panel_ids_by_item_id = {"
278 f.write(panel_ids_by_item_id.map do |item_id, panel_ids|
279 "#{item_id}:[" + panel_ids.map do |panel_id|
280 "\"#{panel_id}\""
281 end.join(",") + "]"
282 end.join(","))
234 f.write "}\nvar painting_ids_by_item_id = {" 283 f.write "}\nvar painting_ids_by_item_id = {"
235 f.write(painting_ids_by_item_id.map do |item_id, painting_ids| 284 f.write(painting_ids_by_item_id.map do |item_id, painting_ids|
236 "#{item_id}:[" + painting_ids.map do |painting_id| 285 "#{item_id}:[" + painting_ids.map do |painting_id|
@@ -257,6 +306,10 @@ File.open(outputpath, "w") do |f|
257 f.write(mentioned_paintings.map do |painting_id| 306 f.write(mentioned_paintings.map do |painting_id|
258 "\"#{painting_id}\"" 307 "\"#{painting_id}\""
259 end.join(",")) 308 end.join(","))
309 f.write "]\nvar mentioned_panels = ["
310 f.write(mentioned_panels.map do |panel_id|
311 "\"#{panel_id}\""
312 end.join(","))
260 f.write "]\nvar mentioned_warps = [" 313 f.write "]\nvar mentioned_warps = ["
261 f.write(mentioned_warps.map do |warp_id| 314 f.write(mentioned_warps.map do |warp_id|
262 "\"#{warp_id}\"" 315 "\"#{warp_id}\""
@@ -273,8 +326,12 @@ File.open(outputpath, "w") do |f|
273 f.write(sunwarps.map do |sunwarp| 326 f.write(sunwarps.map do |sunwarp|
274 "{\"orientation\":\"#{sunwarp["orientation"]}\",\"entrance_indicator_pos\":#{sunwarp["entrance_indicator_pos"].to_s}}" 327 "{\"orientation\":\"#{sunwarp["orientation"]}\",\"entrance_indicator_pos\":#{sunwarp["entrance_indicator_pos"].to_s}}"
275 end.join(",")) 328 end.join(","))
276 f.write "]\nvar items_by_progressive_id = {" 329 f.write "]\nvar door_items_by_progressive_id = {"
277 f.write(items_by_progressive_id.map do |item_id, progression_ids| 330 f.write(door_items_by_progressive_id.map do |item_id, progression_ids|
331 "#{item_id}:[" + progression_ids.map(&:to_s).join(",") + "]"
332 end.join(","))
333 f.write "}\nvar panel_items_by_progressive_id = {"
334 f.write(panel_items_by_progressive_id.map do |item_id, progression_ids|
278 "#{item_id}:[" + progression_ids.map(&:to_s).join(",") + "]" 335 "#{item_id}:[" + progression_ids.map(&:to_s).join(",") + "]"
279 end.join(",")) 336 end.join(","))
280 f.write "}" 337 f.write "}"