mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-08 08:45:43 +08:00
filtering unavailable maps from playlist
This commit is contained in:
parent
ad06b244a0
commit
50b6e22195
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import _ba
|
||||||
import copy
|
import copy
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
@ -36,6 +37,7 @@ def filter_playlist(playlist: PlaylistType,
|
|||||||
from ba._gameactivity import GameActivity
|
from ba._gameactivity import GameActivity
|
||||||
goodlist: list[dict] = []
|
goodlist: list[dict] = []
|
||||||
unowned_maps: Sequence[str]
|
unowned_maps: Sequence[str]
|
||||||
|
available_maps: list[str] = list(_ba.app.maps.keys())
|
||||||
if remove_unowned or mark_unowned:
|
if remove_unowned or mark_unowned:
|
||||||
unowned_maps = get_unowned_maps()
|
unowned_maps = get_unowned_maps()
|
||||||
unowned_game_types = get_unowned_game_types()
|
unowned_game_types = get_unowned_game_types()
|
||||||
@ -124,6 +126,11 @@ def filter_playlist(playlist: PlaylistType,
|
|||||||
|
|
||||||
gameclass = getclass(entry['type'], GameActivity)
|
gameclass = getclass(entry['type'], GameActivity)
|
||||||
|
|
||||||
|
if entry['settings']['map'] not in available_maps:
|
||||||
|
raise ImportError(
|
||||||
|
f"Map not found: '{entry['settings']['map']}'"
|
||||||
|
)
|
||||||
|
|
||||||
if remove_unowned and gameclass in unowned_game_types:
|
if remove_unowned and gameclass in unowned_game_types:
|
||||||
continue
|
continue
|
||||||
if add_resolved_type:
|
if add_resolved_type:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user