about summary refs log tree commit diff stats
path: root/util
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-04-18 17:45:10 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2024-04-18 17:45:10 -0400
commit67ec5e396a2e60cc531345e80d377afbcfc22c32 (patch)
treeb71d9ca3b24293c44e166238cfdb5419f822cd1b /util
parent139ecb09dcb49177d1fa39baaf8e378e3009fc76 (diff)
parente33ba8444d965ed903a0ca87d2824af334c4cdd9 (diff)
downloadlingo-archipelago-67ec5e396a2e60cc531345e80d377afbcfc22c32.tar.gz
lingo-archipelago-67ec5e396a2e60cc531345e80d377afbcfc22c32.tar.bz2
lingo-archipelago-67ec5e396a2e60cc531345e80d377afbcfc22c32.zip
Merge branch 'sunwarps' into future
Diffstat (limited to 'util')
-rw-r--r--util/generate_gamedata.rb28
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
12panel_to_id = {} 12panel_to_id = {}
13door_groups = {} 13door_groups = {}
14warp_groups = {}
14 15
15panel_output = [] 16panel_output = []
16door_ids_by_item_id = {} 17door_ids_by_item_id = {}
@@ -18,6 +19,7 @@ painting_ids_by_item_id = {}
18warp_ids_by_item_id = {} 19warp_ids_by_item_id = {}
19panel_ids_by_location_id = {} 20panel_ids_by_location_id = {}
20classification_by_location_id = {} 21classification_by_location_id = {}
22sunwarps = Array.new(12) {Hash.new}
21mentioned_doors = Set[] 23mentioned_doors = Set[]
22mentioned_paintings = Set[] 24mentioned_paintings = Set[]
23mentioned_warps = Set[] 25mentioned_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
93end 105end
94 106
95config.each do |room_name, room_data| 107config.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
177end 194end
178 195
196warp_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
199end
200
179File.open(outputpath, "w") do |f| 201File.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 "]"
231end 257end