diff options
Diffstat (limited to 'utils/validate_config.rb')
| -rw-r--r-- | utils/validate_config.rb | 48 |
1 files changed, 38 insertions, 10 deletions
| diff --git a/utils/validate_config.rb b/utils/validate_config.rb index ae0ac61..831fee2 100644 --- a/utils/validate_config.rb +++ b/utils/validate_config.rb | |||
| @@ -37,12 +37,14 @@ configured_panels = Set[] | |||
| 37 | mentioned_rooms = Set[] | 37 | mentioned_rooms = Set[] |
| 38 | mentioned_doors = Set[] | 38 | mentioned_doors = Set[] |
| 39 | mentioned_panels = Set[] | 39 | mentioned_panels = Set[] |
| 40 | mentioned_sunwarp_entrances = Set[] | ||
| 41 | mentioned_sunwarp_exits = Set[] | ||
| 40 | 42 | ||
| 41 | door_groups = {} | 43 | door_groups = {} |
| 42 | 44 | ||
| 43 | directives = Set["entrances", "panels", "doors", "paintings", "progression"] | 45 | directives = Set["entrances", "panels", "doors", "paintings", "sunwarps", "progression"] |
| 44 | panel_directives = Set["id", "required_room", "required_door", "required_panel", "colors", "check", "exclude_reduce", "tag", "link", "subtag", "achievement", "copy_to_sign", "non_counting", "hunt"] | 46 | panel_directives = Set["id", "required_room", "required_door", "required_panel", "colors", "check", "exclude_reduce", "tag", "link", "subtag", "achievement", "copy_to_sign", "non_counting", "hunt"] |
| 45 | door_directives = Set["id", "painting_id", "panels", "item_name", "item_group", "location_name", "skip_location", "skip_item", "door_group", "include_reduce", "junk_item", "event"] | 47 | door_directives = Set["id", "painting_id", "panels", "item_name", "item_group", "location_name", "skip_location", "skip_item", "door_group", "include_reduce", "event", "warp_id"] |
| 46 | painting_directives = Set["id", "enter_only", "exit_only", "orientation", "required_door", "required", "required_when_no_doors", "move", "req_blocked", "req_blocked_when_no_doors"] | 48 | painting_directives = Set["id", "enter_only", "exit_only", "orientation", "required_door", "required", "required_when_no_doors", "move", "req_blocked", "req_blocked_when_no_doors"] |
| 47 | 49 | ||
| 48 | non_counting = 0 | 50 | non_counting = 0 |
| @@ -67,17 +69,17 @@ config.each do |room_name, room| | |||
| 67 | 69 | ||
| 68 | entrances = [] | 70 | entrances = [] |
| 69 | if entrance.kind_of? Hash | 71 | if entrance.kind_of? Hash |
| 70 | if entrance.keys() != ["painting"] then | 72 | entrances = [entrance] |
| 71 | entrances = [entrance] | ||
| 72 | end | ||
| 73 | elsif entrance.kind_of? Array | 73 | elsif entrance.kind_of? Array |
| 74 | entrances = entrance | 74 | entrances = entrance |
| 75 | end | 75 | end |
| 76 | 76 | ||
| 77 | entrances.each do |e| | 77 | entrances.each do |e| |
| 78 | entrance_room = e.include?("room") ? e["room"] : room_name | 78 | if e.include?("door") then |
| 79 | mentioned_rooms.add(entrance_room) | 79 | entrance_room = e.include?("room") ? e["room"] : room_name |
| 80 | mentioned_doors.add(entrance_room + " - " + e["door"]) | 80 | mentioned_rooms.add(entrance_room) |
| 81 | mentioned_doors.add(entrance_room + " - " + e["door"]) | ||
| 82 | end | ||
| 81 | end | 83 | end |
| 82 | end | 84 | end |
| 83 | 85 | ||
| @@ -204,8 +206,8 @@ config.each do |room_name, room| | |||
| 204 | end | 206 | end |
| 205 | end | 207 | end |
| 206 | 208 | ||
| 207 | if not door.include?("id") and not door.include?("painting_id") and not door["skip_item"] and not door["event"] then | 209 | if not door.include?("id") and not door.include?("painting_id") and not door.include?("warp_id") and not door["skip_item"] and not door["event"] then |
| 208 | puts "#{room_name} - #{door_name} :::: Should be marked skip_item or event if there are no doors or paintings" | 210 | puts "#{room_name} - #{door_name} :::: Should be marked skip_item or event if there are no doors, paintings, or warps" |
| 209 | end | 211 | end |
| 210 | 212 | ||
| 211 | if door.include?("panels") | 213 | if door.include?("panels") |
| @@ -292,6 +294,32 @@ config.each do |room_name, room| | |||
| 292 | end | 294 | end |
| 293 | end | 295 | end |
| 294 | 296 | ||
| 297 | (room["sunwarps"] || []).each do |sunwarp| | ||
| 298 | if sunwarp.include? "dots" and sunwarp.include? "direction" then | ||
| 299 | if sunwarp["dots"] < 1 or sunwarp["dots"] > 6 then | ||
| 300 | puts "#{room_name} :::: Contains a sunwarp with an invalid dots value" | ||
| 301 | end | ||
| 302 | |||
| 303 | if sunwarp["direction"] == "enter" then | ||
| 304 | if mentioned_sunwarp_entrances.include? sunwarp["dots"] then | ||
| 305 | puts "Multiple #{sunwarp["dots"]} sunwarp entrances were found" | ||
| 306 | else | ||
| 307 | mentioned_sunwarp_entrances.add(sunwarp["dots"]) | ||
| 308 | end | ||
| 309 | elsif sunwarp["direction"] == "exit" then | ||
| 310 | if mentioned_sunwarp_exits.include? sunwarp["dots"] then | ||
| 311 | puts "Multiple #{sunwarp["dots"]} sunwarp exits were found" | ||
| 312 | else | ||
| 313 | mentioned_sunwarp_exits.add(sunwarp["dots"]) | ||
| 314 | end | ||
| 315 | else | ||
| 316 | puts "#{room_name} :::: Contains a sunwarp with an invalid direction value" | ||
| 317 | end | ||
| 318 | else | ||
| 319 | puts "#{room_name} :::: Contains a sunwarp without a dots and direction" | ||
| 320 | end | ||
| 321 | end | ||
| 322 | |||
| 295 | (room["progression"] || {}).each do |progression_name, door_list| | 323 | (room["progression"] || {}).each do |progression_name, door_list| |
| 296 | door_list.each do |door| | 324 | door_list.each do |door| |
| 297 | if door.kind_of? Hash then | 325 | if door.kind_of? Hash then |
