diff options
Diffstat (limited to 'util/generate_gamedata.rb')
-rw-r--r-- | util/generate_gamedata.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index 4c530f1..7674277 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb | |||
@@ -19,6 +19,7 @@ painting_ids_by_item_id = {} | |||
19 | warp_ids_by_item_id = {} | 19 | warp_ids_by_item_id = {} |
20 | panel_ids_by_location_id = {} | 20 | panel_ids_by_location_id = {} |
21 | classification_by_location_id = {} | 21 | classification_by_location_id = {} |
22 | sunwarps = Array.new(12) {Hash.new} | ||
22 | mentioned_doors = Set[] | 23 | mentioned_doors = Set[] |
23 | mentioned_paintings = Set[] | 24 | mentioned_paintings = Set[] |
24 | mentioned_warps = Set[] | 25 | mentioned_warps = Set[] |
@@ -91,6 +92,16 @@ config.each do |room_name, room_data| | |||
91 | painting_output[painting["id"]] = painting | 92 | painting_output[painting["id"]] = painting |
92 | end | 93 | end |
93 | end | 94 | end |
95 | |||
96 | if room_data.include? "sunwarps" | ||
97 | room_data["sunwarps"].each do |sunwarp| | ||
98 | index = sunwarp["dots"] - 1 | ||
99 | if sunwarp["direction"] == "exit" then | ||
100 | index += 6 | ||
101 | end | ||
102 | sunwarps[index] = sunwarp | ||
103 | end | ||
104 | end | ||
94 | end | 105 | end |
95 | 106 | ||
96 | config.each do |room_name, room_data| | 107 | config.each do |room_name, room_data| |
@@ -238,5 +249,9 @@ File.open(outputpath, "w") do |f| | |||
238 | f.write(classification_by_location_id.map do |location_id, classification| | 249 | f.write(classification_by_location_id.map do |location_id, classification| |
239 | "#{location_id}:#{classification}" | 250 | "#{location_id}:#{classification}" |
240 | end.join(",")) | 251 | end.join(",")) |
241 | f.write "}" | 252 | f.write "}\nvar sunwarps = [" |
253 | f.write(sunwarps.map do |sunwarp| | ||
254 | "{\"orientation\":\"#{sunwarp["orientation"]}\",\"entrance_indicator_pos\":#{sunwarp["entrance_indicator_pos"].to_s}}" | ||
255 | end.join(",")) | ||
256 | f.write "]" | ||
242 | end | 257 | end |