Bombsquad-Ballistica-Modded.../dist/ba_data/python/bastd/stdmap.py

39 lines
864 B
Python
Raw Normal View History

2021-03-29 03:24:13 +05:30
# Released under the MIT License. See LICENSE for details.
#
"""Defines standard map type."""
from __future__ import annotations
from typing import TYPE_CHECKING
import ba
if TYPE_CHECKING:
2022-06-30 00:31:52 +05:30
from typing import Any
2021-03-29 03:24:13 +05:30
def _get_map_data(name: str) -> dict[str, Any]:
2021-03-29 03:24:13 +05:30
import json
print('Would get map data', name)
2021-10-26 23:24:50 +05:30
with open('ba_data/data/maps/' + name + '.json',
encoding='utf-8') as infile:
2021-03-29 03:24:13 +05:30
mapdata = json.loads(infile.read())
assert isinstance(mapdata, dict)
return mapdata
class StdMap(ba.Map):
"""A map completely defined by asset data.
"""
2022-06-30 00:31:52 +05:30
_data: dict[str, Any] | None = None
2021-03-29 03:24:13 +05:30
@classmethod
def _getdata(cls) -> dict[str, Any]:
2021-03-29 03:24:13 +05:30
if cls._data is None:
cls._data = _get_map_data('bridgit')
return cls._data
def __init__(self) -> None:
super().__init__()