Rename & update memory_game.py for 1.7.37+ (API 9)

This commit is contained in:
! Freaku 2025-02-08 10:53:50 +05:30 committed by GitHub
parent 98b8133144
commit 4f23ee5fff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,32 +12,29 @@ from __future__ import annotations
# (& some improvements) # (& some improvements)
# incase someone is wondering how is map floating. Check out # incase someone is wondering how is map floating. Check out
# def spawnAllMap(self) # def spawnAllMap(self)
# ba_meta require api 9
# ba_meta require api 8
from typing import TYPE_CHECKING, overload from typing import TYPE_CHECKING, overload
import _babase, babase, random import _babase
import babase
import random
import bascenev1 as bs import bascenev1 as bs
from bascenev1lib.gameutils import SharedObjects from bascenev1lib.gameutils import SharedObjects
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any, Sequence, Optional, List, Dict, Type, Union, Any, Literal from typing import Any, Sequence, Optional, List, Dict, Type, Union, Any, Literal
class OnTimer(bs.Actor): class OnTimer(bs.Actor):
"""Timer which counts but doesn't show on-screen""" """Timer which counts but doesn't show on-screen"""
def __init__(self) -> None: def __init__(self) -> None:
super().__init__() super().__init__()
self._starttime_ms: int | None = None self._starttime_ms: int | None = None
self.node = bs.newnode('text', attrs={ 'v_attach': 'top', 'h_attach': 'center', 'h_align': 'center', 'color': (1, 1, 0.5, 1), 'flatness': 0.5, 'shadow': 0.5, 'position': (0, -70), 'scale': 0, 'text': ''}) self.node = bs.newnode('text', attrs={'v_attach': 'top', 'h_attach': 'center', 'h_align': 'center', 'color': (
1, 1, 0.5, 1), 'flatness': 0.5, 'shadow': 0.5, 'position': (0, -70), 'scale': 0, 'text': ''})
self.inputnode = bs.newnode( self.inputnode = bs.newnode(
'timedisplay', attrs={'timemin': 0, 'showsubseconds': True} 'timedisplay', attrs={'timemin': 0, 'showsubseconds': True}
) )
@ -101,8 +98,6 @@ class OnTimer(bs.Actor):
self.node.delete() self.node.delete()
class Player(bs.Player['Team']): class Player(bs.Player['Team']):
"""Our player type for this game.""" """Our player type for this game."""
@ -120,7 +115,8 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
name = 'Memory Game' name = 'Memory Game'
description = 'Memories tiles and survive till the end!' description = 'Memories tiles and survive till the end!'
available_settings = [bs.BoolSetting('Epic Mode', default=False), bs.BoolSetting('Enable Bottom Credits', True)] available_settings = [bs.BoolSetting(
'Epic Mode', default=False), bs.BoolSetting('Enable Bottom Credits', True)]
scoreconfig = bs.ScoreConfig(label='Survived', scoretype=bs.ScoreType.MILLISECONDS, version='B') scoreconfig = bs.ScoreConfig(label='Survived', scoretype=bs.ScoreType.MILLISECONDS, version='B')
# Print messages when players die (since its meaningful in this game). # Print messages when players die (since its meaningful in this game).
@ -152,9 +148,9 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
if self._epic_mode: if self._epic_mode:
self.slow_motion = True self.slow_motion = True
shared = SharedObjects.get() shared = SharedObjects.get()
self._collide_with_player=bs.Material() self._collide_with_player = bs.Material()
self._collide_with_player.add_actions(actions=(('modify_part_collision', 'collide', True))) self._collide_with_player.add_actions(actions=(('modify_part_collision', 'collide', True)))
self.dont_collide=bs.Material() self.dont_collide = bs.Material()
self.dont_collide.add_actions(actions=(('modify_part_collision', 'collide', False))) self.dont_collide.add_actions(actions=(('modify_part_collision', 'collide', False)))
self._levelStage = 0 self._levelStage = 0
@ -177,7 +173,7 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
self._mapFGSpaz = bs.gettexture('neoSpazIcon') self._mapFGSpaz = bs.gettexture('neoSpazIcon')
self._mapFGZoe = bs.gettexture('zoeIcon') self._mapFGZoe = bs.gettexture('zoeIcon')
self._mapFGSnake = bs.gettexture('ninjaIcon') self._mapFGSnake = bs.gettexture('ninjaIcon')
self._mapFGKronk= bs.gettexture('kronkIcon') self._mapFGKronk = bs.gettexture('kronkIcon')
self._mapFGMel = bs.gettexture('melIcon') self._mapFGMel = bs.gettexture('melIcon')
self._mapFGJack = bs.gettexture('jackIcon') self._mapFGJack = bs.gettexture('jackIcon')
self._mapFGSanta = bs.gettexture('santaIcon') self._mapFGSanta = bs.gettexture('santaIcon')
@ -195,59 +191,58 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
self._circleTex = bs.gettexture('circleShadow') self._circleTex = bs.gettexture('circleShadow')
self._image = bs.newnode('image', self._image = bs.newnode('image',
attrs={'texture': self._imageTextDefault, attrs={'texture': self._imageTextDefault,
'position':(0,-100), 'position': (0, -100),
'scale':(100,100), 'scale': (100, 100),
'opacity': 0.0, 'opacity': 0.0,
'attach':'topCenter'}) 'attach': 'topCenter'})
self._textCounter = bs.newnode('text', self._textCounter = bs.newnode('text',
attrs={'text': '10', attrs={'text': '10',
'position': (0, -100), 'position': (0, -100),
'scale': 2.3, 'scale': 2.3,
'shadow': 1.0, 'shadow': 1.0,
'flatness': 1.0, 'flatness': 1.0,
'opacity': 0.0, 'opacity': 0.0,
'v_attach': 'top', 'v_attach': 'top',
'h_attach': 'center', 'h_attach': 'center',
'h_align': 'center', 'h_align': 'center',
'v_align': 'center'}) 'v_align': 'center'})
self._textLevel = bs.newnode('text', self._textLevel = bs.newnode('text',
attrs={'text': 'Level ' + str(self._levelStage), attrs={'text': 'Level ' + str(self._levelStage),
'position': (0, -28), 'position': (0, -28),
'scale': 1.3, 'scale': 1.3,
'shadow': 1.0, 'shadow': 1.0,
'flatness': 1.0, 'flatness': 1.0,
'color': (1.0, 0.0, 1.0), 'color': (1.0, 0.0, 1.0),
'opacity': 0.0, 'opacity': 0.0,
'v_attach': 'top', 'v_attach': 'top',
'h_attach': 'center', 'h_attach': 'center',
'h_align': 'center', 'h_align': 'center',
'v_align': 'center'}) 'v_align': 'center'})
self._imageCircle = bs.newnode('image', self._imageCircle = bs.newnode('image',
attrs={'texture': self._circleTex, attrs={'texture': self._circleTex,
'position': (75, -75), 'position': (75, -75),
'scale': (20,20), 'scale': (20, 20),
'color': (0.2, 0.2, 0.2), 'color': (0.2, 0.2, 0.2),
'opacity': 0.0, 'opacity': 0.0,
'attach': 'topCenter'}) 'attach': 'topCenter'})
self._imageCircle2 = bs.newnode('image', self._imageCircle2 = bs.newnode('image',
attrs={'texture': self._circleTex, attrs={'texture': self._circleTex,
'position': (75, -100), 'position': (75, -100),
'scale': (20,20), 'scale': (20, 20),
'color': (0.2, 0.2, 0.2), 'color': (0.2, 0.2, 0.2),
'opacity': 0.0, 'opacity': 0.0,
'attach': 'topCenter'}) 'attach': 'topCenter'})
self._imageCircle3 = bs.newnode('image', self._imageCircle3 = bs.newnode('image',
attrs={'texture': self._circleTex, attrs={'texture': self._circleTex,
'position': (75, -125), 'position': (75, -125),
'scale': (20,20), 'scale': (20, 20),
'color': (0.2, 0.2, 0.2), 'color': (0.2, 0.2, 0.2),
'opacity': 0.0, 'opacity': 0.0,
'attach': 'topCenter'}) 'attach': 'topCenter'})
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
super().on_transition_in() super().on_transition_in()
@ -298,10 +293,18 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
self.coldel14 = True self.coldel14 = True
self.coldel15 = True self.coldel15 = True
self.coldel16 = True self.coldel16 = True
import base64 if self.credit_text:
exec(base64.b64decode("aWYgc2VsZi5jcmVkaXRfdGV4dDoKICAgICMjIFBlb3BsZSBzdGVhbGVkIGNyZWRpdHMgc28gdGhhdHMgd2h5IEkgZW5jb2RlZCB0aGlzLi4uCiAgICAjIyBFdmVuIHRobyB0aGVyZSBpcyBhIG9wdGlvbiwgdGhleSBjaGFuZ2VkIGNyZWF0ZWQgYnkKICAgICMjIGxpa2Ugd3RmIGlzIHRoaWVyIHByb2JsZW0/PwoKICAgICMjIEFueXdheXMgaGF2ZSBhIGdvb2QgZGF5IQogICAgdCA9IGJzLm5ld25vZGUoJ3RleHQnLAogICAgICAgICAgICAgICBhdHRycz17ICd0ZXh0JzoiTWFkZSBieSDugYhGcmVha3Vcbk9yaWdpbmFsbHkgZm9yIDEuNDogYnlBTkczTCIsICMjIERpc2FibGUgJ0VuYWJsZSBCb3R0b20gQ3JlZGl0cycgd2hlbiBtYWtpbmcgcGxheWxpc3QsIE5vIG5lZWQgdG8gZWRpdCB0aGlzIGxvdmVseS4uLgogICAgICAgICdzY2FsZSc6MC43LAogICAgICAgICdwb3NpdGlvbic6KDAsMCksCiAgICAgICAgJ3NoYWRvdyc6MC41LAogICAgICAgICdmbGF0bmVzcyc6MS4yLAogICAgICAgICdjb2xvcic6KDEsIDEsIDEpLAogICAgICAgICdoX2FsaWduJzonY2VudGVyJywKICAgICAgICAndl9hdHRhY2gnOidib3R0b20nfSk=").decode('UTF-8')) t = bs.newnode('text',
self.spawnAllMap() attrs={'text': "Made by Freaku\nOriginally for 1.4: byANG3L", # Disable 'Enable Bottom Credits' when making playlist, No need to edit this lovely...
self.flashHide() 'scale': 0.7,
'position': (0, 0),
'shadow': 0.5,
'flatness': 1.2,
'color': (1, 1, 1),
'h_align': 'center',
'v_attach': 'bottom'})
self.spawnAllMap()
self.flashHide()
# Check for immediate end (if we've only got 1 player, etc). # Check for immediate end (if we've only got 1 player, etc).
bs.timer(5, self._check_end_game) bs.timer(5, self._check_end_game)
@ -310,6 +313,7 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
def startCounter(self): def startCounter(self):
self._textCounter.text = '10' self._textCounter.text = '10'
def count9(): def count9():
def count8(): def count8():
def count7(): def count7():
@ -358,8 +362,8 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
if self.has_begun(): if self.has_begun():
bs.broadcastmessage( bs.broadcastmessage(
babase.Lstr(resource='playerDelayedJoinText', babase.Lstr(resource='playerDelayedJoinText',
subs=[('${PLAYER}', player.getname(full=True))]), subs=[('${PLAYER}', player.getname(full=True))]),
color=(0, 1, 0),transient=True,clients=[player.sessionplayer.inputdevice.client_id]) color=(0, 1, 0), transient=True, clients=[player.sessionplayer.inputdevice.client_id])
# For score purposes, mark them as having died right as the # For score purposes, mark them as having died right as the
# game started. # game started.
assert self._timer is not None assert self._timer is not None
@ -377,7 +381,8 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
# overriding the default character spawning.. # overriding the default character spawning..
def spawn_player(self, player: Player) -> bs.Actor: def spawn_player(self, player: Player) -> bs.Actor:
spaz = self.spawn_player_spaz(player) spaz = self.spawn_player_spaz(player)
pos = (self._spawnCenter[0] + random.uniform(-1.5, 2.5), self._spawnCenter[1], self._spawnCenter[2] + random.uniform(-2.5, 1.5)) pos = (self._spawnCenter[0] + random.uniform(-1.5, 2.5),
self._spawnCenter[1], self._spawnCenter[2] + random.uniform(-2.5, 1.5))
spaz.connect_controls_to_player(enable_punch=False, enable_bomb=False, enable_pickup=False) spaz.connect_controls_to_player(enable_punch=False, enable_bomb=False, enable_pickup=False)
spaz.handlemessage(bs.StandMessage(pos)) spaz.handlemessage(bs.StandMessage(pos))
return spaz return spaz
@ -385,49 +390,50 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
def _randomSelect(self): def _randomSelect(self):
if self._levelStage == 1: if self._levelStage == 1:
self._textureSelected = random.choice([self._mapFGMinesTex, self._textureSelected = random.choice([self._mapFGMinesTex,
self._mapFGStickyTex]) self._mapFGStickyTex])
self._image.texture = self._textureSelected self._image.texture = self._textureSelected
elif self._levelStage == 2: elif self._levelStage == 2:
self._textureSelected = random.choice([self._mapFGIceTex, self._textureSelected = random.choice([self._mapFGIceTex,
self._mapFGShieldTex]) self._mapFGShieldTex])
self._image.texture = self._textureSelected self._image.texture = self._textureSelected
elif self._levelStage in [3,4,5]: elif self._levelStage in [3, 4, 5]:
self._textureSelected = random.choice([self._mapFGStickyTex, self._textureSelected = random.choice([self._mapFGStickyTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGImpactTex, self._mapFGImpactTex,
self._mapFGMinesTex]) self._mapFGMinesTex])
self._image.texture = self._textureSelected self._image.texture = self._textureSelected
elif self._levelStage in [6,7,8,9]: elif self._levelStage in [6, 7, 8, 9]:
self._textureSelected = random.choice([self._mapFGCurseTex, self._textureSelected = random.choice([self._mapFGCurseTex,
self._mapFGHealthTex, self._mapFGHealthTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGImpactTex, self._mapFGImpactTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGPunchTex, self._mapFGPunchTex,
self._mapFGShieldTex]) self._mapFGShieldTex])
self._image.texture = self._textureSelected self._image.texture = self._textureSelected
elif self._levelStage >= 10: elif self._levelStage >= 10:
self._textureSelected = random.choice([self._mapFGSpaz, self._textureSelected = random.choice([self._mapFGSpaz,
self._mapFGZoe, self._mapFGZoe,
self._mapFGSnake, self._mapFGSnake,
self._mapFGKronk, self._mapFGKronk,
self._mapFGMel, self._mapFGMel,
self._mapFGJack, self._mapFGJack,
self._mapFGSanta, self._mapFGSanta,
self._mapFGFrosty, self._mapFGFrosty,
self._mapFGBones, self._mapFGBones,
self._mapFGBernard, self._mapFGBernard,
self._mapFGPascal, self._mapFGPascal,
self._mapFGAli, self._mapFGAli,
self._mapFGRobot, self._mapFGRobot,
self._mapFGAgent, self._mapFGAgent,
self._mapFGGrumbledorf, self._mapFGGrumbledorf,
self._mapFGPixel]) self._mapFGPixel])
self._image.texture = self._textureSelected self._image.texture = self._textureSelected
return self._textureSelected return self._textureSelected
def _stop(self): def _stop(self):
self._textureSelected = self._randomSelect() self._textureSelected = self._randomSelect()
def circle(): def circle():
def circle2(): def circle2():
def circle3(): def circle3():
@ -447,100 +453,100 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
def _randomPlatform(self): def _randomPlatform(self):
if self._levelStage == 1: if self._levelStage == 1:
randomTexture=[self._mapFGMinesTex, randomTexture = [self._mapFGMinesTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGStickyTex, self._mapFGStickyTex,
self._mapFGStickyTex, self._mapFGStickyTex,
self._mapFGStickyTex, self._mapFGStickyTex,
self._mapFGStickyTex, self._mapFGStickyTex,
self._mapFGStickyTex, self._mapFGStickyTex,
self._mapFGStickyTex, self._mapFGStickyTex,
self._mapFGStickyTex, self._mapFGStickyTex,
self._mapFGStickyTex] self._mapFGStickyTex]
elif self._levelStage == 2: elif self._levelStage == 2:
randomTexture=[self._mapFGIceTex, randomTexture = [self._mapFGIceTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGShieldTex, self._mapFGShieldTex,
self._mapFGShieldTex, self._mapFGShieldTex,
self._mapFGShieldTex, self._mapFGShieldTex,
self._mapFGShieldTex, self._mapFGShieldTex,
self._mapFGShieldTex, self._mapFGShieldTex,
self._mapFGShieldTex, self._mapFGShieldTex,
self._mapFGShieldTex, self._mapFGShieldTex,
self._mapFGShieldTex] self._mapFGShieldTex]
elif self._levelStage in [3,4,5]: elif self._levelStage in [3, 4, 5]:
randomTexture=[self._mapFGStickyTex, randomTexture = [self._mapFGStickyTex,
self._mapFGStickyTex, self._mapFGStickyTex,
self._mapFGStickyTex, self._mapFGStickyTex,
self._mapFGStickyTex, self._mapFGStickyTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGImpactTex, self._mapFGImpactTex,
self._mapFGImpactTex, self._mapFGImpactTex,
self._mapFGImpactTex, self._mapFGImpactTex,
self._mapFGImpactTex, self._mapFGImpactTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGMinesTex] self._mapFGMinesTex]
elif self._levelStage in [6,7,8,9]: elif self._levelStage in [6, 7, 8, 9]:
randomTexture=[self._mapFGHealthTex, randomTexture = [self._mapFGHealthTex,
self._mapFGShieldTex, self._mapFGShieldTex,
self._mapFGCurseTex, self._mapFGCurseTex,
self._mapFGCurseTex, self._mapFGCurseTex,
self._mapFGHealthTex, self._mapFGHealthTex,
self._mapFGHealthTex, self._mapFGHealthTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGImpactTex, self._mapFGImpactTex,
self._mapFGImpactTex, self._mapFGImpactTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGPunchTex, self._mapFGPunchTex,
self._mapFGPunchTex, self._mapFGPunchTex,
self._mapFGShieldTex, self._mapFGShieldTex,
self._mapFGShieldTex] self._mapFGShieldTex]
elif self._levelStage >= 10: elif self._levelStage >= 10:
randomTexture=[self._mapFGSpaz, randomTexture = [self._mapFGSpaz,
self._mapFGZoe, self._mapFGZoe,
self._mapFGSnake, self._mapFGSnake,
self._mapFGKronk, self._mapFGKronk,
self._mapFGMel, self._mapFGMel,
self._mapFGJack, self._mapFGJack,
self._mapFGSanta, self._mapFGSanta,
self._mapFGFrosty, self._mapFGFrosty,
self._mapFGBones, self._mapFGBones,
self._mapFGBernard, self._mapFGBernard,
self._mapFGPascal, self._mapFGPascal,
self._mapFGAli, self._mapFGAli,
self._mapFGRobot, self._mapFGRobot,
self._mapFGAgent, self._mapFGAgent,
self._mapFGGrumbledorf, self._mapFGGrumbledorf,
self._mapFGPixel] self._mapFGPixel]
(self.mapFGPTex, self.mapFGP2Tex, (self.mapFGPTex, self.mapFGP2Tex,
self.mapFGP3Tex, self.mapFGP4Tex, self.mapFGP3Tex, self.mapFGP4Tex,
self.mapFGP5Tex, self.mapFGP6Tex, self.mapFGP5Tex, self.mapFGP6Tex,
self.mapFGP7Tex, self.mapFGP8Tex, self.mapFGP7Tex, self.mapFGP8Tex,
self.mapFGP9Tex,self.mapFGP10Tex, self.mapFGP9Tex, self.mapFGP10Tex,
self.mapFGP11Tex, self.mapFGP12Tex, self.mapFGP11Tex, self.mapFGP12Tex,
self.mapFGP13Tex, self.mapFGP14Tex, self.mapFGP13Tex, self.mapFGP14Tex,
self.mapFGP15Tex, self.mapFGP16Tex) = ( self.mapFGP15Tex, self.mapFGP16Tex) = (
random.sample(randomTexture, 16)) random.sample(randomTexture, 16))
self._mixPlatform() self._mixPlatform()
def _mixPlatform(self): def _mixPlatform(self):
@ -677,114 +683,130 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
shared = SharedObjects.get() shared = SharedObjects.get()
if self.coldel: if self.coldel:
self.mapFGP = bs.newnode('prop', self.mapFGP = bs.newnode('prop',
attrs={'body': 'puck', 'position': (4.5,2,-9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (4.5, 2, -9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGPTex = None self.mapFGPTex = None
self.mapFGPcol = bs.newnode('region',attrs={'position': (4.5,2,-9),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGPcol = bs.newnode('region', attrs={'position': (4.5, 2, -9), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel = False self.coldel = False
if self.coldel2: if self.coldel2:
self.mapFGP2 = bs.newnode('prop', self.mapFGP2 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (4.5,2,-6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (4.5, 2, -6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP2Tex = None self.mapFGP2Tex = None
self.mapFGP2col = bs.newnode('region',attrs={'position': (4.5,2,-6),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP2col = bs.newnode('region', attrs={'position': (4.5, 2, -6), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel2 = False self.coldel2 = False
if self.coldel3: if self.coldel3:
self.mapFGP3 = bs.newnode('prop', self.mapFGP3 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (4.5,2,-3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (4.5, 2, -3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP3Tex = None self.mapFGP3Tex = None
self.mapFGP3col = bs.newnode('region',attrs={'position': (4.5,2,-3),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP3col = bs.newnode('region', attrs={'position': (4.5, 2, -3), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel3 = False self.coldel3 = False
if self.coldel4: if self.coldel4:
self.mapFGP4 = bs.newnode('prop', self.mapFGP4 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (4.5,2,0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (4.5, 2, 0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP4Tex = None self.mapFGP4Tex = None
self.mapFGP4col = bs.newnode('region',attrs={'position': (4.5,2,0),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP4col = bs.newnode('region', attrs={'position': (4.5, 2, 0), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel4 = False self.coldel4 = False
if self.coldel5: if self.coldel5:
self.mapFGP5 = bs.newnode('prop', self.mapFGP5 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (1.5,2,-9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (1.5, 2, -9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP5Tex = None self.mapFGP5Tex = None
self.mapFGP5col = bs.newnode('region',attrs={'position': (1.5,2,-9),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP5col = bs.newnode('region', attrs={'position': (1.5, 2, -9), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel5 = False self.coldel5 = False
if self.coldel6: if self.coldel6:
self.mapFGP6 = bs.newnode('prop', self.mapFGP6 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (1.5,2,-6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (1.5, 2, -6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP6Tex = None self.mapFGP6Tex = None
self.mapFGP6col = bs.newnode('region',attrs={'position': (1.5,2,-6),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP6col = bs.newnode('region', attrs={'position': (1.5, 2, -6), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel6 = False self.coldel6 = False
if self.coldel7: if self.coldel7:
self.mapFGP7 = bs.newnode('prop', self.mapFGP7 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (1.5,2,-3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (1.5, 2, -3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP7Tex = None self.mapFGP7Tex = None
self.mapFGP7col = bs.newnode('region',attrs={'position': (1.5,2,-3),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP7col = bs.newnode('region', attrs={'position': (1.5, 2, -3), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel7 = False self.coldel7 = False
if self.coldel8: if self.coldel8:
self.mapFGP8 = bs.newnode('prop', self.mapFGP8 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (1.5,2,0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (1.5, 2, 0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP8Tex = None self.mapFGP8Tex = None
self.mapFGP8col = bs.newnode('region',attrs={'position': (1.5,2,0),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP8col = bs.newnode('region', attrs={'position': (1.5, 2, 0), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel8 = False self.coldel8 = False
if self.coldel9: if self.coldel9:
self.mapFGP9 = bs.newnode('prop', self.mapFGP9 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-1.5,2,-9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-1.5, 2, -9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP9Tex = None self.mapFGP9Tex = None
self.mapFGP9col = bs.newnode('region',attrs={'position': (-1.5,2,-9),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP9col = bs.newnode('region', attrs={'position': (-1.5, 2, -9), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel9 = False self.coldel9 = False
if self.coldel10: if self.coldel10:
self.mapFGP10 = bs.newnode('prop', self.mapFGP10 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-1.5,2,-6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-1.5, 2, -6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP10Tex = None self.mapFGP10Tex = None
self.mapFGP10col = bs.newnode('region',attrs={'position': (-1.5,2,-6),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP10col = bs.newnode('region', attrs={'position': (-1.5, 2, -6), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel10 = False self.coldel10 = False
if self.coldel11: if self.coldel11:
self.mapFGP11 = bs.newnode('prop', self.mapFGP11 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-1.5,2,-3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-1.5, 2, -3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP11Tex = None self.mapFGP11Tex = None
self.mapFGP11col = bs.newnode('region',attrs={'position': (-1.5,2,-3),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP11col = bs.newnode('region', attrs={'position': (-1.5, 2, -3), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel11 = False self.coldel11 = False
if self.coldel12: if self.coldel12:
self.mapFGP12 = bs.newnode('prop', self.mapFGP12 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-1.5,2,0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-1.5, 2, 0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP12Tex = None self.mapFGP12Tex = None
self.mapFGP12col = bs.newnode('region',attrs={'position': (-1.5,2,0),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP12col = bs.newnode('region', attrs={'position': (-1.5, 2, 0), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel12 = False self.coldel12 = False
if self.coldel13: if self.coldel13:
self.mapFGP13 = bs.newnode('prop', self.mapFGP13 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-4.5,2,-9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-4.5, 2, -9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP13Tex = None self.mapFGP13Tex = None
self.mapFGP13col = bs.newnode('region',attrs={'position': (-4.5,2,-9),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP13col = bs.newnode('region', attrs={'position': (-4.5, 2, -9), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel13 = False self.coldel13 = False
if self.coldel14: if self.coldel14:
self.mapFGP14 = bs.newnode('prop', self.mapFGP14 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-4.5,2,-6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-4.5, 2, -6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP14Tex = None self.mapFGP14Tex = None
self.mapFGP14col = bs.newnode('region',attrs={'position': (-4.5,2,-6),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP14col = bs.newnode('region', attrs={'position': (-4.5, 2, -6), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel14 = False self.coldel14 = False
if self.coldel15: if self.coldel15:
self.mapFGP15 = bs.newnode('prop', self.mapFGP15 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-4.5,2,-3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-4.5, 2, -3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP15Tex = None self.mapFGP15Tex = None
self.mapFGP15col = bs.newnode('region',attrs={'position': (-4.5,2,-3),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP15col = bs.newnode('region', attrs={'position': (-4.5, 2, -3), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel15 = False self.coldel15 = False
if self.coldel16: if self.coldel16:
self.mapFGP16 = bs.newnode('prop', self.mapFGP16 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-4.5,2,0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-4.5, 2, 0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP16Tex = None self.mapFGP16Tex = None
self.mapFGP16col = bs.newnode('region',attrs={'position': (-4.5,2,0),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP16col = bs.newnode('region', attrs={'position': (-4.5, 2, 0), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel16 = False self.coldel16 = False
def _platformTexDefault(self): def _platformTexDefault(self):
@ -868,7 +890,6 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
if living_team_count <= 1: if living_team_count <= 1:
self.end_game() self.end_game()
def end_game(self) -> None: def end_game(self) -> None:
cur_time = bs.time() cur_time = bs.time()
assert self._timer is not None assert self._timer is not None
@ -921,18 +942,14 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
self.end(results=results) self.end(results=results)
class MGdefs(): class MGdefs():
points = {} points = {}
boxes = {} boxes = {}
boxes['area_of_interest_bounds'] = (0.3544110667, 4.493562578, -2.518391331) + (0.0, 0.0, 0.0) + (16.64754831, 8.06138989, 18.5029888) boxes['area_of_interest_bounds'] = (
boxes['map_bounds'] = (0.2608783669, 4.899663734, -3.543675157) + (0.0, 0.0, 0.0) + (29.23565494, 14.19991443, 29.92689344) 0.3544110667, 4.493562578, -2.518391331) + (0.0, 0.0, 0.0) + (16.64754831, 8.06138989, 18.5029888)
boxes['map_bounds'] = (0.2608783669, 4.899663734, -3.543675157) + \
(0.0, 0.0, 0.0) + (29.23565494, 14.19991443, 29.92689344)
class MGmap(bs.Map): class MGmap(bs.Map):
defs = MGdefs() defs = MGdefs()
@ -975,16 +992,12 @@ class MGmap(bs.Map):
gnode.vr_near_clip = 0.5 gnode.vr_near_clip = 0.5
bs._map.register_map(MGmap) bs._map.register_map(MGmap)
# ba_meta export plugin # ba_meta export plugin
class byFreaku(babase.Plugin): class byFreaku(babase.Plugin):
def __init__(self): def __init__(self):
## Campaign support ## ## Campaign support ##
babase.app.classic.add_coop_practice_level(bs.Level(name='Memory Game', displayname='${GAME}', gametype=MGgame, settings={}, preview_texture_name='achievementOffYouGo')) babase.app.classic.add_coop_practice_level(bs.Level(
name='Memory Game', displayname='${GAME}', gametype=MGgame, settings={}, preview_texture_name='achievementOffYouGo'))