Update ALL GAMEMODE for 1.7.20+

(except Musical Flags)
This commit is contained in:
! Freaku 2023-07-27 18:22:40 +05:30 committed by GitHub
parent 1990fc5c7e
commit 07d6968898
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 402 additions and 395 deletions

View file

@ -1,18 +1,19 @@
#Ported by: Freaku / @[Just] Freak#4999
# Ported by your friend: Freaku
#Join BCS:
# https://discord.gg/ucyaesh
# ba_meta require api 7
# ba_meta require api 8
from __future__ import annotations
from typing import TYPE_CHECKING
import ba
from bastd.actor.playerspaz import PlayerSpaz
import babase
import bascenev1 as bs
from bascenev1lib.actor.playerspaz import PlayerSpaz
if TYPE_CHECKING:
from typing import Any, Type, List, Dict, Tuple, Union, Sequence, Optional
@ -56,21 +57,21 @@ states = [ State(bomb='normal', name='Basic Bombs'),
State(punch=True, name='Punching only'),
State(curse=True, name='Cursed', final=True) ]
class Player(ba.Player['Team']):
class Player(bs.Player['Team']):
"""Our player type for this game."""
def __init__(self):
self.state = None
class Team(ba.Team[Player]):
class Team(bs.Team[Player]):
"""Our team type for this game."""
def __init__(self) -> None:
self.score = 0
# ba_meta export game
class ArmsRaceGame(ba.TeamGameActivity[Player, Team]):
# ba_meta export bascenev1.GameActivity
class ArmsRaceGame(bs.TeamGameActivity[Player, Team]):
"""A game type based on acquiring kills."""
name = 'Arms Race'
@ -81,9 +82,9 @@ class ArmsRaceGame(ba.TeamGameActivity[Player, Team]):
@classmethod
def get_available_settings(
cls, sessiontype: Type[ba.Session]) -> List[ba.Setting]:
cls, sessiontype: Type[bs.Session]) -> List[babase.Setting]:
settings = [
ba.IntChoiceSetting(
bs.IntChoiceSetting(
'Time Limit',
choices=[
('None', 0),
@ -95,7 +96,7 @@ class ArmsRaceGame(ba.TeamGameActivity[Player, Team]):
],
default=0,
),
ba.FloatChoiceSetting(
bs.FloatChoiceSetting(
'Respawn Times',
choices=[
('Shorter', 0.25),
@ -106,21 +107,21 @@ class ArmsRaceGame(ba.TeamGameActivity[Player, Team]):
],
default=1.0,
),
ba.BoolSetting('Epic Mode', default=False)]
bs.BoolSetting('Epic Mode', default=False)]
for state in states:
if not state.required:
settings.append(ba.BoolSetting(state.get_setting(), default=True))
settings.append(bs.BoolSetting(state.get_setting(), default=True))
return settings
@classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
return (issubclass(sessiontype, ba.DualTeamSession)
or issubclass(sessiontype, ba.FreeForAllSession))
def supports_session_type(cls, sessiontype: Type[bs.Session]) -> bool:
return (issubclass(sessiontype, bs.DualTeamSession)
or issubclass(sessiontype, bs.FreeForAllSession))
@classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('melee')
def get_supported_maps(cls, sessiontype: Type[bs.Session]) -> List[str]:
return bs.app.classic.getmaps('melee')
def __init__(self, settings: dict):
super().__init__(settings)
@ -129,14 +130,14 @@ class ArmsRaceGame(ba.TeamGameActivity[Player, Team]):
if i < len(self.states) and not state.final:
state.next = self.states[i + 1]
state.index = i
self._dingsound = ba.getsound('dingSmall')
self._dingsound = bs.getsound('dingSmall')
self._epic_mode = bool(settings['Epic Mode'])
self._time_limit = float(settings['Time Limit'])
# Base class overrides.
self.slow_motion = self._epic_mode
self.default_music = (ba.MusicType.EPIC if self._epic_mode else
ba.MusicType.TO_THE_DEATH)
self.default_music = (bs.MusicType.EPIC if self._epic_mode else
bs.MusicType.TO_THE_DEATH)
def get_instance_description(self) -> Union[str, Sequence]:
return 'Upgrade your weapon by eliminating enemies.'
@ -172,7 +173,7 @@ class ArmsRaceGame(ba.TeamGameActivity[Player, Team]):
def handlemessage(self, msg: Any) -> Any:
if isinstance(msg, ba.PlayerDiedMessage):
if isinstance(msg, bs.PlayerDiedMessage):
if self.isValidKill(msg):
self.stats.player_scored(msg.getkillerplayer(Player), 10, kill=True)
if not msg.getkillerplayer(Player).state.final:
@ -188,7 +189,7 @@ class ArmsRaceGame(ba.TeamGameActivity[Player, Team]):
return None
def end_game(self) -> None:
results = ba.GameResults()
results = bs.GameResults()
for team in self.teams:
results.set_team_score(team, team.score)
self.end(results=results)
self.end(results=results)

View file

@ -1,13 +1,13 @@
#Frozen One ported
#By your friend: @[Just] Freak#4999
# Ported by your friend: Freaku
import ba
from bastd.game.chosenone import Player, ChosenOneGame
import babase
import bascenev1 as bs
from bascenev1lib.game.chosenone import Player, ChosenOneGame
# ba_meta require api 7
# ba_meta export game
# ba_meta require api 8
# ba_meta export bascenev1.GameActivity
class FrozenOneGame(ChosenOneGame):
name = 'Frozen One'
@ -15,4 +15,4 @@ class FrozenOneGame(ChosenOneGame):
super()._set_chosen_one_player(player)
if hasattr(player, 'actor'):
player.actor.frozen = True
player.actor.node.frozen = 1
player.actor.node.frozen = 1

View file

@ -1,13 +1,14 @@
#Made by your friend: Freaku / @[Just] Freak#4999
# Made by your friend: Freaku
import ba, random
from bastd.actor.bomb import Bomb
from bastd.game.meteorshower import Player, MeteorShowerGame
import babase
import bascenev1 as bs, random
from bascenev1lib.actor.bomb import Bomb
from bascenev1lib.game.meteorshower import Player, MeteorShowerGame
# ba_meta require api 7
# ba_meta export game
# ba_meta require api 8
# ba_meta export bascenev1.GameActivity
class IcyEmitsGame(MeteorShowerGame):
name = 'Icy Emits'
@ -24,7 +25,7 @@ class IcyEmitsGame(MeteorShowerGame):
-5.5 + 2.1 * random.random())
dropdir = (-1.0 if pos[0] > 0 else 1.0)
vel = (0,10,0)
ba.timer(delay, ba.Call(self._drop_bomb, pos, vel))
bs.timer(delay, babase.Call(self._drop_bomb, pos, vel))
delay += 0.1
self._set_meteor_timer()
@ -38,8 +39,8 @@ class IcyEmitsGame(MeteorShowerGame):
# ba_meta export plugin
class byFreaku(ba.Plugin):
class byFreaku(babase.Plugin):
def __init__(self):
## Campaign support ##
randomPic = ['lakeFrigidPreview','hockeyStadiumPreview']
ba.app.add_coop_practice_level(ba.Level(name='Icy Emits', displayname='${GAME}', gametype=IcyEmitsGame, settings={}, preview_texture_name=random.choice(randomPic)))
babase.app.classic.add_coop_practice_level(bs.Level(name='Icy Emits', displayname='${GAME}', gametype=IcyEmitsGame, settings={}, preview_texture_name=random.choice(randomPic)))

View file

@ -2,7 +2,7 @@ from __future__ import annotations
## Original creator: byANG3L ##
## Made by: Freaku / @[Just] Freak#4999 ##
## Made by: Freaku ##
## From: BSWorld Modpack (https://youtu.be/1TN56NLlShE) ##
@ -21,64 +21,61 @@ from __future__ import annotations
# ba_meta require api 7
# ba_meta require api 8
from typing import TYPE_CHECKING, overload
import _ba,ba,random
from bastd.gameutils import SharedObjects
import _babase, babase, random
import bascenev1 as bs
from bascenev1lib.gameutils import SharedObjects
if TYPE_CHECKING:
from typing import Any, Sequence, Optional, List, Dict, Type, Union, Any, Literal
class OnTimer(ba.Actor):
class OnTimer(bs.Actor):
"""Timer which counts but doesn't show on-screen"""
def __init__(self) -> None:
super().__init__()
self._starttime_ms: Optional[int] = None
self.node = ba.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 = ba.newnode('timedisplay', attrs={ 'timemin': 0, 'showsubseconds': True })
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.inputnode = bs.newnode(
'timedisplay', attrs={'timemin': 0, 'showsubseconds': True}
)
self.inputnode.connectattr('output', self.node, 'text')
def start(self) -> None:
tval = ba.time(timeformat=ba.TimeFormat.MILLISECONDS)
"""Start the timer."""
tval = int(bs.time() * 1000.0)
assert isinstance(tval, int)
self._starttime_ms = tval
self.inputnode.time1 = self._starttime_ms
ba.getactivity().globalsnode.connectattr('time', self.inputnode, 'time2')
def has_started(self) -> bool:
return self._starttime_ms is not None
def stop(self,
endtime: Union[int, float] = None,
timeformat: ba.TimeFormat = ba.TimeFormat.SECONDS) -> None:
if endtime is None:
endtime = ba.time(timeformat=ba.TimeFormat.MILLISECONDS)
timeformat = ba.TimeFormat.MILLISECONDS
if self._starttime_ms is None:
print('Warning: OnTimer.stop() called without start() first')
else:
endtime_ms: int
if timeformat is ba.TimeFormat.SECONDS:
endtime_ms = int(endtime * 1000)
elif timeformat is ba.TimeFormat.MILLISECONDS:
assert isinstance(endtime, int)
endtime_ms = endtime
else:
raise ValueError(f'invalid timeformat: {timeformat}')
bs.getactivity().globalsnode.connectattr(
'time', self.inputnode, 'time2'
)
def has_started(self) -> bool:
"""Return whether this timer has started yet."""
return self._starttime_ms is not None
def stop(self, endtime: int | float | None = None) -> None:
"""End the timer.
If 'endtime' is not None, it is used when calculating
the final display time; otherwise the current time is used.
"""
if endtime is None:
endtime = bs.time()
if self._starttime_ms is None:
logging.warning(
'OnScreenTimer.stop() called without first calling start()'
)
else:
endtime_ms = int(endtime * 1000)
self.inputnode.timemax = endtime_ms - self._starttime_ms
# Overloads so type checker knows our exact return type based in args.
@overload
def getstarttime(self, timeformat: Literal[ba.TimeFormat.SECONDS] = ba.TimeFormat.SECONDS) -> float:
...
@overload
def getstarttime(self,
timeformat: Literal[ba.TimeFormat.MILLISECONDS]) -> int:
...
def getstarttime(
self,
timeformat: ba.TimeFormat = ba.TimeFormat.SECONDS
) -> Union[int, float]:
"""Return the sim-time when start() was called.
def getstarttime(self) -> float:
"""Return the scene-time when start() was called.
Time will be returned in seconds if timeformat is SECONDS or
milliseconds if it is MILLISECONDS.
@ -86,15 +83,11 @@ class OnTimer(ba.Actor):
val_ms: Any
if self._starttime_ms is None:
print('WARNING: getstarttime() called on un-started timer')
val_ms = ba.time(timeformat=ba.TimeFormat.MILLISECONDS)
val_ms = int(bs.time() * 1000.0)
else:
val_ms = self._starttime_ms
assert isinstance(val_ms, int)
if timeformat is ba.TimeFormat.SECONDS:
return 0.001 * val_ms
if timeformat is ba.TimeFormat.MILLISECONDS:
return val_ms
raise ValueError(f'invalid timeformat: {timeformat}')
return 0.001 * val_ms
@property
def starttime(self) -> float:
@ -103,14 +96,14 @@ class OnTimer(ba.Actor):
def handlemessage(self, msg: Any) -> Any:
# if we're asked to die, just kill our node/timer
if isinstance(msg, ba.DieMessage):
if isinstance(msg, bs.DieMessage):
if self.node:
self.node.delete()
class Player(ba.Player['Team']):
class Player(bs.Player['Team']):
"""Our player type for this game."""
def __init__(self) -> None:
@ -118,32 +111,32 @@ class Player(ba.Player['Team']):
self.death_time: Optional[float] = None
class Team(ba.Team[Player]):
class Team(bs.Team[Player]):
"""Our team type for this game."""
# ba_meta export game
class MGgame(ba.TeamGameActivity[Player, Team]):
# ba_meta export bascenev1.GameActivity
class MGgame(bs.TeamGameActivity[Player, Team]):
name = 'Memory Game'
description = 'Memories tiles and survive till the end!'
available_settings = [ba.BoolSetting('Epic Mode', default=False), ba.BoolSetting('Enable Bottom Credits', True)]
scoreconfig = ba.ScoreConfig(label='Survived', scoretype=ba.ScoreType.MILLISECONDS, version='B')
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')
# Print messages when players die (since its meaningful in this game).
announce_player_deaths = True
# we're currently hard-coded for one map..
@classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
def get_supported_maps(cls, sessiontype: Type[bs.Session]) -> List[str]:
return ['Sky Tiles']
# We support teams, free-for-all, and co-op sessions.
@classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
return (issubclass(sessiontype, ba.DualTeamSession)
or issubclass(sessiontype, ba.FreeForAllSession)
or issubclass(sessiontype, ba.CoopSession))
def supports_session_type(cls, sessiontype: Type[bs.Session]) -> bool:
return (issubclass(sessiontype, bs.DualTeamSession)
or issubclass(sessiontype, bs.FreeForAllSession)
or issubclass(sessiontype, babase.CoopSession))
def __init__(self, settings: dict):
super().__init__(settings)
@ -154,14 +147,14 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self.credit_text = bool(settings['Enable Bottom Credits'])
# Some base class overrides:
self.default_music = (ba.MusicType.EPIC
if self._epic_mode else ba.MusicType.SURVIVAL)
self.default_music = (bs.MusicType.EPIC
if self._epic_mode else bs.MusicType.SURVIVAL)
if self._epic_mode:
self.slow_motion = True
shared = SharedObjects.get()
self._collide_with_player=ba.Material()
self._collide_with_player=bs.Material()
self._collide_with_player.add_actions(actions=(('modify_part_collision', 'collide', True)))
self.dont_collide=ba.Material()
self.dont_collide=bs.Material()
self.dont_collide.add_actions(actions=(('modify_part_collision', 'collide', False)))
self._levelStage = 0
@ -169,46 +162,46 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self._lastPlayerDeathTime = None
self._spawnCenter = (-3.17358, 2.75764, -2.99124)
self._mapFGPModel = ba.getmodel('buttonSquareOpaque')
self._mapFGPDefaultTex = ba.gettexture('achievementOffYouGo')
self._mapFGPModel = bs.getmesh('buttonSquareOpaque')
self._mapFGPDefaultTex = bs.gettexture('achievementOffYouGo')
self._mapFGCurseTex = ba.gettexture('powerupCurse')
self._mapFGHealthTex = ba.gettexture('powerupHealth')
self._mapFGIceTex = ba.gettexture('powerupIceBombs')
self._mapFGImpactTex = ba.gettexture('powerupImpactBombs')
self._mapFGMinesTex = ba.gettexture('powerupLandMines')
self._mapFGPunchTex = ba.gettexture('powerupPunch')
self._mapFGShieldTex = ba.gettexture('powerupShield')
self._mapFGStickyTex = ba.gettexture('powerupStickyBombs')
self._mapFGCurseTex = bs.gettexture('powerupCurse')
self._mapFGHealthTex = bs.gettexture('powerupHealth')
self._mapFGIceTex = bs.gettexture('powerupIceBombs')
self._mapFGImpactTex = bs.gettexture('powerupImpactBombs')
self._mapFGMinesTex = bs.gettexture('powerupLandMines')
self._mapFGPunchTex = bs.gettexture('powerupPunch')
self._mapFGShieldTex = bs.gettexture('powerupShield')
self._mapFGStickyTex = bs.gettexture('powerupStickyBombs')
self._mapFGSpaz = ba.gettexture('neoSpazIcon')
self._mapFGZoe = ba.gettexture('zoeIcon')
self._mapFGSnake = ba.gettexture('ninjaIcon')
self._mapFGKronk= ba.gettexture('kronkIcon')
self._mapFGMel = ba.gettexture('melIcon')
self._mapFGJack = ba.gettexture('jackIcon')
self._mapFGSanta = ba.gettexture('santaIcon')
self._mapFGFrosty = ba.gettexture('frostyIcon')
self._mapFGBones = ba.gettexture('bonesIcon')
self._mapFGBernard = ba.gettexture('bearIcon')
self._mapFGPascal = ba.gettexture('penguinIcon')
self._mapFGAli = ba.gettexture('aliIcon')
self._mapFGRobot = ba.gettexture('cyborgIcon')
self._mapFGAgent = ba.gettexture('agentIcon')
self._mapFGGrumbledorf = ba.gettexture('wizardIcon')
self._mapFGPixel = ba.gettexture('pixieIcon')
self._mapFGSpaz = bs.gettexture('neoSpazIcon')
self._mapFGZoe = bs.gettexture('zoeIcon')
self._mapFGSnake = bs.gettexture('ninjaIcon')
self._mapFGKronk= bs.gettexture('kronkIcon')
self._mapFGMel = bs.gettexture('melIcon')
self._mapFGJack = bs.gettexture('jackIcon')
self._mapFGSanta = bs.gettexture('santaIcon')
self._mapFGFrosty = bs.gettexture('frostyIcon')
self._mapFGBones = bs.gettexture('bonesIcon')
self._mapFGBernard = bs.gettexture('bearIcon')
self._mapFGPascal = bs.gettexture('penguinIcon')
self._mapFGAli = bs.gettexture('aliIcon')
self._mapFGRobot = bs.gettexture('cyborgIcon')
self._mapFGAgent = bs.gettexture('agentIcon')
self._mapFGGrumbledorf = bs.gettexture('wizardIcon')
self._mapFGPixel = bs.gettexture('pixieIcon')
self._imageTextDefault = ba.gettexture('bg')
self._circleTex = ba.gettexture('circleShadow')
self._imageTextDefault = bs.gettexture('bg')
self._circleTex = bs.gettexture('circleShadow')
self._image = ba.newnode('image',
self._image = bs.newnode('image',
attrs={'texture': self._imageTextDefault,
'position':(0,-100),
'scale':(100,100),
'opacity': 0.0,
'attach':'topCenter'})
self._textCounter = ba.newnode('text',
self._textCounter = bs.newnode('text',
attrs={'text': '10',
'position': (0, -100),
'scale': 2.3,
@ -220,7 +213,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
'h_align': 'center',
'v_align': 'center'})
self._textLevel = ba.newnode('text',
self._textLevel = bs.newnode('text',
attrs={'text': 'Level ' + str(self._levelStage),
'position': (0, -28),
'scale': 1.3,
@ -233,21 +226,21 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
'h_align': 'center',
'v_align': 'center'})
self._imageCircle = ba.newnode('image',
self._imageCircle = bs.newnode('image',
attrs={'texture': self._circleTex,
'position': (75, -75),
'scale': (20,20),
'color': (0.2, 0.2, 0.2),
'opacity': 0.0,
'attach': 'topCenter'})
self._imageCircle2 = ba.newnode('image',
self._imageCircle2 = bs.newnode('image',
attrs={'texture': self._circleTex,
'position': (75, -100),
'scale': (20,20),
'color': (0.2, 0.2, 0.2),
'opacity': 0.0,
'attach': 'topCenter'})
self._imageCircle3 = ba.newnode('image',
self._imageCircle3 = bs.newnode('image',
attrs={'texture': self._circleTex,
'position': (75, -125),
'scale': (20,20),
@ -258,12 +251,12 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
def on_transition_in(self) -> None:
super().on_transition_in()
self._bellLow = ba.getsound('bellLow')
self._bellMed = ba.getsound('bellMed')
self._bellHigh = ba.getsound('bellHigh')
self._tickSound = ba.getsound('tick')
self._tickFinal = ba.getsound('powerup01')
self._scoreSound = ba.getsound('score')
self._bellLow = bs.getsound('bellLow')
self._bellMed = bs.getsound('bellMed')
self._bellHigh = bs.getsound('bellHigh')
self._tickSound = bs.getsound('tick')
self._tickFinal = bs.getsound('powerup01')
self._scoreSound = bs.getsound('score')
self._image.opacity = 1
self._textCounter.opacity = 1
@ -280,8 +273,8 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
if self._levelStage == 1:
timeStart = 6
ba.timer(timeStart, self._randomPlatform)
ba.timer(timeStart, self.startCounter)
bs.timer(timeStart, self._randomPlatform)
bs.timer(timeStart, self.startCounter)
def on_begin(self) -> None:
super().on_begin()
@ -306,14 +299,14 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self.coldel15 = True
self.coldel16 = True
import base64
exec(base64.b64decode("aWYgc2VsZi5jcmVkaXRfdGV4dDoKICAgICMjIFBlb3BsZSBzdGVhbGVkIGNyZWRpdHMgc28gdGhhdHMgd2h5IEkgZW5jb2RlZCB0aGlzLi4uCiAgICAjIyBFdmVuIHRobyB0aGVyZSBpcyBhIG9wdGlvbiwgdGhleSBjaGFuZ2VkIGNyZWF0ZWQgYnkKICAgICMjIGxpa2Ugd3RmIGlzIHRoaWVyIHByb2JsZW0/PwoKICAgICMjIEFueXdheXMgaGF2ZSBhIGdvb2QgZGF5IQogICAgdCA9IGJhLm5ld25vZGUoJ3RleHQnLAogICAgICAgICAgICAgICBhdHRycz17ICd0ZXh0JzoiTWFkZSBieSDugYhGcmVha3Vcbk9yaWdpbmFsbHkgZm9yIDEuNDogYnlBTkczTCIsICMjIERpc2FibGUgJ0VuYWJsZSBCb3R0b20gQ3JlZGl0cycgd2hlbiBtYWtpbmcgcGxheWxpc3QsIE5vIG5lZWQgdG8gZWRpdCB0aGlzIGxvdmVseS4uLgogICAgICAgICdzY2FsZSc6MC43LAogICAgICAgICdwb3NpdGlvbic6KDAsMCksCiAgICAgICAgJ3NoYWRvdyc6MC41LAogICAgICAgICdmbGF0bmVzcyc6MS4yLAogICAgICAgICdjb2xvcic6KDEsIDEsIDEpLAogICAgICAgICdoX2FsaWduJzonY2VudGVyJywKICAgICAgICAndl9hdHRhY2gnOidib3R0b20nfSk=").decode('UTF-8'))
exec(base64.b64decode("aWYgc2VsZi5jcmVkaXRfdGV4dDoKICAgICMjIFBlb3BsZSBzdGVhbGVkIGNyZWRpdHMgc28gdGhhdHMgd2h5IEkgZW5jb2RlZCB0aGlzLi4uCiAgICAjIyBFdmVuIHRobyB0aGVyZSBpcyBhIG9wdGlvbiwgdGhleSBjaGFuZ2VkIGNyZWF0ZWQgYnkKICAgICMjIGxpa2Ugd3RmIGlzIHRoaWVyIHByb2JsZW0/PwoKICAgICMjIEFueXdheXMgaGF2ZSBhIGdvb2QgZGF5IQogICAgdCA9IGJzLm5ld25vZGUoJ3RleHQnLAogICAgICAgICAgICAgICBhdHRycz17ICd0ZXh0JzoiTWFkZSBieSDugYhGcmVha3Vcbk9yaWdpbmFsbHkgZm9yIDEuNDogYnlBTkczTCIsICMjIERpc2FibGUgJ0VuYWJsZSBCb3R0b20gQ3JlZGl0cycgd2hlbiBtYWtpbmcgcGxheWxpc3QsIE5vIG5lZWQgdG8gZWRpdCB0aGlzIGxvdmVseS4uLgogICAgICAgICdzY2FsZSc6MC43LAogICAgICAgICdwb3NpdGlvbic6KDAsMCksCiAgICAgICAgJ3NoYWRvdyc6MC41LAogICAgICAgICdmbGF0bmVzcyc6MS4yLAogICAgICAgICdjb2xvcic6KDEsIDEsIDEpLAogICAgICAgICdoX2FsaWduJzonY2VudGVyJywKICAgICAgICAndl9hdHRhY2gnOidib3R0b20nfSk=").decode('UTF-8'))
self.spawnAllMap()
self.flashHide()
# Check for immediate end (if we've only got 1 player, etc).
ba.timer(5, self._check_end_game)
self._dingSound = ba.getsound('dingSmall')
self._dingSoundHigh = ba.getsound('dingSmallHigh')
bs.timer(5, self._check_end_game)
self._dingSound = bs.getsound('dingSmall')
self._dingSoundHigh = bs.getsound('dingSmallHigh')
def startCounter(self):
self._textCounter.text = '10'
@ -328,43 +321,43 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
def count1():
def countFinal():
self._textCounter.text = ''
ba.playsound(self._tickFinal)
self._tickFinal.play()
self._stop()
self._textCounter.text = '1'
ba.playsound(self._tickSound)
ba.timer(1, countFinal)
self._tickSound.play()
bs.timer(1, countFinal)
self._textCounter.text = '2'
ba.playsound(self._tickSound)
ba.timer(1, count1)
self._tickSound.play()
bs.timer(1, count1)
self._textCounter.text = '3'
ba.playsound(self._tickSound)
ba.timer(1, count2)
self._tickSound.play()
bs.timer(1, count2)
self._textCounter.text = '4'
ba.playsound(self._tickSound)
ba.timer(1, count3)
self._tickSound.play()
bs.timer(1, count3)
self._textCounter.text = '5'
ba.playsound(self._tickSound)
ba.timer(1, count4)
self._tickSound.play()
bs.timer(1, count4)
self._textCounter.text = '6'
ba.playsound(self._tickSound)
ba.timer(1, count5)
self._tickSound.play()
bs.timer(1, count5)
self._textCounter.text = '7'
ba.playsound(self._tickSound)
ba.timer(1, count6)
self._tickSound.play()
bs.timer(1, count6)
self._textCounter.text = '8'
ba.playsound(self._tickSound)
ba.timer(1, count7)
self._tickSound.play()
bs.timer(1, count7)
self._textCounter.text = '9'
ba.playsound(self._tickSound)
ba.timer(1, count8)
ba.timer(1, count9)
self._tickSound.play()
bs.timer(1, count8)
bs.timer(1, count9)
def on_player_join(self, player: Player) -> None:
# Don't allow joining after we start
# (would enable leave/rejoin tomfoolery).
if self.has_begun():
ba.screenmessage(
ba.Lstr(resource='playerDelayedJoinText',
bs.broadcastmessage(
babase.Lstr(resource='playerDelayedJoinText',
subs=[('${PLAYER}', player.getname(full=True))]),
color=(0, 1, 0),transient=True,clients=[player.sessionplayer.inputdevice.client_id])
# For score purposes, mark them as having died right as the
@ -382,11 +375,11 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self._check_end_game()
# overriding the default character spawning..
def spawn_player(self, player: Player) -> ba.Actor:
def spawn_player(self, player: Player) -> bs.Actor:
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))
spaz.connect_controls_to_player(enable_punch=False, enable_bomb=False, enable_pickup=False)
spaz.handlemessage(ba.StandMessage(pos))
spaz.handlemessage(bs.StandMessage(pos))
return spaz
def _randomSelect(self):
@ -440,17 +433,17 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
def circle3():
self._imageCircle3.color = (0.0, 1.0, 0.0)
self._imageCircle3.opacity = 1.0
ba.playsound(self._bellHigh)
ba.timer(0.2, self._doDelete)
self._bellHigh.play()
bs.timer(0.2, self._doDelete)
self._imageCircle2.color = (1.0, 1.0, 0.0)
self._imageCircle2.opacity = 1.0
ba.playsound(self._bellMed)
ba.timer(1, circle3)
self._bellMed.play()
bs.timer(1, circle3)
self._imageCircle.color = (1.0, 0.0, 0.0)
self._imageCircle.opacity = 1.0
ba.playsound(self._bellLow)
ba.timer(1, circle2)
ba.timer(1, circle)
self._bellLow.play()
bs.timer(1, circle2)
bs.timer(1, circle)
def _randomPlatform(self):
if self._levelStage == 1:
@ -551,13 +544,13 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self._mixPlatform()
def _mixPlatform(self):
ba.timer(1, self.flashShow)
ba.timer(3, self.flashHide)
ba.timer(4, self.flashShow)
ba.timer(6, self.flashHide)
ba.timer(7, self.flashShow)
ba.timer(9, self.flashHide)
ba.timer(13.2, self.flashShow)
bs.timer(1, self.flashShow)
bs.timer(3, self.flashHide)
bs.timer(4, self.flashShow)
bs.timer(6, self.flashHide)
bs.timer(7, self.flashShow)
bs.timer(9, self.flashHide)
bs.timer(13.2, self.flashShow)
def flashHide(self):
self.mapFGP.color_texture = self._mapFGPDefaultTex
@ -661,14 +654,14 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self.mapFGP16col.delete()
self.coldel16 = True
ba.timer(3.3, self._platformTexDefault)
bs.timer(3.3, self._platformTexDefault)
def spawnAllMap(self):
"""
# Here's how it works:
# First, create prop with a gravity scale of 0
# Then use a in-game model which will suit it (For this one I didn't chose box, since it will look kinda weird) Right?
# Instead I used a 2d model (which is nothing but a button in menu)
# Then use a in-game mesh which will suit it (For this one I didn't chose box, since it will look kinda weird) Right?
# Instead I used a 2d mesh (which is nothing but a button in menu)
# This prop SHOULD NOT collide with anything, since it has gravity_scale of 0 if it'll get weight it will fall down :((
# These are where we change those color-textures and is seen in-game
@ -683,115 +676,115 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
"""
shared = SharedObjects.get()
if self.coldel:
self.mapFGP = ba.newnode('prop',
attrs={'body': 'puck', 'position': (3,2,-9), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGPTex = None
self.mapFGPcol = ba.newnode('region',attrs={'position': (3,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
if self.coldel2:
self.mapFGP2 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (3,2,-6), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGP2Tex = None
self.mapFGP2col = ba.newnode('region',attrs={'position': (3,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
if self.coldel3:
self.mapFGP3 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (3,2,-3), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGP3Tex = None
self.mapFGP3col = ba.newnode('region',attrs={'position': (3,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
if self.coldel4:
self.mapFGP4 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (3,2,0), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGP4Tex = None
self.mapFGP4col = ba.newnode('region',attrs={'position': (3,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
if self.coldel5:
self.mapFGP5 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (0,2,-9), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGP5Tex = None
self.mapFGP5col = ba.newnode('region',attrs={'position': (0,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
if self.coldel6:
self.mapFGP6 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (0,2,-6), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGP6Tex = None
self.mapFGP6col = ba.newnode('region',attrs={'position': (0,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
if self.coldel7:
self.mapFGP7 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (0,2,-3), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGP7Tex = None
self.mapFGP7col = ba.newnode('region',attrs={'position': (0,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
if self.coldel8:
self.mapFGP8 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (0,2,0), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGP8Tex = None
self.mapFGP8col = ba.newnode('region',attrs={'position': (0,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
if self.coldel9:
self.mapFGP9 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-3,2,-9), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGP9Tex = None
self.mapFGP9col = ba.newnode('region',attrs={'position': (-3,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
if self.coldel10:
self.mapFGP10 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-3,2,-6), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGP10Tex = None
self.mapFGP10col = ba.newnode('region',attrs={'position': (-3,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
if self.coldel11:
self.mapFGP11 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-3,2,-3), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGP11Tex = None
self.mapFGP11col = ba.newnode('region',attrs={'position': (-3,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
if self.coldel12:
self.mapFGP12 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-3,2,0), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGP12Tex = None
self.mapFGP12col = ba.newnode('region',attrs={'position': (-3,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
if self.coldel13:
self.mapFGP13 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-6,2,-9), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGP13Tex = None
self.mapFGP13col = ba.newnode('region',attrs={'position': (-6,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
if self.coldel14:
self.mapFGP14 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-6,2,-6), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGP14Tex = None
self.mapFGP14col = ba.newnode('region',attrs={'position': (-6,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
if self.coldel15:
self.mapFGP15 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-6,2,-3), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGP15Tex = None
self.mapFGP15col = ba.newnode('region',attrs={'position': (-6,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
if self.coldel16:
self.mapFGP16 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-6,2,0), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, '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.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]})
self.mapFGP16Tex = None
self.mapFGP16col = ba.newnode('region',attrs={'position': (-6,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
def _platformTexDefault(self):
@ -814,27 +807,27 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
timeStart = 6
else:
timeStart = 2
ba.playsound(self._scoreSound)
activity = _ba.get_foreground_host_activity()
self._scoreSound.play()
activity = bs.get_foreground_host_activity()
for i in activity.players:
try:
i.actor.node.handlemessage(ba.CelebrateMessage(2.0))
i.actor.node.handlemessage(bs.CelebrateMessage(2.0))
except:
pass
ba.timer(timeStart, self._randomPlatform)
ba.timer(timeStart, self.startCounter)
bs.timer(timeStart, self._randomPlatform)
bs.timer(timeStart, self.startCounter)
self.spawnAllMap()
self.flashHide()
# Various high-level game events come through this method.
def handlemessage(self, msg: Any) -> Any:
if isinstance(msg, ba.PlayerDiedMessage):
if isinstance(msg, bs.PlayerDiedMessage):
# Augment standard behavior.
super().handlemessage(msg)
curtime = ba.time()
curtime = bs.time()
# Record the player's moment of death.
# assert isinstance(msg.spaz.player
@ -844,15 +837,15 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
# (more accurate looking).
# In teams/ffa, allow a one-second fudge-factor so we can
# get more draws if players die basically at the same time.
if isinstance(self.session, ba.CoopSession):
if isinstance(self.session, bs.CoopSession):
# Teams will still show up if we check now.. check in
# the next cycle.
ba.pushcall(self._check_end_game)
babase.pushcall(self._check_end_game)
# Also record this for a final setting of the clock.
self._last_player_death_time = curtime
else:
ba.timer(1.0, self._check_end_game)
bs.timer(1.0, self._check_end_game)
else:
# Default handler:
return super().handlemessage(msg)
@ -868,7 +861,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
# In co-op, we go till everyone is dead.. otherwise we go
# until one team remains.
if isinstance(self.session, ba.CoopSession):
if isinstance(self.session, bs.CoopSession):
if living_team_count <= 0:
self.end_game()
else:
@ -877,7 +870,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
def end_game(self) -> None:
cur_time = ba.time()
cur_time = bs.time()
assert self._timer is not None
start_time = self._timer.getstarttime()
@ -908,7 +901,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
# Ok now calc game results: set a score for each team and then tell
# the game to end.
results = ba.GameResults()
results = bs.GameResults()
# Remember that 'free-for-all' mode is simply a special form
# of 'teams' mode where each player gets their own team, so we can
@ -941,7 +934,7 @@ class MGdefs():
boxes['area_of_interest_bounds'] = (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(ba.Map):
class MGmap(bs.Map):
defs = MGdefs()
name = 'Sky Tiles'
@ -957,23 +950,23 @@ class MGmap(ba.Map):
@classmethod
def on_preload(cls) -> Any:
data: Dict[str, Any] = {
'bgtex': ba.gettexture('menuBG'),
'bgmodel': ba.getmodel('thePadBG')
'bgtex': bs.gettexture('menuBG'),
'bgmesh': bs.getmesh('thePadBG')
}
return data
def __init__(self) -> None:
super().__init__()
shared = SharedObjects.get()
self.node = ba.newnode(
self.node = bs.newnode(
'terrain',
attrs={
'model': self.preloaddata['bgmodel'],
'mesh': self.preloaddata['bgmesh'],
'lighting': False,
'background': True,
'color_texture': self.preloaddata['bgtex']
})
gnode = ba.getactivity().globalsnode
gnode = bs.getactivity().globalsnode
gnode.tint = (1.3, 1.2, 1.0)
gnode.ambient_color = (1.3, 1.2, 1.0)
gnode.vignette_outer = (0.57, 0.57, 0.57)
@ -985,13 +978,13 @@ class MGmap(ba.Map):
ba._map.register_map(MGmap)
bs._map.register_map(MGmap)
# ba_meta export plugin
class byFreaku(ba.Plugin):
class byFreaku(babase.Plugin):
def __init__(self):
## Campaign support ##
ba.app.add_coop_practice_level(ba.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'))

View file

@ -1,6 +1,6 @@
# Volley Ball (final)
# Made by your friend: Freaku / @[Just] Freak#4999
# Made by your friend: Freaku
@ -34,7 +34,6 @@
## 2022
- Code cleanup
- No longer requires a plugin
- More accurate Goal positions
"""
@ -47,18 +46,19 @@
# ba_meta require api 7
# ba_meta require api 8
from __future__ import annotations
from typing import TYPE_CHECKING
import _ba, ba, random
from bastd.actor.playerspaz import PlayerSpaz
from bastd.actor.scoreboard import Scoreboard
from bastd.actor.powerupbox import PowerupBoxFactory
from bastd.actor.bomb import BombFactory
from bastd.gameutils import SharedObjects
import babase, random
import bascenev1 as bs
from bascenev1lib.actor.playerspaz import PlayerSpaz
from bascenev1lib.actor.scoreboard import Scoreboard
from bascenev1lib.actor.powerupbox import PowerupBoxFactory
from bascenev1lib.actor.bomb import BombFactory
from bascenev1lib.gameutils import SharedObjects
if TYPE_CHECKING:
from typing import Any, Sequence, Dict, Type, List, Optional, Union
@ -72,7 +72,7 @@ class PuckDiedMessage:
self.puck = puck
class Puck(ba.Actor):
class Puck(bs.Actor):
def __init__(self, position: Sequence[float] = (0.0, 1.0, 0.0)):
super().__init__()
shared = SharedObjects.get()
@ -85,16 +85,16 @@ class Puck(ba.Actor):
assert activity is not None
assert isinstance(activity, VolleyBallGame)
pmats = [shared.object_material, activity.puck_material]
self.node = ba.newnode('prop',
self.node = bs.newnode('prop',
delegate=self,
attrs={
'model': activity.puck_model,
'mesh': activity.puck_mesh,
'color_texture': activity.puck_tex,
'body': 'sphere',
'reflection': 'soft',
'reflection_scale': [0.2],
'shadow_size': 0.6,
'model_scale': 0.4,
'mesh_scale': 0.4,
'body_scale': 1.07,
'is_area_of_interest': True,
'position': self._spawn_pos,
@ -104,12 +104,12 @@ class Puck(ba.Actor):
# Since it rolls on spawn, lets make gravity
# to 0, and when another node (bomb/spaz)
# touches it. It'll act back as our normie puck!
ba.animate(self.node, 'gravity_scale', {0:-0.1, 0.2:1}, False)
bs.animate(self.node, 'gravity_scale', {0:-0.1, 0.2:1}, False)
# When other node touches, it realises its new gravity_scale
def handlemessage(self, msg: Any) -> Any:
if isinstance(msg, ba.DieMessage):
if isinstance(msg, bs.DieMessage):
assert self.node
self.node.delete()
activity = self._activity()
@ -117,11 +117,11 @@ class Puck(ba.Actor):
activity.handlemessage(PuckDiedMessage(self))
# If we go out of bounds, move back to where we started.
elif isinstance(msg, ba.OutOfBoundsMessage):
elif isinstance(msg, bs.OutOfBoundsMessage):
assert self.node
self.node.position = self._spawn_pos
elif isinstance(msg, ba.HitMessage):
elif isinstance(msg, bs.HitMessage):
assert self.node
assert msg.force_direction is not None
self.node.handlemessage(
@ -142,28 +142,28 @@ class Puck(ba.Actor):
super().handlemessage(msg)
class Player(ba.Player['Team']):
class Player(bs.Player['Team']):
"""Our player type for this game."""
class Team(ba.Team[Player]):
class Team(bs.Team[Player]):
"""Our team type for this game."""
def __init__(self) -> None:
self.score = 0
# ba_meta export game
class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
# ba_meta export bascenev1.GameActivity
class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
name = 'Volley Ball'
description = 'Score some goals.\nby \ue048Freaku'
available_settings = [
ba.IntSetting(
bs.IntSetting(
'Score to Win',
min_value=1,
default=1,
increment=1,
),
ba.IntChoiceSetting(
bs.IntChoiceSetting(
'Time Limit',
choices=[
('None', 0),
@ -175,7 +175,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
],
default=0,
),
ba.FloatChoiceSetting(
bs.FloatChoiceSetting(
'Respawn Times',
choices=[
('Shorter', 0.25),
@ -186,36 +186,36 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
],
default=1.0,
),
ba.BoolSetting('Epic Mode', True),
ba.BoolSetting('Night Mode', False),
ba.BoolSetting('Icy Floor', True),
ba.BoolSetting('Disable Punch', False),
ba.BoolSetting('Disable Bombs', False),
ba.BoolSetting('Enable Bottom Credits', True),
bs.BoolSetting('Epic Mode', True),
bs.BoolSetting('Night Mode', False),
bs.BoolSetting('Icy Floor', True),
bs.BoolSetting('Disable Punch', False),
bs.BoolSetting('Disable Bombs', False),
bs.BoolSetting('Enable Bottom Credits', True),
]
default_music = ba.MusicType.HOCKEY
default_music = bs.MusicType.HOCKEY
@classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool:
return issubclass(sessiontype, ba.DualTeamSession)
def supports_session_type(cls, sessiontype: Type[bs.Session]) -> bool:
return issubclass(sessiontype, bs.DualTeamSession)
@classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
def get_supported_maps(cls, sessiontype: Type[bs.Session]) -> List[str]:
return ['Open Field', 'Closed Arena']
def __init__(self, settings: dict):
super().__init__(settings)
shared = SharedObjects.get()
self._scoreboard = Scoreboard()
self._cheer_sound = ba.getsound('cheer')
self._chant_sound = ba.getsound('crowdChant')
self._foghorn_sound = ba.getsound('foghorn')
self._swipsound = ba.getsound('swip')
self._whistle_sound = ba.getsound('refWhistle')
self.puck_model = ba.getmodel('shield')
self.puck_tex = ba.gettexture('gameCircleIcon')
self._puck_sound = ba.getsound('metalHit')
self.puck_material = ba.Material()
self._cheer_sound = bs.getsound('cheer')
self._chant_sound = bs.getsound('crowdChant')
self._foghorn_sound = bs.getsound('foghorn')
self._swipsound = bs.getsound('swip')
self._whistle_sound = bs.getsound('refWhistle')
self.puck_mesh = bs.getmesh('shield')
self.puck_tex = bs.gettexture('gameCircleIcon')
self._puck_sound = bs.getsound('metalHit')
self.puck_material = bs.Material()
self.puck_material.add_actions(actions=(('modify_part_collision',
'friction', 0.5)))
self.puck_material.add_actions(conditions=('they_have_material',
@ -246,8 +246,8 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
conditions=('they_have_material',
PowerupBoxFactory.get().powerup_material),
actions=(('modify_part_collision', 'physical', False),
('message', 'their_node', 'at_connect', ba.DieMessage())))
self._score_region_material = ba.Material()
('message', 'their_node', 'at_connect', bs.DieMessage())))
self._score_region_material = bs.Material()
self._score_region_material.add_actions(
conditions=('they_have_material', self.puck_material),
actions=(('modify_part_collision', 'collide',
@ -255,8 +255,8 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
('call', 'at_connect', self._handle_score)))
self._wall_material=ba.Material()
self._fake_wall_material=ba.Material()
self._wall_material=bs.Material()
self._fake_wall_material=bs.Material()
self._wall_material.add_actions(
actions=(
@ -297,7 +297,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
self.blocks=[]
self._net_wall_material=ba.Material()
self._net_wall_material=bs.Material()
self._net_wall_material.add_actions(
conditions=('they_have_material', shared.player_material),
actions=(
@ -325,7 +325,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
self._puck_spawn_pos: Optional[Sequence[float]] = None
self._score_regions: Optional[List[ba.NodeActor]] = None
self._score_regions: Optional[List[bs.NodeActor]] = None
self._puck: Optional[Puck] = None
self._score_to_win = int(settings['Score to Win'])
self._punchie_ = bool(settings['Disable Punch'])
@ -337,8 +337,8 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
self._epic_mode = bool(settings['Epic Mode'])
# Base class overrides.
self.slow_motion = self._epic_mode
self.default_music = (ba.MusicType.EPIC if self._epic_mode else
ba.MusicType.TO_THE_DEATH)
self.default_music = (bs.MusicType.EPIC if self._epic_mode else
bs.MusicType.TO_THE_DEATH)
def get_instance_description(self) -> Union[str, Sequence]:
if self._score_to_win == 1:
@ -355,15 +355,15 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
self.setup_standard_time_limit(self._time_limit)
if self._night_mode:
ba.getactivity().globalsnode.tint = (0.5, 0.7, 1)
bs.getactivity().globalsnode.tint = (0.5, 0.7, 1)
self._puck_spawn_pos = self.map.get_flag_position(None)
self._spawn_puck()
# Set up the two score regions.
self._score_regions = []
self._score_regions.append(
ba.NodeActor(
ba.newnode('region',
bs.NodeActor(
bs.newnode('region',
attrs={
'position':(5.7, 0, -0.065),
'scale': (10.7, 0.001, 8),
@ -371,8 +371,8 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
'materials': [self._score_region_material]
})))
self._score_regions.append(
ba.NodeActor(
ba.newnode('region',
bs.NodeActor(
bs.newnode('region',
attrs={
'position':(-5.7, 0, -0.065),
'scale': (10.7, 0.001, 8),
@ -380,25 +380,25 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
'materials': [self._score_region_material]
})))
self._update_scoreboard()
ba.playsound(self._chant_sound)
self._chant_sound.play()
import base64
exec(base64.b64decode("aWYgc2VsZi5jcmVkaXRfdGV4dDoKICAgICMjIFBlb3BsZSBzdGVhbGVkIGNyZWRpdHMgc28gdGhhdHMgd2h5IEkgZW5jb2RlZCB0aGlzLi4uCiAgICAjIyBFdmVuIHRobyB0aGVyZSBpcyBhIG9wdGlvbiwgdGhleSBjaGFuZ2VkIGNyZWF0ZWQgYnkKICAgICMjIGxpa2Ugd3RmIGlzIHRoaWVyIHByb2JsZW0/PwogICAgCiAgICAjIyBBbnl3YXlzIGhhdmUgYSBnb29kIGRheSEKICAgIHQgPSBiYS5uZXdub2RlKCd0ZXh0JywKICAgICAgICAgICAgICAgYXR0cnM9eyAndGV4dCc6IkNyZWF0ZWQgYnkg7oGIRnJlYWt1XG5Wb2xsZXlCYWxsIiwgIyMgRGlzYWJsZSAnRW5hYmxlIEJvdHRvbSBDcmVkaXRzJyB3aGVuIG1ha2luZyBwbGF5bGlzdCwgTm8gbmVlZCB0byBlZGl0IHRoaXMgbG92ZWx5Li4uCiAgICAgICAgJ3NjYWxlJzowLjcsCiAgICAgICAgJ3Bvc2l0aW9uJzooMCwwKSwgI0xldHMgaG9wZSBoZSB1c2VzIFRWIGJvcmRlciBvZiBzZXR0aW5ncz5HcmFwaGljcwogICAgICAgICdzaGFkb3cnOjAuNSwKICAgICAgICAnZmxhdG5lc3MnOjEuMiwKICAgICAgICAnY29sb3InOigxLCAxLCAxKSwKICAgICAgICAnaF9hbGlnbic6J2NlbnRlcicsCiAgICAgICAgJ3ZfYXR0YWNoJzonYm90dG9tJ30p").decode('UTF-8'))
exec(base64.b64decode("aWYgc2VsZi5jcmVkaXRfdGV4dDoKICAgICMjIFBlb3BsZSBzdGVhbGVkIGNyZWRpdHMgc28gdGhhdHMgd2h5IEkgZW5jb2RlZCB0aGlzLi4uCiAgICAjIyBFdmVuIHRobyB0aGVyZSBpcyBhIG9wdGlvbiwgdGhleSBjaGFuZ2VkIGNyZWF0ZWQgYnkKICAgICMjIGxpa2Ugd3RmIGlzIHRoaWVyIHByb2JsZW0/PwogICAgCiAgICAjIyBBbnl3YXlzIGhhdmUgYSBnb29kIGRheSEKICAgIHQgPSBicy5uZXdub2RlKCd0ZXh0JywKICAgICAgICAgICAgICAgYXR0cnM9eyAndGV4dCc6IkNyZWF0ZWQgYnkg7oGIRnJlYWt1XG5Wb2xsZXlCYWxsIiwgIyMgRGlzYWJsZSAnRW5hYmxlIEJvdHRvbSBDcmVkaXRzJyB3aGVuIG1ha2luZyBwbGF5bGlzdCwgTm8gbmVlZCB0byBlZGl0IHRoaXMgbG92ZWx5Li4uCiAgICAgICAgJ3NjYWxlJzowLjcsCiAgICAgICAgJ3Bvc2l0aW9uJzooMCwwKSwgI0xldHMgaG9wZSBoZSB1c2VzIFRWIGJvcmRlciBvZiBzZXR0aW5ncz5HcmFwaGljcwogICAgICAgICdzaGFkb3cnOjAuNSwKICAgICAgICAnZmxhdG5lc3MnOjEuMiwKICAgICAgICAnY29sb3InOigxLCAxLCAxKSwKICAgICAgICAnaF9hbGlnbic6J2NlbnRlcicsCiAgICAgICAgJ3ZfYXR0YWNoJzonYm90dG9tJ30p").decode('UTF-8'))
shared = SharedObjects.get()
self.blocks.append(ba.NodeActor(ba.newnode('region',attrs={'position': (0,2.4,0),'scale': (0.8,6,20),'type': 'box','materials': (self._fake_wall_material, )})))
self.blocks.append(bs.NodeActor(bs.newnode('region',attrs={'position': (0,2.4,0),'scale': (0.8,6,20),'type': 'box','materials': (self._fake_wall_material, )})))
self.net_blocc.append(ba.NodeActor(ba.newnode('region',attrs={'position': (0,0,0),'scale': (0.6,2.4,20),'type': 'box','materials': (self._net_wall_material, )})))
self.net_blocc.append(bs.NodeActor(bs.newnode('region',attrs={'position': (0,0,0),'scale': (0.6,2.4,20),'type': 'box','materials': (self._net_wall_material, )})))
def on_team_join(self, team: Team) -> None:
self._update_scoreboard()
def _handle_puck_player_collide(self) -> None:
collision = ba.getcollision()
collision = bs.getcollision()
try:
puck = collision.sourcenode.getdelegate(Puck, True)
player = collision.opposingnode.getdelegate(PlayerSpaz,
True).getplayer(
Player, True)
except ba.NotFoundError:
except bs.NotFoundError:
return
puck.last_players_to_touch[player.team.id] = player
@ -415,7 +415,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
if self._puck.scored:
return
region = ba.getcollision().sourcenode
region = bs.getcollision().sourcenode
index = 0
for index in range(len(self._score_regions)):
if region == self._score_regions[index].node:
@ -440,7 +440,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
for player in team.players:
if player.actor:
player.actor.handlemessage(ba.CelebrateMessage(2.0))
player.actor.handlemessage(bs.CelebrateMessage(2.0))
# If we've got the player from the scoring team that last
# touched us, give them points.
@ -455,28 +455,28 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
if team.score >= self._score_to_win:
self.end_game()
ba.playsound(self._foghorn_sound)
ba.playsound(self._cheer_sound)
self._foghorn_sound.play()
self._cheer_sound.play()
self._puck.scored = True
# Kill the puck (it'll respawn itself shortly).
ba.emitfx(position= ba.getcollision().position, count=int(6.0 + 7.0 * 12), scale=3, spread=0.5, chunk_type='spark')
ba.timer(0.7, self._kill_puck)
bs.emitfx(position= bs.getcollision().position, count=int(6.0 + 7.0 * 12), scale=3, spread=0.5, chunk_type='spark')
bs.timer(0.7, self._kill_puck)
ba.cameraflash(duration=7.0)
bs.cameraflash(duration=7.0)
self._update_scoreboard()
def end_game(self) -> None:
results = ba.GameResults()
results = bs.GameResults()
for team in self.teams:
results.set_team_score(team, team.score)
self.end(results=results)
def on_transition_in(self) -> None:
super().on_transition_in()
activity = ba.getactivity()
activity = bs.getactivity()
if self._icy_flooor:
activity.map.is_hockey = True
@ -486,7 +486,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
self._scoreboard.set_team_value(team, team.score, winscore)
# overriding the default character spawning..
def spawn_player(self, player: Player) -> ba.Actor:
def spawn_player(self, player: Player) -> bs.Actor:
spaz = self.spawn_player_spaz(player)
if self._bombies_:
@ -503,7 +503,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
def handlemessage(self, msg: Any) -> Any:
# Respawn dead players if they're still in the game.
if isinstance(msg, ba.PlayerDiedMessage):
if isinstance(msg, bs.PlayerDiedMessage):
# Augment standard behavior...
super().handlemessage(msg)
self.respawn_player(msg.getplayer(Player))
@ -511,17 +511,17 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
# Respawn dead pucks.
elif isinstance(msg, PuckDiedMessage):
if not self.has_ended():
ba.timer(2.2, self._spawn_puck)
bs.timer(2.2, self._spawn_puck)
else:
super().handlemessage(msg)
def _flash_puck_spawn(self) -> None:
# Effect >>>>>> Flashly
ba.emitfx(position= self._puck_spawn_pos, count=int(6.0 + 7.0 * 12), scale=1.7, spread=0.4, chunk_type='spark')
bs.emitfx(position= self._puck_spawn_pos, count=int(6.0 + 7.0 * 12), scale=1.7, spread=0.4, chunk_type='spark')
def _spawn_puck(self) -> None:
ba.playsound(self._swipsound)
ba.playsound(self._whistle_sound)
self._swipsound.play()
self._whistle_sound.play()
self._flash_puck_spawn()
assert self._puck_spawn_pos is not None
self._puck = Puck(position=self._puck_spawn_pos)
@ -566,7 +566,7 @@ class PointzzforH:
class VolleyBallMap(ba.Map):
class VolleyBallMap(bs.Map):
defs = Pointzz()
name = "Open Field"
@ -581,10 +581,10 @@ class VolleyBallMap(ba.Map):
@classmethod
def on_preload(cls) -> Any:
data: Dict[str, Any] = {
'model': ba.getmodel('footballStadium'),
'vr_fill_model': ba.getmodel('footballStadiumVRFill'),
'collide_model': ba.getcollidemodel('footballStadiumCollide'),
'tex': ba.gettexture('footballStadium')
'mesh': bs.getmesh('footballStadium'),
'vr_fill_mesh': bs.getmesh('footballStadiumVRFill'),
'collision_mesh': bs.getcollisionmesh('footballStadiumCollide'),
'tex': bs.gettexture('footballStadium')
}
return data
@ -593,60 +593,60 @@ class VolleyBallMap(ba.Map):
shared = SharedObjects.get()
x = -5
while x<5:
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(0,0,x),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,0,x),
'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(0,.25,x),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,.25,x),
'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(0,.5,x),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,.5,x),
'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(0,.75,x),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,.75,x),
'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(0,1,x),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,1,x),
'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
x = x + 0.5
y = -1
while y>-11:
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(y,0.01,4),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(y,0.01,4),
'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(y,0.01,-4),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(y,0.01,-4),
'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(-y,0.01,4),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-y,0.01,4),
'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(-y,0.01,-4),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-y,0.01,-4),
'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
y-=1
z = 0
while z<5:
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(11,0.01,z),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(11,0.01,z),
'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(11,0.01,-z),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(11,0.01,-z),
'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(-11,0.01,z),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-11,0.01,z),
'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(-11,0.01,-z),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-11,0.01,-z),
'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
z+=1
self.node = ba.newnode(
self.node = bs.newnode(
'terrain',
delegate=self,
attrs={
'model': self.preloaddata['model'],
'collide_model': self.preloaddata['collide_model'],
'mesh': self.preloaddata['mesh'],
'collision_mesh': self.preloaddata['collision_mesh'],
'color_texture': self.preloaddata['tex'],
'materials': [shared.footing_material]
})
ba.newnode('terrain',
bs.newnode('terrain',
attrs={
'model': self.preloaddata['vr_fill_model'],
'mesh': self.preloaddata['vr_fill_mesh'],
'lighting': False,
'vr_only': True,
'background': True,
'color_texture': self.preloaddata['tex']
})
gnode = ba.getactivity().globalsnode
gnode = bs.getactivity().globalsnode
gnode.tint = (1.3, 1.2, 1.0)
gnode.ambient_color = (1.3, 1.2, 1.0)
gnode.vignette_outer = (0.57, 0.57, 0.57)
@ -656,7 +656,7 @@ class VolleyBallMap(ba.Map):
class VolleyBallMapH(ba.Map):
class VolleyBallMapH(bs.Map):
defs = PointzzforH()
name = 'Closed Arena'
@ -671,13 +671,13 @@ class VolleyBallMapH(ba.Map):
@classmethod
def on_preload(cls) -> Any:
data: Dict[str, Any] = {
'models': (ba.getmodel('hockeyStadiumOuter'),
ba.getmodel('hockeyStadiumInner')),
'vr_fill_model': ba.getmodel('footballStadiumVRFill'),
'collide_model': ba.getcollidemodel('hockeyStadiumCollide'),
'tex': ba.gettexture('hockeyStadium'),
'meshs': (bs.getmesh('hockeyStadiumOuter'),
bs.getmesh('hockeyStadiumInner')),
'vr_fill_mesh': bs.getmesh('footballStadiumVRFill'),
'collision_mesh': bs.getcollisionmesh('hockeyStadiumCollide'),
'tex': bs.gettexture('hockeyStadium'),
}
mat = ba.Material()
mat = bs.Material()
mat.add_actions(actions=('modify_part_collision', 'friction', 0.01))
data['ice_material'] = mat
return data
@ -687,65 +687,65 @@ class VolleyBallMapH(ba.Map):
shared = SharedObjects.get()
x = -5
while x<5:
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(0,0,x),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,0,x),
'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(0,.25,x),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,.25,x),
'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(0,.5,x),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,.5,x),
'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(0,.75,x),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,.75,x),
'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(0,1,x),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(0,1,x),
'color':(1,1,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
x = x + 0.5
y = -1
while y>-11:
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(y,0.01,4),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(y,0.01,4),
'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(y,0.01,-4),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(y,0.01,-4),
'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(-y,0.01,4),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-y,0.01,4),
'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(-y,0.01,-4),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-y,0.01,-4),
'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
y-=1
z = 0
while z<5:
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(11,0.01,z),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(11,0.01,z),
'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(11,0.01,-z),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(11,0.01,-z),
'color':(1,0,0),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(-11,0.01,z),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-11,0.01,z),
'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
self.zone = ba.newnode('locator',attrs={'shape':'circle','position':(-11,0.01,-z),
self.zone = bs.newnode('locator',attrs={'shape':'circle','position':(-11,0.01,-z),
'color':(0,0,1),'opacity':1,'draw_beauty':True,'additive':False,'size':[0.40]})
z+=1
self.node = ba.newnode('terrain',
self.node = bs.newnode('terrain',
delegate=self,
attrs={
'model':
'mesh':
None,
'collide_model':
ba.getcollidemodel('footballStadiumCollide'), # we dont want Goalposts...
'collision_mesh':
bs.getcollisionmesh('footballStadiumCollide'), # we dont want Goalposts...
'color_texture':
self.preloaddata['tex'],
'materials': [
shared.footing_material]
})
ba.newnode('terrain',
bs.newnode('terrain',
attrs={
'model': self.preloaddata['vr_fill_model'],
'mesh': self.preloaddata['vr_fill_mesh'],
'vr_only': True,
'lighting': False,
'background': True,
})
mats = [shared.footing_material]
self.floor = ba.newnode('terrain',
self.floor = bs.newnode('terrain',
attrs={
'model': self.preloaddata['models'][1],
'mesh': self.preloaddata['meshs'][1],
'color_texture': self.preloaddata['tex'],
'opacity': 0.92,
'opacity_in_low_or_medium_quality': 1.0,
@ -753,16 +753,16 @@ class VolleyBallMapH(ba.Map):
'color': (0.4,0.9,0)
})
self.background = ba.newnode(
self.background = bs.newnode(
'terrain',
attrs={
'model': ba.getmodel('natureBackground'),
'mesh': bs.getmesh('natureBackground'),
'lighting': False,
'background': True,
'color': (0.5,0.30,0.4)
})
gnode = ba.getactivity().globalsnode
gnode = bs.getactivity().globalsnode
gnode.floor_reflection = True
gnode.debris_friction = 0.3
gnode.debris_kill_height = -0.3
@ -777,5 +777,17 @@ class VolleyBallMapH(ba.Map):
ba._map.register_map(VolleyBallMap)
ba._map.register_map(VolleyBallMapH)
bs._map.register_map(VolleyBallMap)
bs._map.register_map(VolleyBallMapH)
# ba_meta export plugin
class byFreaku(babase.Plugin):
def __init__(self):
# Reason of plugin:
# To register maps.
#
# Then why not include function here?
# On server upon first launch, plugins are not activated,
# (same can be case for user if disabled auto-enable plugins)
pass