about summary refs log tree commit diff stats
path: root/util
diff options
context:
space:
mode:
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