bastd.stdmap

Defines standard map type.

 1# Released under the MIT License. See LICENSE for details.
 2#
 3"""Defines standard map type."""
 4
 5from __future__ import annotations
 6
 7from typing import TYPE_CHECKING
 8
 9import ba
10
11if TYPE_CHECKING:
12    from typing import Any
13
14
15def _get_map_data(name: str) -> dict[str, Any]:
16    import json
17    print('Would get map data', name)
18    with open('ba_data/data/maps/' + name + '.json',
19              encoding='utf-8') as infile:
20        mapdata = json.loads(infile.read())
21    assert isinstance(mapdata, dict)
22    return mapdata
23
24
25class StdMap(ba.Map):
26    """A map completely defined by asset data.
27
28    """
29    _data: dict[str, Any] | None = None
30
31    @classmethod
32    def _getdata(cls) -> dict[str, Any]:
33        if cls._data is None:
34            cls._data = _get_map_data('bridgit')
35        return cls._data
36
37    def __init__(self) -> None:
38        super().__init__()
class StdMap(ba._map.Map):
26class StdMap(ba.Map):
27    """A map completely defined by asset data.
28
29    """
30    _data: dict[str, Any] | None = None
31
32    @classmethod
33    def _getdata(cls) -> dict[str, Any]:
34        if cls._data is None:
35            cls._data = _get_map_data('bridgit')
36        return cls._data
37
38    def __init__(self) -> None:
39        super().__init__()

A map completely defined by asset data.

StdMap()
38    def __init__(self) -> None:
39        super().__init__()

Instantiate a map.

Inherited Members
ba._map.Map
defs
name
preload
get_play_types
get_preview_texture_name
on_preload
getname
get_music_type
is_point_near_edge
get_def_bound_box
get_def_point
get_def_points
get_start_position
get_ffa_start_position
get_flag_position
exists
handlemessage
ba._actor.Actor
autoretain
on_expire
expired
is_alive
activity
getactivity