diff options
-rw-r--r-- | Archipelago/client.gd | 59 | ||||
-rw-r--r-- | Archipelago/load.gd | 2 | ||||
-rw-r--r-- | Archipelago/panel.gd | 11 | ||||
-rw-r--r-- | util/generate_gamedata.rb | 75 |
4 files changed, 126 insertions, 21 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 3973f0e..5f8be4e 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd | |||
@@ -19,12 +19,12 @@ var enable_multiplayer = false | |||
19 | var track_player = false | 19 | var track_player = false |
20 | var connection_history = [] | 20 | var connection_history = [] |
21 | 21 | ||
22 | const my_version = "4.1.0" | 22 | const my_version = "panels-beta6" |
23 | const ap_version = {"major": 0, "minor": 5, "build": 0, "class": "Version"} | 23 | const ap_version = {"major": 0, "minor": 5, "build": 0, "class": "Version"} |
24 | const color_items = [ | 24 | const color_items = [ |
25 | "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow" | 25 | "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow" |
26 | ] | 26 | ] |
27 | const progressive_items = { | 27 | const door_progressive_items = { |
28 | "Progressive Orange Tower": | 28 | "Progressive Orange Tower": |
29 | ["Second Floor", "Third Floor", "Fourth Floor", "Fifth Floor", "Sixth Floor", "Seventh Floor"], | 29 | ["Second Floor", "Third Floor", "Fourth Floor", "Fifth Floor", "Sixth Floor", "Seventh Floor"], |
30 | "Progressive Art Gallery": | 30 | "Progressive Art Gallery": |
@@ -36,6 +36,15 @@ const progressive_items = { | |||
36 | "Progressive Pilgrimage": | 36 | "Progressive Pilgrimage": |
37 | ["1 Sunwarp", "2 Sunwarp", "3 Sunwarp", "4 Sunwarp", "5 Sunwarp", "6 Sunwarp"] | 37 | ["1 Sunwarp", "2 Sunwarp", "3 Sunwarp", "4 Sunwarp", "5 Sunwarp", "6 Sunwarp"] |
38 | } | 38 | } |
39 | const panel_progressive_items = { | ||
40 | "Progressive Hallway Room": ["First Door", "Second Door", "Third Door", "Fourth Door"], | ||
41 | "Progressive Colorful": | ||
42 | ["White", "Black", "Red", "Yellow", "Blue", "Purple", "Orange", "Green", "Brown", "Gray"], | ||
43 | "Progressive Number Hunt": | ||
44 | ["Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Zero"], | ||
45 | "Progressive Symmetry Room": ["Near Far", "Warts Straw", "Leaf Feel"], | ||
46 | "Progressive Suits Area": ["Words Sword", "Lost", "Amen Name"] | ||
47 | } | ||
39 | 48 | ||
40 | const kTHE_END = 0 | 49 | const kTHE_END = 0 |
41 | const kTHE_MASTER = 1 | 50 | const kTHE_MASTER = 1 |
@@ -90,6 +99,7 @@ var _localdata_file = "" | |||
90 | var _death_link = false | 99 | var _death_link = false |
91 | var _victory_condition = 0 # THE END, THE MASTER, LEVEL 2 | 100 | var _victory_condition = 0 # THE END, THE MASTER, LEVEL 2 |
92 | var _door_shuffle = false | 101 | var _door_shuffle = false |
102 | var _panel_door_shuffle = false | ||
93 | var _color_shuffle = false | 103 | var _color_shuffle = false |
94 | var _panel_shuffle = 0 # none, rearrange | 104 | var _panel_shuffle = 0 # none, rearrange |
95 | var _painting_shuffle = false | 105 | var _painting_shuffle = false |
@@ -276,9 +286,15 @@ func _on_data(): | |||
276 | _color_shuffle = _slot_data["shuffle_colors"] | 286 | _color_shuffle = _slot_data["shuffle_colors"] |
277 | 287 | ||
278 | if _slot_data.has("shuffle_doors"): | 288 | if _slot_data.has("shuffle_doors"): |
279 | _door_shuffle = (_slot_data["shuffle_doors"] > 0) | 289 | if _slot_data.has("group_doors"): |
290 | _door_shuffle = (_slot_data["shuffle_doors"] == 2) | ||
291 | _panel_door_shuffle = (_slot_data["shuffle_doors"] == 1) | ||
292 | else: | ||
293 | _door_shuffle = (_slot_data["shuffle_doors"] > 0) | ||
294 | _panel_door_shuffle = false | ||
280 | else: | 295 | else: |
281 | _door_shuffle = false | 296 | _door_shuffle = false |
297 | _panel_door_shuffle = false | ||
282 | 298 | ||
283 | if _slot_data.has("shuffle_paintings"): | 299 | if _slot_data.has("shuffle_paintings"): |
284 | _painting_shuffle = _slot_data["shuffle_paintings"] | 300 | _painting_shuffle = _slot_data["shuffle_paintings"] |
@@ -734,6 +750,12 @@ func processItem(item, index, from, flags): | |||
734 | for door_id in gamedata.door_ids_by_item_id[int(item)]: | 750 | for door_id in gamedata.door_ids_by_item_id[int(item)]: |
735 | doorsNode.get_node(door_id).openDoor() | 751 | doorsNode.get_node(door_id).openDoor() |
736 | 752 | ||
753 | if gamedata.panel_ids_by_item_id.has(int(item)): | ||
754 | var panelsNode = get_tree().get_root().get_node("Spatial/Panels") | ||
755 | for panel_id in gamedata.panel_ids_by_item_id[int(item)]: | ||
756 | panelsNode.get_node(panel_id).get_node("AP_Panel").locked = false | ||
757 | emit_signal("evaluate_solvability") | ||
758 | |||
737 | if gamedata.painting_ids_by_item_id.has(int(item)): | 759 | if gamedata.painting_ids_by_item_id.has(int(item)): |
738 | var real_parent_node = get_tree().get_root().get_node("Spatial/Decorations/Paintings") | 760 | var real_parent_node = get_tree().get_root().get_node("Spatial/Decorations/Paintings") |
739 | var fake_parent_node = get_tree().get_root().get_node_or_null("Spatial/AP_Paintings") | 761 | var fake_parent_node = get_tree().get_root().get_node_or_null("Spatial/AP_Paintings") |
@@ -754,15 +776,34 @@ func processItem(item, index, from, flags): | |||
754 | warpsNode.get_node(warp_id).unlock_warp() | 776 | warpsNode.get_node(warp_id).unlock_warp() |
755 | 777 | ||
756 | # Handle progressive items. | 778 | # Handle progressive items. |
757 | if int(item) in gamedata.items_by_progressive_id.keys(): | 779 | var is_progressive_door = int(item) in gamedata.door_items_by_progressive_id |
780 | var is_progressive_panel = int(item) in gamedata.panel_items_by_progressive_id | ||
781 | var progitems = null | ||
782 | var prognames = null | ||
783 | |||
784 | if is_progressive_door and is_progressive_panel: | ||
785 | if _door_shuffle: | ||
786 | progitems = gamedata.door_items_by_progressive_id[int(item)] | ||
787 | prognames = door_progressive_items | ||
788 | else: | ||
789 | progitems = gamedata.panel_items_by_progressive_id[int(item)] | ||
790 | prognames = panel_progressive_items | ||
791 | elif is_progressive_door: | ||
792 | progitems = gamedata.door_items_by_progressive_id[int(item)] | ||
793 | prognames = door_progressive_items | ||
794 | elif is_progressive_panel: | ||
795 | progitems = gamedata.panel_items_by_progressive_id[int(item)] | ||
796 | prognames = panel_progressive_items | ||
797 | |||
798 | if progitems != null: | ||
758 | if not int(item) in _progressive_progress: | 799 | if not int(item) in _progressive_progress: |
759 | _progressive_progress[int(item)] = 0 | 800 | _progressive_progress[int(item)] = 0 |
760 | 801 | ||
761 | if _progressive_progress[int(item)] < gamedata.items_by_progressive_id[int(item)].size(): | 802 | if _progressive_progress[int(item)] < progitems.size(): |
762 | var subitems = gamedata.items_by_progressive_id[int(item)] | 803 | var subitem_id = progitems[_progressive_progress[int(item)]] |
763 | var subitem_id = subitems[_progressive_progress[int(item)]] | ||
764 | global._print("Subitem: %d" % subitem_id) | 804 | global._print("Subitem: %d" % subitem_id) |
765 | processItem(subitem_id, null, null, null) | 805 | processItem(subitem_id, null, null, null) |
806 | item_name += " (%s)" % prognames[item_name][_progressive_progress[int(item)]] | ||
766 | _progressive_progress[int(item)] += 1 | 807 | _progressive_progress[int(item)] += 1 |
767 | 808 | ||
768 | if _color_shuffle and color_items.has(_item_id_to_name["Lingo"][item]): | 809 | if _color_shuffle and color_items.has(_item_id_to_name["Lingo"][item]): |
@@ -776,10 +817,6 @@ func processItem(item, index, from, flags): | |||
776 | _last_new_item = index | 817 | _last_new_item = index |
777 | saveLocaldata() | 818 | saveLocaldata() |
778 | 819 | ||
779 | if item_name in progressive_items: | ||
780 | var subitem = progressive_items[item_name][_progressive_progress[int(item)] - 1] | ||
781 | item_name += " (%s)" % subitem | ||
782 | |||
783 | var player_name = "Unknown" | 820 | var player_name = "Unknown" |
784 | if _player_name_by_slot.has(from): | 821 | if _player_name_by_slot.has(from): |
785 | player_name = _player_name_by_slot[from] | 822 | player_name = _player_name_by_slot[from] |
diff --git a/Archipelago/load.gd b/Archipelago/load.gd index c35525b..ce7bba5 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 = "" | |||
5 | var atbash_text = "" | 5 | var atbash_text = "" |
6 | var orig_color = Color(0, 0, 0, 0) | 6 | var orig_color = Color(0, 0, 0, 0) |
7 | var solvable = true | 7 | var solvable = true |
8 | var locked = false | ||
8 | 9 | ||
9 | const kAtbashPre = "abcdefghijklmnopqrstuvwxyz1234567890+-" | 10 | const kAtbashPre = "abcdefghijklmnopqrstuvwxyz1234567890+-" |
10 | const kAtbashPost = "zyxwvutsrqponmlkjihgfedcba0987654321-+" | 11 | const 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 | ||
13 | panel_to_id = {} | 13 | panel_to_id = {} |
14 | door_groups = {} | 14 | door_groups = {} |
15 | panel_groups = {} | ||
15 | warp_groups = {} | 16 | warp_groups = {} |
16 | 17 | ||
17 | panel_output = [] | 18 | panel_output = [] |
18 | door_ids_by_item_id = {} | 19 | door_ids_by_item_id = {} |
19 | painting_ids_by_item_id = {} | 20 | painting_ids_by_item_id = {} |
21 | panel_ids_by_item_id = {} | ||
20 | warp_ids_by_item_id = {} | 22 | warp_ids_by_item_id = {} |
21 | panel_ids_by_location_id = {} | 23 | panel_ids_by_location_id = {} |
22 | classification_by_location_id = {} | 24 | classification_by_location_id = {} |
23 | sunwarps = Array.new(12) {Hash.new} | 25 | sunwarps = Array.new(12) {Hash.new} |
24 | mentioned_doors = Set[] | 26 | mentioned_doors = Set[] |
25 | mentioned_paintings = Set[] | 27 | mentioned_paintings = Set[] |
28 | mentioned_panels = Set[] | ||
26 | mentioned_warps = Set[] | 29 | mentioned_warps = Set[] |
27 | painting_output = {} | 30 | painting_output = {} |
28 | items_by_progressive_id = {} | 31 | door_items_by_progressive_id = {} |
32 | panel_items_by_progressive_id = {} | ||
29 | 33 | ||
30 | ids_config = YAML.load_file(idspath) | 34 | ids_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 | ||
209 | end | 247 | end |
210 | 248 | ||
211 | door_groups.each do |group_name, door_ids| | 249 | door_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 |
214 | end | 252 | end |
215 | 253 | ||
254 | panel_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 | ||
257 | end | ||
258 | |||
216 | warp_groups.each do |group_name, warp_ids| | 259 | warp_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 "}" |