bascenev1lib.maps

Standard maps.

   1# Released under the MIT License. See LICENSE for details.
   2#
   3"""Standard maps."""
   4# pylint: disable=too-many-lines
   5
   6from __future__ import annotations
   7
   8from typing import TYPE_CHECKING
   9
  10import bascenev1 as bs
  11from bascenev1lib.gameutils import SharedObjects
  12
  13if TYPE_CHECKING:
  14    from typing import Any
  15
  16
  17class HockeyStadium(bs.Map):
  18    """Stadium map used for ice hockey games."""
  19
  20    # noinspection PyUnresolvedReferences
  21    from bascenev1lib.mapdata import hockey_stadium as defs
  22
  23    name = 'Hockey Stadium'
  24
  25    @classmethod
  26    def get_play_types(cls) -> list[str]:
  27        """Return valid play types for this map."""
  28        return ['melee', 'hockey', 'team_flag', 'keep_away']
  29
  30    @classmethod
  31    def get_preview_texture_name(cls) -> str:
  32        return 'hockeyStadiumPreview'
  33
  34    @classmethod
  35    def on_preload(cls) -> Any:
  36        data: dict[str, Any] = {
  37            'meshes': (
  38                bs.getmesh('hockeyStadiumOuter'),
  39                bs.getmesh('hockeyStadiumInner'),
  40                bs.getmesh('hockeyStadiumStands'),
  41            ),
  42            'vr_fill_mesh': bs.getmesh('footballStadiumVRFill'),
  43            'collision_mesh': bs.getcollisionmesh('hockeyStadiumCollide'),
  44            'tex': bs.gettexture('hockeyStadium'),
  45            'stands_tex': bs.gettexture('footballStadium'),
  46        }
  47        mat = bs.Material()
  48        mat.add_actions(actions=('modify_part_collision', 'friction', 0.01))
  49        data['ice_material'] = mat
  50        return data
  51
  52    def __init__(self) -> None:
  53        super().__init__()
  54        shared = SharedObjects.get()
  55        self.node = bs.newnode(
  56            'terrain',
  57            delegate=self,
  58            attrs={
  59                'mesh': self.preloaddata['meshes'][0],
  60                'collision_mesh': self.preloaddata['collision_mesh'],
  61                'color_texture': self.preloaddata['tex'],
  62                'materials': [
  63                    shared.footing_material,
  64                    self.preloaddata['ice_material'],
  65                ],
  66            },
  67        )
  68        bs.newnode(
  69            'terrain',
  70            attrs={
  71                'mesh': self.preloaddata['vr_fill_mesh'],
  72                'vr_only': True,
  73                'lighting': False,
  74                'background': True,
  75                'color_texture': self.preloaddata['stands_tex'],
  76            },
  77        )
  78        mats = [shared.footing_material, self.preloaddata['ice_material']]
  79        self.floor = bs.newnode(
  80            'terrain',
  81            attrs={
  82                'mesh': self.preloaddata['meshes'][1],
  83                'color_texture': self.preloaddata['tex'],
  84                'opacity': 0.92,
  85                'opacity_in_low_or_medium_quality': 1.0,
  86                'materials': mats,
  87            },
  88        )
  89        self.stands = bs.newnode(
  90            'terrain',
  91            attrs={
  92                'mesh': self.preloaddata['meshes'][2],
  93                'visible_in_reflections': False,
  94                'color_texture': self.preloaddata['stands_tex'],
  95            },
  96        )
  97        gnode = bs.getactivity().globalsnode
  98        gnode.floor_reflection = True
  99        gnode.debris_friction = 0.3
 100        gnode.debris_kill_height = -0.3
 101        gnode.tint = (1.2, 1.3, 1.33)
 102        gnode.ambient_color = (1.15, 1.25, 1.6)
 103        gnode.vignette_outer = (0.66, 0.67, 0.73)
 104        gnode.vignette_inner = (0.93, 0.93, 0.95)
 105        gnode.vr_camera_offset = (0, -0.8, -1.1)
 106        gnode.vr_near_clip = 0.5
 107        self.is_hockey = True
 108
 109
 110class FootballStadium(bs.Map):
 111    """Stadium map for football games."""
 112
 113    from bascenev1lib.mapdata import football_stadium as defs
 114
 115    name = 'Football Stadium'
 116
 117    @classmethod
 118    def get_play_types(cls) -> list[str]:
 119        """Return valid play types for this map."""
 120        return ['melee', 'football', 'team_flag', 'keep_away']
 121
 122    @classmethod
 123    def get_preview_texture_name(cls) -> str:
 124        return 'footballStadiumPreview'
 125
 126    @classmethod
 127    def on_preload(cls) -> Any:
 128        data: dict[str, Any] = {
 129            'mesh': bs.getmesh('footballStadium'),
 130            'vr_fill_mesh': bs.getmesh('footballStadiumVRFill'),
 131            'collision_mesh': bs.getcollisionmesh('footballStadiumCollide'),
 132            'tex': bs.gettexture('footballStadium'),
 133        }
 134        return data
 135
 136    def __init__(self) -> None:
 137        super().__init__()
 138        shared = SharedObjects.get()
 139        self.node = bs.newnode(
 140            'terrain',
 141            delegate=self,
 142            attrs={
 143                'mesh': self.preloaddata['mesh'],
 144                'collision_mesh': self.preloaddata['collision_mesh'],
 145                'color_texture': self.preloaddata['tex'],
 146                'materials': [shared.footing_material],
 147            },
 148        )
 149        bs.newnode(
 150            'terrain',
 151            attrs={
 152                'mesh': self.preloaddata['vr_fill_mesh'],
 153                'lighting': False,
 154                'vr_only': True,
 155                'background': True,
 156                'color_texture': self.preloaddata['tex'],
 157            },
 158        )
 159        gnode = bs.getactivity().globalsnode
 160        gnode.tint = (1.3, 1.2, 1.0)
 161        gnode.ambient_color = (1.3, 1.2, 1.0)
 162        gnode.vignette_outer = (0.57, 0.57, 0.57)
 163        gnode.vignette_inner = (0.9, 0.9, 0.9)
 164        gnode.vr_camera_offset = (0, -0.8, -1.1)
 165        gnode.vr_near_clip = 0.5
 166
 167    def is_point_near_edge(self, point: bs.Vec3, running: bool = False) -> bool:
 168        box_position = self.defs.boxes['edge_box'][0:3]
 169        box_scale = self.defs.boxes['edge_box'][6:9]
 170        xpos = (point.x - box_position[0]) / box_scale[0]
 171        zpos = (point.z - box_position[2]) / box_scale[2]
 172        return xpos < -0.5 or xpos > 0.5 or zpos < -0.5 or zpos > 0.5
 173
 174
 175class Bridgit(bs.Map):
 176    """Map with a narrow bridge in the middle."""
 177
 178    # noinspection PyUnresolvedReferences
 179    from bascenev1lib.mapdata import bridgit as defs
 180
 181    name = 'Bridgit'
 182    dataname = 'bridgit'
 183
 184    @classmethod
 185    def get_play_types(cls) -> list[str]:
 186        """Return valid play types for this map."""
 187        # print('getting playtypes', cls._getdata()['play_types'])
 188        return ['melee', 'team_flag', 'keep_away']
 189
 190    @classmethod
 191    def get_preview_texture_name(cls) -> str:
 192        return 'bridgitPreview'
 193
 194    @classmethod
 195    def on_preload(cls) -> Any:
 196        data: dict[str, Any] = {
 197            'mesh_top': bs.getmesh('bridgitLevelTop'),
 198            'mesh_bottom': bs.getmesh('bridgitLevelBottom'),
 199            'mesh_bg': bs.getmesh('natureBackground'),
 200            'bg_vr_fill_mesh': bs.getmesh('natureBackgroundVRFill'),
 201            'collision_mesh': bs.getcollisionmesh('bridgitLevelCollide'),
 202            'tex': bs.gettexture('bridgitLevelColor'),
 203            'mesh_bg_tex': bs.gettexture('natureBackgroundColor'),
 204            'collide_bg': bs.getcollisionmesh('natureBackgroundCollide'),
 205            'railing_collision_mesh': (
 206                bs.getcollisionmesh('bridgitLevelRailingCollide')
 207            ),
 208            'bg_material': bs.Material(),
 209        }
 210        data['bg_material'].add_actions(
 211            actions=('modify_part_collision', 'friction', 10.0)
 212        )
 213        return data
 214
 215    def __init__(self) -> None:
 216        super().__init__()
 217        shared = SharedObjects.get()
 218        self.node = bs.newnode(
 219            'terrain',
 220            delegate=self,
 221            attrs={
 222                'collision_mesh': self.preloaddata['collision_mesh'],
 223                'mesh': self.preloaddata['mesh_top'],
 224                'color_texture': self.preloaddata['tex'],
 225                'materials': [shared.footing_material],
 226            },
 227        )
 228        self.bottom = bs.newnode(
 229            'terrain',
 230            attrs={
 231                'mesh': self.preloaddata['mesh_bottom'],
 232                'lighting': False,
 233                'color_texture': self.preloaddata['tex'],
 234            },
 235        )
 236        self.background = bs.newnode(
 237            'terrain',
 238            attrs={
 239                'mesh': self.preloaddata['mesh_bg'],
 240                'lighting': False,
 241                'background': True,
 242                'color_texture': self.preloaddata['mesh_bg_tex'],
 243            },
 244        )
 245        bs.newnode(
 246            'terrain',
 247            attrs={
 248                'mesh': self.preloaddata['bg_vr_fill_mesh'],
 249                'lighting': False,
 250                'vr_only': True,
 251                'background': True,
 252                'color_texture': self.preloaddata['mesh_bg_tex'],
 253            },
 254        )
 255        self.railing = bs.newnode(
 256            'terrain',
 257            attrs={
 258                'collision_mesh': self.preloaddata['railing_collision_mesh'],
 259                'materials': [shared.railing_material],
 260                'bumper': True,
 261            },
 262        )
 263        self.bg_collide = bs.newnode(
 264            'terrain',
 265            attrs={
 266                'collision_mesh': self.preloaddata['collide_bg'],
 267                'materials': [
 268                    shared.footing_material,
 269                    self.preloaddata['bg_material'],
 270                    shared.death_material,
 271                ],
 272            },
 273        )
 274        gnode = bs.getactivity().globalsnode
 275        gnode.tint = (1.1, 1.2, 1.3)
 276        gnode.ambient_color = (1.1, 1.2, 1.3)
 277        gnode.vignette_outer = (0.65, 0.6, 0.55)
 278        gnode.vignette_inner = (0.9, 0.9, 0.93)
 279
 280
 281class BigG(bs.Map):
 282    """Large G shaped map for racing"""
 283
 284    # noinspection PyUnresolvedReferences
 285    from bascenev1lib.mapdata import big_g as defs
 286
 287    name = 'Big G'
 288
 289    @classmethod
 290    def get_play_types(cls) -> list[str]:
 291        """Return valid play types for this map."""
 292        return [
 293            'race',
 294            'melee',
 295            'keep_away',
 296            'team_flag',
 297            'king_of_the_hill',
 298            'conquest',
 299        ]
 300
 301    @classmethod
 302    def get_preview_texture_name(cls) -> str:
 303        return 'bigGPreview'
 304
 305    @classmethod
 306    def on_preload(cls) -> Any:
 307        data: dict[str, Any] = {
 308            'mesh_top': bs.getmesh('bigG'),
 309            'mesh_bottom': bs.getmesh('bigGBottom'),
 310            'mesh_bg': bs.getmesh('natureBackground'),
 311            'bg_vr_fill_mesh': bs.getmesh('natureBackgroundVRFill'),
 312            'collision_mesh': bs.getcollisionmesh('bigGCollide'),
 313            'tex': bs.gettexture('bigG'),
 314            'mesh_bg_tex': bs.gettexture('natureBackgroundColor'),
 315            'collide_bg': bs.getcollisionmesh('natureBackgroundCollide'),
 316            'bumper_collision_mesh': bs.getcollisionmesh('bigGBumper'),
 317            'bg_material': bs.Material(),
 318        }
 319        data['bg_material'].add_actions(
 320            actions=('modify_part_collision', 'friction', 10.0)
 321        )
 322        return data
 323
 324    def __init__(self) -> None:
 325        super().__init__()
 326        shared = SharedObjects.get()
 327        self.node = bs.newnode(
 328            'terrain',
 329            delegate=self,
 330            attrs={
 331                'collision_mesh': self.preloaddata['collision_mesh'],
 332                'color': (0.7, 0.7, 0.7),
 333                'mesh': self.preloaddata['mesh_top'],
 334                'color_texture': self.preloaddata['tex'],
 335                'materials': [shared.footing_material],
 336            },
 337        )
 338        self.bottom = bs.newnode(
 339            'terrain',
 340            attrs={
 341                'mesh': self.preloaddata['mesh_bottom'],
 342                'color': (0.7, 0.7, 0.7),
 343                'lighting': False,
 344                'color_texture': self.preloaddata['tex'],
 345            },
 346        )
 347        self.background = bs.newnode(
 348            'terrain',
 349            attrs={
 350                'mesh': self.preloaddata['mesh_bg'],
 351                'lighting': False,
 352                'background': True,
 353                'color_texture': self.preloaddata['mesh_bg_tex'],
 354            },
 355        )
 356        bs.newnode(
 357            'terrain',
 358            attrs={
 359                'mesh': self.preloaddata['bg_vr_fill_mesh'],
 360                'lighting': False,
 361                'vr_only': True,
 362                'background': True,
 363                'color_texture': self.preloaddata['mesh_bg_tex'],
 364            },
 365        )
 366        self.railing = bs.newnode(
 367            'terrain',
 368            attrs={
 369                'collision_mesh': self.preloaddata['bumper_collision_mesh'],
 370                'materials': [shared.railing_material],
 371                'bumper': True,
 372            },
 373        )
 374        self.bg_collide = bs.newnode(
 375            'terrain',
 376            attrs={
 377                'collision_mesh': self.preloaddata['collide_bg'],
 378                'materials': [
 379                    shared.footing_material,
 380                    self.preloaddata['bg_material'],
 381                    shared.death_material,
 382                ],
 383            },
 384        )
 385        gnode = bs.getactivity().globalsnode
 386        gnode.tint = (1.1, 1.2, 1.3)
 387        gnode.ambient_color = (1.1, 1.2, 1.3)
 388        gnode.vignette_outer = (0.65, 0.6, 0.55)
 389        gnode.vignette_inner = (0.9, 0.9, 0.93)
 390
 391
 392class Roundabout(bs.Map):
 393    """CTF map featuring two platforms and a long way around between them"""
 394
 395    # noinspection PyUnresolvedReferences
 396    from bascenev1lib.mapdata import roundabout as defs
 397
 398    name = 'Roundabout'
 399
 400    @classmethod
 401    def get_play_types(cls) -> list[str]:
 402        """Return valid play types for this map."""
 403        return ['melee', 'keep_away', 'team_flag']
 404
 405    @classmethod
 406    def get_preview_texture_name(cls) -> str:
 407        return 'roundaboutPreview'
 408
 409    @classmethod
 410    def on_preload(cls) -> Any:
 411        data: dict[str, Any] = {
 412            'mesh': bs.getmesh('roundaboutLevel'),
 413            'mesh_bottom': bs.getmesh('roundaboutLevelBottom'),
 414            'mesh_bg': bs.getmesh('natureBackground'),
 415            'bg_vr_fill_mesh': bs.getmesh('natureBackgroundVRFill'),
 416            'collision_mesh': bs.getcollisionmesh('roundaboutLevelCollide'),
 417            'tex': bs.gettexture('roundaboutLevelColor'),
 418            'mesh_bg_tex': bs.gettexture('natureBackgroundColor'),
 419            'collide_bg': bs.getcollisionmesh('natureBackgroundCollide'),
 420            'railing_collision_mesh': (
 421                bs.getcollisionmesh('roundaboutLevelBumper')
 422            ),
 423            'bg_material': bs.Material(),
 424        }
 425        data['bg_material'].add_actions(
 426            actions=('modify_part_collision', 'friction', 10.0)
 427        )
 428        return data
 429
 430    def __init__(self) -> None:
 431        super().__init__(vr_overlay_offset=(0, -1, 1))
 432        shared = SharedObjects.get()
 433        self.node = bs.newnode(
 434            'terrain',
 435            delegate=self,
 436            attrs={
 437                'collision_mesh': self.preloaddata['collision_mesh'],
 438                'mesh': self.preloaddata['mesh'],
 439                'color_texture': self.preloaddata['tex'],
 440                'materials': [shared.footing_material],
 441            },
 442        )
 443        self.bottom = bs.newnode(
 444            'terrain',
 445            attrs={
 446                'mesh': self.preloaddata['mesh_bottom'],
 447                'lighting': False,
 448                'color_texture': self.preloaddata['tex'],
 449            },
 450        )
 451        self.background = bs.newnode(
 452            'terrain',
 453            attrs={
 454                'mesh': self.preloaddata['mesh_bg'],
 455                'lighting': False,
 456                'background': True,
 457                'color_texture': self.preloaddata['mesh_bg_tex'],
 458            },
 459        )
 460        bs.newnode(
 461            'terrain',
 462            attrs={
 463                'mesh': self.preloaddata['bg_vr_fill_mesh'],
 464                'lighting': False,
 465                'vr_only': True,
 466                'background': True,
 467                'color_texture': self.preloaddata['mesh_bg_tex'],
 468            },
 469        )
 470        self.bg_collide = bs.newnode(
 471            'terrain',
 472            attrs={
 473                'collision_mesh': self.preloaddata['collide_bg'],
 474                'materials': [
 475                    shared.footing_material,
 476                    self.preloaddata['bg_material'],
 477                    shared.death_material,
 478                ],
 479            },
 480        )
 481        self.railing = bs.newnode(
 482            'terrain',
 483            attrs={
 484                'collision_mesh': self.preloaddata['railing_collision_mesh'],
 485                'materials': [shared.railing_material],
 486                'bumper': True,
 487            },
 488        )
 489        gnode = bs.getactivity().globalsnode
 490        gnode.tint = (1.0, 1.05, 1.1)
 491        gnode.ambient_color = (1.0, 1.05, 1.1)
 492        gnode.shadow_ortho = True
 493        gnode.vignette_outer = (0.63, 0.65, 0.7)
 494        gnode.vignette_inner = (0.97, 0.95, 0.93)
 495
 496
 497class MonkeyFace(bs.Map):
 498    """Map sorta shaped like a monkey face; teehee!"""
 499
 500    # noinspection PyUnresolvedReferences
 501    from bascenev1lib.mapdata import monkey_face as defs
 502
 503    name = 'Monkey Face'
 504
 505    @classmethod
 506    def get_play_types(cls) -> list[str]:
 507        """Return valid play types for this map."""
 508        return ['melee', 'keep_away', 'team_flag']
 509
 510    @classmethod
 511    def get_preview_texture_name(cls) -> str:
 512        return 'monkeyFacePreview'
 513
 514    @classmethod
 515    def on_preload(cls) -> Any:
 516        data: dict[str, Any] = {
 517            'mesh': bs.getmesh('monkeyFaceLevel'),
 518            'bottom_mesh': bs.getmesh('monkeyFaceLevelBottom'),
 519            'mesh_bg': bs.getmesh('natureBackground'),
 520            'bg_vr_fill_mesh': bs.getmesh('natureBackgroundVRFill'),
 521            'collision_mesh': bs.getcollisionmesh('monkeyFaceLevelCollide'),
 522            'tex': bs.gettexture('monkeyFaceLevelColor'),
 523            'mesh_bg_tex': bs.gettexture('natureBackgroundColor'),
 524            'collide_bg': bs.getcollisionmesh('natureBackgroundCollide'),
 525            'railing_collision_mesh': (
 526                bs.getcollisionmesh('monkeyFaceLevelBumper')
 527            ),
 528            'bg_material': bs.Material(),
 529        }
 530        data['bg_material'].add_actions(
 531            actions=('modify_part_collision', 'friction', 10.0)
 532        )
 533        return data
 534
 535    def __init__(self) -> None:
 536        super().__init__()
 537        shared = SharedObjects.get()
 538        self.node = bs.newnode(
 539            'terrain',
 540            delegate=self,
 541            attrs={
 542                'collision_mesh': self.preloaddata['collision_mesh'],
 543                'mesh': self.preloaddata['mesh'],
 544                'color_texture': self.preloaddata['tex'],
 545                'materials': [shared.footing_material],
 546            },
 547        )
 548        self.bottom = bs.newnode(
 549            'terrain',
 550            attrs={
 551                'mesh': self.preloaddata['bottom_mesh'],
 552                'lighting': False,
 553                'color_texture': self.preloaddata['tex'],
 554            },
 555        )
 556        self.background = bs.newnode(
 557            'terrain',
 558            attrs={
 559                'mesh': self.preloaddata['mesh_bg'],
 560                'lighting': False,
 561                'background': True,
 562                'color_texture': self.preloaddata['mesh_bg_tex'],
 563            },
 564        )
 565        bs.newnode(
 566            'terrain',
 567            attrs={
 568                'mesh': self.preloaddata['bg_vr_fill_mesh'],
 569                'lighting': False,
 570                'vr_only': True,
 571                'background': True,
 572                'color_texture': self.preloaddata['mesh_bg_tex'],
 573            },
 574        )
 575        self.bg_collide = bs.newnode(
 576            'terrain',
 577            attrs={
 578                'collision_mesh': self.preloaddata['collide_bg'],
 579                'materials': [
 580                    shared.footing_material,
 581                    self.preloaddata['bg_material'],
 582                    shared.death_material,
 583                ],
 584            },
 585        )
 586        self.railing = bs.newnode(
 587            'terrain',
 588            attrs={
 589                'collision_mesh': self.preloaddata['railing_collision_mesh'],
 590                'materials': [shared.railing_material],
 591                'bumper': True,
 592            },
 593        )
 594        gnode = bs.getactivity().globalsnode
 595        gnode.tint = (1.1, 1.2, 1.2)
 596        gnode.ambient_color = (1.2, 1.3, 1.3)
 597        gnode.vignette_outer = (0.60, 0.62, 0.66)
 598        gnode.vignette_inner = (0.97, 0.95, 0.93)
 599        gnode.vr_camera_offset = (-1.4, 0, 0)
 600
 601
 602class ZigZag(bs.Map):
 603    """A very long zig-zaggy map"""
 604
 605    # noinspection PyUnresolvedReferences
 606    from bascenev1lib.mapdata import zig_zag as defs
 607
 608    name = 'Zigzag'
 609
 610    @classmethod
 611    def get_play_types(cls) -> list[str]:
 612        """Return valid play types for this map."""
 613        return [
 614            'melee',
 615            'keep_away',
 616            'team_flag',
 617            'conquest',
 618            'king_of_the_hill',
 619        ]
 620
 621    @classmethod
 622    def get_preview_texture_name(cls) -> str:
 623        return 'zigzagPreview'
 624
 625    @classmethod
 626    def on_preload(cls) -> Any:
 627        data: dict[str, Any] = {
 628            'mesh': bs.getmesh('zigZagLevel'),
 629            'mesh_bottom': bs.getmesh('zigZagLevelBottom'),
 630            'mesh_bg': bs.getmesh('natureBackground'),
 631            'bg_vr_fill_mesh': bs.getmesh('natureBackgroundVRFill'),
 632            'collision_mesh': bs.getcollisionmesh('zigZagLevelCollide'),
 633            'tex': bs.gettexture('zigZagLevelColor'),
 634            'mesh_bg_tex': bs.gettexture('natureBackgroundColor'),
 635            'collide_bg': bs.getcollisionmesh('natureBackgroundCollide'),
 636            'railing_collision_mesh': bs.getcollisionmesh('zigZagLevelBumper'),
 637            'bg_material': bs.Material(),
 638        }
 639        data['bg_material'].add_actions(
 640            actions=('modify_part_collision', 'friction', 10.0)
 641        )
 642        return data
 643
 644    def __init__(self) -> None:
 645        super().__init__()
 646        shared = SharedObjects.get()
 647        self.node = bs.newnode(
 648            'terrain',
 649            delegate=self,
 650            attrs={
 651                'collision_mesh': self.preloaddata['collision_mesh'],
 652                'mesh': self.preloaddata['mesh'],
 653                'color_texture': self.preloaddata['tex'],
 654                'materials': [shared.footing_material],
 655            },
 656        )
 657        self.background = bs.newnode(
 658            'terrain',
 659            attrs={
 660                'mesh': self.preloaddata['mesh_bg'],
 661                'lighting': False,
 662                'color_texture': self.preloaddata['mesh_bg_tex'],
 663            },
 664        )
 665        self.bottom = bs.newnode(
 666            'terrain',
 667            attrs={
 668                'mesh': self.preloaddata['mesh_bottom'],
 669                'lighting': False,
 670                'color_texture': self.preloaddata['tex'],
 671            },
 672        )
 673        bs.newnode(
 674            'terrain',
 675            attrs={
 676                'mesh': self.preloaddata['bg_vr_fill_mesh'],
 677                'lighting': False,
 678                'vr_only': True,
 679                'background': True,
 680                'color_texture': self.preloaddata['mesh_bg_tex'],
 681            },
 682        )
 683        self.bg_collide = bs.newnode(
 684            'terrain',
 685            attrs={
 686                'collision_mesh': self.preloaddata['collide_bg'],
 687                'materials': [
 688                    shared.footing_material,
 689                    self.preloaddata['bg_material'],
 690                    shared.death_material,
 691                ],
 692            },
 693        )
 694        self.railing = bs.newnode(
 695            'terrain',
 696            attrs={
 697                'collision_mesh': self.preloaddata['railing_collision_mesh'],
 698                'materials': [shared.railing_material],
 699                'bumper': True,
 700            },
 701        )
 702        gnode = bs.getactivity().globalsnode
 703        gnode.tint = (1.0, 1.15, 1.15)
 704        gnode.ambient_color = (1.0, 1.15, 1.15)
 705        gnode.vignette_outer = (0.57, 0.59, 0.63)
 706        gnode.vignette_inner = (0.97, 0.95, 0.93)
 707        gnode.vr_camera_offset = (-1.5, 0, 0)
 708
 709
 710class ThePad(bs.Map):
 711    """A simple square shaped map with a raised edge."""
 712
 713    # noinspection PyUnresolvedReferences
 714    from bascenev1lib.mapdata import the_pad as defs
 715
 716    name = 'The Pad'
 717
 718    @classmethod
 719    def get_play_types(cls) -> list[str]:
 720        """Return valid play types for this map."""
 721        return ['melee', 'keep_away', 'team_flag', 'king_of_the_hill']
 722
 723    @classmethod
 724    def get_preview_texture_name(cls) -> str:
 725        return 'thePadPreview'
 726
 727    @classmethod
 728    def on_preload(cls) -> Any:
 729        data: dict[str, Any] = {
 730            'mesh': bs.getmesh('thePadLevel'),
 731            'bottom_mesh': bs.getmesh('thePadLevelBottom'),
 732            'collision_mesh': bs.getcollisionmesh('thePadLevelCollide'),
 733            'tex': bs.gettexture('thePadLevelColor'),
 734            'bgtex': bs.gettexture('menuBG'),
 735            'bgmesh': bs.getmesh('thePadBG'),
 736            'railing_collision_mesh': bs.getcollisionmesh('thePadLevelBumper'),
 737            'vr_fill_mound_mesh': bs.getmesh('thePadVRFillMound'),
 738            'vr_fill_mound_tex': bs.gettexture('vrFillMound'),
 739        }
 740        # fixme should chop this into vr/non-vr sections for efficiency
 741        return data
 742
 743    def __init__(self) -> None:
 744        super().__init__()
 745        shared = SharedObjects.get()
 746        self.node = bs.newnode(
 747            'terrain',
 748            delegate=self,
 749            attrs={
 750                'collision_mesh': self.preloaddata['collision_mesh'],
 751                'mesh': self.preloaddata['mesh'],
 752                'color_texture': self.preloaddata['tex'],
 753                'materials': [shared.footing_material],
 754            },
 755        )
 756        self.bottom = bs.newnode(
 757            'terrain',
 758            attrs={
 759                'mesh': self.preloaddata['bottom_mesh'],
 760                'lighting': False,
 761                'color_texture': self.preloaddata['tex'],
 762            },
 763        )
 764        self.background = bs.newnode(
 765            'terrain',
 766            attrs={
 767                'mesh': self.preloaddata['bgmesh'],
 768                'lighting': False,
 769                'background': True,
 770                'color_texture': self.preloaddata['bgtex'],
 771            },
 772        )
 773        self.railing = bs.newnode(
 774            'terrain',
 775            attrs={
 776                'collision_mesh': self.preloaddata['railing_collision_mesh'],
 777                'materials': [shared.railing_material],
 778                'bumper': True,
 779            },
 780        )
 781        bs.newnode(
 782            'terrain',
 783            attrs={
 784                'mesh': self.preloaddata['vr_fill_mound_mesh'],
 785                'lighting': False,
 786                'vr_only': True,
 787                'color': (0.56, 0.55, 0.47),
 788                'background': True,
 789                'color_texture': self.preloaddata['vr_fill_mound_tex'],
 790            },
 791        )
 792        gnode = bs.getactivity().globalsnode
 793        gnode.tint = (1.1, 1.1, 1.0)
 794        gnode.ambient_color = (1.1, 1.1, 1.0)
 795        gnode.vignette_outer = (0.7, 0.65, 0.75)
 796        gnode.vignette_inner = (0.95, 0.95, 0.93)
 797
 798
 799class DoomShroom(bs.Map):
 800    """A giant mushroom. Of doom!"""
 801
 802    # noinspection PyUnresolvedReferences
 803    from bascenev1lib.mapdata import doom_shroom as defs
 804
 805    name = 'Doom Shroom'
 806
 807    @classmethod
 808    def get_play_types(cls) -> list[str]:
 809        """Return valid play types for this map."""
 810        return ['melee', 'keep_away', 'team_flag']
 811
 812    @classmethod
 813    def get_preview_texture_name(cls) -> str:
 814        return 'doomShroomPreview'
 815
 816    @classmethod
 817    def on_preload(cls) -> Any:
 818        data: dict[str, Any] = {
 819            'mesh': bs.getmesh('doomShroomLevel'),
 820            'collision_mesh': bs.getcollisionmesh('doomShroomLevelCollide'),
 821            'tex': bs.gettexture('doomShroomLevelColor'),
 822            'bgtex': bs.gettexture('doomShroomBGColor'),
 823            'bgmesh': bs.getmesh('doomShroomBG'),
 824            'vr_fill_mesh': bs.getmesh('doomShroomVRFill'),
 825            'stem_mesh': bs.getmesh('doomShroomStem'),
 826            'collide_bg': bs.getcollisionmesh('doomShroomStemCollide'),
 827        }
 828        return data
 829
 830    def __init__(self) -> None:
 831        super().__init__()
 832        shared = SharedObjects.get()
 833        self.node = bs.newnode(
 834            'terrain',
 835            delegate=self,
 836            attrs={
 837                'collision_mesh': self.preloaddata['collision_mesh'],
 838                'mesh': self.preloaddata['mesh'],
 839                'color_texture': self.preloaddata['tex'],
 840                'materials': [shared.footing_material],
 841            },
 842        )
 843        self.background = bs.newnode(
 844            'terrain',
 845            attrs={
 846                'mesh': self.preloaddata['bgmesh'],
 847                'lighting': False,
 848                'background': True,
 849                'color_texture': self.preloaddata['bgtex'],
 850            },
 851        )
 852        bs.newnode(
 853            'terrain',
 854            attrs={
 855                'mesh': self.preloaddata['vr_fill_mesh'],
 856                'lighting': False,
 857                'vr_only': True,
 858                'background': True,
 859                'color_texture': self.preloaddata['bgtex'],
 860            },
 861        )
 862        self.stem = bs.newnode(
 863            'terrain',
 864            attrs={
 865                'mesh': self.preloaddata['stem_mesh'],
 866                'lighting': False,
 867                'color_texture': self.preloaddata['tex'],
 868            },
 869        )
 870        self.bg_collide = bs.newnode(
 871            'terrain',
 872            attrs={
 873                'collision_mesh': self.preloaddata['collide_bg'],
 874                'materials': [shared.footing_material, shared.death_material],
 875            },
 876        )
 877        gnode = bs.getactivity().globalsnode
 878        gnode.tint = (0.82, 1.10, 1.15)
 879        gnode.ambient_color = (0.9, 1.3, 1.1)
 880        gnode.shadow_ortho = False
 881        gnode.vignette_outer = (0.76, 0.76, 0.76)
 882        gnode.vignette_inner = (0.95, 0.95, 0.99)
 883
 884    def is_point_near_edge(self, point: bs.Vec3, running: bool = False) -> bool:
 885        xpos = point.x
 886        zpos = point.z
 887        x_adj = xpos * 0.125
 888        z_adj = (zpos + 3.7) * 0.2
 889        if running:
 890            x_adj *= 1.4
 891            z_adj *= 1.4
 892        return x_adj * x_adj + z_adj * z_adj > 1.0
 893
 894
 895class LakeFrigid(bs.Map):
 896    """An icy lake fit for racing."""
 897
 898    # noinspection PyUnresolvedReferences
 899    from bascenev1lib.mapdata import lake_frigid as defs
 900
 901    name = 'Lake Frigid'
 902
 903    @classmethod
 904    def get_play_types(cls) -> list[str]:
 905        """Return valid play types for this map."""
 906        return ['melee', 'keep_away', 'team_flag', 'race']
 907
 908    @classmethod
 909    def get_preview_texture_name(cls) -> str:
 910        return 'lakeFrigidPreview'
 911
 912    @classmethod
 913    def on_preload(cls) -> Any:
 914        data: dict[str, Any] = {
 915            'mesh': bs.getmesh('lakeFrigid'),
 916            'mesh_top': bs.getmesh('lakeFrigidTop'),
 917            'mesh_reflections': bs.getmesh('lakeFrigidReflections'),
 918            'collision_mesh': bs.getcollisionmesh('lakeFrigidCollide'),
 919            'tex': bs.gettexture('lakeFrigid'),
 920            'tex_reflections': bs.gettexture('lakeFrigidReflections'),
 921            'vr_fill_mesh': bs.getmesh('lakeFrigidVRFill'),
 922        }
 923        mat = bs.Material()
 924        mat.add_actions(actions=('modify_part_collision', 'friction', 0.01))
 925        data['ice_material'] = mat
 926        return data
 927
 928    def __init__(self) -> None:
 929        super().__init__()
 930        shared = SharedObjects.get()
 931        self.node = bs.newnode(
 932            'terrain',
 933            delegate=self,
 934            attrs={
 935                'collision_mesh': self.preloaddata['collision_mesh'],
 936                'mesh': self.preloaddata['mesh'],
 937                'color_texture': self.preloaddata['tex'],
 938                'materials': [
 939                    shared.footing_material,
 940                    self.preloaddata['ice_material'],
 941                ],
 942            },
 943        )
 944        bs.newnode(
 945            'terrain',
 946            attrs={
 947                'mesh': self.preloaddata['mesh_top'],
 948                'lighting': False,
 949                'color_texture': self.preloaddata['tex'],
 950            },
 951        )
 952        bs.newnode(
 953            'terrain',
 954            attrs={
 955                'mesh': self.preloaddata['mesh_reflections'],
 956                'lighting': False,
 957                'overlay': True,
 958                'opacity': 0.15,
 959                'color_texture': self.preloaddata['tex_reflections'],
 960            },
 961        )
 962        bs.newnode(
 963            'terrain',
 964            attrs={
 965                'mesh': self.preloaddata['vr_fill_mesh'],
 966                'lighting': False,
 967                'vr_only': True,
 968                'background': True,
 969                'color_texture': self.preloaddata['tex'],
 970            },
 971        )
 972        gnode = bs.getactivity().globalsnode
 973        gnode.tint = (1, 1, 1)
 974        gnode.ambient_color = (1, 1, 1)
 975        gnode.shadow_ortho = True
 976        gnode.vignette_outer = (0.86, 0.86, 0.86)
 977        gnode.vignette_inner = (0.95, 0.95, 0.99)
 978        gnode.vr_near_clip = 0.5
 979        self.is_hockey = True
 980
 981
 982class TipTop(bs.Map):
 983    """A pointy map good for king-of-the-hill-ish games."""
 984
 985    # noinspection PyUnresolvedReferences
 986    from bascenev1lib.mapdata import tip_top as defs
 987
 988    name = 'Tip Top'
 989
 990    @classmethod
 991    def get_play_types(cls) -> list[str]:
 992        """Return valid play types for this map."""
 993        return ['melee', 'keep_away', 'team_flag', 'king_of_the_hill']
 994
 995    @classmethod
 996    def get_preview_texture_name(cls) -> str:
 997        return 'tipTopPreview'
 998
 999    @classmethod
1000    def on_preload(cls) -> Any:
1001        data: dict[str, Any] = {
1002            'mesh': bs.getmesh('tipTopLevel'),
1003            'bottom_mesh': bs.getmesh('tipTopLevelBottom'),
1004            'collision_mesh': bs.getcollisionmesh('tipTopLevelCollide'),
1005            'tex': bs.gettexture('tipTopLevelColor'),
1006            'bgtex': bs.gettexture('tipTopBGColor'),
1007            'bgmesh': bs.getmesh('tipTopBG'),
1008            'railing_collision_mesh': bs.getcollisionmesh('tipTopLevelBumper'),
1009        }
1010        return data
1011
1012    def __init__(self) -> None:
1013        super().__init__(vr_overlay_offset=(0, -0.2, 2.5))
1014        shared = SharedObjects.get()
1015        self.node = bs.newnode(
1016            'terrain',
1017            delegate=self,
1018            attrs={
1019                'collision_mesh': self.preloaddata['collision_mesh'],
1020                'mesh': self.preloaddata['mesh'],
1021                'color_texture': self.preloaddata['tex'],
1022                'color': (0.7, 0.7, 0.7),
1023                'materials': [shared.footing_material],
1024            },
1025        )
1026        self.bottom = bs.newnode(
1027            'terrain',
1028            attrs={
1029                'mesh': self.preloaddata['bottom_mesh'],
1030                'lighting': False,
1031                'color': (0.7, 0.7, 0.7),
1032                'color_texture': self.preloaddata['tex'],
1033            },
1034        )
1035        self.background = bs.newnode(
1036            'terrain',
1037            attrs={
1038                'mesh': self.preloaddata['bgmesh'],
1039                'lighting': False,
1040                'color': (0.4, 0.4, 0.4),
1041                'background': True,
1042                'color_texture': self.preloaddata['bgtex'],
1043            },
1044        )
1045        self.railing = bs.newnode(
1046            'terrain',
1047            attrs={
1048                'collision_mesh': self.preloaddata['railing_collision_mesh'],
1049                'materials': [shared.railing_material],
1050                'bumper': True,
1051            },
1052        )
1053        gnode = bs.getactivity().globalsnode
1054        gnode.tint = (0.8, 0.9, 1.3)
1055        gnode.ambient_color = (0.8, 0.9, 1.3)
1056        gnode.vignette_outer = (0.79, 0.79, 0.69)
1057        gnode.vignette_inner = (0.97, 0.97, 0.99)
1058
1059
1060class CragCastle(bs.Map):
1061    """A lovely castle map."""
1062
1063    # noinspection PyUnresolvedReferences
1064    from bascenev1lib.mapdata import crag_castle as defs
1065
1066    name = 'Crag Castle'
1067
1068    @classmethod
1069    def get_play_types(cls) -> list[str]:
1070        """Return valid play types for this map."""
1071        return ['melee', 'keep_away', 'team_flag', 'conquest']
1072
1073    @classmethod
1074    def get_preview_texture_name(cls) -> str:
1075        return 'cragCastlePreview'
1076
1077    @classmethod
1078    def on_preload(cls) -> Any:
1079        data: dict[str, Any] = {
1080            'mesh': bs.getmesh('cragCastleLevel'),
1081            'bottom_mesh': bs.getmesh('cragCastleLevelBottom'),
1082            'collision_mesh': bs.getcollisionmesh('cragCastleLevelCollide'),
1083            'tex': bs.gettexture('cragCastleLevelColor'),
1084            'bgtex': bs.gettexture('menuBG'),
1085            'bgmesh': bs.getmesh('thePadBG'),
1086            'railing_collision_mesh': (
1087                bs.getcollisionmesh('cragCastleLevelBumper')
1088            ),
1089            'vr_fill_mound_mesh': bs.getmesh('cragCastleVRFillMound'),
1090            'vr_fill_mound_tex': bs.gettexture('vrFillMound'),
1091        }
1092        # fixme should chop this into vr/non-vr sections
1093        return data
1094
1095    def __init__(self) -> None:
1096        super().__init__()
1097        shared = SharedObjects.get()
1098        self.node = bs.newnode(
1099            'terrain',
1100            delegate=self,
1101            attrs={
1102                'collision_mesh': self.preloaddata['collision_mesh'],
1103                'mesh': self.preloaddata['mesh'],
1104                'color_texture': self.preloaddata['tex'],
1105                'materials': [shared.footing_material],
1106            },
1107        )
1108        self.bottom = bs.newnode(
1109            'terrain',
1110            attrs={
1111                'mesh': self.preloaddata['bottom_mesh'],
1112                'lighting': False,
1113                'color_texture': self.preloaddata['tex'],
1114            },
1115        )
1116        self.background = bs.newnode(
1117            'terrain',
1118            attrs={
1119                'mesh': self.preloaddata['bgmesh'],
1120                'lighting': False,
1121                'background': True,
1122                'color_texture': self.preloaddata['bgtex'],
1123            },
1124        )
1125        self.railing = bs.newnode(
1126            'terrain',
1127            attrs={
1128                'collision_mesh': self.preloaddata['railing_collision_mesh'],
1129                'materials': [shared.railing_material],
1130                'bumper': True,
1131            },
1132        )
1133        bs.newnode(
1134            'terrain',
1135            attrs={
1136                'mesh': self.preloaddata['vr_fill_mound_mesh'],
1137                'lighting': False,
1138                'vr_only': True,
1139                'color': (0.2, 0.25, 0.2),
1140                'background': True,
1141                'color_texture': self.preloaddata['vr_fill_mound_tex'],
1142            },
1143        )
1144        gnode = bs.getactivity().globalsnode
1145        gnode.shadow_ortho = True
1146        gnode.shadow_offset = (0, 0, -5.0)
1147        gnode.tint = (1.15, 1.05, 0.75)
1148        gnode.ambient_color = (1.15, 1.05, 0.75)
1149        gnode.vignette_outer = (0.6, 0.65, 0.6)
1150        gnode.vignette_inner = (0.95, 0.95, 0.95)
1151        gnode.vr_near_clip = 1.0
1152
1153
1154class TowerD(bs.Map):
1155    """Map used for runaround mini-game."""
1156
1157    from bascenev1lib.mapdata import tower_d as defs
1158
1159    name = 'Tower D'
1160
1161    @classmethod
1162    def get_play_types(cls) -> list[str]:
1163        """Return valid play types for this map."""
1164        return []
1165
1166    @classmethod
1167    def get_preview_texture_name(cls) -> str:
1168        return 'towerDPreview'
1169
1170    @classmethod
1171    def on_preload(cls) -> Any:
1172        data: dict[str, Any] = {
1173            'mesh': bs.getmesh('towerDLevel'),
1174            'mesh_bottom': bs.getmesh('towerDLevelBottom'),
1175            'collision_mesh': bs.getcollisionmesh('towerDLevelCollide'),
1176            'tex': bs.gettexture('towerDLevelColor'),
1177            'bgtex': bs.gettexture('menuBG'),
1178            'bgmesh': bs.getmesh('thePadBG'),
1179            'player_wall_collision_mesh': bs.getcollisionmesh(
1180                'towerDPlayerWall'
1181            ),
1182            'player_wall_material': bs.Material(),
1183        }
1184        # fixme should chop this into vr/non-vr sections
1185        data['player_wall_material'].add_actions(
1186            actions=('modify_part_collision', 'friction', 0.0)
1187        )
1188        # anything that needs to hit the wall can apply this material
1189        data['collide_with_wall_material'] = bs.Material()
1190        data['player_wall_material'].add_actions(
1191            conditions=(
1192                'they_dont_have_material',
1193                data['collide_with_wall_material'],
1194            ),
1195            actions=('modify_part_collision', 'collide', False),
1196        )
1197        data['vr_fill_mound_mesh'] = bs.getmesh('stepRightUpVRFillMound')
1198        data['vr_fill_mound_tex'] = bs.gettexture('vrFillMound')
1199        return data
1200
1201    def __init__(self) -> None:
1202        super().__init__(vr_overlay_offset=(0, 1, 1))
1203        shared = SharedObjects.get()
1204        self.node = bs.newnode(
1205            'terrain',
1206            delegate=self,
1207            attrs={
1208                'collision_mesh': self.preloaddata['collision_mesh'],
1209                'mesh': self.preloaddata['mesh'],
1210                'color_texture': self.preloaddata['tex'],
1211                'materials': [shared.footing_material],
1212            },
1213        )
1214        self.node_bottom = bs.newnode(
1215            'terrain',
1216            delegate=self,
1217            attrs={
1218                'mesh': self.preloaddata['mesh_bottom'],
1219                'lighting': False,
1220                'color_texture': self.preloaddata['tex'],
1221            },
1222        )
1223        bs.newnode(
1224            'terrain',
1225            attrs={
1226                'mesh': self.preloaddata['vr_fill_mound_mesh'],
1227                'lighting': False,
1228                'vr_only': True,
1229                'color': (0.53, 0.57, 0.5),
1230                'background': True,
1231                'color_texture': self.preloaddata['vr_fill_mound_tex'],
1232            },
1233        )
1234        self.background = bs.newnode(
1235            'terrain',
1236            attrs={
1237                'mesh': self.preloaddata['bgmesh'],
1238                'lighting': False,
1239                'background': True,
1240                'color_texture': self.preloaddata['bgtex'],
1241            },
1242        )
1243        self.player_wall = bs.newnode(
1244            'terrain',
1245            attrs={
1246                'collision_mesh': self.preloaddata[
1247                    'player_wall_collision_mesh'
1248                ],
1249                'affect_bg_dynamics': False,
1250                'materials': [self.preloaddata['player_wall_material']],
1251            },
1252        )
1253        gnode = bs.getactivity().globalsnode
1254        gnode.tint = (1.15, 1.11, 1.03)
1255        gnode.ambient_color = (1.2, 1.1, 1.0)
1256        gnode.vignette_outer = (0.7, 0.73, 0.7)
1257        gnode.vignette_inner = (0.95, 0.95, 0.95)
1258
1259    def is_point_near_edge(self, point: bs.Vec3, running: bool = False) -> bool:
1260        # see if we're within edge_box
1261        boxes = self.defs.boxes
1262        box_position = boxes['edge_box'][0:3]
1263        box_scale = boxes['edge_box'][6:9]
1264        box_position2 = boxes['edge_box2'][0:3]
1265        box_scale2 = boxes['edge_box2'][6:9]
1266        xpos = (point.x - box_position[0]) / box_scale[0]
1267        zpos = (point.z - box_position[2]) / box_scale[2]
1268        xpos2 = (point.x - box_position2[0]) / box_scale2[0]
1269        zpos2 = (point.z - box_position2[2]) / box_scale2[2]
1270        # if we're outside of *both* boxes we're near the edge
1271        return (xpos < -0.5 or xpos > 0.5 or zpos < -0.5 or zpos > 0.5) and (
1272            xpos2 < -0.5 or xpos2 > 0.5 or zpos2 < -0.5 or zpos2 > 0.5
1273        )
1274
1275
1276class HappyThoughts(bs.Map):
1277    """Flying map."""
1278
1279    # noinspection PyUnresolvedReferences
1280    from bascenev1lib.mapdata import happy_thoughts as defs
1281
1282    name = 'Happy Thoughts'
1283
1284    @classmethod
1285    def get_play_types(cls) -> list[str]:
1286        """Return valid play types for this map."""
1287        return [
1288            'melee',
1289            'keep_away',
1290            'team_flag',
1291            'conquest',
1292            'king_of_the_hill',
1293        ]
1294
1295    @classmethod
1296    def get_preview_texture_name(cls) -> str:
1297        return 'alwaysLandPreview'
1298
1299    @classmethod
1300    def on_preload(cls) -> Any:
1301        data: dict[str, Any] = {
1302            'mesh': bs.getmesh('alwaysLandLevel'),
1303            'bottom_mesh': bs.getmesh('alwaysLandLevelBottom'),
1304            'bgmesh': bs.getmesh('alwaysLandBG'),
1305            'collision_mesh': bs.getcollisionmesh('alwaysLandLevelCollide'),
1306            'tex': bs.gettexture('alwaysLandLevelColor'),
1307            'bgtex': bs.gettexture('alwaysLandBGColor'),
1308            'vr_fill_mound_mesh': bs.getmesh('alwaysLandVRFillMound'),
1309            'vr_fill_mound_tex': bs.gettexture('vrFillMound'),
1310        }
1311        return data
1312
1313    @classmethod
1314    def get_music_type(cls) -> bs.MusicType:
1315        return bs.MusicType.FLYING
1316
1317    def __init__(self) -> None:
1318        super().__init__(vr_overlay_offset=(0, -3.7, 2.5))
1319        shared = SharedObjects.get()
1320        self.node = bs.newnode(
1321            'terrain',
1322            delegate=self,
1323            attrs={
1324                'collision_mesh': self.preloaddata['collision_mesh'],
1325                'mesh': self.preloaddata['mesh'],
1326                'color_texture': self.preloaddata['tex'],
1327                'materials': [shared.footing_material],
1328            },
1329        )
1330        self.bottom = bs.newnode(
1331            'terrain',
1332            attrs={
1333                'mesh': self.preloaddata['bottom_mesh'],
1334                'lighting': False,
1335                'color_texture': self.preloaddata['tex'],
1336            },
1337        )
1338        self.background = bs.newnode(
1339            'terrain',
1340            attrs={
1341                'mesh': self.preloaddata['bgmesh'],
1342                'lighting': False,
1343                'background': True,
1344                'color_texture': self.preloaddata['bgtex'],
1345            },
1346        )
1347        bs.newnode(
1348            'terrain',
1349            attrs={
1350                'mesh': self.preloaddata['vr_fill_mound_mesh'],
1351                'lighting': False,
1352                'vr_only': True,
1353                'color': (0.2, 0.25, 0.2),
1354                'background': True,
1355                'color_texture': self.preloaddata['vr_fill_mound_tex'],
1356            },
1357        )
1358        gnode = bs.getactivity().globalsnode
1359        gnode.happy_thoughts_mode = True
1360        gnode.shadow_offset = (0.0, 8.0, 5.0)
1361        gnode.tint = (1.3, 1.23, 1.0)
1362        gnode.ambient_color = (1.3, 1.23, 1.0)
1363        gnode.vignette_outer = (0.64, 0.59, 0.69)
1364        gnode.vignette_inner = (0.95, 0.95, 0.93)
1365        gnode.vr_near_clip = 1.0
1366        self.is_flying = True
1367
1368        # throw out some tips on flying
1369        txt = bs.newnode(
1370            'text',
1371            attrs={
1372                'text': bs.Lstr(resource='pressJumpToFlyText'),
1373                'scale': 1.2,
1374                'maxwidth': 800,
1375                'position': (0, 200),
1376                'shadow': 0.5,
1377                'flatness': 0.5,
1378                'h_align': 'center',
1379                'v_attach': 'bottom',
1380            },
1381        )
1382        cmb = bs.newnode(
1383            'combine',
1384            owner=txt,
1385            attrs={'size': 4, 'input0': 0.3, 'input1': 0.9, 'input2': 0.0},
1386        )
1387        bs.animate(cmb, 'input3', {3.0: 0, 4.0: 1, 9.0: 1, 10.0: 0})
1388        cmb.connectattr('output', txt, 'color')
1389        bs.timer(10.0, txt.delete)
1390
1391
1392class StepRightUp(bs.Map):
1393    """Wide stepped map good for CTF or Assault."""
1394
1395    # noinspection PyUnresolvedReferences
1396    from bascenev1lib.mapdata import step_right_up as defs
1397
1398    name = 'Step Right Up'
1399
1400    @classmethod
1401    def get_play_types(cls) -> list[str]:
1402        """Return valid play types for this map."""
1403        return ['melee', 'keep_away', 'team_flag', 'conquest']
1404
1405    @classmethod
1406    def get_preview_texture_name(cls) -> str:
1407        return 'stepRightUpPreview'
1408
1409    @classmethod
1410    def on_preload(cls) -> Any:
1411        data: dict[str, Any] = {
1412            'mesh': bs.getmesh('stepRightUpLevel'),
1413            'mesh_bottom': bs.getmesh('stepRightUpLevelBottom'),
1414            'collision_mesh': bs.getcollisionmesh('stepRightUpLevelCollide'),
1415            'tex': bs.gettexture('stepRightUpLevelColor'),
1416            'bgtex': bs.gettexture('menuBG'),
1417            'bgmesh': bs.getmesh('thePadBG'),
1418            'vr_fill_mound_mesh': bs.getmesh('stepRightUpVRFillMound'),
1419            'vr_fill_mound_tex': bs.gettexture('vrFillMound'),
1420        }
1421        # fixme should chop this into vr/non-vr chunks
1422        return data
1423
1424    def __init__(self) -> None:
1425        super().__init__(vr_overlay_offset=(0, -1, 2))
1426        shared = SharedObjects.get()
1427        self.node = bs.newnode(
1428            'terrain',
1429            delegate=self,
1430            attrs={
1431                'collision_mesh': self.preloaddata['collision_mesh'],
1432                'mesh': self.preloaddata['mesh'],
1433                'color_texture': self.preloaddata['tex'],
1434                'materials': [shared.footing_material],
1435            },
1436        )
1437        self.node_bottom = bs.newnode(
1438            'terrain',
1439            delegate=self,
1440            attrs={
1441                'mesh': self.preloaddata['mesh_bottom'],
1442                'lighting': False,
1443                'color_texture': self.preloaddata['tex'],
1444            },
1445        )
1446        bs.newnode(
1447            'terrain',
1448            attrs={
1449                'mesh': self.preloaddata['vr_fill_mound_mesh'],
1450                'lighting': False,
1451                'vr_only': True,
1452                'color': (0.53, 0.57, 0.5),
1453                'background': True,
1454                'color_texture': self.preloaddata['vr_fill_mound_tex'],
1455            },
1456        )
1457        self.background = bs.newnode(
1458            'terrain',
1459            attrs={
1460                'mesh': self.preloaddata['bgmesh'],
1461                'lighting': False,
1462                'background': True,
1463                'color_texture': self.preloaddata['bgtex'],
1464            },
1465        )
1466        gnode = bs.getactivity().globalsnode
1467        gnode.tint = (1.2, 1.1, 1.0)
1468        gnode.ambient_color = (1.2, 1.1, 1.0)
1469        gnode.vignette_outer = (0.7, 0.65, 0.75)
1470        gnode.vignette_inner = (0.95, 0.95, 0.93)
1471
1472
1473class Courtyard(bs.Map):
1474    """A courtyard-ish looking map for co-op levels."""
1475
1476    from bascenev1lib.mapdata import courtyard as defs
1477
1478    name = 'Courtyard'
1479
1480    @classmethod
1481    def get_play_types(cls) -> list[str]:
1482        """Return valid play types for this map."""
1483        return ['melee', 'keep_away', 'team_flag']
1484
1485    @classmethod
1486    def get_preview_texture_name(cls) -> str:
1487        return 'courtyardPreview'
1488
1489    @classmethod
1490    def on_preload(cls) -> Any:
1491        data: dict[str, Any] = {
1492            'mesh': bs.getmesh('courtyardLevel'),
1493            'mesh_bottom': bs.getmesh('courtyardLevelBottom'),
1494            'collision_mesh': bs.getcollisionmesh('courtyardLevelCollide'),
1495            'tex': bs.gettexture('courtyardLevelColor'),
1496            'bgtex': bs.gettexture('menuBG'),
1497            'bgmesh': bs.getmesh('thePadBG'),
1498            'player_wall_collision_mesh': (
1499                bs.getcollisionmesh('courtyardPlayerWall')
1500            ),
1501            'player_wall_material': bs.Material(),
1502        }
1503        # FIXME: Chop this into vr and non-vr chunks.
1504        data['player_wall_material'].add_actions(
1505            actions=('modify_part_collision', 'friction', 0.0)
1506        )
1507        # anything that needs to hit the wall should apply this.
1508        data['collide_with_wall_material'] = bs.Material()
1509        data['player_wall_material'].add_actions(
1510            conditions=(
1511                'they_dont_have_material',
1512                data['collide_with_wall_material'],
1513            ),
1514            actions=('modify_part_collision', 'collide', False),
1515        )
1516        data['vr_fill_mound_mesh'] = bs.getmesh('stepRightUpVRFillMound')
1517        data['vr_fill_mound_tex'] = bs.gettexture('vrFillMound')
1518        return data
1519
1520    def __init__(self) -> None:
1521        super().__init__()
1522        shared = SharedObjects.get()
1523        self.node = bs.newnode(
1524            'terrain',
1525            delegate=self,
1526            attrs={
1527                'collision_mesh': self.preloaddata['collision_mesh'],
1528                'mesh': self.preloaddata['mesh'],
1529                'color_texture': self.preloaddata['tex'],
1530                'materials': [shared.footing_material],
1531            },
1532        )
1533        self.background = bs.newnode(
1534            'terrain',
1535            attrs={
1536                'mesh': self.preloaddata['bgmesh'],
1537                'lighting': False,
1538                'background': True,
1539                'color_texture': self.preloaddata['bgtex'],
1540            },
1541        )
1542        self.bottom = bs.newnode(
1543            'terrain',
1544            attrs={
1545                'mesh': self.preloaddata['mesh_bottom'],
1546                'lighting': False,
1547                'color_texture': self.preloaddata['tex'],
1548            },
1549        )
1550        bs.newnode(
1551            'terrain',
1552            attrs={
1553                'mesh': self.preloaddata['vr_fill_mound_mesh'],
1554                'lighting': False,
1555                'vr_only': True,
1556                'color': (0.53, 0.57, 0.5),
1557                'background': True,
1558                'color_texture': self.preloaddata['vr_fill_mound_tex'],
1559            },
1560        )
1561        # in co-op mode games, put up a wall to prevent players
1562        # from getting in the turrets (that would foil our brilliant AI)
1563        if isinstance(bs.getsession(), bs.CoopSession):
1564            cmesh = self.preloaddata['player_wall_collision_mesh']
1565            self.player_wall = bs.newnode(
1566                'terrain',
1567                attrs={
1568                    'collision_mesh': cmesh,
1569                    'affect_bg_dynamics': False,
1570                    'materials': [self.preloaddata['player_wall_material']],
1571                },
1572            )
1573        gnode = bs.getactivity().globalsnode
1574        gnode.tint = (1.2, 1.17, 1.1)
1575        gnode.ambient_color = (1.2, 1.17, 1.1)
1576        gnode.vignette_outer = (0.6, 0.6, 0.64)
1577        gnode.vignette_inner = (0.95, 0.95, 0.93)
1578
1579    def is_point_near_edge(self, point: bs.Vec3, running: bool = False) -> bool:
1580        # count anything off our ground level as safe (for our platforms)
1581        # see if we're within edge_box
1582        box_position = self.defs.boxes['edge_box'][0:3]
1583        box_scale = self.defs.boxes['edge_box'][6:9]
1584        xpos = (point.x - box_position[0]) / box_scale[0]
1585        zpos = (point.z - box_position[2]) / box_scale[2]
1586        return xpos < -0.5 or xpos > 0.5 or zpos < -0.5 or zpos > 0.5
1587
1588
1589class Rampage(bs.Map):
1590    """Wee little map with ramps on the sides."""
1591
1592    from bascenev1lib.mapdata import rampage as defs
1593
1594    name = 'Rampage'
1595
1596    @classmethod
1597    def get_play_types(cls) -> list[str]:
1598        """Return valid play types for this map."""
1599        return ['melee', 'keep_away', 'team_flag']
1600
1601    @classmethod
1602    def get_preview_texture_name(cls) -> str:
1603        return 'rampagePreview'
1604
1605    @classmethod
1606    def on_preload(cls) -> Any:
1607        data: dict[str, Any] = {
1608            'mesh': bs.getmesh('rampageLevel'),
1609            'bottom_mesh': bs.getmesh('rampageLevelBottom'),
1610            'collision_mesh': bs.getcollisionmesh('rampageLevelCollide'),
1611            'tex': bs.gettexture('rampageLevelColor'),
1612            'bgtex': bs.gettexture('rampageBGColor'),
1613            'bgtex2': bs.gettexture('rampageBGColor2'),
1614            'bgmesh': bs.getmesh('rampageBG'),
1615            'bgmesh2': bs.getmesh('rampageBG2'),
1616            'vr_fill_mesh': bs.getmesh('rampageVRFill'),
1617            'railing_collision_mesh': bs.getcollisionmesh('rampageBumper'),
1618        }
1619        return data
1620
1621    def __init__(self) -> None:
1622        super().__init__(vr_overlay_offset=(0, 0, 2))
1623        shared = SharedObjects.get()
1624        self.node = bs.newnode(
1625            'terrain',
1626            delegate=self,
1627            attrs={
1628                'collision_mesh': self.preloaddata['collision_mesh'],
1629                'mesh': self.preloaddata['mesh'],
1630                'color_texture': self.preloaddata['tex'],
1631                'materials': [shared.footing_material],
1632            },
1633        )
1634        self.background = bs.newnode(
1635            'terrain',
1636            attrs={
1637                'mesh': self.preloaddata['bgmesh'],
1638                'lighting': False,
1639                'background': True,
1640                'color_texture': self.preloaddata['bgtex'],
1641            },
1642        )
1643        self.bottom = bs.newnode(
1644            'terrain',
1645            attrs={
1646                'mesh': self.preloaddata['bottom_mesh'],
1647                'lighting': False,
1648                'color_texture': self.preloaddata['tex'],
1649            },
1650        )
1651        self.bg2 = bs.newnode(
1652            'terrain',
1653            attrs={
1654                'mesh': self.preloaddata['bgmesh2'],
1655                'lighting': False,
1656                'background': True,
1657                'color_texture': self.preloaddata['bgtex2'],
1658            },
1659        )
1660        bs.newnode(
1661            'terrain',
1662            attrs={
1663                'mesh': self.preloaddata['vr_fill_mesh'],
1664                'lighting': False,
1665                'vr_only': True,
1666                'background': True,
1667                'color_texture': self.preloaddata['bgtex2'],
1668            },
1669        )
1670        self.railing = bs.newnode(
1671            'terrain',
1672            attrs={
1673                'collision_mesh': self.preloaddata['railing_collision_mesh'],
1674                'materials': [shared.railing_material],
1675                'bumper': True,
1676            },
1677        )
1678        gnode = bs.getactivity().globalsnode
1679        gnode.tint = (1.2, 1.1, 0.97)
1680        gnode.ambient_color = (1.3, 1.2, 1.03)
1681        gnode.vignette_outer = (0.62, 0.64, 0.69)
1682        gnode.vignette_inner = (0.97, 0.95, 0.93)
1683
1684    def is_point_near_edge(self, point: bs.Vec3, running: bool = False) -> bool:
1685        box_position = self.defs.boxes['edge_box'][0:3]
1686        box_scale = self.defs.boxes['edge_box'][6:9]
1687        xpos = (point.x - box_position[0]) / box_scale[0]
1688        zpos = (point.z - box_position[2]) / box_scale[2]
1689        return xpos < -0.5 or xpos > 0.5 or zpos < -0.5 or zpos > 0.5
class HockeyStadium(bascenev1._map.Map):
 18class HockeyStadium(bs.Map):
 19    """Stadium map used for ice hockey games."""
 20
 21    # noinspection PyUnresolvedReferences
 22    from bascenev1lib.mapdata import hockey_stadium as defs
 23
 24    name = 'Hockey Stadium'
 25
 26    @classmethod
 27    def get_play_types(cls) -> list[str]:
 28        """Return valid play types for this map."""
 29        return ['melee', 'hockey', 'team_flag', 'keep_away']
 30
 31    @classmethod
 32    def get_preview_texture_name(cls) -> str:
 33        return 'hockeyStadiumPreview'
 34
 35    @classmethod
 36    def on_preload(cls) -> Any:
 37        data: dict[str, Any] = {
 38            'meshes': (
 39                bs.getmesh('hockeyStadiumOuter'),
 40                bs.getmesh('hockeyStadiumInner'),
 41                bs.getmesh('hockeyStadiumStands'),
 42            ),
 43            'vr_fill_mesh': bs.getmesh('footballStadiumVRFill'),
 44            'collision_mesh': bs.getcollisionmesh('hockeyStadiumCollide'),
 45            'tex': bs.gettexture('hockeyStadium'),
 46            'stands_tex': bs.gettexture('footballStadium'),
 47        }
 48        mat = bs.Material()
 49        mat.add_actions(actions=('modify_part_collision', 'friction', 0.01))
 50        data['ice_material'] = mat
 51        return data
 52
 53    def __init__(self) -> None:
 54        super().__init__()
 55        shared = SharedObjects.get()
 56        self.node = bs.newnode(
 57            'terrain',
 58            delegate=self,
 59            attrs={
 60                'mesh': self.preloaddata['meshes'][0],
 61                'collision_mesh': self.preloaddata['collision_mesh'],
 62                'color_texture': self.preloaddata['tex'],
 63                'materials': [
 64                    shared.footing_material,
 65                    self.preloaddata['ice_material'],
 66                ],
 67            },
 68        )
 69        bs.newnode(
 70            'terrain',
 71            attrs={
 72                'mesh': self.preloaddata['vr_fill_mesh'],
 73                'vr_only': True,
 74                'lighting': False,
 75                'background': True,
 76                'color_texture': self.preloaddata['stands_tex'],
 77            },
 78        )
 79        mats = [shared.footing_material, self.preloaddata['ice_material']]
 80        self.floor = bs.newnode(
 81            'terrain',
 82            attrs={
 83                'mesh': self.preloaddata['meshes'][1],
 84                'color_texture': self.preloaddata['tex'],
 85                'opacity': 0.92,
 86                'opacity_in_low_or_medium_quality': 1.0,
 87                'materials': mats,
 88            },
 89        )
 90        self.stands = bs.newnode(
 91            'terrain',
 92            attrs={
 93                'mesh': self.preloaddata['meshes'][2],
 94                'visible_in_reflections': False,
 95                'color_texture': self.preloaddata['stands_tex'],
 96            },
 97        )
 98        gnode = bs.getactivity().globalsnode
 99        gnode.floor_reflection = True
100        gnode.debris_friction = 0.3
101        gnode.debris_kill_height = -0.3
102        gnode.tint = (1.2, 1.3, 1.33)
103        gnode.ambient_color = (1.15, 1.25, 1.6)
104        gnode.vignette_outer = (0.66, 0.67, 0.73)
105        gnode.vignette_inner = (0.93, 0.93, 0.95)
106        gnode.vr_camera_offset = (0, -0.8, -1.1)
107        gnode.vr_near_clip = 0.5
108        self.is_hockey = True

Stadium map used for ice hockey games.

HockeyStadium()
 53    def __init__(self) -> None:
 54        super().__init__()
 55        shared = SharedObjects.get()
 56        self.node = bs.newnode(
 57            'terrain',
 58            delegate=self,
 59            attrs={
 60                'mesh': self.preloaddata['meshes'][0],
 61                'collision_mesh': self.preloaddata['collision_mesh'],
 62                'color_texture': self.preloaddata['tex'],
 63                'materials': [
 64                    shared.footing_material,
 65                    self.preloaddata['ice_material'],
 66                ],
 67            },
 68        )
 69        bs.newnode(
 70            'terrain',
 71            attrs={
 72                'mesh': self.preloaddata['vr_fill_mesh'],
 73                'vr_only': True,
 74                'lighting': False,
 75                'background': True,
 76                'color_texture': self.preloaddata['stands_tex'],
 77            },
 78        )
 79        mats = [shared.footing_material, self.preloaddata['ice_material']]
 80        self.floor = bs.newnode(
 81            'terrain',
 82            attrs={
 83                'mesh': self.preloaddata['meshes'][1],
 84                'color_texture': self.preloaddata['tex'],
 85                'opacity': 0.92,
 86                'opacity_in_low_or_medium_quality': 1.0,
 87                'materials': mats,
 88            },
 89        )
 90        self.stands = bs.newnode(
 91            'terrain',
 92            attrs={
 93                'mesh': self.preloaddata['meshes'][2],
 94                'visible_in_reflections': False,
 95                'color_texture': self.preloaddata['stands_tex'],
 96            },
 97        )
 98        gnode = bs.getactivity().globalsnode
 99        gnode.floor_reflection = True
100        gnode.debris_friction = 0.3
101        gnode.debris_kill_height = -0.3
102        gnode.tint = (1.2, 1.3, 1.33)
103        gnode.ambient_color = (1.15, 1.25, 1.6)
104        gnode.vignette_outer = (0.66, 0.67, 0.73)
105        gnode.vignette_inner = (0.93, 0.93, 0.95)
106        gnode.vr_camera_offset = (0, -0.8, -1.1)
107        gnode.vr_near_clip = 0.5
108        self.is_hockey = True

Instantiate a map.

name = 'Hockey Stadium'
@classmethod
def get_play_types(cls) -> list[str]:
26    @classmethod
27    def get_play_types(cls) -> list[str]:
28        """Return valid play types for this map."""
29        return ['melee', 'hockey', 'team_flag', 'keep_away']

Return valid play types for this map.

@classmethod
def get_preview_texture_name(cls) -> str:
31    @classmethod
32    def get_preview_texture_name(cls) -> str:
33        return 'hockeyStadiumPreview'

Return the name of the preview texture for this map.

@classmethod
def on_preload(cls) -> Any:
35    @classmethod
36    def on_preload(cls) -> Any:
37        data: dict[str, Any] = {
38            'meshes': (
39                bs.getmesh('hockeyStadiumOuter'),
40                bs.getmesh('hockeyStadiumInner'),
41                bs.getmesh('hockeyStadiumStands'),
42            ),
43            'vr_fill_mesh': bs.getmesh('footballStadiumVRFill'),
44            'collision_mesh': bs.getcollisionmesh('hockeyStadiumCollide'),
45            'tex': bs.gettexture('hockeyStadium'),
46            'stands_tex': bs.gettexture('footballStadium'),
47        }
48        mat = bs.Material()
49        mat.add_actions(actions=('modify_part_collision', 'friction', 0.01))
50        data['ice_material'] = mat
51        return data

Called when the map is being preloaded.

It should return any media/data it requires to operate

node
floor
stands
is_hockey
Inherited Members
bascenev1._map.Map
preload
getname
get_music_type
spawn_points
ffa_spawn_points
spawn_by_flag_points
flag_points
flag_points_default
powerup_spawn_points
tnt_points
is_flying
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
bascenev1._actor.Actor
autoretain
on_expire
expired
is_alive
activity
getactivity
class FootballStadium(bascenev1._map.Map):
111class FootballStadium(bs.Map):
112    """Stadium map for football games."""
113
114    from bascenev1lib.mapdata import football_stadium as defs
115
116    name = 'Football Stadium'
117
118    @classmethod
119    def get_play_types(cls) -> list[str]:
120        """Return valid play types for this map."""
121        return ['melee', 'football', 'team_flag', 'keep_away']
122
123    @classmethod
124    def get_preview_texture_name(cls) -> str:
125        return 'footballStadiumPreview'
126
127    @classmethod
128    def on_preload(cls) -> Any:
129        data: dict[str, Any] = {
130            'mesh': bs.getmesh('footballStadium'),
131            'vr_fill_mesh': bs.getmesh('footballStadiumVRFill'),
132            'collision_mesh': bs.getcollisionmesh('footballStadiumCollide'),
133            'tex': bs.gettexture('footballStadium'),
134        }
135        return data
136
137    def __init__(self) -> None:
138        super().__init__()
139        shared = SharedObjects.get()
140        self.node = bs.newnode(
141            'terrain',
142            delegate=self,
143            attrs={
144                'mesh': self.preloaddata['mesh'],
145                'collision_mesh': self.preloaddata['collision_mesh'],
146                'color_texture': self.preloaddata['tex'],
147                'materials': [shared.footing_material],
148            },
149        )
150        bs.newnode(
151            'terrain',
152            attrs={
153                'mesh': self.preloaddata['vr_fill_mesh'],
154                'lighting': False,
155                'vr_only': True,
156                'background': True,
157                'color_texture': self.preloaddata['tex'],
158            },
159        )
160        gnode = bs.getactivity().globalsnode
161        gnode.tint = (1.3, 1.2, 1.0)
162        gnode.ambient_color = (1.3, 1.2, 1.0)
163        gnode.vignette_outer = (0.57, 0.57, 0.57)
164        gnode.vignette_inner = (0.9, 0.9, 0.9)
165        gnode.vr_camera_offset = (0, -0.8, -1.1)
166        gnode.vr_near_clip = 0.5
167
168    def is_point_near_edge(self, point: bs.Vec3, running: bool = False) -> bool:
169        box_position = self.defs.boxes['edge_box'][0:3]
170        box_scale = self.defs.boxes['edge_box'][6:9]
171        xpos = (point.x - box_position[0]) / box_scale[0]
172        zpos = (point.z - box_position[2]) / box_scale[2]
173        return xpos < -0.5 or xpos > 0.5 or zpos < -0.5 or zpos > 0.5

Stadium map for football games.

FootballStadium()
137    def __init__(self) -> None:
138        super().__init__()
139        shared = SharedObjects.get()
140        self.node = bs.newnode(
141            'terrain',
142            delegate=self,
143            attrs={
144                'mesh': self.preloaddata['mesh'],
145                'collision_mesh': self.preloaddata['collision_mesh'],
146                'color_texture': self.preloaddata['tex'],
147                'materials': [shared.footing_material],
148            },
149        )
150        bs.newnode(
151            'terrain',
152            attrs={
153                'mesh': self.preloaddata['vr_fill_mesh'],
154                'lighting': False,
155                'vr_only': True,
156                'background': True,
157                'color_texture': self.preloaddata['tex'],
158            },
159        )
160        gnode = bs.getactivity().globalsnode
161        gnode.tint = (1.3, 1.2, 1.0)
162        gnode.ambient_color = (1.3, 1.2, 1.0)
163        gnode.vignette_outer = (0.57, 0.57, 0.57)
164        gnode.vignette_inner = (0.9, 0.9, 0.9)
165        gnode.vr_camera_offset = (0, -0.8, -1.1)
166        gnode.vr_near_clip = 0.5

Instantiate a map.

name = 'Football Stadium'
@classmethod
def get_play_types(cls) -> list[str]:
118    @classmethod
119    def get_play_types(cls) -> list[str]:
120        """Return valid play types for this map."""
121        return ['melee', 'football', 'team_flag', 'keep_away']

Return valid play types for this map.

@classmethod
def get_preview_texture_name(cls) -> str:
123    @classmethod
124    def get_preview_texture_name(cls) -> str:
125        return 'footballStadiumPreview'

Return the name of the preview texture for this map.

@classmethod
def on_preload(cls) -> Any:
127    @classmethod
128    def on_preload(cls) -> Any:
129        data: dict[str, Any] = {
130            'mesh': bs.getmesh('footballStadium'),
131            'vr_fill_mesh': bs.getmesh('footballStadiumVRFill'),
132            'collision_mesh': bs.getcollisionmesh('footballStadiumCollide'),
133            'tex': bs.gettexture('footballStadium'),
134        }
135        return data

Called when the map is being preloaded.

It should return any media/data it requires to operate

node
def is_point_near_edge(self, point: _babase.Vec3, running: bool = False) -> bool:
168    def is_point_near_edge(self, point: bs.Vec3, running: bool = False) -> bool:
169        box_position = self.defs.boxes['edge_box'][0:3]
170        box_scale = self.defs.boxes['edge_box'][6:9]
171        xpos = (point.x - box_position[0]) / box_scale[0]
172        zpos = (point.z - box_position[2]) / box_scale[2]
173        return xpos < -0.5 or xpos > 0.5 or zpos < -0.5 or zpos > 0.5

Return whether the provided point is near an edge of the map.

Simple bot logic uses this call to determine if they are approaching a cliff or wall. If this returns True they will generally not walk/run any farther away from the origin. If 'running' is True, the buffer should be a bit larger.

Inherited Members
bascenev1._map.Map
preload
getname
get_music_type
spawn_points
ffa_spawn_points
spawn_by_flag_points
flag_points
flag_points_default
powerup_spawn_points
tnt_points
is_hockey
is_flying
get_def_bound_box
get_def_point
get_def_points
get_start_position
get_ffa_start_position
get_flag_position
exists
handlemessage
bascenev1._actor.Actor
autoretain
on_expire
expired
is_alive
activity
getactivity
class Bridgit(bascenev1._map.Map):
176class Bridgit(bs.Map):
177    """Map with a narrow bridge in the middle."""
178
179    # noinspection PyUnresolvedReferences
180    from bascenev1lib.mapdata import bridgit as defs
181
182    name = 'Bridgit'
183    dataname = 'bridgit'
184
185    @classmethod
186    def get_play_types(cls) -> list[str]:
187        """Return valid play types for this map."""
188        # print('getting playtypes', cls._getdata()['play_types'])
189        return ['melee', 'team_flag', 'keep_away']
190
191    @classmethod
192    def get_preview_texture_name(cls) -> str:
193        return 'bridgitPreview'
194
195    @classmethod
196    def on_preload(cls) -> Any:
197        data: dict[str, Any] = {
198            'mesh_top': bs.getmesh('bridgitLevelTop'),
199            'mesh_bottom': bs.getmesh('bridgitLevelBottom'),
200            'mesh_bg': bs.getmesh('natureBackground'),
201            'bg_vr_fill_mesh': bs.getmesh('natureBackgroundVRFill'),
202            'collision_mesh': bs.getcollisionmesh('bridgitLevelCollide'),
203            'tex': bs.gettexture('bridgitLevelColor'),
204            'mesh_bg_tex': bs.gettexture('natureBackgroundColor'),
205            'collide_bg': bs.getcollisionmesh('natureBackgroundCollide'),
206            'railing_collision_mesh': (
207                bs.getcollisionmesh('bridgitLevelRailingCollide')
208            ),
209            'bg_material': bs.Material(),
210        }
211        data['bg_material'].add_actions(
212            actions=('modify_part_collision', 'friction', 10.0)
213        )
214        return data
215
216    def __init__(self) -> None:
217        super().__init__()
218        shared = SharedObjects.get()
219        self.node = bs.newnode(
220            'terrain',
221            delegate=self,
222            attrs={
223                'collision_mesh': self.preloaddata['collision_mesh'],
224                'mesh': self.preloaddata['mesh_top'],
225                'color_texture': self.preloaddata['tex'],
226                'materials': [shared.footing_material],
227            },
228        )
229        self.bottom = bs.newnode(
230            'terrain',
231            attrs={
232                'mesh': self.preloaddata['mesh_bottom'],
233                'lighting': False,
234                'color_texture': self.preloaddata['tex'],
235            },
236        )
237        self.background = bs.newnode(
238            'terrain',
239            attrs={
240                'mesh': self.preloaddata['mesh_bg'],
241                'lighting': False,
242                'background': True,
243                'color_texture': self.preloaddata['mesh_bg_tex'],
244            },
245        )
246        bs.newnode(
247            'terrain',
248            attrs={
249                'mesh': self.preloaddata['bg_vr_fill_mesh'],
250                'lighting': False,
251                'vr_only': True,
252                'background': True,
253                'color_texture': self.preloaddata['mesh_bg_tex'],
254            },
255        )
256        self.railing = bs.newnode(
257            'terrain',
258            attrs={
259                'collision_mesh': self.preloaddata['railing_collision_mesh'],
260                'materials': [shared.railing_material],
261                'bumper': True,
262            },
263        )
264        self.bg_collide = bs.newnode(
265            'terrain',
266            attrs={
267                'collision_mesh': self.preloaddata['collide_bg'],
268                'materials': [
269                    shared.footing_material,
270                    self.preloaddata['bg_material'],
271                    shared.death_material,
272                ],
273            },
274        )
275        gnode = bs.getactivity().globalsnode
276        gnode.tint = (1.1, 1.2, 1.3)
277        gnode.ambient_color = (1.1, 1.2, 1.3)
278        gnode.vignette_outer = (0.65, 0.6, 0.55)
279        gnode.vignette_inner = (0.9, 0.9, 0.93)

Map with a narrow bridge in the middle.

Bridgit()
216    def __init__(self) -> None:
217        super().__init__()
218        shared = SharedObjects.get()
219        self.node = bs.newnode(
220            'terrain',
221            delegate=self,
222            attrs={
223                'collision_mesh': self.preloaddata['collision_mesh'],
224                'mesh': self.preloaddata['mesh_top'],
225                'color_texture': self.preloaddata['tex'],
226                'materials': [shared.footing_material],
227            },
228        )
229        self.bottom = bs.newnode(
230            'terrain',
231            attrs={
232                'mesh': self.preloaddata['mesh_bottom'],
233                'lighting': False,
234                'color_texture': self.preloaddata['tex'],
235            },
236        )
237        self.background = bs.newnode(
238            'terrain',
239            attrs={
240                'mesh': self.preloaddata['mesh_bg'],
241                'lighting': False,
242                'background': True,
243                'color_texture': self.preloaddata['mesh_bg_tex'],
244            },
245        )
246        bs.newnode(
247            'terrain',
248            attrs={
249                'mesh': self.preloaddata['bg_vr_fill_mesh'],
250                'lighting': False,
251                'vr_only': True,
252                'background': True,
253                'color_texture': self.preloaddata['mesh_bg_tex'],
254            },
255        )
256        self.railing = bs.newnode(
257            'terrain',
258            attrs={
259                'collision_mesh': self.preloaddata['railing_collision_mesh'],
260                'materials': [shared.railing_material],
261                'bumper': True,
262            },
263        )
264        self.bg_collide = bs.newnode(
265            'terrain',
266            attrs={
267                'collision_mesh': self.preloaddata['collide_bg'],
268                'materials': [
269                    shared.footing_material,
270                    self.preloaddata['bg_material'],
271                    shared.death_material,
272                ],
273            },
274        )
275        gnode = bs.getactivity().globalsnode
276        gnode.tint = (1.1, 1.2, 1.3)
277        gnode.ambient_color = (1.1, 1.2, 1.3)
278        gnode.vignette_outer = (0.65, 0.6, 0.55)
279        gnode.vignette_inner = (0.9, 0.9, 0.93)

Instantiate a map.

name = 'Bridgit'
dataname = 'bridgit'
@classmethod
def get_play_types(cls) -> list[str]:
185    @classmethod
186    def get_play_types(cls) -> list[str]:
187        """Return valid play types for this map."""
188        # print('getting playtypes', cls._getdata()['play_types'])
189        return ['melee', 'team_flag', 'keep_away']

Return valid play types for this map.

@classmethod
def get_preview_texture_name(cls) -> str:
191    @classmethod
192    def get_preview_texture_name(cls) -> str:
193        return 'bridgitPreview'

Return the name of the preview texture for this map.

@classmethod
def on_preload(cls) -> Any:
195    @classmethod
196    def on_preload(cls) -> Any:
197        data: dict[str, Any] = {
198            'mesh_top': bs.getmesh('bridgitLevelTop'),
199            'mesh_bottom': bs.getmesh('bridgitLevelBottom'),
200            'mesh_bg': bs.getmesh('natureBackground'),
201            'bg_vr_fill_mesh': bs.getmesh('natureBackgroundVRFill'),
202            'collision_mesh': bs.getcollisionmesh('bridgitLevelCollide'),
203            'tex': bs.gettexture('bridgitLevelColor'),
204            'mesh_bg_tex': bs.gettexture('natureBackgroundColor'),
205            'collide_bg': bs.getcollisionmesh('natureBackgroundCollide'),
206            'railing_collision_mesh': (
207                bs.getcollisionmesh('bridgitLevelRailingCollide')
208            ),
209            'bg_material': bs.Material(),
210        }
211        data['bg_material'].add_actions(
212            actions=('modify_part_collision', 'friction', 10.0)
213        )
214        return data

Called when the map is being preloaded.

It should return any media/data it requires to operate

node
bottom
background
railing
bg_collide
Inherited Members
bascenev1._map.Map
preload
getname
get_music_type
spawn_points
ffa_spawn_points
spawn_by_flag_points
flag_points
flag_points_default
powerup_spawn_points
tnt_points
is_hockey
is_flying
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
bascenev1._actor.Actor
autoretain
on_expire
expired
is_alive
activity
getactivity
class BigG(bascenev1._map.Map):
282class BigG(bs.Map):
283    """Large G shaped map for racing"""
284
285    # noinspection PyUnresolvedReferences
286    from bascenev1lib.mapdata import big_g as defs
287
288    name = 'Big G'
289
290    @classmethod
291    def get_play_types(cls) -> list[str]:
292        """Return valid play types for this map."""
293        return [
294            'race',
295            'melee',
296            'keep_away',
297            'team_flag',
298            'king_of_the_hill',
299            'conquest',
300        ]
301
302    @classmethod
303    def get_preview_texture_name(cls) -> str:
304        return 'bigGPreview'
305
306    @classmethod
307    def on_preload(cls) -> Any:
308        data: dict[str, Any] = {
309            'mesh_top': bs.getmesh('bigG'),
310            'mesh_bottom': bs.getmesh('bigGBottom'),
311            'mesh_bg': bs.getmesh('natureBackground'),
312            'bg_vr_fill_mesh': bs.getmesh('natureBackgroundVRFill'),
313            'collision_mesh': bs.getcollisionmesh('bigGCollide'),
314            'tex': bs.gettexture('bigG'),
315            'mesh_bg_tex': bs.gettexture('natureBackgroundColor'),
316            'collide_bg': bs.getcollisionmesh('natureBackgroundCollide'),
317            'bumper_collision_mesh': bs.getcollisionmesh('bigGBumper'),
318            'bg_material': bs.Material(),
319        }
320        data['bg_material'].add_actions(
321            actions=('modify_part_collision', 'friction', 10.0)
322        )
323        return data
324
325    def __init__(self) -> None:
326        super().__init__()
327        shared = SharedObjects.get()
328        self.node = bs.newnode(
329            'terrain',
330            delegate=self,
331            attrs={
332                'collision_mesh': self.preloaddata['collision_mesh'],
333                'color': (0.7, 0.7, 0.7),
334                'mesh': self.preloaddata['mesh_top'],
335                'color_texture': self.preloaddata['tex'],
336                'materials': [shared.footing_material],
337            },
338        )
339        self.bottom = bs.newnode(
340            'terrain',
341            attrs={
342                'mesh': self.preloaddata['mesh_bottom'],
343                'color': (0.7, 0.7, 0.7),
344                'lighting': False,
345                'color_texture': self.preloaddata['tex'],
346            },
347        )
348        self.background = bs.newnode(
349            'terrain',
350            attrs={
351                'mesh': self.preloaddata['mesh_bg'],
352                'lighting': False,
353                'background': True,
354                'color_texture': self.preloaddata['mesh_bg_tex'],
355            },
356        )
357        bs.newnode(
358            'terrain',
359            attrs={
360                'mesh': self.preloaddata['bg_vr_fill_mesh'],
361                'lighting': False,
362                'vr_only': True,
363                'background': True,
364                'color_texture': self.preloaddata['mesh_bg_tex'],
365            },
366        )
367        self.railing = bs.newnode(
368            'terrain',
369            attrs={
370                'collision_mesh': self.preloaddata['bumper_collision_mesh'],
371                'materials': [shared.railing_material],
372                'bumper': True,
373            },
374        )
375        self.bg_collide = bs.newnode(
376            'terrain',
377            attrs={
378                'collision_mesh': self.preloaddata['collide_bg'],
379                'materials': [
380                    shared.footing_material,
381                    self.preloaddata['bg_material'],
382                    shared.death_material,
383                ],
384            },
385        )
386        gnode = bs.getactivity().globalsnode
387        gnode.tint = (1.1, 1.2, 1.3)
388        gnode.ambient_color = (1.1, 1.2, 1.3)
389        gnode.vignette_outer = (0.65, 0.6, 0.55)
390        gnode.vignette_inner = (0.9, 0.9, 0.93)

Large G shaped map for racing

BigG()
325    def __init__(self) -> None:
326        super().__init__()
327        shared = SharedObjects.get()
328        self.node = bs.newnode(
329            'terrain',
330            delegate=self,
331            attrs={
332                'collision_mesh': self.preloaddata['collision_mesh'],
333                'color': (0.7, 0.7, 0.7),
334                'mesh': self.preloaddata['mesh_top'],
335                'color_texture': self.preloaddata['tex'],
336                'materials': [shared.footing_material],
337            },
338        )
339        self.bottom = bs.newnode(
340            'terrain',
341            attrs={
342                'mesh': self.preloaddata['mesh_bottom'],
343                'color': (0.7, 0.7, 0.7),
344                'lighting': False,
345                'color_texture': self.preloaddata['tex'],
346            },
347        )
348        self.background = bs.newnode(
349            'terrain',
350            attrs={
351                'mesh': self.preloaddata['mesh_bg'],
352                'lighting': False,
353                'background': True,
354                'color_texture': self.preloaddata['mesh_bg_tex'],
355            },
356        )
357        bs.newnode(
358            'terrain',
359            attrs={
360                'mesh': self.preloaddata['bg_vr_fill_mesh'],
361                'lighting': False,
362                'vr_only': True,
363                'background': True,
364                'color_texture': self.preloaddata['mesh_bg_tex'],
365            },
366        )
367        self.railing = bs.newnode(
368            'terrain',
369            attrs={
370                'collision_mesh': self.preloaddata['bumper_collision_mesh'],
371                'materials': [shared.railing_material],
372                'bumper': True,
373            },
374        )
375        self.bg_collide = bs.newnode(
376            'terrain',
377            attrs={
378                'collision_mesh': self.preloaddata['collide_bg'],
379                'materials': [
380                    shared.footing_material,
381                    self.preloaddata['bg_material'],
382                    shared.death_material,
383                ],
384            },
385        )
386        gnode = bs.getactivity().globalsnode
387        gnode.tint = (1.1, 1.2, 1.3)
388        gnode.ambient_color = (1.1, 1.2, 1.3)
389        gnode.vignette_outer = (0.65, 0.6, 0.55)
390        gnode.vignette_inner = (0.9, 0.9, 0.93)

Instantiate a map.

name = 'Big G'
@classmethod
def get_play_types(cls) -> list[str]:
290    @classmethod
291    def get_play_types(cls) -> list[str]:
292        """Return valid play types for this map."""
293        return [
294            'race',
295            'melee',
296            'keep_away',
297            'team_flag',
298            'king_of_the_hill',
299            'conquest',
300        ]

Return valid play types for this map.

@classmethod
def get_preview_texture_name(cls) -> str:
302    @classmethod
303    def get_preview_texture_name(cls) -> str:
304        return 'bigGPreview'

Return the name of the preview texture for this map.

@classmethod
def on_preload(cls) -> Any:
306    @classmethod
307    def on_preload(cls) -> Any:
308        data: dict[str, Any] = {
309            'mesh_top': bs.getmesh('bigG'),
310            'mesh_bottom': bs.getmesh('bigGBottom'),
311            'mesh_bg': bs.getmesh('natureBackground'),
312            'bg_vr_fill_mesh': bs.getmesh('natureBackgroundVRFill'),
313            'collision_mesh': bs.getcollisionmesh('bigGCollide'),
314            'tex': bs.gettexture('bigG'),
315            'mesh_bg_tex': bs.gettexture('natureBackgroundColor'),
316            'collide_bg': bs.getcollisionmesh('natureBackgroundCollide'),
317            'bumper_collision_mesh': bs.getcollisionmesh('bigGBumper'),
318            'bg_material': bs.Material(),
319        }
320        data['bg_material'].add_actions(
321            actions=('modify_part_collision', 'friction', 10.0)
322        )
323        return data

Called when the map is being preloaded.

It should return any media/data it requires to operate

node
bottom
background
railing
bg_collide
Inherited Members
bascenev1._map.Map
preload
getname
get_music_type
spawn_points
ffa_spawn_points
spawn_by_flag_points
flag_points
flag_points_default
powerup_spawn_points
tnt_points
is_hockey
is_flying
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
bascenev1._actor.Actor
autoretain
on_expire
expired
is_alive
activity
getactivity
class Roundabout(bascenev1._map.Map):
393class Roundabout(bs.Map):
394    """CTF map featuring two platforms and a long way around between them"""
395
396    # noinspection PyUnresolvedReferences
397    from bascenev1lib.mapdata import roundabout as defs
398
399    name = 'Roundabout'
400
401    @classmethod
402    def get_play_types(cls) -> list[str]:
403        """Return valid play types for this map."""
404        return ['melee', 'keep_away', 'team_flag']
405
406    @classmethod
407    def get_preview_texture_name(cls) -> str:
408        return 'roundaboutPreview'
409
410    @classmethod
411    def on_preload(cls) -> Any:
412        data: dict[str, Any] = {
413            'mesh': bs.getmesh('roundaboutLevel'),
414            'mesh_bottom': bs.getmesh('roundaboutLevelBottom'),
415            'mesh_bg': bs.getmesh('natureBackground'),
416            'bg_vr_fill_mesh': bs.getmesh('natureBackgroundVRFill'),
417            'collision_mesh': bs.getcollisionmesh('roundaboutLevelCollide'),
418            'tex': bs.gettexture('roundaboutLevelColor'),
419            'mesh_bg_tex': bs.gettexture('natureBackgroundColor'),
420            'collide_bg': bs.getcollisionmesh('natureBackgroundCollide'),
421            'railing_collision_mesh': (
422                bs.getcollisionmesh('roundaboutLevelBumper')
423            ),
424            'bg_material': bs.Material(),
425        }
426        data['bg_material'].add_actions(
427            actions=('modify_part_collision', 'friction', 10.0)
428        )
429        return data
430
431    def __init__(self) -> None:
432        super().__init__(vr_overlay_offset=(0, -1, 1))
433        shared = SharedObjects.get()
434        self.node = bs.newnode(
435            'terrain',
436            delegate=self,
437            attrs={
438                'collision_mesh': self.preloaddata['collision_mesh'],
439                'mesh': self.preloaddata['mesh'],
440                'color_texture': self.preloaddata['tex'],
441                'materials': [shared.footing_material],
442            },
443        )
444        self.bottom = bs.newnode(
445            'terrain',
446            attrs={
447                'mesh': self.preloaddata['mesh_bottom'],
448                'lighting': False,
449                'color_texture': self.preloaddata['tex'],
450            },
451        )
452        self.background = bs.newnode(
453            'terrain',
454            attrs={
455                'mesh': self.preloaddata['mesh_bg'],
456                'lighting': False,
457                'background': True,
458                'color_texture': self.preloaddata['mesh_bg_tex'],
459            },
460        )
461        bs.newnode(
462            'terrain',
463            attrs={
464                'mesh': self.preloaddata['bg_vr_fill_mesh'],
465                'lighting': False,
466                'vr_only': True,
467                'background': True,
468                'color_texture': self.preloaddata['mesh_bg_tex'],
469            },
470        )
471        self.bg_collide = bs.newnode(
472            'terrain',
473            attrs={
474                'collision_mesh': self.preloaddata['collide_bg'],
475                'materials': [
476                    shared.footing_material,
477                    self.preloaddata['bg_material'],
478                    shared.death_material,
479                ],
480            },
481        )
482        self.railing = bs.newnode(
483            'terrain',
484            attrs={
485                'collision_mesh': self.preloaddata['railing_collision_mesh'],
486                'materials': [shared.railing_material],
487                'bumper': True,
488            },
489        )
490        gnode = bs.getactivity().globalsnode
491        gnode.tint = (1.0, 1.05, 1.1)
492        gnode.ambient_color = (1.0, 1.05, 1.1)
493        gnode.shadow_ortho = True
494        gnode.vignette_outer = (0.63, 0.65, 0.7)
495        gnode.vignette_inner = (0.97, 0.95, 0.93)

CTF map featuring two platforms and a long way around between them

Roundabout()
431    def __init__(self) -> None:
432        super().__init__(vr_overlay_offset=(0, -1, 1))
433        shared = SharedObjects.get()
434        self.node = bs.newnode(
435            'terrain',
436            delegate=self,
437            attrs={
438                'collision_mesh': self.preloaddata['collision_mesh'],
439                'mesh': self.preloaddata['mesh'],
440                'color_texture': self.preloaddata['tex'],
441                'materials': [shared.footing_material],
442            },
443        )
444        self.bottom = bs.newnode(
445            'terrain',
446            attrs={
447                'mesh': self.preloaddata['mesh_bottom'],
448                'lighting': False,
449                'color_texture': self.preloaddata['tex'],
450            },
451        )
452        self.background = bs.newnode(
453            'terrain',
454            attrs={
455                'mesh': self.preloaddata['mesh_bg'],
456                'lighting': False,
457                'background': True,
458                'color_texture': self.preloaddata['mesh_bg_tex'],
459            },
460        )
461        bs.newnode(
462            'terrain',
463            attrs={
464                'mesh': self.preloaddata['bg_vr_fill_mesh'],
465                'lighting': False,
466                'vr_only': True,
467                'background': True,
468                'color_texture': self.preloaddata['mesh_bg_tex'],
469            },
470        )
471        self.bg_collide = bs.newnode(
472            'terrain',
473            attrs={
474                'collision_mesh': self.preloaddata['collide_bg'],
475                'materials': [
476                    shared.footing_material,
477                    self.preloaddata['bg_material'],
478                    shared.death_material,
479                ],
480            },
481        )
482        self.railing = bs.newnode(
483            'terrain',
484            attrs={
485                'collision_mesh': self.preloaddata['railing_collision_mesh'],
486                'materials': [shared.railing_material],
487                'bumper': True,
488            },
489        )
490        gnode = bs.getactivity().globalsnode
491        gnode.tint = (1.0, 1.05, 1.1)
492        gnode.ambient_color = (1.0, 1.05, 1.1)
493        gnode.shadow_ortho = True
494        gnode.vignette_outer = (0.63, 0.65, 0.7)
495        gnode.vignette_inner = (0.97, 0.95, 0.93)

Instantiate a map.

name = 'Roundabout'
@classmethod
def get_play_types(cls) -> list[str]:
401    @classmethod
402    def get_play_types(cls) -> list[str]:
403        """Return valid play types for this map."""
404        return ['melee', 'keep_away', 'team_flag']

Return valid play types for this map.

@classmethod
def get_preview_texture_name(cls) -> str:
406    @classmethod
407    def get_preview_texture_name(cls) -> str:
408        return 'roundaboutPreview'

Return the name of the preview texture for this map.

@classmethod
def on_preload(cls) -> Any:
410    @classmethod
411    def on_preload(cls) -> Any:
412        data: dict[str, Any] = {
413            'mesh': bs.getmesh('roundaboutLevel'),
414            'mesh_bottom': bs.getmesh('roundaboutLevelBottom'),
415            'mesh_bg': bs.getmesh('natureBackground'),
416            'bg_vr_fill_mesh': bs.getmesh('natureBackgroundVRFill'),
417            'collision_mesh': bs.getcollisionmesh('roundaboutLevelCollide'),
418            'tex': bs.gettexture('roundaboutLevelColor'),
419            'mesh_bg_tex': bs.gettexture('natureBackgroundColor'),
420            'collide_bg': bs.getcollisionmesh('natureBackgroundCollide'),
421            'railing_collision_mesh': (
422                bs.getcollisionmesh('roundaboutLevelBumper')
423            ),
424            'bg_material': bs.Material(),
425        }
426        data['bg_material'].add_actions(
427            actions=('modify_part_collision', 'friction', 10.0)
428        )
429        return data

Called when the map is being preloaded.

It should return any media/data it requires to operate

node
bottom
background
bg_collide
railing
Inherited Members
bascenev1._map.Map
preload
getname
get_music_type
spawn_points
ffa_spawn_points
spawn_by_flag_points
flag_points
flag_points_default
powerup_spawn_points
tnt_points
is_hockey
is_flying
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
bascenev1._actor.Actor
autoretain
on_expire
expired
is_alive
activity
getactivity
class MonkeyFace(bascenev1._map.Map):
498class MonkeyFace(bs.Map):
499    """Map sorta shaped like a monkey face; teehee!"""
500
501    # noinspection PyUnresolvedReferences
502    from bascenev1lib.mapdata import monkey_face as defs
503
504    name = 'Monkey Face'
505
506    @classmethod
507    def get_play_types(cls) -> list[str]:
508        """Return valid play types for this map."""
509        return ['melee', 'keep_away', 'team_flag']
510
511    @classmethod
512    def get_preview_texture_name(cls) -> str:
513        return 'monkeyFacePreview'
514
515    @classmethod
516    def on_preload(cls) -> Any:
517        data: dict[str, Any] = {
518            'mesh': bs.getmesh('monkeyFaceLevel'),
519            'bottom_mesh': bs.getmesh('monkeyFaceLevelBottom'),
520            'mesh_bg': bs.getmesh('natureBackground'),
521            'bg_vr_fill_mesh': bs.getmesh('natureBackgroundVRFill'),
522            'collision_mesh': bs.getcollisionmesh('monkeyFaceLevelCollide'),
523            'tex': bs.gettexture('monkeyFaceLevelColor'),
524            'mesh_bg_tex': bs.gettexture('natureBackgroundColor'),
525            'collide_bg': bs.getcollisionmesh('natureBackgroundCollide'),
526            'railing_collision_mesh': (
527                bs.getcollisionmesh('monkeyFaceLevelBumper')
528            ),
529            'bg_material': bs.Material(),
530        }
531        data['bg_material'].add_actions(
532            actions=('modify_part_collision', 'friction', 10.0)
533        )
534        return data
535
536    def __init__(self) -> None:
537        super().__init__()
538        shared = SharedObjects.get()
539        self.node = bs.newnode(
540            'terrain',
541            delegate=self,
542            attrs={
543                'collision_mesh': self.preloaddata['collision_mesh'],
544                'mesh': self.preloaddata['mesh'],
545                'color_texture': self.preloaddata['tex'],
546                'materials': [shared.footing_material],
547            },
548        )
549        self.bottom = bs.newnode(
550            'terrain',
551            attrs={
552                'mesh': self.preloaddata['bottom_mesh'],
553                'lighting': False,
554                'color_texture': self.preloaddata['tex'],
555            },
556        )
557        self.background = bs.newnode(
558            'terrain',
559            attrs={
560                'mesh': self.preloaddata['mesh_bg'],
561                'lighting': False,
562                'background': True,
563                'color_texture': self.preloaddata['mesh_bg_tex'],
564            },
565        )
566        bs.newnode(
567            'terrain',
568            attrs={
569                'mesh': self.preloaddata['bg_vr_fill_mesh'],
570                'lighting': False,
571                'vr_only': True,
572                'background': True,
573                'color_texture': self.preloaddata['mesh_bg_tex'],
574            },
575        )
576        self.bg_collide = bs.newnode(
577            'terrain',
578            attrs={
579                'collision_mesh': self.preloaddata['collide_bg'],
580                'materials': [
581                    shared.footing_material,
582                    self.preloaddata['bg_material'],
583                    shared.death_material,
584                ],
585            },
586        )
587        self.railing = bs.newnode(
588            'terrain',
589            attrs={
590                'collision_mesh': self.preloaddata['railing_collision_mesh'],
591                'materials': [shared.railing_material],
592                'bumper': True,
593            },
594        )
595        gnode = bs.getactivity().globalsnode
596        gnode.tint = (1.1, 1.2, 1.2)
597        gnode.ambient_color = (1.2, 1.3, 1.3)
598        gnode.vignette_outer = (0.60, 0.62, 0.66)
599        gnode.vignette_inner = (0.97, 0.95, 0.93)
600        gnode.vr_camera_offset = (-1.4, 0, 0)

Map sorta shaped like a monkey face; teehee!

MonkeyFace()
536    def __init__(self) -> None:
537        super().__init__()
538        shared = SharedObjects.get()
539        self.node = bs.newnode(
540            'terrain',
541            delegate=self,
542            attrs={
543                'collision_mesh': self.preloaddata['collision_mesh'],
544                'mesh': self.preloaddata['mesh'],
545                'color_texture': self.preloaddata['tex'],
546                'materials': [shared.footing_material],
547            },
548        )
549        self.bottom = bs.newnode(
550            'terrain',
551            attrs={
552                'mesh': self.preloaddata['bottom_mesh'],
553                'lighting': False,
554                'color_texture': self.preloaddata['tex'],
555            },
556        )
557        self.background = bs.newnode(
558            'terrain',
559            attrs={
560                'mesh': self.preloaddata['mesh_bg'],
561                'lighting': False,
562                'background': True,
563                'color_texture': self.preloaddata['mesh_bg_tex'],
564            },
565        )
566        bs.newnode(
567            'terrain',
568            attrs={
569                'mesh': self.preloaddata['bg_vr_fill_mesh'],
570                'lighting': False,
571                'vr_only': True,
572                'background': True,
573                'color_texture': self.preloaddata['mesh_bg_tex'],
574            },
575        )
576        self.bg_collide = bs.newnode(
577            'terrain',
578            attrs={
579                'collision_mesh': self.preloaddata['collide_bg'],
580                'materials': [
581                    shared.footing_material,
582                    self.preloaddata['bg_material'],
583                    shared.death_material,
584                ],
585            },
586        )
587        self.railing = bs.newnode(
588            'terrain',
589            attrs={
590                'collision_mesh': self.preloaddata['railing_collision_mesh'],
591                'materials': [shared.railing_material],
592                'bumper': True,
593            },
594        )
595        gnode = bs.getactivity().globalsnode
596        gnode.tint = (1.1, 1.2, 1.2)
597        gnode.ambient_color = (1.2, 1.3, 1.3)
598        gnode.vignette_outer = (0.60, 0.62, 0.66)
599        gnode.vignette_inner = (0.97, 0.95, 0.93)
600        gnode.vr_camera_offset = (-1.4, 0, 0)

Instantiate a map.

name = 'Monkey Face'
@classmethod
def get_play_types(cls) -> list[str]:
506    @classmethod
507    def get_play_types(cls) -> list[str]:
508        """Return valid play types for this map."""
509        return ['melee', 'keep_away', 'team_flag']

Return valid play types for this map.

@classmethod
def get_preview_texture_name(cls) -> str:
511    @classmethod
512    def get_preview_texture_name(cls) -> str:
513        return 'monkeyFacePreview'

Return the name of the preview texture for this map.

@classmethod
def on_preload(cls) -> Any:
515    @classmethod
516    def on_preload(cls) -> Any:
517        data: dict[str, Any] = {
518            'mesh': bs.getmesh('monkeyFaceLevel'),
519            'bottom_mesh': bs.getmesh('monkeyFaceLevelBottom'),
520            'mesh_bg': bs.getmesh('natureBackground'),
521            'bg_vr_fill_mesh': bs.getmesh('natureBackgroundVRFill'),
522            'collision_mesh': bs.getcollisionmesh('monkeyFaceLevelCollide'),
523            'tex': bs.gettexture('monkeyFaceLevelColor'),
524            'mesh_bg_tex': bs.gettexture('natureBackgroundColor'),
525            'collide_bg': bs.getcollisionmesh('natureBackgroundCollide'),
526            'railing_collision_mesh': (
527                bs.getcollisionmesh('monkeyFaceLevelBumper')
528            ),
529            'bg_material': bs.Material(),
530        }
531        data['bg_material'].add_actions(
532            actions=('modify_part_collision', 'friction', 10.0)
533        )
534        return data

Called when the map is being preloaded.

It should return any media/data it requires to operate

node
bottom
background
bg_collide
railing
Inherited Members
bascenev1._map.Map
preload
getname
get_music_type
spawn_points
ffa_spawn_points
spawn_by_flag_points
flag_points
flag_points_default
powerup_spawn_points
tnt_points
is_hockey
is_flying
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
bascenev1._actor.Actor
autoretain
on_expire
expired
is_alive
activity
getactivity
class ZigZag(bascenev1._map.Map):
603class ZigZag(bs.Map):
604    """A very long zig-zaggy map"""
605
606    # noinspection PyUnresolvedReferences
607    from bascenev1lib.mapdata import zig_zag as defs
608
609    name = 'Zigzag'
610
611    @classmethod
612    def get_play_types(cls) -> list[str]:
613        """Return valid play types for this map."""
614        return [
615            'melee',
616            'keep_away',
617            'team_flag',
618            'conquest',
619            'king_of_the_hill',
620        ]
621
622    @classmethod
623    def get_preview_texture_name(cls) -> str:
624        return 'zigzagPreview'
625
626    @classmethod
627    def on_preload(cls) -> Any:
628        data: dict[str, Any] = {
629            'mesh': bs.getmesh('zigZagLevel'),
630            'mesh_bottom': bs.getmesh('zigZagLevelBottom'),
631            'mesh_bg': bs.getmesh('natureBackground'),
632            'bg_vr_fill_mesh': bs.getmesh('natureBackgroundVRFill'),
633            'collision_mesh': bs.getcollisionmesh('zigZagLevelCollide'),
634            'tex': bs.gettexture('zigZagLevelColor'),
635            'mesh_bg_tex': bs.gettexture('natureBackgroundColor'),
636            'collide_bg': bs.getcollisionmesh('natureBackgroundCollide'),
637            'railing_collision_mesh': bs.getcollisionmesh('zigZagLevelBumper'),
638            'bg_material': bs.Material(),
639        }
640        data['bg_material'].add_actions(
641            actions=('modify_part_collision', 'friction', 10.0)
642        )
643        return data
644
645    def __init__(self) -> None:
646        super().__init__()
647        shared = SharedObjects.get()
648        self.node = bs.newnode(
649            'terrain',
650            delegate=self,
651            attrs={
652                'collision_mesh': self.preloaddata['collision_mesh'],
653                'mesh': self.preloaddata['mesh'],
654                'color_texture': self.preloaddata['tex'],
655                'materials': [shared.footing_material],
656            },
657        )
658        self.background = bs.newnode(
659            'terrain',
660            attrs={
661                'mesh': self.preloaddata['mesh_bg'],
662                'lighting': False,
663                'color_texture': self.preloaddata['mesh_bg_tex'],
664            },
665        )
666        self.bottom = bs.newnode(
667            'terrain',
668            attrs={
669                'mesh': self.preloaddata['mesh_bottom'],
670                'lighting': False,
671                'color_texture': self.preloaddata['tex'],
672            },
673        )
674        bs.newnode(
675            'terrain',
676            attrs={
677                'mesh': self.preloaddata['bg_vr_fill_mesh'],
678                'lighting': False,
679                'vr_only': True,
680                'background': True,
681                'color_texture': self.preloaddata['mesh_bg_tex'],
682            },
683        )
684        self.bg_collide = bs.newnode(
685            'terrain',
686            attrs={
687                'collision_mesh': self.preloaddata['collide_bg'],
688                'materials': [
689                    shared.footing_material,
690                    self.preloaddata['bg_material'],
691                    shared.death_material,
692                ],
693            },
694        )
695        self.railing = bs.newnode(
696            'terrain',
697            attrs={
698                'collision_mesh': self.preloaddata['railing_collision_mesh'],
699                'materials': [shared.railing_material],
700                'bumper': True,
701            },
702        )
703        gnode = bs.getactivity().globalsnode
704        gnode.tint = (1.0, 1.15, 1.15)
705        gnode.ambient_color = (1.0, 1.15, 1.15)
706        gnode.vignette_outer = (0.57, 0.59, 0.63)
707        gnode.vignette_inner = (0.97, 0.95, 0.93)
708        gnode.vr_camera_offset = (-1.5, 0, 0)

A very long zig-zaggy map

ZigZag()
645    def __init__(self) -> None:
646        super().__init__()
647        shared = SharedObjects.get()
648        self.node = bs.newnode(
649            'terrain',
650            delegate=self,
651            attrs={
652                'collision_mesh': self.preloaddata['collision_mesh'],
653                'mesh': self.preloaddata['mesh'],
654                'color_texture': self.preloaddata['tex'],
655                'materials': [shared.footing_material],
656            },
657        )
658        self.background = bs.newnode(
659            'terrain',
660            attrs={
661                'mesh': self.preloaddata['mesh_bg'],
662                'lighting': False,
663                'color_texture': self.preloaddata['mesh_bg_tex'],
664            },
665        )
666        self.bottom = bs.newnode(
667            'terrain',
668            attrs={
669                'mesh': self.preloaddata['mesh_bottom'],
670                'lighting': False,
671                'color_texture': self.preloaddata['tex'],
672            },
673        )
674        bs.newnode(
675            'terrain',
676            attrs={
677                'mesh': self.preloaddata['bg_vr_fill_mesh'],
678                'lighting': False,
679                'vr_only': True,
680                'background': True,
681                'color_texture': self.preloaddata['mesh_bg_tex'],
682            },
683        )
684        self.bg_collide = bs.newnode(
685            'terrain',
686            attrs={
687                'collision_mesh': self.preloaddata['collide_bg'],
688                'materials': [
689                    shared.footing_material,
690                    self.preloaddata['bg_material'],
691                    shared.death_material,
692                ],
693            },
694        )
695        self.railing = bs.newnode(
696            'terrain',
697            attrs={
698                'collision_mesh': self.preloaddata['railing_collision_mesh'],
699                'materials': [shared.railing_material],
700                'bumper': True,
701            },
702        )
703        gnode = bs.getactivity().globalsnode
704        gnode.tint = (1.0, 1.15, 1.15)
705        gnode.ambient_color = (1.0, 1.15, 1.15)
706        gnode.vignette_outer = (0.57, 0.59, 0.63)
707        gnode.vignette_inner = (0.97, 0.95, 0.93)
708        gnode.vr_camera_offset = (-1.5, 0, 0)

Instantiate a map.

name = 'Zigzag'
@classmethod
def get_play_types(cls) -> list[str]:
611    @classmethod
612    def get_play_types(cls) -> list[str]:
613        """Return valid play types for this map."""
614        return [
615            'melee',
616            'keep_away',
617            'team_flag',
618            'conquest',
619            'king_of_the_hill',
620        ]

Return valid play types for this map.

@classmethod
def get_preview_texture_name(cls) -> str:
622    @classmethod
623    def get_preview_texture_name(cls) -> str:
624        return 'zigzagPreview'

Return the name of the preview texture for this map.

@classmethod
def on_preload(cls) -> Any:
626    @classmethod
627    def on_preload(cls) -> Any:
628        data: dict[str, Any] = {
629            'mesh': bs.getmesh('zigZagLevel'),
630            'mesh_bottom': bs.getmesh('zigZagLevelBottom'),
631            'mesh_bg': bs.getmesh('natureBackground'),
632            'bg_vr_fill_mesh': bs.getmesh('natureBackgroundVRFill'),
633            'collision_mesh': bs.getcollisionmesh('zigZagLevelCollide'),
634            'tex': bs.gettexture('zigZagLevelColor'),
635            'mesh_bg_tex': bs.gettexture('natureBackgroundColor'),
636            'collide_bg': bs.getcollisionmesh('natureBackgroundCollide'),
637            'railing_collision_mesh': bs.getcollisionmesh('zigZagLevelBumper'),
638            'bg_material': bs.Material(),
639        }
640        data['bg_material'].add_actions(
641            actions=('modify_part_collision', 'friction', 10.0)
642        )
643        return data

Called when the map is being preloaded.

It should return any media/data it requires to operate

node
background
bottom
bg_collide
railing
Inherited Members
bascenev1._map.Map
preload
getname
get_music_type
spawn_points
ffa_spawn_points
spawn_by_flag_points
flag_points
flag_points_default
powerup_spawn_points
tnt_points
is_hockey
is_flying
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
bascenev1._actor.Actor
autoretain
on_expire
expired
is_alive
activity
getactivity
class ThePad(bascenev1._map.Map):
711class ThePad(bs.Map):
712    """A simple square shaped map with a raised edge."""
713
714    # noinspection PyUnresolvedReferences
715    from bascenev1lib.mapdata import the_pad as defs
716
717    name = 'The Pad'
718
719    @classmethod
720    def get_play_types(cls) -> list[str]:
721        """Return valid play types for this map."""
722        return ['melee', 'keep_away', 'team_flag', 'king_of_the_hill']
723
724    @classmethod
725    def get_preview_texture_name(cls) -> str:
726        return 'thePadPreview'
727
728    @classmethod
729    def on_preload(cls) -> Any:
730        data: dict[str, Any] = {
731            'mesh': bs.getmesh('thePadLevel'),
732            'bottom_mesh': bs.getmesh('thePadLevelBottom'),
733            'collision_mesh': bs.getcollisionmesh('thePadLevelCollide'),
734            'tex': bs.gettexture('thePadLevelColor'),
735            'bgtex': bs.gettexture('menuBG'),
736            'bgmesh': bs.getmesh('thePadBG'),
737            'railing_collision_mesh': bs.getcollisionmesh('thePadLevelBumper'),
738            'vr_fill_mound_mesh': bs.getmesh('thePadVRFillMound'),
739            'vr_fill_mound_tex': bs.gettexture('vrFillMound'),
740        }
741        # fixme should chop this into vr/non-vr sections for efficiency
742        return data
743
744    def __init__(self) -> None:
745        super().__init__()
746        shared = SharedObjects.get()
747        self.node = bs.newnode(
748            'terrain',
749            delegate=self,
750            attrs={
751                'collision_mesh': self.preloaddata['collision_mesh'],
752                'mesh': self.preloaddata['mesh'],
753                'color_texture': self.preloaddata['tex'],
754                'materials': [shared.footing_material],
755            },
756        )
757        self.bottom = bs.newnode(
758            'terrain',
759            attrs={
760                'mesh': self.preloaddata['bottom_mesh'],
761                'lighting': False,
762                'color_texture': self.preloaddata['tex'],
763            },
764        )
765        self.background = bs.newnode(
766            'terrain',
767            attrs={
768                'mesh': self.preloaddata['bgmesh'],
769                'lighting': False,
770                'background': True,
771                'color_texture': self.preloaddata['bgtex'],
772            },
773        )
774        self.railing = bs.newnode(
775            'terrain',
776            attrs={
777                'collision_mesh': self.preloaddata['railing_collision_mesh'],
778                'materials': [shared.railing_material],
779                'bumper': True,
780            },
781        )
782        bs.newnode(
783            'terrain',
784            attrs={
785                'mesh': self.preloaddata['vr_fill_mound_mesh'],
786                'lighting': False,
787                'vr_only': True,
788                'color': (0.56, 0.55, 0.47),
789                'background': True,
790                'color_texture': self.preloaddata['vr_fill_mound_tex'],
791            },
792        )
793        gnode = bs.getactivity().globalsnode
794        gnode.tint = (1.1, 1.1, 1.0)
795        gnode.ambient_color = (1.1, 1.1, 1.0)
796        gnode.vignette_outer = (0.7, 0.65, 0.75)
797        gnode.vignette_inner = (0.95, 0.95, 0.93)

A simple square shaped map with a raised edge.

ThePad()
744    def __init__(self) -> None:
745        super().__init__()
746        shared = SharedObjects.get()
747        self.node = bs.newnode(
748            'terrain',
749            delegate=self,
750            attrs={
751                'collision_mesh': self.preloaddata['collision_mesh'],
752                'mesh': self.preloaddata['mesh'],
753                'color_texture': self.preloaddata['tex'],
754                'materials': [shared.footing_material],
755            },
756        )
757        self.bottom = bs.newnode(
758            'terrain',
759            attrs={
760                'mesh': self.preloaddata['bottom_mesh'],
761                'lighting': False,
762                'color_texture': self.preloaddata['tex'],
763            },
764        )
765        self.background = bs.newnode(
766            'terrain',
767            attrs={
768                'mesh': self.preloaddata['bgmesh'],
769                'lighting': False,
770                'background': True,
771                'color_texture': self.preloaddata['bgtex'],
772            },
773        )
774        self.railing = bs.newnode(
775            'terrain',
776            attrs={
777                'collision_mesh': self.preloaddata['railing_collision_mesh'],
778                'materials': [shared.railing_material],
779                'bumper': True,
780            },
781        )
782        bs.newnode(
783            'terrain',
784            attrs={
785                'mesh': self.preloaddata['vr_fill_mound_mesh'],
786                'lighting': False,
787                'vr_only': True,
788                'color': (0.56, 0.55, 0.47),
789                'background': True,
790                'color_texture': self.preloaddata['vr_fill_mound_tex'],
791            },
792        )
793        gnode = bs.getactivity().globalsnode
794        gnode.tint = (1.1, 1.1, 1.0)
795        gnode.ambient_color = (1.1, 1.1, 1.0)
796        gnode.vignette_outer = (0.7, 0.65, 0.75)
797        gnode.vignette_inner = (0.95, 0.95, 0.93)

Instantiate a map.

name = 'The Pad'
@classmethod
def get_play_types(cls) -> list[str]:
719    @classmethod
720    def get_play_types(cls) -> list[str]:
721        """Return valid play types for this map."""
722        return ['melee', 'keep_away', 'team_flag', 'king_of_the_hill']

Return valid play types for this map.

@classmethod
def get_preview_texture_name(cls) -> str:
724    @classmethod
725    def get_preview_texture_name(cls) -> str:
726        return 'thePadPreview'

Return the name of the preview texture for this map.

@classmethod
def on_preload(cls) -> Any:
728    @classmethod
729    def on_preload(cls) -> Any:
730        data: dict[str, Any] = {
731            'mesh': bs.getmesh('thePadLevel'),
732            'bottom_mesh': bs.getmesh('thePadLevelBottom'),
733            'collision_mesh': bs.getcollisionmesh('thePadLevelCollide'),
734            'tex': bs.gettexture('thePadLevelColor'),
735            'bgtex': bs.gettexture('menuBG'),
736            'bgmesh': bs.getmesh('thePadBG'),
737            'railing_collision_mesh': bs.getcollisionmesh('thePadLevelBumper'),
738            'vr_fill_mound_mesh': bs.getmesh('thePadVRFillMound'),
739            'vr_fill_mound_tex': bs.gettexture('vrFillMound'),
740        }
741        # fixme should chop this into vr/non-vr sections for efficiency
742        return data

Called when the map is being preloaded.

It should return any media/data it requires to operate

node
bottom
background
railing
Inherited Members
bascenev1._map.Map
preload
getname
get_music_type
spawn_points
ffa_spawn_points
spawn_by_flag_points
flag_points
flag_points_default
powerup_spawn_points
tnt_points
is_hockey
is_flying
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
bascenev1._actor.Actor
autoretain
on_expire
expired
is_alive
activity
getactivity
class DoomShroom(bascenev1._map.Map):
800class DoomShroom(bs.Map):
801    """A giant mushroom. Of doom!"""
802
803    # noinspection PyUnresolvedReferences
804    from bascenev1lib.mapdata import doom_shroom as defs
805
806    name = 'Doom Shroom'
807
808    @classmethod
809    def get_play_types(cls) -> list[str]:
810        """Return valid play types for this map."""
811        return ['melee', 'keep_away', 'team_flag']
812
813    @classmethod
814    def get_preview_texture_name(cls) -> str:
815        return 'doomShroomPreview'
816
817    @classmethod
818    def on_preload(cls) -> Any:
819        data: dict[str, Any] = {
820            'mesh': bs.getmesh('doomShroomLevel'),
821            'collision_mesh': bs.getcollisionmesh('doomShroomLevelCollide'),
822            'tex': bs.gettexture('doomShroomLevelColor'),
823            'bgtex': bs.gettexture('doomShroomBGColor'),
824            'bgmesh': bs.getmesh('doomShroomBG'),
825            'vr_fill_mesh': bs.getmesh('doomShroomVRFill'),
826            'stem_mesh': bs.getmesh('doomShroomStem'),
827            'collide_bg': bs.getcollisionmesh('doomShroomStemCollide'),
828        }
829        return data
830
831    def __init__(self) -> None:
832        super().__init__()
833        shared = SharedObjects.get()
834        self.node = bs.newnode(
835            'terrain',
836            delegate=self,
837            attrs={
838                'collision_mesh': self.preloaddata['collision_mesh'],
839                'mesh': self.preloaddata['mesh'],
840                'color_texture': self.preloaddata['tex'],
841                'materials': [shared.footing_material],
842            },
843        )
844        self.background = bs.newnode(
845            'terrain',
846            attrs={
847                'mesh': self.preloaddata['bgmesh'],
848                'lighting': False,
849                'background': True,
850                'color_texture': self.preloaddata['bgtex'],
851            },
852        )
853        bs.newnode(
854            'terrain',
855            attrs={
856                'mesh': self.preloaddata['vr_fill_mesh'],
857                'lighting': False,
858                'vr_only': True,
859                'background': True,
860                'color_texture': self.preloaddata['bgtex'],
861            },
862        )
863        self.stem = bs.newnode(
864            'terrain',
865            attrs={
866                'mesh': self.preloaddata['stem_mesh'],
867                'lighting': False,
868                'color_texture': self.preloaddata['tex'],
869            },
870        )
871        self.bg_collide = bs.newnode(
872            'terrain',
873            attrs={
874                'collision_mesh': self.preloaddata['collide_bg'],
875                'materials': [shared.footing_material, shared.death_material],
876            },
877        )
878        gnode = bs.getactivity().globalsnode
879        gnode.tint = (0.82, 1.10, 1.15)
880        gnode.ambient_color = (0.9, 1.3, 1.1)
881        gnode.shadow_ortho = False
882        gnode.vignette_outer = (0.76, 0.76, 0.76)
883        gnode.vignette_inner = (0.95, 0.95, 0.99)
884
885    def is_point_near_edge(self, point: bs.Vec3, running: bool = False) -> bool:
886        xpos = point.x
887        zpos = point.z
888        x_adj = xpos * 0.125
889        z_adj = (zpos + 3.7) * 0.2
890        if running:
891            x_adj *= 1.4
892            z_adj *= 1.4
893        return x_adj * x_adj + z_adj * z_adj > 1.0

A giant mushroom. Of doom!

DoomShroom()
831    def __init__(self) -> None:
832        super().__init__()
833        shared = SharedObjects.get()
834        self.node = bs.newnode(
835            'terrain',
836            delegate=self,
837            attrs={
838                'collision_mesh': self.preloaddata['collision_mesh'],
839                'mesh': self.preloaddata['mesh'],
840                'color_texture': self.preloaddata['tex'],
841                'materials': [shared.footing_material],
842            },
843        )
844        self.background = bs.newnode(
845            'terrain',
846            attrs={
847                'mesh': self.preloaddata['bgmesh'],
848                'lighting': False,
849                'background': True,
850                'color_texture': self.preloaddata['bgtex'],
851            },
852        )
853        bs.newnode(
854            'terrain',
855            attrs={
856                'mesh': self.preloaddata['vr_fill_mesh'],
857                'lighting': False,
858                'vr_only': True,
859                'background': True,
860                'color_texture': self.preloaddata['bgtex'],
861            },
862        )
863        self.stem = bs.newnode(
864            'terrain',
865            attrs={
866                'mesh': self.preloaddata['stem_mesh'],
867                'lighting': False,
868                'color_texture': self.preloaddata['tex'],
869            },
870        )
871        self.bg_collide = bs.newnode(
872            'terrain',
873            attrs={
874                'collision_mesh': self.preloaddata['collide_bg'],
875                'materials': [shared.footing_material, shared.death_material],
876            },
877        )
878        gnode = bs.getactivity().globalsnode
879        gnode.tint = (0.82, 1.10, 1.15)
880        gnode.ambient_color = (0.9, 1.3, 1.1)
881        gnode.shadow_ortho = False
882        gnode.vignette_outer = (0.76, 0.76, 0.76)
883        gnode.vignette_inner = (0.95, 0.95, 0.99)

Instantiate a map.

name = 'Doom Shroom'
@classmethod
def get_play_types(cls) -> list[str]:
808    @classmethod
809    def get_play_types(cls) -> list[str]:
810        """Return valid play types for this map."""
811        return ['melee', 'keep_away', 'team_flag']

Return valid play types for this map.

@classmethod
def get_preview_texture_name(cls) -> str:
813    @classmethod
814    def get_preview_texture_name(cls) -> str:
815        return 'doomShroomPreview'

Return the name of the preview texture for this map.

@classmethod
def on_preload(cls) -> Any:
817    @classmethod
818    def on_preload(cls) -> Any:
819        data: dict[str, Any] = {
820            'mesh': bs.getmesh('doomShroomLevel'),
821            'collision_mesh': bs.getcollisionmesh('doomShroomLevelCollide'),
822            'tex': bs.gettexture('doomShroomLevelColor'),
823            'bgtex': bs.gettexture('doomShroomBGColor'),
824            'bgmesh': bs.getmesh('doomShroomBG'),
825            'vr_fill_mesh': bs.getmesh('doomShroomVRFill'),
826            'stem_mesh': bs.getmesh('doomShroomStem'),
827            'collide_bg': bs.getcollisionmesh('doomShroomStemCollide'),
828        }
829        return data

Called when the map is being preloaded.

It should return any media/data it requires to operate

node
background
stem
bg_collide
def is_point_near_edge(self, point: _babase.Vec3, running: bool = False) -> bool:
885    def is_point_near_edge(self, point: bs.Vec3, running: bool = False) -> bool:
886        xpos = point.x
887        zpos = point.z
888        x_adj = xpos * 0.125
889        z_adj = (zpos + 3.7) * 0.2
890        if running:
891            x_adj *= 1.4
892            z_adj *= 1.4
893        return x_adj * x_adj + z_adj * z_adj > 1.0

Return whether the provided point is near an edge of the map.

Simple bot logic uses this call to determine if they are approaching a cliff or wall. If this returns True they will generally not walk/run any farther away from the origin. If 'running' is True, the buffer should be a bit larger.

Inherited Members
bascenev1._map.Map
preload
getname
get_music_type
spawn_points
ffa_spawn_points
spawn_by_flag_points
flag_points
flag_points_default
powerup_spawn_points
tnt_points
is_hockey
is_flying
get_def_bound_box
get_def_point
get_def_points
get_start_position
get_ffa_start_position
get_flag_position
exists
handlemessage
bascenev1._actor.Actor
autoretain
on_expire
expired
is_alive
activity
getactivity
class LakeFrigid(bascenev1._map.Map):
896class LakeFrigid(bs.Map):
897    """An icy lake fit for racing."""
898
899    # noinspection PyUnresolvedReferences
900    from bascenev1lib.mapdata import lake_frigid as defs
901
902    name = 'Lake Frigid'
903
904    @classmethod
905    def get_play_types(cls) -> list[str]:
906        """Return valid play types for this map."""
907        return ['melee', 'keep_away', 'team_flag', 'race']
908
909    @classmethod
910    def get_preview_texture_name(cls) -> str:
911        return 'lakeFrigidPreview'
912
913    @classmethod
914    def on_preload(cls) -> Any:
915        data: dict[str, Any] = {
916            'mesh': bs.getmesh('lakeFrigid'),
917            'mesh_top': bs.getmesh('lakeFrigidTop'),
918            'mesh_reflections': bs.getmesh('lakeFrigidReflections'),
919            'collision_mesh': bs.getcollisionmesh('lakeFrigidCollide'),
920            'tex': bs.gettexture('lakeFrigid'),
921            'tex_reflections': bs.gettexture('lakeFrigidReflections'),
922            'vr_fill_mesh': bs.getmesh('lakeFrigidVRFill'),
923        }
924        mat = bs.Material()
925        mat.add_actions(actions=('modify_part_collision', 'friction', 0.01))
926        data['ice_material'] = mat
927        return data
928
929    def __init__(self) -> None:
930        super().__init__()
931        shared = SharedObjects.get()
932        self.node = bs.newnode(
933            'terrain',
934            delegate=self,
935            attrs={
936                'collision_mesh': self.preloaddata['collision_mesh'],
937                'mesh': self.preloaddata['mesh'],
938                'color_texture': self.preloaddata['tex'],
939                'materials': [
940                    shared.footing_material,
941                    self.preloaddata['ice_material'],
942                ],
943            },
944        )
945        bs.newnode(
946            'terrain',
947            attrs={
948                'mesh': self.preloaddata['mesh_top'],
949                'lighting': False,
950                'color_texture': self.preloaddata['tex'],
951            },
952        )
953        bs.newnode(
954            'terrain',
955            attrs={
956                'mesh': self.preloaddata['mesh_reflections'],
957                'lighting': False,
958                'overlay': True,
959                'opacity': 0.15,
960                'color_texture': self.preloaddata['tex_reflections'],
961            },
962        )
963        bs.newnode(
964            'terrain',
965            attrs={
966                'mesh': self.preloaddata['vr_fill_mesh'],
967                'lighting': False,
968                'vr_only': True,
969                'background': True,
970                'color_texture': self.preloaddata['tex'],
971            },
972        )
973        gnode = bs.getactivity().globalsnode
974        gnode.tint = (1, 1, 1)
975        gnode.ambient_color = (1, 1, 1)
976        gnode.shadow_ortho = True
977        gnode.vignette_outer = (0.86, 0.86, 0.86)
978        gnode.vignette_inner = (0.95, 0.95, 0.99)
979        gnode.vr_near_clip = 0.5
980        self.is_hockey = True

An icy lake fit for racing.

LakeFrigid()
929    def __init__(self) -> None:
930        super().__init__()
931        shared = SharedObjects.get()
932        self.node = bs.newnode(
933            'terrain',
934            delegate=self,
935            attrs={
936                'collision_mesh': self.preloaddata['collision_mesh'],
937                'mesh': self.preloaddata['mesh'],
938                'color_texture': self.preloaddata['tex'],
939                'materials': [
940                    shared.footing_material,
941                    self.preloaddata['ice_material'],
942                ],
943            },
944        )
945        bs.newnode(
946            'terrain',
947            attrs={
948                'mesh': self.preloaddata['mesh_top'],
949                'lighting': False,
950                'color_texture': self.preloaddata['tex'],
951            },
952        )
953        bs.newnode(
954            'terrain',
955            attrs={
956                'mesh': self.preloaddata['mesh_reflections'],
957                'lighting': False,
958                'overlay': True,
959                'opacity': 0.15,
960                'color_texture': self.preloaddata['tex_reflections'],
961            },
962        )
963        bs.newnode(
964            'terrain',
965            attrs={
966                'mesh': self.preloaddata['vr_fill_mesh'],
967                'lighting': False,
968                'vr_only': True,
969                'background': True,
970                'color_texture': self.preloaddata['tex'],
971            },
972        )
973        gnode = bs.getactivity().globalsnode
974        gnode.tint = (1, 1, 1)
975        gnode.ambient_color = (1, 1, 1)
976        gnode.shadow_ortho = True
977        gnode.vignette_outer = (0.86, 0.86, 0.86)
978        gnode.vignette_inner = (0.95, 0.95, 0.99)
979        gnode.vr_near_clip = 0.5
980        self.is_hockey = True

Instantiate a map.

name = 'Lake Frigid'
@classmethod
def get_play_types(cls) -> list[str]:
904    @classmethod
905    def get_play_types(cls) -> list[str]:
906        """Return valid play types for this map."""
907        return ['melee', 'keep_away', 'team_flag', 'race']

Return valid play types for this map.

@classmethod
def get_preview_texture_name(cls) -> str:
909    @classmethod
910    def get_preview_texture_name(cls) -> str:
911        return 'lakeFrigidPreview'

Return the name of the preview texture for this map.

@classmethod
def on_preload(cls) -> Any:
913    @classmethod
914    def on_preload(cls) -> Any:
915        data: dict[str, Any] = {
916            'mesh': bs.getmesh('lakeFrigid'),
917            'mesh_top': bs.getmesh('lakeFrigidTop'),
918            'mesh_reflections': bs.getmesh('lakeFrigidReflections'),
919            'collision_mesh': bs.getcollisionmesh('lakeFrigidCollide'),
920            'tex': bs.gettexture('lakeFrigid'),
921            'tex_reflections': bs.gettexture('lakeFrigidReflections'),
922            'vr_fill_mesh': bs.getmesh('lakeFrigidVRFill'),
923        }
924        mat = bs.Material()
925        mat.add_actions(actions=('modify_part_collision', 'friction', 0.01))
926        data['ice_material'] = mat
927        return data

Called when the map is being preloaded.

It should return any media/data it requires to operate

node
is_hockey
Inherited Members
bascenev1._map.Map
preload
getname
get_music_type
spawn_points
ffa_spawn_points
spawn_by_flag_points
flag_points
flag_points_default
powerup_spawn_points
tnt_points
is_flying
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
bascenev1._actor.Actor
autoretain
on_expire
expired
is_alive
activity
getactivity
class TipTop(bascenev1._map.Map):
 983class TipTop(bs.Map):
 984    """A pointy map good for king-of-the-hill-ish games."""
 985
 986    # noinspection PyUnresolvedReferences
 987    from bascenev1lib.mapdata import tip_top as defs
 988
 989    name = 'Tip Top'
 990
 991    @classmethod
 992    def get_play_types(cls) -> list[str]:
 993        """Return valid play types for this map."""
 994        return ['melee', 'keep_away', 'team_flag', 'king_of_the_hill']
 995
 996    @classmethod
 997    def get_preview_texture_name(cls) -> str:
 998        return 'tipTopPreview'
 999
1000    @classmethod
1001    def on_preload(cls) -> Any:
1002        data: dict[str, Any] = {
1003            'mesh': bs.getmesh('tipTopLevel'),
1004            'bottom_mesh': bs.getmesh('tipTopLevelBottom'),
1005            'collision_mesh': bs.getcollisionmesh('tipTopLevelCollide'),
1006            'tex': bs.gettexture('tipTopLevelColor'),
1007            'bgtex': bs.gettexture('tipTopBGColor'),
1008            'bgmesh': bs.getmesh('tipTopBG'),
1009            'railing_collision_mesh': bs.getcollisionmesh('tipTopLevelBumper'),
1010        }
1011        return data
1012
1013    def __init__(self) -> None:
1014        super().__init__(vr_overlay_offset=(0, -0.2, 2.5))
1015        shared = SharedObjects.get()
1016        self.node = bs.newnode(
1017            'terrain',
1018            delegate=self,
1019            attrs={
1020                'collision_mesh': self.preloaddata['collision_mesh'],
1021                'mesh': self.preloaddata['mesh'],
1022                'color_texture': self.preloaddata['tex'],
1023                'color': (0.7, 0.7, 0.7),
1024                'materials': [shared.footing_material],
1025            },
1026        )
1027        self.bottom = bs.newnode(
1028            'terrain',
1029            attrs={
1030                'mesh': self.preloaddata['bottom_mesh'],
1031                'lighting': False,
1032                'color': (0.7, 0.7, 0.7),
1033                'color_texture': self.preloaddata['tex'],
1034            },
1035        )
1036        self.background = bs.newnode(
1037            'terrain',
1038            attrs={
1039                'mesh': self.preloaddata['bgmesh'],
1040                'lighting': False,
1041                'color': (0.4, 0.4, 0.4),
1042                'background': True,
1043                'color_texture': self.preloaddata['bgtex'],
1044            },
1045        )
1046        self.railing = bs.newnode(
1047            'terrain',
1048            attrs={
1049                'collision_mesh': self.preloaddata['railing_collision_mesh'],
1050                'materials': [shared.railing_material],
1051                'bumper': True,
1052            },
1053        )
1054        gnode = bs.getactivity().globalsnode
1055        gnode.tint = (0.8, 0.9, 1.3)
1056        gnode.ambient_color = (0.8, 0.9, 1.3)
1057        gnode.vignette_outer = (0.79, 0.79, 0.69)
1058        gnode.vignette_inner = (0.97, 0.97, 0.99)

A pointy map good for king-of-the-hill-ish games.

TipTop()
1013    def __init__(self) -> None:
1014        super().__init__(vr_overlay_offset=(0, -0.2, 2.5))
1015        shared = SharedObjects.get()
1016        self.node = bs.newnode(
1017            'terrain',
1018            delegate=self,
1019            attrs={
1020                'collision_mesh': self.preloaddata['collision_mesh'],
1021                'mesh': self.preloaddata['mesh'],
1022                'color_texture': self.preloaddata['tex'],
1023                'color': (0.7, 0.7, 0.7),
1024                'materials': [shared.footing_material],
1025            },
1026        )
1027        self.bottom = bs.newnode(
1028            'terrain',
1029            attrs={
1030                'mesh': self.preloaddata['bottom_mesh'],
1031                'lighting': False,
1032                'color': (0.7, 0.7, 0.7),
1033                'color_texture': self.preloaddata['tex'],
1034            },
1035        )
1036        self.background = bs.newnode(
1037            'terrain',
1038            attrs={
1039                'mesh': self.preloaddata['bgmesh'],
1040                'lighting': False,
1041                'color': (0.4, 0.4, 0.4),
1042                'background': True,
1043                'color_texture': self.preloaddata['bgtex'],
1044            },
1045        )
1046        self.railing = bs.newnode(
1047            'terrain',
1048            attrs={
1049                'collision_mesh': self.preloaddata['railing_collision_mesh'],
1050                'materials': [shared.railing_material],
1051                'bumper': True,
1052            },
1053        )
1054        gnode = bs.getactivity().globalsnode
1055        gnode.tint = (0.8, 0.9, 1.3)
1056        gnode.ambient_color = (0.8, 0.9, 1.3)
1057        gnode.vignette_outer = (0.79, 0.79, 0.69)
1058        gnode.vignette_inner = (0.97, 0.97, 0.99)

Instantiate a map.

name = 'Tip Top'
@classmethod
def get_play_types(cls) -> list[str]:
991    @classmethod
992    def get_play_types(cls) -> list[str]:
993        """Return valid play types for this map."""
994        return ['melee', 'keep_away', 'team_flag', 'king_of_the_hill']

Return valid play types for this map.

@classmethod
def get_preview_texture_name(cls) -> str:
996    @classmethod
997    def get_preview_texture_name(cls) -> str:
998        return 'tipTopPreview'

Return the name of the preview texture for this map.

@classmethod
def on_preload(cls) -> Any:
1000    @classmethod
1001    def on_preload(cls) -> Any:
1002        data: dict[str, Any] = {
1003            'mesh': bs.getmesh('tipTopLevel'),
1004            'bottom_mesh': bs.getmesh('tipTopLevelBottom'),