about summary refs log tree commit diff stats
path: root/util
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-08-22 12:20:28 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-08-22 12:20:28 -0400
commita2138459de0ef60fa446be9b70310b11aaf78610 (patch)
tree85ad61c1d167c08ca588a248e4b07c8cb7d37cb9 /util
parenta07d74766538f9adbbdb0387d8c5fb395cdbd1bf (diff)
downloadlingo-archipelago-a2138459de0ef60fa446be9b70310b11aaf78610.tar.gz
lingo-archipelago-a2138459de0ef60fa446be9b70310b11aaf78610.tar.bz2
lingo-archipelago-a2138459de0ef60fa446be9b70310b11aaf78610.zip
Only necessary checks are sent out now
i.e. the checks for every individual panel are not sent out if you are not playing panelsanity.
Diffstat (limited to 'util')
-rw-r--r--util/generate_gamedata.rb27
1 files changed, 26 insertions, 1 deletions
diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index bf8e3ae..72f0932 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb
@@ -4,6 +4,10 @@ require 'yaml'
4configpath = ARGV[0] 4configpath = ARGV[0]
5outputpath = ARGV[1] 5outputpath = ARGV[1]
6 6
7CLASSIFICATION_NORMAL = 1
8CLASSIFICATION_REDUCED = 2
9CLASSIFICATION_INSANITY = 4
10
7panel_to_id = {} 11panel_to_id = {}
8door_groups = {} 12door_groups = {}
9 13
@@ -11,6 +15,7 @@ panel_output = []
11door_ids_by_item_id = {} 15door_ids_by_item_id = {}
12painting_ids_by_item_id = {} 16painting_ids_by_item_id = {}
13panel_ids_by_location_id = {} 17panel_ids_by_location_id = {}
18classification_by_location_id = {}
14mentioned_doors = Set[] 19mentioned_doors = Set[]
15mentioned_paintings = Set[] 20mentioned_paintings = Set[]
16painting_output = {} 21painting_output = {}
@@ -54,8 +59,17 @@ config.each do |room_name, room_data|
54 end 59 end
55 panel_output << ret 60 panel_output << ret
56 61
62 panel_ids_by_location_id[full_name] = [panel["id"]]
63
64 classification_by_location_id[full_name] ||= 0
65 classification_by_location_id[full_name] += CLASSIFICATION_INSANITY
66
57 if panel.include? "check" and panel["check"] 67 if panel.include? "check" and panel["check"]
58 panel_ids_by_location_id[full_name] = [panel["id"]] 68 classification_by_location_id[full_name] += CLASSIFICATION_NORMAL
69
70 unless panel.include? "exclude_reduce" and panel["exclude_reduce"]
71 classification_by_location_id[full_name] += CLASSIFICATION_REDUCED
72 end
59 end 73 end
60 end 74 end
61 end 75 end
@@ -105,6 +119,13 @@ config.each do |room_name, room_data|
105 end 119 end
106 panel_to_id[other_name] 120 panel_to_id[other_name]
107 end 121 end
122
123 classification_by_location_id[chosen_name] ||= 0
124 classification_by_location_id[chosen_name] += CLASSIFICATION_NORMAL
125
126 if door.include? "include_reduce" and door["include_reduce"]
127 classification_by_location_id[chosen_name] += CLASSIFICATION_REDUCED
128 end
108 end 129 end
109 130
110 if not (door.include? "skip_item" and door["skip_item"]) and 131 if not (door.include? "skip_item" and door["skip_item"]) and
@@ -189,5 +210,9 @@ File.open(outputpath, "w") do |f|
189 f.write(painting_output.map do |painting_id, painting| 210 f.write(painting_output.map do |painting_id, painting|
190 "\"#{painting_id}\":{\"orientation\":\"#{painting["orientation"]}\",\"move\":#{painting.include? "move" and painting["move"]}}" 211 "\"#{painting_id}\":{\"orientation\":\"#{painting["orientation"]}\",\"move\":#{painting.include? "move" and painting["move"]}}"
191 end.join(",")) 212 end.join(","))
213 f.write "}\nvar classification_by_location_id = {"
214 f.write(classification_by_location_id.map do |location_id, classification|
215 "\"#{location_id}\":#{classification}"
216 end.join(","))
192 f.write "}" 217 f.write "}"
193end 218end
n693' href='#n693'>693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750