about summary refs log tree commit diff stats
path: root/util
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-04-22 14:11:05 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2024-04-22 14:11:05 -0400
commit34602a22dd85a675a91adcecb93972876ec518fd (patch)
tree0c21dde008fb8c23b9a086eff877ffe92e6c83ff /util
parent402d532b5a10fc6e18cba12844f64a5bfb1d0b07 (diff)
downloadlingo-archipelago-34602a22dd85a675a91adcecb93972876ec518fd.tar.gz
lingo-archipelago-34602a22dd85a675a91adcecb93972876ec518fd.tar.bz2
lingo-archipelago-34602a22dd85a675a91adcecb93972876ec518fd.zip
Make progression items resistant to renames
Diffstat (limited to 'util')
-rw-r--r--util/generate_gamedata.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index cf57395..1f18b7e 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb
@@ -24,6 +24,7 @@ mentioned_doors = Set[]
24mentioned_paintings = Set[] 24mentioned_paintings = Set[]
25mentioned_warps = Set[] 25mentioned_warps = Set[]
26painting_output = {} 26painting_output = {}
27items_by_progressive_id = {}
27 28
28ids_config = YAML.load_file(idspath) 29ids_config = YAML.load_file(idspath)
29 30
@@ -102,6 +103,20 @@ config.each do |room_name, room_data|
102 sunwarps[index] = sunwarp 103 sunwarps[index] = sunwarp
103 end 104 end
104 end 105 end
106
107 if room_data.include? "progression"
108 room_data["progression"].each do |progressive_item_name, progression|
109 progressive_id = ids_config["progression"][progressive_item_name]
110 items_by_progressive_id[progressive_id] = []
111
112 progression.each do |item|
113 item_room_name = (item.kind_of? Hash) ? item["room"] : room_name
114 item_item_name = (item.kind_of? Hash) ? item["door"] : item
115
116 items_by_progressive_id[progressive_id] << ids_config["doors"][item_room_name][item_item_name]["item"]
117 end
118 end
119 end
105end 120end
106 121
107config.each do |room_name, room_data| 122config.each do |room_name, room_data|
@@ -253,5 +268,9 @@ File.open(outputpath, "w") do |f|
253 f.write(sunwarps.map do |sunwarp| 268 f.write(sunwarps.map do |sunwarp|
254 "{\"orientation\":\"#{sunwarp["orientation"]}\",\"entrance_indicator_pos\":#{sunwarp["entrance_indicator_pos"].to_s}}" 269 "{\"orientation\":\"#{sunwarp["orientation"]}\",\"entrance_indicator_pos\":#{sunwarp["entrance_indicator_pos"].to_s}}"
255 end.join(",")) 270 end.join(","))
256 f.write "]" 271 f.write "]\nvar items_by_progressive_id = {"
272 f.write(items_by_progressive_id.map do |item_id, progression_ids|
273 "#{item_id}:[" + progression_ids.map(&:to_s).join(",") + "]"
274 end.join(","))
275 f.write "}"
257end 276end