diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-04-18 17:45:10 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-04-18 17:45:10 -0400 |
commit | 67ec5e396a2e60cc531345e80d377afbcfc22c32 (patch) | |
tree | b71d9ca3b24293c44e166238cfdb5419f822cd1b /util/generate_gamedata.rb | |
parent | 139ecb09dcb49177d1fa39baaf8e378e3009fc76 (diff) | |
parent | e33ba8444d965ed903a0ca87d2824af334c4cdd9 (diff) | |
download | lingo-archipelago-67ec5e396a2e60cc531345e80d377afbcfc22c32.tar.gz lingo-archipelago-67ec5e396a2e60cc531345e80d377afbcfc22c32.tar.bz2 lingo-archipelago-67ec5e396a2e60cc531345e80d377afbcfc22c32.zip |
Merge branch 'sunwarps' into future
Diffstat (limited to 'util/generate_gamedata.rb')
-rw-r--r-- | util/generate_gamedata.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index 8275ab7..cf57395 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb | |||
@@ -11,6 +11,7 @@ CLASSIFICATION_INSANITY = 4 | |||
11 | 11 | ||
12 | panel_to_id = {} | 12 | panel_to_id = {} |
13 | door_groups = {} | 13 | door_groups = {} |
14 | warp_groups = {} | ||
14 | 15 | ||
15 | panel_output = [] | 16 | panel_output = [] |
16 | door_ids_by_item_id = {} | 17 | door_ids_by_item_id = {} |
@@ -18,6 +19,7 @@ painting_ids_by_item_id = {} | |||
18 | warp_ids_by_item_id = {} | 19 | warp_ids_by_item_id = {} |
19 | panel_ids_by_location_id = {} | 20 | panel_ids_by_location_id = {} |
20 | classification_by_location_id = {} | 21 | classification_by_location_id = {} |
22 | sunwarps = Array.new(12) {Hash.new} | ||
21 | mentioned_doors = Set[] | 23 | mentioned_doors = Set[] |
22 | mentioned_paintings = Set[] | 24 | mentioned_paintings = Set[] |
23 | mentioned_warps = Set[] | 25 | mentioned_warps = Set[] |
@@ -90,6 +92,16 @@ config.each do |room_name, room_data| | |||
90 | painting_output[painting["id"]] = painting | 92 | painting_output[painting["id"]] = painting |
91 | end | 93 | end |
92 | 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 | ||
93 | end | 105 | end |
94 | 106 | ||
95 | config.each do |room_name, room_data| | 107 | config.each do |room_name, room_data| |
@@ -163,6 +175,11 @@ config.each do |room_name, room_data| | |||
163 | internal_warp_ids = door["warp_id"] | 175 | internal_warp_ids = door["warp_id"] |
164 | end | 176 | end |
165 | 177 | ||
178 | if door.include? "door_group" | ||
179 | warp_groups[door["door_group"]] ||= Set[] | ||
180 | warp_groups[door["door_group"]].merge(internal_warp_ids) | ||
181 | end | ||
182 | |||
166 | warp_ids_by_item_id[item_id] = internal_warp_ids | 183 | warp_ids_by_item_id[item_id] = internal_warp_ids |
167 | mentioned_warps.merge(internal_warp_ids) | 184 | mentioned_warps.merge(internal_warp_ids) |
168 | end | 185 | end |
@@ -176,6 +193,11 @@ door_groups.each do |group_name, door_ids| | |||
176 | door_ids_by_item_id[item_id] = door_ids.to_a | 193 | door_ids_by_item_id[item_id] = door_ids.to_a |
177 | end | 194 | end |
178 | 195 | ||
196 | warp_groups.each do |group_name, warp_ids| | ||
197 | item_id = ids_config["door_groups"][group_name] | ||
198 | warp_ids_by_item_id[item_id] = warp_ids.to_a | ||
199 | end | ||
200 | |||
179 | File.open(outputpath, "w") do |f| | 201 | File.open(outputpath, "w") do |f| |
180 | f.write "extends Node\n\nvar panels = [" | 202 | f.write "extends Node\n\nvar panels = [" |
181 | f.write(panel_output.map do |panel| | 203 | f.write(panel_output.map do |panel| |
@@ -227,5 +249,9 @@ File.open(outputpath, "w") do |f| | |||
227 | f.write(classification_by_location_id.map do |location_id, classification| | 249 | f.write(classification_by_location_id.map do |location_id, classification| |
228 | "#{location_id}:#{classification}" | 250 | "#{location_id}:#{classification}" |
229 | end.join(",")) | 251 | end.join(",")) |
230 | 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 "]" | ||
231 | end | 257 | end |