--This script maps block types to playlist names.
--I reserve the right to change this mapping.

--Local data structures.
local initialized = false
p.chunk_bt_to_playlist = {} --These play music when you are "in their chunk".
p.kilo_bt_to_playlist = {}  --These play music when you are "in their kilo chunk".

function p.add_kilo(bt, playlist)
    p.kilo_bt_to_playlist[bt] = playlist
end

function p.remove_kilo(bt)
    p.kilo_bt_to_playlist[bt] = nil
end

function p.add_chunk(bt, playlist)
    p.chunk_bt_to_playlist[bt] = playlist
    p.add_kilo(bt, playlist)
end

function p.remove_chunk(bt)
    p.chunk_bt_to_playlist[bt] = nil
    p.remove_kilo(bt, playlist)
end

function p.add(bt, playlist)
    p.add_kilo(bt, playlist)
end

function p.remove(bt, playlist)
    p.remove_kilo(bt, playlist)
end

--Getting the playlist that is specified
--by the path of the player.
function p.get_cur_playlist()
    p.init_maybe();

    local player_level = ga_get_viewer_level()
    local level = player_level
    while(level >= 0) do
        local bt = ga_get_cocoon_block_of_chunk(level, std.bp(0,0,0))

        if( level == player_level ) then
            --For chunks at the same level of the player,
            --to play a playlist, they have to be in the
            --chunk_bt_to_playlist table.
            local new_playlist_name = p.chunk_bt_to_playlist[bt]
            if( new_playlist_name ~= nil ) then
                return new_playlist_name
            end
        else
            local new_playlist_name = p.kilo_bt_to_playlist[bt]
            if( new_playlist_name ~= nil ) then
                return new_playlist_name
            end
        end
        level = level - 1
    end
end

function p.init_maybe()
    if( initialized ) then return end
    initialized = true

    -------------------------------------------
    --Top of world.
    --It is intended that these playlists are all within "xar_top_of_world".

    p.add("ROOT",               "xar_top_of_world_very_top")
    p.add("SPACE_ROOT",         "xar_space_top")
    p.add("SPACE_CASE_GAUNT",   "xar_top_gauntlet") --The three challenges.
    p.add("SPACE_GALAXY",       "xar_space_galaxy")
    p.add("SPACE_SUN",          "xar_space_sun")
    p.add("SPACE_PLANET_AREA",  "xar_planet_area")

    -------------------------------------------
    --Ying world.
    --It is intended that these playlists are all within "xar_ying_world".

    p.add("YW_2",                       "xar_ying_world") --The big ying shell.

    p.add("YW_CHAMBERS",                "xar_ying_world_chambers")
    p.add("NOOB_MAZE",                  "xar_noob_maze")
    p.add("NOOB_MAZE_FLOWER_BLOCK",     "xar_noob_maze")
    p.add("TUTORIAL",                   "xar_tutorial")
    p.add("HAPPY_LAND",                 "xar_happy_land")
    p.add("HAPPY_LAND_START_HOOKS",     "xar_happy_land_main")

    p.add("YING_FOREST",                "xar_ying_forest")
    p.add("YING_FOREST_AIR_TOP",        "xar_ying_forest_air")

    p.add("SMALL_YELLOW_FLOWER_ROOM",   "xar_small_yellow_flower")
    p.add("SMALL_YELLOW_FLOWER_CITY_2", "xar_small_yellow_flower_dungeon")
    p.add("SMALL_CANNON_PYRAMID",       "xar_small_cannon_pyramid")
    p.add("LARGE_CANNON_PYRAMID",       "xar_large_cannon_pyramid")
    p.add("JUMBO_YELLOW_FLOWER",        "xar_jumbo_yellow_flower")

    p.add("YW_SMALL_ISLAND_CAVE_1",     "xar_ying_cave_island1")
    p.add("YW_SMALL_ISLAND_CAVE_5",     "xar_ying_cave_island5")

    p.add_chunk("YW_SHELL_ROOM",        "xar_ying_flower")

    --Unremembered tower is in the "dungeon" section.

    -------------------------------------------
    --Midway.
    --It is intended that these playlists are all within "xar_midway".

    p.add("TAU_CAVE_LAYER_1_MOLD_START",    "xar_tau_caves")
    p.add("TAU_CAVE_LAYER_2_CAVE_START",    "xar_tau_caves")
    p.add("TAU_CAVE_LAYER_3_CAVE_START",    "xar_tau_caves")
    p.add("TAU_CAVE_LAYER_1_MOLD",          "xar_tau_caves")
    p.add("TAU_CAVE_LAYER_2_CAVE",          "xar_tau_caves")
    p.add("TAU_CAVE_LAYER_3_CAVE",          "xar_tau_caves")

    p.add("TAU_CAVE_MOSS",                  "xar_tau_cave_moss")

    p.add("TAU_CAVE_AIR_TWEED_DUM",         "xar_tweed_air")
    p.add("TAU_CAVE_AIR_TWEED_DEE",         "xar_tweed_air")
    p.add("TAU_CAVE_TWEED_DEE_CAVE_1",      "xar_tweed_cave")

    p.add("STONEY_AIR",                     "xar_stoney_air")
    p.add("STONEY_AIR_YELLOW_CUBE_1_RICH",  "xar_yellow_cube_rich")
    p.add("STONEY_AIR_YELLOW_CUBE_1",       "xar_yellow_cube")
    p.add("STONEY_CHURCH",                  "xar_stoney_sanctuary")

    p.add("MOSSY_AIR_CUBE",                 "xar_mossy_air_black_cube")

    p.add("BLACKBERRY_MEDIUM",              "xar_blackberry")

    p.add("ORANGE",                         "xar_orange")
    p.add("ORANGE_OUTER_MANTLE_MEGA",       "xar_orange_mantle")

    p.add("BLUE_BUBBLE_INSIDE_KILO",        "xar_blue_bubble")

    -------------------------------------------
    --I1.
    --It is intended that these playlists are all within "xar_i1".

    p.add("BOTANY_LAB_TOP_1",           "xar_botany_lab_surface")
    p.add("BOTANY_LAB_BLACK_CUBE",      "xar_botany_lab_black_cube")
    p.add("BOTANY_LAB_LIGHTHOUSE_CASE", "xar_lighthouse")

    p.add("INFINITY_FLOWER_CHEESE_1",   "xar_inf_flower_cheese")

    p.add("WILLISTON_KILO_ABOVE",       "xar_i1_williston_field")

    p.add("WILLISTON_CASTLE",           "xar_i1_williston_castle_normal")
    p.add("WILLISTON_ZUBE_CASTLE",      "xar_i1_williston_castle_zube")

    p.add("SCORPIUS_PORTAL",            "xar_i1_scorpius_portal")

    -------------------------------------------
    --I2.
    --It is intended that these playlists are all within "xar_i2".

    p.add("FANATIC_LATTICE_BIG",            "xar_i2_fanatic_lattice")
    p.add("FANATIC_LATTICE",                "xar_i2_fanatic_lattice")

    p.add("FANATIC_WEED",                       "xar_i2_fanatic_weed")
    p.add("FANATIC_BLUE_MEGA",                  "xar_i2_fanatic_blue_caves")
    p.add("WEED_RINGS",                         "xar_i2_weed_rings")
    p.add("MINI_AMMO_FOREST_TOP",               "xar_i2_mini_ammo_forest_top")
    p.add("MINI_AMMO_FOREST_HANGING_MEGA",      "xar_i2_mini_ammo_forest_hanging")
    p.add("MINI_AMMO_FOREST_GUERRILLA_KILO",    "xar_i2_guerrilla_forest")
    p.add("MINI_AMMO_FOREST_BIG_POD",           "xar_i2_mini_forest_big_pod")

    p.add("BUBBLE_CAVE_BUBBLE_KILO",                "xar_i2_bubble_cave_bubble")
    p.add("BUBBLE_CAVE_MEGA",                       "xar_i2_bubble_cave")
    p.add("BUBBLE_CAVE_BUBBLE_ABOMINATION_KILO",    "xar_i2_bubble_cave_center") --Could add boss music.

    p.add("SMALL_BLUE_FLOWER_FRUIT_MEGA",           "xar_i2_small_blue_flower_1")
    p.add("SMALL_BLUE_FLOWER_SECONDARY_MEGA_INNER", "xar_i2_small_blue_flower_2")
    p.add("SMALL_BLUE_FLOWER_TERTIARY_MEGA",        "xar_i2_small_blue_flower_3")
    p.add("SMALL_BLUE_FLOWER_QUATERNARY_MEGA",      "xar_i2_small_blue_flower_4")
    p.add("SMALL_BLUE_FLOWER_QUINARY_KILO",         "xar_i2_small_blue_flower_5")

    p.add("FANATIC_ISLAND_WILLOW_MAIN",             "xar_i2_willow_normal")
    p.add("FANATIC_ISLAND_WILLOW_CENTER",           "xar_i2_willow_normal")

    p.add("MYSTIC_VINE_SHAFT_1",        "xar_i2_mystic_vine_1")
    p.add("MYSTIC_VINE_SHAFT_2",        "xar_i2_mystic_vine_2")
    p.add("MYSTIC_VINE_SHAFT_3",        "xar_i2_mystic_vine_3")
    p.add("MYSTIC_VINE_SHAFT_4",        "xar_i2_mystic_vine_4")

    p.add("RASPBERRY",                  "xar_i2_raspberry")

    p.add("TO_I3_HOMING_WALL_MEGA",     "xar_i2_gate_to_i3_homing")
    p.add("TO_I3_MIRROR_WALL_MEGA",     "xar_i2_gate_to_i3_mirror")

    p.add("FANATIC_SPIRE",      "xar_i2_fanatic_spire")

    p.add("CREEPING_JENI_TOP",      "xar_i2_creeping_jeni")
    p.add("CREEPING_JENI_VINE_2",   "xar_i2_creeping_jeni_vine")

    p.add("VIOLETS_OUT_2",      "xar_i2_violets_1")
    p.add("VIOLETS_OUT_3",      "xar_i2_violets_2")
    p.add("VIOLETS_OUT_4",      "xar_i2_violets_3")
    p.add("VIOLETS_OUT_3_MAP",  "xar_i2_violets_secret")

    --Vines.
    p.add("I2VB_2",             "xar_i2_vine_bundle_1")
    p.add("I2VB_3",             "xar_i2_vine_bundle_2")
    p.add("I2VB_4",             "xar_i2_vine_bundle_3")
    p.add("I2VB_5",             "xar_i2_vine_bundle_4")
    p.add("FANATIC_VINE_SHAFT", "xar_i2_fanatic_vine")
    p.add("PIRATE_VINE",        "xar_i2_pirate_vine")
    --Laser branch vine.
    p.add("LBV_A",              "xar_i2_laser_branch_vine_1")
    p.add("LBV_B",              "xar_i2_laser_branch_vine_1")
    p.add("LBV_2_A",            "xar_i2_laser_branch_vine_2")
    p.add("LBV_2_B",            "xar_i2_laser_branch_vine_2")
    p.add("LBV_3_A",            "xar_i2_laser_branch_vine_3")
    p.add("LBV_3_B",            "xar_i2_laser_branch_vine_3")
    --More vines.
    p.add("TORONTO_VINE_A",     "xar_i2_toronto_vine")
    p.add("TORONTO_VINE_B",     "xar_i2_toronto_vine")
    p.add("TORONTO_VINE_MAZE",  "xar_i2_toronto_vine_center")
    p.add("I2VB_LAB_SUPER",     "xar_i2_lab_bundle")
    p.add("I2VB_YELLOW",        "xar_i2_yellow_vine")

    p.add("FANATIC_ISLAND_CAVES",           "xar_i2_fanatic_island_caves")
    p.add("FANATIC_ISLAND_WELL_AIR_KILO",   "xar_i2_fanatic_island_well")
    p.add("FANATIC_ISLAND_WELL_BELOW",      "xar_i2_fanatic_island_well")
    p.add("SPIRIT_POCKET",                  "xar_i2_spirit_pocket")
    p.add("FANATIC_ISLAND_ABOVE",           "xar_i2_fanatic_island_forest")
    p.add("FANATIC_ISLAND_WELL_ABOVE",      "xar_i2_fanatic_island_forest")

    p.add("I2_FERN_OSTRICH",    "xar_i2_fern_ostrich")

    -------------------------------------------
    --I3.
    --It is intended that these playlists are all within "xar_i3".

    p.add("GROUP_3_MEGA",                       "xar_i3_main_forest_large_size") --Hard to get.
    p.add("GROUP_3_PATCH_AIR_ABOVE",            "xar_i3_main_forest")
    p.add("GROUP_3_PATCH_TREES_BELOW",          "xar_i3_main_forest")
    p.add("GROUP_3_PATCH_TREES_ABOVE",          "xar_i3_main_forest")
    p.add("GROUP_3_PATCH_AMMO_KILO_BELOW",      "xar_i3_main_forest")
    p.add("GROUP_3_PATCH_EMP_POST",             "xar_i3_main_forest")
    p.add("GROUP_3_PATCH_WAYPOINT_KILO_BELOW",  "xar_i3_main_forest")
    p.add("GROUP_3_PATCH_WAYPOINT_KILO_ABOVE",  "xar_i3_main_forest")
    p.add("SAGITTARIUS_PORTAL",                 "xar_i3_main_forest")
    p.add("SAGITTARIUS_ABOVE",                  "xar_i3_main_forest")

    p.add("JACKFRUIT_CENTER_GREEN",     "xar_i3_jackfruit")

    p.add("GROUP_3_PATCH_DESERT",       "xar_i3_desert")
    p.add("DESERT_ABOVE",               "xar_i3_desert")
    p.add("DESERT_CACTUS",              "xar_i3_desert_cactus")
    p.add("DESERT_OASIS",               "xar_i3_desert_oasis")
    p.add("DESERT_FLOWER_TOP_2",        "xar_i3_desert_flower")
    p.add("DESERT_FLOWER_CLOUD",        "xar_i3_desert_flower_cloud")
    p.add("TANGERINE",                  "xar_i3_tangerine")

    p.add("RIVER_KILO",         "xar_i3_river")
    p.add("RIVER_CENTER_KILO",  "xar_i3_river")
    p.add("RIVER_TREASURE_1",   "xar_i3_river")

    p.add("MAHOGANY_BARK_MEGA",     "xar_i3_mahogany_bark")
    p.add("MAHOGANY_INSIDE_MEGA",   "xar_i3_mahogany_cavity")

    p.add("I3_TREETOP_CAVE_MEGA",   "xar_i3_treetop_outer")
    p.add("I3_TREETOP_INNER_TRUNK", "xar_i3_inner_tree")

    p.add("CARROTS_GROUND",         "xar_i3_carrots_cave")
    p.add("TURNIPS_BELOW",          "xar_i3_turnips_cave")
    p.add("BEETS_BELOW",            "xar_i3_beets_cave")

    -------------------------------------------
    --Burlington.
    --It is intended that these playlists are all within "xar_burlington".

    p.add("BURLINGTON_COLS",            "xar_bur_giant_columns")

    p.add("BURLINGTON",                 "xar_bur_city")

    --Entering the combination lock.
    p.add("BURLINGTON_CITY_BUILDING_ROOM_SPIRAL",       "xar_bur_combo")
    p.add("BURLINGTON_CITY_BASE_KILO",                  "xar_bur_combo")
    p.add("BURLINGTON_CITY_HANGING_SPIRAL_BUILDINGS",   "xar_bur_combo")

    p.add("BURLINGTON_TEGAN_GARDEN",    "xar_bur_tegan_garden")
    p.add("BURLINGTON_APPLE_CLUB",      "xar_bur_apple_club")

    -------------------------------------------
    --Space.

    p.add("SPACE_TOP_1",                "xar_outer_space_level_0")
    p.add("MYLANTIS_ABOVE",             "xar_outer_space_level_0")
    -- p.add("SPACE_TOP_2",    "xar_space_top_2")

    --Later, might want to have playlists for various parts
    --of moons and planets.

    p.add("SMALL_MINIGUN_PLANET",       "xar_planet_small_minigun")
    p.add("PLANET_CLAY",                "xar_planet_clay")

    p.add("SPACE_MOON_ALPHA",           "xar_moon_alpha")
    p.add("SMALL_DARK_HOLE_MAZE",       "xar_moon_beta")
    p.add("SPACE_MOON_GAMMA",           "xar_moon_gamma")
    p.add("TAU_CAVE_MOON",              "xar_moon_tau")
    p.add("TAU_CAVE_MOON_SECRET",       "xar_moon_tau")
    p.add("MOON_ICE",                   "xar_moon_ice")
    p.add("FORBIDDEN_PLANET",           "xar_moon_fire_rate")
    p.add("BLUE_RING_STATION_SHAFT",    "xar_outer_space_blue_ring_station")

    -------------------------------------------
    --The bulk.

    --This will be added to the game later.

    -------------------------------------------
    --Mylantis.
    --It is intended that these playlists are all within "xar_mylantis".

    p.add("MYLANTIS",                   "xar_mylantis")
    --Need to add music to the Mylantis city underground.

    p.add("DAN_HOUSE_AREA_HOUSE_ABOVE", "xar_secret_farmhouse");

    p.add("MYLANTIS_CRUST_MEGA",        "xar_mylantis_crust") --Could break into pieces.
    p.add("MYLANTIS_CRUST_BOT_KILO",    "xar_mylantis_cavern")
    p.add("MYLANTIS_CAVE_MEGA",         "xar_mylantis_caves")
    p.add("MYLANTIS_CAVERN_KILO",       "xar_mylantis_cavern")
    p.add("MYLANTIS_GREAT_CAVERN_MEGA", "xar_mylantis_great_cavern")
    p.add("MYLANTIS_RED_CAVE_MEGA",     "xar_mylantis_red_caves")
    --
    p.add("LOST_SPICE_REFINERY",        "xar_mylantis_refinery")

    -------------------------------------------
    --Hell.
    --It is intended that these playlists are all within "xar_hell".

    --Entrances to hell.
    p.add_chunk("MYLANTIS_CITY_HOL_ENTRANCE",   "xar_hell_house_of_lampreys")
    p.add_chunk("MYLANTIS_CITY_HOL_LAMPREY",    "xar_hell_house_of_lampreys")
    p.add_chunk("MYLANTIS_CITY_HOL_PORTAL",     "xar_hell_house_of_lampreys") --Could make another playlist.
    p.add("BURLINGTON_APPLE_CLUB_HELL",         "xar_hell_club_green_apple")

    p.add("GROUP_3_PATCH_HELL",                 "xar_hell_entrance") --Could make another playlist.

    p.add("HELL_LEVEL1_ENTRANCE",               "xar_hell_entrance_hell_flower")

    --Inside the hell flower.
    p.add("HELLBERRY",                          "xar_hell_flower_pre_boss_fight")
    p.add("HELLBERRY_SEED_ENTRANCE_2",          "xar_hell_flower_before_final_boss")
    p.add("HELLBERRY_SEED",                     "xar_boss_inner_core")
    p.add("HELLBERRY_SEED_TOWER_3",             "xar_hell_flower_after_boss")

    p.add("HELL_GATE_KILO",                     "xar_hell_gate") --Can get to after getting key to universe.
    
    --More hell areas will added below the gate later.

    -------------------------------------------
    --Credits.
    --It is intended that these playlists are all within "xar_credits".

    p.add("ENDING_KILO",    "xar_credits")

    --Zach Barth thought the theme song to Infinifrag 2 should be
    --Party Hard by Andrew WK!
    p.add_chunk("ENDING_SECRET_INF_2_1",    "xar_inf2")
    p.add_chunk("ENDING_SECRET_INF_2_2",    "xar_inf2")
    p.add_chunk("ENDING_SECRET_INF_2_3",    "xar_inf2")
    p.add_chunk("ENDING_SECRET_INF_2_4",    "xar_inf2")
    p.add_chunk("ENDING_SECRET_INF_2_5",    "xar_inf2")
    p.add_chunk("ENDING_SECRET_INF_2_6",    "xar_inf2")
    p.add_chunk("ENDING_SECRET_INF_2_7",    "xar_inf2")
    p.add_chunk("ENDING_SECRET_INF_2_8",    "xar_inf2")

    -------------------------------------------
    --No waypoint.
    --It is intended that these playlists are all within "xar_no_waypoint".

    p.add("QUICKSAND_GRASS_1",          "xar_nwp_quicksand_grass")
    p.add("SMALL_WHITE_FLOWER_CENTER",  "xar_nwp_small_white_flower")
    p.add("SMALL_2D_BLACK_FLOWER_MAZE", "xar_nwp_small_black_flower")
    p.add("APPLE_TREE_RED",             "xar_nwp_apple_tree_red")
    p.add("APPLE_TREE_YELLOW",          "xar_nwp_apple_tree_yellow")
    p.add("APPLE_TREE_GREEN",           "xar_nwp_apple_tree_green")
    p.add("HEALTH_TOWER",               "xar_nwp_health_tower")
    p.add("CUBE1",                      "xar_new_cube_alpha")

    -------------------------------------------
    --Sponges.
    --It is intended that these playlists are all within "xar_sponge".

    p.add("SPONGE_PURE",        "xar_sponge_pure")
    p.add("SPONGE1",            "xar_sponge_alpha")
    p.add("SPONGE2",            "xar_sponge_beta")
    p.add("TOPAZ_GEM_SPONGE",   "xar_sponge_topaz")
    p.add("IOLITE_GEM_SPONGE",  "xar_sponge_iolite")
    p.add("EMERALD_GEM_SPONGE", "xar_sponge_emerald")

    -------------------------------------------
    --Mushrooms (could organize this differently).
    --It is intended that these playlists are all within
    --the "xar_mushroom" folder, but the user may want
    --to organize this differently.

    p.add("BLUE_MUSHROOM",      "xar_blue_mushroom")
    p.add("MUSHROOM",           "xar_salmon_mushroom")
    p.add("BLACK_MUSHROOM",     "xar_black_mushroom")
    p.add("YELLOW_MUSHROOM",    "xar_yellow_mushroom")
    p.add("RED_MUSHROOM",       "xar_red_mushroom")

    -------------------------------------------
    --Large mazes.
    --It is intended that these playlists are all within "xar_maze/xar_big_maze".

    p.add("YW_SLOW_EXIT_2",             "xar_ying_world_exit_maze")
    p.add("STONEY_CHURCH_MAZE_KILO",    "xar_stoney_sanctuary_maze")
    p.add("SMALL_WHITE_FLOWER_MAZE",    "xar_small_white_flower_maze")
    p.add("CATACOMBS",                  "xar_catacombs")
    p.add("RED_MAZE",                   "xar_red_maze_flower")
    p.add("ALADDIN_CAVE_BELOW",         "xar_aladdin_cave_maze")
    p.add("LARGE_WHITE_FLOWER_MAZE",    "xar_large_white_flower_maze")

    -------------------------------------------
    --Big room maze.
    --It is intended that these playlists are all within "xar_maze/xar_big_room_maze".

    p.add("TORONTO",        "xar_toronto")
    p.add("SAPPHIRE_GEM",   "xar_sapphire")
    p.add("AMETHYST_GEM",   "xar_amethyst")

    -------------------------------------------
    --Caves.
    --Some caves are claustrophobic (which we call small),
    --and others are not (which we call large).
    --It is intended that these playlists are all within "xar_cave".

    p.add("TAU_CAVE_FLOWER_CENTER",     "xar_tau_cave_flower")
    p.add("RICHMOND_TOP_HOMING_1",      "xar_richmond_red_caves")
    
    p.add("MOSSY_AIR_CUBE_CAVE_KILO",   "xar_mossy_air_black_cube_caves")

    p.add("ORANGE_OUTER_CRUST_KILO",    "xar_orange_outer_crust")

    p.add("ICE_CUBE_SOLID",             "xar_ice_cube_solid")

    p.add("BOTANY_LAB_CAVE_IMP_TOP",    "xar_botany_caves_imp")
    p.add("BOTANY_LAB_CAVE_GNOLL",      "xar_botany_caves_gnoll")
    p.add("BOTANY_LAB_CAVE_DEMON",      "xar_botany_caves_demon")
    p.add("BOTANY_LAB_CAVE_ORC",        "xar_botany_caves_orc")

    p.add_chunk("DESERT_CAVE_ENTRANCE",                 "xar_desert_cave")
    p.add_chunk("DESERT_CAVE_ENTRANCE_TUBE",            "xar_desert_cave")
    p.add_chunk("DESERT_CAVE_ENTRANCE_TUBE_BOTTOM",     "xar_desert_cave")
    p.add("DESERT_CAVE_BIG",                            "xar_desert_cave")

    p.add("NUKE_RADIUS_CAVES_MEGA",     "xar_i2_nuke_radius_cave")

    -------------------------------------------
    --Boss.
    --It is intended that these playlists are all within "xar_boss".
    
    p.add("GUNS",                                   "xar_guns")

    p.add("LASER_FORT_SMALL",                       "xar_laser_fort_small")

    --"Arcades", where you are given infinite ammo.
    p.add("RICHMOND_LIBRARY_ARCADE_KILO",           "xar_richmond_arcade")
    p.add("RAIL_CAVE",                              "xar_rail_cave_arcade")
    p.add("BURLINGTON_TOWER_SPIRAL",                "xar_arcade_bur_tower_spiral")

    p.add("YING_FOREST_DEEP_HANGING_BATTLE_X",      "xar_boss_honey_comb")
    p.add("YING_FOREST_DEEP_HANGING_BATTLE_Y",      "xar_boss_honey_comb")
    p.add("YW_SHELL_3",                             "xar_boss_ying_shell")

    p.add("STONEY_AIR_CAVE_3_TOP",                  "xar_boss_stoney_cave")

    p.add("ORANGE_INNER_CRUST_KILO_HARD",           "xar_orange_inner_crust")

    p.add("ICE_CUBE_AIR",                           "xar_ice_cube_air")

    p.add("BLUE_BUBBLE_QUICK_ENTRANCE_2",           "xar_blue_bubble_entrance")
    p.add("BLUE_BUBBLE_QUICK_ENTRANCE_1",           "xar_blue_bubble_entrance")
    p.add("BLUE_BUBBLE_NUKE_KILO",                  "xar_blue_bubble_red_room")

    p.add("BOTANY_LAB_CAVE_TROLL",                  "xar_botany_caves_troll")
    p.add("BOTANY_LAB_BIG_RED",                     "xar_botany_lab_red_cube")

    p.add("LIGHTHOUSE_QUICK_1",                     "xar_lighthouse_quick_entrance")

    p.add("INFINITY_FLOWER_ROOM",                   "xar_inf_flower")

    p.add("I2_LIBRARY_TOWER_SHAFT_BOTTOM",          "xar_i2_lib_tower")
    p.add("I2_LIBRARY_TOWER_SHAFT",                 "xar_i2_lib_tower")
    p.add("I2_LIBRARY_TOWER_SHAFT_BOSS",            "xar_i2_lib_tower")
    p.add("I2_LIBRARY_TOWER_SHAFT_TOP",             "xar_i2_lib_tower")

    p.add("MAHOGANY_CORE_WALL_KILO",                "xar_i3_mahogany_core_wall")

    p.add("ROSE_RED_CORE",                          "xar_boss_rose_red")

    p.add("DAN_HOUSE_BOSS_MEGA",                    "xar_boss_farmhouse_basement")

    -------------------------------------------
    --Dungeon (often with floors).
    
    p.add("YING_FOREST_TOWER_FLOOR_1",          "xar_unremembered_tower")
    p.add("YING_FOREST_TOWER_FLOOR_2",          "xar_unremembered_tower")
    p.add("YING_FOREST_TOWER_FLOOR_3",          "xar_unremembered_tower")
    p.add("YING_FOREST_TOWER_FLOOR_4",          "xar_unremembered_tower")
    p.add("YING_FOREST_TOWER_TREASURE_KILO",    "xar_unremembered_tower")

    p.add("RICHMOND_SEWERS_1",          "xar_richmond_sewers")

    --A cave system and then a dugeon basement.
    p.add("BOTANY_LAB_LIGHTHOUSE_CASE", "xar_lighthouse_below")

    p.add("WILLISTON_KILO_BELOW",       "xar_williston_dungeon")

    p.add("DAN_HOUSE_AREA_HOUSE_BELOW", "xar_secret_farmhouse_basement");

    -------------------------------------------
    --Library.
    --It is intended that these playlists are all within "xar_library".

    p.add("RICHMOND_LIBRARY",       "xar_library_richmond")
    p.add("MAIN_BRANCH_LIB_1",      "xar_library_main_branch")
    p.add("I1_LIBRARY",             "xar_library_i1")
    p.add("I2_LIBRARY",             "xar_library_i2")
    p.add("I3_LIBRARY",             "xar_library_i3")
    p.add("SPACE_LIBRARY",          "xar_library_space")
    p.add("MYLANTIS_CAVES_LIB",     "xar_library_mylantis_caves")

    -------------------------------------------
    --Town.
    --It is intended that these playlists are all within "xar_town".

    p.add("RICHMOND",                           "xar_town_richmond")
    p.add("JERICHO",                            "xar_town_jericho")
    p.add("HUNTINGTON",                         "xar_town_huntington")
    p.add("BRISTOL",                            "xar_town_bristol")
    p.add("WILLISTON_KILO_CITY_ABOVE",          "xar_town_williston")
    p.add("WILLISTON_CENTER_KILO",              "xar_town_williston_center")
    p.add("MONTREAL",                           "xar_town_montreal")
    p.add("DANVILLE_ABOVE",                     "xar_town_danville")
    p.add("DANVILLE_BELOW",                     "xar_town_danville")
    p.add("BUBBLE_CAVE_WALL_TREASURE",          "xar_town_bubble_cave")
    p.add("FANATIC_ISLAND_DARK_WILLOW_CENTER",  "xar_town_dark_willow_center")
    p.add("COLCHESTER",                         "xar_town_colchester")
    p.add("ESSEX",                              "xar_town_essex")
    p.add("DENVER",                             "xar_town_denver")

    -------------------------------------------
    --Hidden spaces (often big).
    --Treasure areas with subareas to explore.
    --Some of these are somewhat secret, but not all.
    --It is intended that these playlists are all within "xar_hidden_spaces".

    p.add("STONEY_AIR_SECRET_AREA_2",                   "xar_yellow_cube_secret_island")
    p.add("MOSSY_AIR_CUBE",                             "xar_mossy_air_black_cube")
    p.add("BLUE_BUBBLE_INSIDE",                         "xar_blue_bubble_secret")
    p.add("ICE_CUBE_SECRET",                            "xar_ice_cube_center")
    p.add("ICE_CUBE_TREASURE_1",                        "xar_ice_cube_center")
    p.add("WIG_CHECKPOINT",                             "xar_wig_checkpoint")
    p.add("WOLF_FOREST",                                "xar_wolf_forest")
    p.add("FANATIC_ISLAND_WELL_SECRET_1",               "xar_fanatic_island_well_secret")
    p.add_chunk("TAU_CAVE_MOON_SECRET_ROOM",            "xar_tau_cave_moon_secret")
    p.add_chunk("SPACE_GALAXY_FLOWER_SECRET_TREASURE",  "xar_galaxy_flower_secret")

    p.add("TO_I3_HOMING_INNER_AIR_MEGA",                "xar_i3_gate_center")
    p.add("TO_I3_HOMING_INNER_CENTER_MEGA",             "xar_i3_gate_center")
    p.add("TO_I3_MIRROR_INNER_AIR_MEGA",                "xar_i3_gate_center")
    p.add("TO_I3_MIRROR_INNER_CENTER_MEGA",             "xar_i3_gate_center")
    p.add("GROUP_3_BELOW",                              "xar_i3_gate_center")

    p.add("MAHOGANY_CORE_MEGA",                         "xar_i3_mahogany_core")

    p.add("I3_TREETOP_X_POS",                           "xar_i3_treetop_center")
    p.add("I3_TREETOP_X_NEG",                           "xar_i3_treetop_center")
    p.add("I3_TREETOP_Y_POS",                           "xar_i3_treetop_center")
    p.add("I3_TREETOP_Y_NEG",                           "xar_i3_treetop_center")
    p.add("I3_TREETOP_INNER_TREE",                      "xar_i3_treetop_center")

    p.add("BEET_ABOVE",                                 "xar_i3_beet_cavern")

    p.add_chunk("SPACE_LIBRARY_SECRET_2",               "xar_space_lib_secret")
    p.add_chunk("SPACE_LIBRARY_SECRET_3",               "xar_space_lib_secret")
end
