diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-03-13 12:44:05 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-03-13 12:44:05 -0400 |
commit | 7d19567f1ac1cf4fd6373303e0e767a8adeb89a7 (patch) | |
tree | f63e98a0b7190ee09422acc3ebf5973a843f2367 /util | |
parent | 905c199b2be81dfee0869cf07c71e6850e0763ad (diff) | |
download | lingo-archipelago-7d19567f1ac1cf4fd6373303e0e767a8adeb89a7.tar.gz lingo-archipelago-7d19567f1ac1cf4fd6373303e0e767a8adeb89a7.tar.bz2 lingo-archipelago-7d19567f1ac1cf4fd6373303e0e767a8adeb89a7.zip |
Sort panel solve index by location ID
Diffstat (limited to 'util')
-rw-r--r-- | util/generate_gamedata.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index 83099ad..7db06ca 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb | |||
@@ -30,10 +30,25 @@ mentioned_warps = Set[] | |||
30 | painting_output = {} | 30 | painting_output = {} |
31 | door_items_by_progressive_id = {} | 31 | door_items_by_progressive_id = {} |
32 | panel_items_by_progressive_id = {} | 32 | panel_items_by_progressive_id = {} |
33 | panel_location_ids = [] | ||
34 | solve_index_by_location = {} | ||
33 | 35 | ||
34 | ids_config = YAML.load_file(idspath) | 36 | ids_config = YAML.load_file(idspath) |
35 | |||
36 | config = YAML.load_file(configpath) | 37 | config = YAML.load_file(configpath) |
38 | |||
39 | config.each do |room_name, room_data| | ||
40 | if room_data.include? "panels" | ||
41 | room_data["panels"].each do |panel_name, panel| | ||
42 | location_id = ids_config["panels"][room_name][panel_name] | ||
43 | panel_location_ids << location_id | ||
44 | end | ||
45 | end | ||
46 | end | ||
47 | |||
48 | panel_location_ids.sort.each_with_index do |location_id, index| | ||
49 | solve_index_by_location[location_id] = index | ||
50 | end | ||
51 | |||
37 | config.each do |room_name, room_data| | 52 | config.each do |room_name, room_data| |
38 | if room_data.include? "panels" | 53 | if room_data.include? "panels" |
39 | room_data["panels"].each do |panel_name, panel| | 54 | room_data["panels"].each do |panel_name, panel| |
@@ -45,6 +60,7 @@ config.each do |room_name, room_data| | |||
45 | ret = {} | 60 | ret = {} |
46 | ret["id"] = "\"#{panel["id"]}\"" | 61 | ret["id"] = "\"#{panel["id"]}\"" |
47 | ret["loc"] = location_id | 62 | ret["loc"] = location_id |
63 | ret["solve_index"] = solve_index_by_location[location_id] | ||
48 | if panel.include? "colors" | 64 | if panel.include? "colors" |
49 | if panel["colors"].kind_of? String | 65 | if panel["colors"].kind_of? String |
50 | ret["color"] = "[\"#{panel["colors"]}\"]" | 66 | ret["color"] = "[\"#{panel["colors"]}\"]" |
@@ -73,9 +89,6 @@ config.each do |room_name, room_data| | |||
73 | if panel.include? "achievement" | 89 | if panel.include? "achievement" |
74 | ret["achievement"] = "\"#{panel["achievement"]}\"" | 90 | ret["achievement"] = "\"#{panel["achievement"]}\"" |
75 | end | 91 | end |
76 | if panel.include? "hunt" and panel["hunt"] | ||
77 | ret["hunt"] = "true" | ||
78 | end | ||
79 | panel_output << ret | 92 | panel_output << ret |
80 | 93 | ||
81 | panel_ids_by_location_id[location_id] = [panel["id"]] | 94 | panel_ids_by_location_id[location_id] = [panel["id"]] |