From b2b098573ef5bcd03d61e827d11b969460d992af Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 31 Jan 2024 15:23:08 -0500 Subject: Added support for warp items (including sunwarps) --- util/generate_gamedata.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'util') diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index 5e03655..1cce003 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb @@ -15,10 +15,12 @@ door_groups = {} panel_output = [] door_ids_by_item_id = {} painting_ids_by_item_id = {} +warp_ids_by_item_id = {} panel_ids_by_location_id = {} classification_by_location_id = {} mentioned_doors = Set[] mentioned_paintings = Set[] +mentioned_warps = Set[] painting_output = {} ids_config = YAML.load_file(idspath) @@ -152,6 +154,18 @@ config.each do |room_name, room_data| painting_ids_by_item_id[item_id] = internal_painting_ids mentioned_paintings.merge(internal_painting_ids) end + + if door.include? "warp_id" + internal_warp_ids = [] + if door["warp_id"].kind_of? String + internal_warp_ids = [door["warp_id"]] + else + internal_warp_ids = door["warp_id"] + end + + warp_ids_by_item_id[item_id] = internal_warp_ids + mentioned_warps.merge(internal_warp_ids) + end end end end @@ -181,6 +195,12 @@ File.open(outputpath, "w") do |f| "\"#{painting_id}\"" end.join(",") + "]" end.join(",")) + f.write "}\nvar warp_ids_by_item_id = {" + f.write(warp_ids_by_item_id.map do |item_id, warp_ids| + "#{item_id}:[" + warp_ids.map do |warp_id| + "\"#{warp_id}\"" + end.join(",") + "]" + end.join(",")) f.write "}\nvar panel_ids_by_location_id = {" f.write(panel_ids_by_location_id.map do |location_id, panel_ids| "#{location_id}:[" + panel_ids.map do |panel_id| @@ -195,6 +215,10 @@ File.open(outputpath, "w") do |f| f.write(mentioned_paintings.map do |painting_id| "\"#{painting_id}\"" end.join(",")) + f.write "]\nvar mentioned_warps = [" + f.write(mentioned_warps.map do |warp_id| + "\"#{warp_id}\"" + end.join(",")) f.write "]\nvar paintings = {" f.write(painting_output.map do |painting_id, painting| "\"#{painting_id}\":{\"orientation\":\"#{painting["orientation"]}\",\"move\":#{painting.include? "move" and painting["move"]}}" -- cgit 1.4.1