Merge pull request #177 from Freaku17/main

Updating/Adding new plugins for 1.7.20+ (API 8)
This commit is contained in:
Loup 2023-07-28 20:47:29 +05:30 committed by GitHub
commit 3a92dfa32a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 708 additions and 524 deletions

View file

@ -28,6 +28,44 @@
} }
} }
}, },
"icy_emits": {
"description": "Survice from icy bombs emitting through cold platform. Playable in teams/ffa/co-op",
"external_url": "",
"authors": [
{
"name": "Freaku",
"email": "",
"discord": ""
}
],
"versions": {
"1.0.0": {
"api_version": 8,
"commit_sha": "48f9302",
"released_on": "28-07-2023",
"md5sum": "cedc448a3d625065d586445e115fcd1f"
}
}
},
"frozen_one": {
"description": "Survive until the timer runs out",
"external_url": "",
"authors": [
{
"name": "Freaku",
"email": "",
"discord": ""
}
],
"versions": {
"1.0.0": {
"api_version": 8,
"commit_sha": "48f9302",
"released_on": "28-07-2023",
"md5sum": "529c8b9c9a450317d5aa75e8eab47497"
}
}
},
"simon_says": { "simon_says": {
"description": "You better do what Simon says", "description": "You better do what Simon says",
"external_url": "", "external_url": "",
@ -199,10 +237,16 @@
{ {
"name": "Freaku", "name": "Freaku",
"email": "", "email": "",
"discord": "[Just] Freak#4999" "discord": ""
} }
], ],
"versions": { "versions": {
"2.0.0": {
"api_version": 8,
"commit_sha": "48f9302",
"released_on": "28-07-2023",
"md5sum": "2c457b80b5a35adf0cad1436af4ab3fe"
},
"1.1.0": { "1.1.0": {
"api_version": 7, "api_version": 7,
"commit_sha": "0bc9522", "commit_sha": "0bc9522",
@ -218,10 +262,16 @@
{ {
"name": "Freaku", "name": "Freaku",
"email": "", "email": "",
"discord": "[Just] Freak#4999" "discord": ""
} }
], ],
"versions": { "versions": {
"2.0.0": {
"api_version": 8,
"commit_sha": "48f9302",
"released_on": "28-07-2023",
"md5sum": "49ae645a5afc390ead44d7219b388c78"
},
"1.0.0": { "1.0.0": {
"api_version": 7, "api_version": 7,
"commit_sha": "858030b", "commit_sha": "858030b",
@ -237,10 +287,16 @@
{ {
"name": "Freaku", "name": "Freaku",
"email": "", "email": "",
"discord": "[Just] Freak#4999" "discord": ""
} }
], ],
"versions": { "versions": {
"2.0.0": {
"api_version": 8,
"commit_sha": "48f9302",
"released_on": "28-07-2023",
"md5sum": "4cb6510f9f3ce151720a53a957986864"
},
"1.0.0": { "1.0.0": {
"api_version": 7, "api_version": 7,
"commit_sha": "858030b", "commit_sha": "858030b",
@ -430,20 +486,15 @@
{ {
"name": "Freaku", "name": "Freaku",
"email": "", "email": "",
"discord": "[Just] Freak#4999" "discord": ""
},
{
"name": "LoupGarou",
"email": "LoupGarou5418@outlook.com",
"discord": "ʟօʊքɢǟʀօʊ#3063"
} }
], ],
"versions": { "versions": {
"2.0.0": { "2.0.0": {
"api_version": 8, "api_version": 8,
"commit_sha": "e7a5df9", "commit_sha": "48f9302",
"released_on": "26-07-2023", "released_on": "28-07-2023",
"md5sum": "641732ef5c8c97cd5482b8cd56126310" "md5sum": "22b51a147524d84fbc249e61f21ae424"
}, },
"1.1.0": { "1.1.0": {
"api_version": 7, "api_version": 7,
@ -654,7 +705,7 @@
{ {
"name": "Freaku", "name": "Freaku",
"email": "", "email": "",
"discord": "[Just] Freak#4999" "discord": ""
} }
], ],
"versions": { "versions": {

View file

@ -1,4 +1,4 @@
# Ported by: Freaku / @[Just] Freak#4999 # Ported by your friend: Freaku
# Join BCS: # Join BCS:
# https://discord.gg/ucyaesh # https://discord.gg/ucyaesh
@ -11,7 +11,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import babase import babase
import bauiv1 as bui
import bascenev1 as bs import bascenev1 as bs
from bascenev1lib.actor.playerspaz import PlayerSpaz from bascenev1lib.actor.playerspaz import PlayerSpaz

View file

@ -0,0 +1,18 @@
# Ported by your friend: Freaku
import babase
import bascenev1 as bs
from bascenev1lib.game.chosenone import Player, ChosenOneGame
# ba_meta require api 8
# ba_meta export bascenev1.GameActivity
class FrozenOneGame(ChosenOneGame):
name = 'Frozen One'
def _set_chosen_one_player(self, player: Player) -> None:
super()._set_chosen_one_player(player)
if hasattr(player, 'actor'):
player.actor.frozen = True
player.actor.node.frozen = 1

View file

@ -0,0 +1,48 @@
# Made by your friend: Freaku
import babase
import bascenev1 as bs
import random
from bascenev1lib.actor.bomb import Bomb
from bascenev1lib.game.meteorshower import Player, MeteorShowerGame
# ba_meta require api 8
# ba_meta export bascenev1.GameActivity
class IcyEmitsGame(MeteorShowerGame):
name = 'Icy Emits'
@classmethod
def get_supported_maps(cls, sessiontype):
return ['Lake Frigid', 'Hockey Stadium']
def _drop_bomb_cluster(self) -> None:
delay = 0.0
for _i in range(random.randrange(1, 3)):
# Drop them somewhere within our bounds with velocity pointing
# toward the opposite side.
pos = (-7.3 + 15.3 * random.random(), 5.3,
-5.5 + 2.1 * random.random())
dropdir = (-1.0 if pos[0] > 0 else 1.0)
vel = (0, 10, 0)
bs.timer(delay, babase.Call(self._drop_bomb, pos, vel))
delay += 0.1
self._set_meteor_timer()
def _drop_bomb(self, position, velocity):
random_xpositions = [-10, -9, -8, -7, -6, -5, -
4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
random_zpositions = [-5, -4.5, -4, -3.5, -3, -2.5, -2, -
1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5]
bomb_position = (random.choice(random_xpositions), 0.2, random.choice(random_zpositions))
Bomb(position=bomb_position, velocity=velocity, bomb_type='ice').autoretain()
# ba_meta export plugin
class byFreaku(babase.Plugin):
def __init__(self):
## Campaign support ##
randomPic = ['lakeFrigidPreview', 'hockeyStadiumPreview']
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 ## ## Original creator: byANG3L ##
## Made by: Freaku / @[Just] Freak#4999 ## ## Made by: Freaku ##
## From: BSWorld Modpack (https://youtu.be/1TN56NLlShE) ## ## From: BSWorld Modpack (https://youtu.be/1TN56NLlShE) ##
@ -16,73 +16,63 @@ from __future__ import annotations
# def spawnAllMap(self) # def spawnAllMap(self)
# ba_meta require api 7 # ba_meta require api 8
from typing import TYPE_CHECKING, overload from typing import TYPE_CHECKING, overload
import _ba import _babase
import ba import babase
import random import random
from bastd.gameutils import SharedObjects import bascenev1 as bs
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(ba.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: Optional[int] = None self._starttime_ms: int | None = None
self.node = ba.newnode('text', attrs={'v_attach': 'top', 'h_attach': 'center', 'h_align': 'center', 'color': ( 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': ''}) 1, 1, 0.5, 1), 'flatness': 0.5, 'shadow': 0.5, 'position': (0, -70), 'scale': 0, 'text': ''})
self.inputnode = ba.newnode('timedisplay', attrs={ self.inputnode = bs.newnode(
'timemin': 0, 'showsubseconds': True}) 'timedisplay', attrs={'timemin': 0, 'showsubseconds': True}
)
self.inputnode.connectattr('output', self.node, 'text') self.inputnode.connectattr('output', self.node, 'text')
def start(self) -> None: def start(self) -> None:
tval = ba.time(timeformat=ba.TimeFormat.MILLISECONDS) """Start the timer."""
tval = int(bs.time() * 1000.0)
assert isinstance(tval, int) assert isinstance(tval, int)
self._starttime_ms = tval self._starttime_ms = tval
self.inputnode.time1 = self._starttime_ms self.inputnode.time1 = self._starttime_ms
ba.getactivity().globalsnode.connectattr('time', self.inputnode, 'time2') bs.getactivity().globalsnode.connectattr(
'time', self.inputnode, 'time2'
)
def has_started(self) -> bool: def has_started(self) -> bool:
"""Return whether this timer has started yet."""
return self._starttime_ms is not None return self._starttime_ms is not None
def stop(self, def stop(self, endtime: int | float | None = None) -> None:
endtime: Union[int, float] = None, """End the timer.
timeformat: ba.TimeFormat = ba.TimeFormat.SECONDS) -> None:
If 'endtime' is not None, it is used when calculating
the final display time; otherwise the current time is used.
"""
if endtime is None: if endtime is None:
endtime = ba.time(timeformat=ba.TimeFormat.MILLISECONDS) endtime = bs.time()
timeformat = ba.TimeFormat.MILLISECONDS
if self._starttime_ms is None: if self._starttime_ms is None:
print('Warning: OnTimer.stop() called without start() first') logging.warning(
'OnScreenTimer.stop() called without first calling start()'
)
else: else:
endtime_ms: int endtime_ms = int(endtime * 1000)
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}')
self.inputnode.timemax = endtime_ms - self._starttime_ms self.inputnode.timemax = endtime_ms - self._starttime_ms
# Overloads so type checker knows our exact return type based in args.
@overload def getstarttime(self) -> float:
def getstarttime(self, timeformat: Literal[ba.TimeFormat.SECONDS] = ba.TimeFormat.SECONDS) -> float: """Return the scene-time when start() was called.
...
@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.
Time will be returned in seconds if timeformat is SECONDS or Time will be returned in seconds if timeformat is SECONDS or
milliseconds if it is MILLISECONDS. milliseconds if it is MILLISECONDS.
@ -90,15 +80,11 @@ class OnTimer(ba.Actor):
val_ms: Any val_ms: Any
if self._starttime_ms is None: if self._starttime_ms is None:
print('WARNING: getstarttime() called on un-started timer') print('WARNING: getstarttime() called on un-started timer')
val_ms = ba.time(timeformat=ba.TimeFormat.MILLISECONDS) val_ms = int(bs.time() * 1000.0)
else: else:
val_ms = self._starttime_ms val_ms = self._starttime_ms
assert isinstance(val_ms, int) assert isinstance(val_ms, int)
if timeformat is ba.TimeFormat.SECONDS: return 0.001 * val_ms
return 0.001 * val_ms
if timeformat is ba.TimeFormat.MILLISECONDS:
return val_ms
raise ValueError(f'invalid timeformat: {timeformat}')
@property @property
def starttime(self) -> float: def starttime(self) -> float:
@ -107,12 +93,12 @@ class OnTimer(ba.Actor):
def handlemessage(self, msg: Any) -> Any: def handlemessage(self, msg: Any) -> Any:
# if we're asked to die, just kill our node/timer # if we're asked to die, just kill our node/timer
if isinstance(msg, ba.DieMessage): if isinstance(msg, bs.DieMessage):
if self.node: if self.node:
self.node.delete() self.node.delete()
class Player(ba.Player['Team']): class Player(bs.Player['Team']):
"""Our player type for this game.""" """Our player type for this game."""
def __init__(self) -> None: def __init__(self) -> None:
@ -120,33 +106,33 @@ class Player(ba.Player['Team']):
self.death_time: Optional[float] = None self.death_time: Optional[float] = None
class Team(ba.Team[Player]): class Team(bs.Team[Player]):
"""Our team type for this game.""" """Our team type for this game."""
# ba_meta export game # ba_meta export bascenev1.GameActivity
class MGgame(ba.TeamGameActivity[Player, Team]): 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 = [ba.BoolSetting( available_settings = [bs.BoolSetting(
'Epic Mode', default=False), ba.BoolSetting('Enable Bottom Credits', True)] 'Epic Mode', default=False), bs.BoolSetting('Enable Bottom Credits', True)]
scoreconfig = ba.ScoreConfig(label='Survived', scoretype=ba.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).
announce_player_deaths = True announce_player_deaths = True
# we're currently hard-coded for one map.. # we're currently hard-coded for one map..
@classmethod @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'] return ['Sky Tiles']
# We support teams, free-for-all, and co-op sessions. # We support teams, free-for-all, and co-op sessions.
@classmethod @classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool: def supports_session_type(cls, sessiontype: Type[bs.Session]) -> bool:
return (issubclass(sessiontype, ba.DualTeamSession) return (issubclass(sessiontype, bs.DualTeamSession)
or issubclass(sessiontype, ba.FreeForAllSession) or issubclass(sessiontype, bs.FreeForAllSession)
or issubclass(sessiontype, ba.CoopSession)) or issubclass(sessiontype, babase.CoopSession))
def __init__(self, settings: dict): def __init__(self, settings: dict):
super().__init__(settings) super().__init__(settings)
@ -157,14 +143,14 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self.credit_text = bool(settings['Enable Bottom Credits']) self.credit_text = bool(settings['Enable Bottom Credits'])
# Some base class overrides: # Some base class overrides:
self.default_music = (ba.MusicType.EPIC self.default_music = (bs.MusicType.EPIC
if self._epic_mode else ba.MusicType.SURVIVAL) if self._epic_mode else bs.MusicType.SURVIVAL)
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 = ba.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 = ba.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
@ -172,46 +158,46 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self._lastPlayerDeathTime = None self._lastPlayerDeathTime = None
self._spawnCenter = (-3.17358, 2.75764, -2.99124) self._spawnCenter = (-3.17358, 2.75764, -2.99124)
self._mapFGPModel = ba.getmodel('buttonSquareOpaque') self._mapFGPModel = bs.getmesh('buttonSquareOpaque')
self._mapFGPDefaultTex = ba.gettexture('achievementOffYouGo') self._mapFGPDefaultTex = bs.gettexture('achievementOffYouGo')
self._mapFGCurseTex = ba.gettexture('powerupCurse') self._mapFGCurseTex = bs.gettexture('powerupCurse')
self._mapFGHealthTex = ba.gettexture('powerupHealth') self._mapFGHealthTex = bs.gettexture('powerupHealth')
self._mapFGIceTex = ba.gettexture('powerupIceBombs') self._mapFGIceTex = bs.gettexture('powerupIceBombs')
self._mapFGImpactTex = ba.gettexture('powerupImpactBombs') self._mapFGImpactTex = bs.gettexture('powerupImpactBombs')
self._mapFGMinesTex = ba.gettexture('powerupLandMines') self._mapFGMinesTex = bs.gettexture('powerupLandMines')
self._mapFGPunchTex = ba.gettexture('powerupPunch') self._mapFGPunchTex = bs.gettexture('powerupPunch')
self._mapFGShieldTex = ba.gettexture('powerupShield') self._mapFGShieldTex = bs.gettexture('powerupShield')
self._mapFGStickyTex = ba.gettexture('powerupStickyBombs') self._mapFGStickyTex = bs.gettexture('powerupStickyBombs')
self._mapFGSpaz = ba.gettexture('neoSpazIcon') self._mapFGSpaz = bs.gettexture('neoSpazIcon')
self._mapFGZoe = ba.gettexture('zoeIcon') self._mapFGZoe = bs.gettexture('zoeIcon')
self._mapFGSnake = ba.gettexture('ninjaIcon') self._mapFGSnake = bs.gettexture('ninjaIcon')
self._mapFGKronk = ba.gettexture('kronkIcon') self._mapFGKronk = bs.gettexture('kronkIcon')
self._mapFGMel = ba.gettexture('melIcon') self._mapFGMel = bs.gettexture('melIcon')
self._mapFGJack = ba.gettexture('jackIcon') self._mapFGJack = bs.gettexture('jackIcon')
self._mapFGSanta = ba.gettexture('santaIcon') self._mapFGSanta = bs.gettexture('santaIcon')
self._mapFGFrosty = ba.gettexture('frostyIcon') self._mapFGFrosty = bs.gettexture('frostyIcon')
self._mapFGBones = ba.gettexture('bonesIcon') self._mapFGBones = bs.gettexture('bonesIcon')
self._mapFGBernard = ba.gettexture('bearIcon') self._mapFGBernard = bs.gettexture('bearIcon')
self._mapFGPascal = ba.gettexture('penguinIcon') self._mapFGPascal = bs.gettexture('penguinIcon')
self._mapFGAli = ba.gettexture('aliIcon') self._mapFGAli = bs.gettexture('aliIcon')
self._mapFGRobot = ba.gettexture('cyborgIcon') self._mapFGRobot = bs.gettexture('cyborgIcon')
self._mapFGAgent = ba.gettexture('agentIcon') self._mapFGAgent = bs.gettexture('agentIcon')
self._mapFGGrumbledorf = ba.gettexture('wizardIcon') self._mapFGGrumbledorf = bs.gettexture('wizardIcon')
self._mapFGPixel = ba.gettexture('pixieIcon') self._mapFGPixel = bs.gettexture('pixieIcon')
self._imageTextDefault = ba.gettexture('bg') self._imageTextDefault = bs.gettexture('bg')
self._circleTex = ba.gettexture('circleShadow') self._circleTex = bs.gettexture('circleShadow')
self._image = ba.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 = ba.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,
@ -223,7 +209,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
'h_align': 'center', 'h_align': 'center',
'v_align': 'center'}) 'v_align': 'center'})
self._textLevel = ba.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,
@ -236,21 +222,21 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
'h_align': 'center', 'h_align': 'center',
'v_align': 'center'}) 'v_align': 'center'})
self._imageCircle = ba.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 = ba.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 = ba.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),
@ -260,12 +246,12 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
super().on_transition_in() super().on_transition_in()
self._bellLow = ba.getsound('bellLow') self._bellLow = bs.getsound('bellLow')
self._bellMed = ba.getsound('bellMed') self._bellMed = bs.getsound('bellMed')
self._bellHigh = ba.getsound('bellHigh') self._bellHigh = bs.getsound('bellHigh')
self._tickSound = ba.getsound('tick') self._tickSound = bs.getsound('tick')
self._tickFinal = ba.getsound('powerup01') self._tickFinal = bs.getsound('powerup01')
self._scoreSound = ba.getsound('score') self._scoreSound = bs.getsound('score')
self._image.opacity = 1 self._image.opacity = 1
self._textCounter.opacity = 1 self._textCounter.opacity = 1
@ -282,8 +268,8 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
if self._levelStage == 1: if self._levelStage == 1:
timeStart = 6 timeStart = 6
ba.timer(timeStart, self._randomPlatform) bs.timer(timeStart, self._randomPlatform)
ba.timer(timeStart, self.startCounter) bs.timer(timeStart, self.startCounter)
def on_begin(self) -> None: def on_begin(self) -> None:
super().on_begin() super().on_begin()
@ -308,7 +294,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self.coldel15 = True self.coldel15 = True
self.coldel16 = True self.coldel16 = True
if self.credit_text: if self.credit_text:
t = ba.newnode('text', t = bs.newnode('text',
attrs={'text': "Made by Freaku\nOriginally for 1.4: byANG3L", # Disable 'Enable Bottom Credits' when making playlist, No need to edit this lovely... attrs={'text': "Made by Freaku\nOriginally for 1.4: byANG3L", # Disable 'Enable Bottom Credits' when making playlist, No need to edit this lovely...
'scale': 0.7, 'scale': 0.7,
'position': (0, 0), 'position': (0, 0),
@ -317,13 +303,13 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
'color': (1, 1, 1), 'color': (1, 1, 1),
'h_align': 'center', 'h_align': 'center',
'v_attach': 'bottom'}) 'v_attach': 'bottom'})
self.spawnAllMap() self.spawnAllMap()
self.flashHide() 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).
ba.timer(5, self._check_end_game) bs.timer(5, self._check_end_game)
self._dingSound = ba.getsound('dingSmall') self._dingSound = bs.getsound('dingSmall')
self._dingSoundHigh = ba.getsound('dingSmallHigh') self._dingSoundHigh = bs.getsound('dingSmallHigh')
def startCounter(self): def startCounter(self):
self._textCounter.text = '10' self._textCounter.text = '10'
@ -339,44 +325,44 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
def count1(): def count1():
def countFinal(): def countFinal():
self._textCounter.text = '' self._textCounter.text = ''
ba.playsound(self._tickFinal) self._tickFinal.play()
self._stop() self._stop()
self._textCounter.text = '1' self._textCounter.text = '1'
ba.playsound(self._tickSound) self._tickSound.play()
ba.timer(1, countFinal) bs.timer(1, countFinal)
self._textCounter.text = '2' self._textCounter.text = '2'
ba.playsound(self._tickSound) self._tickSound.play()
ba.timer(1, count1) bs.timer(1, count1)
self._textCounter.text = '3' self._textCounter.text = '3'
ba.playsound(self._tickSound) self._tickSound.play()
ba.timer(1, count2) bs.timer(1, count2)
self._textCounter.text = '4' self._textCounter.text = '4'
ba.playsound(self._tickSound) self._tickSound.play()
ba.timer(1, count3) bs.timer(1, count3)
self._textCounter.text = '5' self._textCounter.text = '5'
ba.playsound(self._tickSound) self._tickSound.play()
ba.timer(1, count4) bs.timer(1, count4)
self._textCounter.text = '6' self._textCounter.text = '6'
ba.playsound(self._tickSound) self._tickSound.play()
ba.timer(1, count5) bs.timer(1, count5)
self._textCounter.text = '7' self._textCounter.text = '7'
ba.playsound(self._tickSound) self._tickSound.play()
ba.timer(1, count6) bs.timer(1, count6)
self._textCounter.text = '8' self._textCounter.text = '8'
ba.playsound(self._tickSound) self._tickSound.play()
ba.timer(1, count7) bs.timer(1, count7)
self._textCounter.text = '9' self._textCounter.text = '9'
ba.playsound(self._tickSound) self._tickSound.play()
ba.timer(1, count8) bs.timer(1, count8)
ba.timer(1, count9) bs.timer(1, count9)
def on_player_join(self, player: Player) -> None: def on_player_join(self, player: Player) -> None:
# Don't allow joining after we start # Don't allow joining after we start
# (would enable leave/rejoin tomfoolery). # (would enable leave/rejoin tomfoolery).
if self.has_begun(): if self.has_begun():
ba.screenmessage( bs.broadcastmessage(
ba.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.
@ -393,12 +379,12 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self._check_end_game() self._check_end_game()
# overriding the default character spawning.. # 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) spaz = self.spawn_player_spaz(player)
pos = (self._spawnCenter[0] + random.uniform(-1.5, 2.5), pos = (self._spawnCenter[0] + random.uniform(-1.5, 2.5),
self._spawnCenter[1], self._spawnCenter[2] + random.uniform(-2.5, 1.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(ba.StandMessage(pos)) spaz.handlemessage(bs.StandMessage(pos))
return spaz return spaz
def _randomSelect(self): def _randomSelect(self):
@ -453,17 +439,17 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
def circle3(): def circle3():
self._imageCircle3.color = (0.0, 1.0, 0.0) self._imageCircle3.color = (0.0, 1.0, 0.0)
self._imageCircle3.opacity = 1.0 self._imageCircle3.opacity = 1.0
ba.playsound(self._bellHigh) self._bellHigh.play()
ba.timer(0.2, self._doDelete) bs.timer(0.2, self._doDelete)
self._imageCircle2.color = (1.0, 1.0, 0.0) self._imageCircle2.color = (1.0, 1.0, 0.0)
self._imageCircle2.opacity = 1.0 self._imageCircle2.opacity = 1.0
ba.playsound(self._bellMed) self._bellMed.play()
ba.timer(1, circle3) bs.timer(1, circle3)
self._imageCircle.color = (1.0, 0.0, 0.0) self._imageCircle.color = (1.0, 0.0, 0.0)
self._imageCircle.opacity = 1.0 self._imageCircle.opacity = 1.0
ba.playsound(self._bellLow) self._bellLow.play()
ba.timer(1, circle2) bs.timer(1, circle2)
ba.timer(1, circle) bs.timer(1, circle)
def _randomPlatform(self): def _randomPlatform(self):
if self._levelStage == 1: if self._levelStage == 1:
@ -564,13 +550,13 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self._mixPlatform() self._mixPlatform()
def _mixPlatform(self): def _mixPlatform(self):
ba.timer(1, self.flashShow) bs.timer(1, self.flashShow)
ba.timer(3, self.flashHide) bs.timer(3, self.flashHide)
ba.timer(4, self.flashShow) bs.timer(4, self.flashShow)
ba.timer(6, self.flashHide) bs.timer(6, self.flashHide)
ba.timer(7, self.flashShow) bs.timer(7, self.flashShow)
ba.timer(9, self.flashHide) bs.timer(9, self.flashHide)
ba.timer(13.2, self.flashShow) bs.timer(13.2, self.flashShow)
def flashHide(self): def flashHide(self):
self.mapFGP.color_texture = self._mapFGPDefaultTex self.mapFGP.color_texture = self._mapFGPDefaultTex
@ -674,14 +660,14 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self.mapFGP16col.delete() self.mapFGP16col.delete()
self.coldel16 = True self.coldel16 = True
ba.timer(3.3, self._platformTexDefault) bs.timer(3.3, self._platformTexDefault)
def spawnAllMap(self): def spawnAllMap(self):
""" """
# Here's how it works: # Here's how it works:
# First, create prop with a gravity scale of 0 # 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? # 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 model (which is nothing but a button in menu) # 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 :(( # 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 # These are where we change those color-textures and is seen in-game
@ -696,130 +682,130 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
""" """
shared = SharedObjects.get() shared = SharedObjects.get()
if self.coldel: if self.coldel:
self.mapFGP = ba.newnode('prop', self.mapFGP = bs.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]}) 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 = ba.newnode('region', attrs={'position': (3, 2, -9), 'scale': ( 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)}) 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 = ba.newnode('prop', self.mapFGP2 = bs.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]}) 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 = ba.newnode('region', attrs={'position': (3, 2, -6), 'scale': ( 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)}) 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 = ba.newnode('prop', self.mapFGP3 = bs.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]}) 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 = ba.newnode('region', attrs={'position': (3, 2, -3), 'scale': ( 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)}) 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 = ba.newnode('prop', self.mapFGP4 = bs.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]}) 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 = ba.newnode('region', attrs={'position': (3, 2, 0), 'scale': ( 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)}) 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 = ba.newnode('prop', self.mapFGP5 = bs.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]}) 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 = ba.newnode('region', attrs={'position': (0, 2, -9), 'scale': ( 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)}) 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 = ba.newnode('prop', self.mapFGP6 = bs.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]}) 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 = ba.newnode('region', attrs={'position': (0, 2, -6), 'scale': ( 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)}) 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 = ba.newnode('prop', self.mapFGP7 = bs.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]}) 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 = ba.newnode('region', attrs={'position': (0, 2, -3), 'scale': ( 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)}) 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 = ba.newnode('prop', self.mapFGP8 = bs.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]}) 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 = ba.newnode('region', attrs={'position': (0, 2, 0), 'scale': ( 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)}) 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 = ba.newnode('prop', self.mapFGP9 = bs.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]}) 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 = ba.newnode('region', attrs={'position': (-3, 2, -9), 'scale': ( 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)}) 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 = ba.newnode('prop', self.mapFGP10 = bs.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]}) 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 = ba.newnode('region', attrs={'position': (-3, 2, -6), 'scale': ( 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)}) 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 = ba.newnode('prop', self.mapFGP11 = bs.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]}) 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 = ba.newnode('region', attrs={'position': (-3, 2, -3), 'scale': ( 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)}) 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 = ba.newnode('prop', self.mapFGP12 = bs.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]}) 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 = ba.newnode('region', attrs={'position': (-3, 2, 0), 'scale': ( 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)}) 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 = ba.newnode('prop', self.mapFGP13 = bs.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]}) 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 = ba.newnode('region', attrs={'position': (-6, 2, -9), 'scale': ( 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)}) 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 = ba.newnode('prop', self.mapFGP14 = bs.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]}) 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 = ba.newnode('region', attrs={'position': (-6, 2, -6), 'scale': ( 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)}) 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 = ba.newnode('prop', self.mapFGP15 = bs.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]}) 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 = ba.newnode('region', attrs={'position': (-6, 2, -3), 'scale': ( 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)}) 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 = ba.newnode('prop', self.mapFGP16 = bs.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]}) 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 = ba.newnode('region', attrs={'position': (-6, 2, 0), 'scale': ( 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)}) 3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel16 = False self.coldel16 = False
@ -843,27 +829,27 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
timeStart = 6 timeStart = 6
else: else:
timeStart = 2 timeStart = 2
ba.playsound(self._scoreSound) self._scoreSound.play()
activity = _ba.get_foreground_host_activity() activity = bs.get_foreground_host_activity()
for i in activity.players: for i in activity.players:
try: try:
i.actor.node.handlemessage(ba.CelebrateMessage(2.0)) i.actor.node.handlemessage(bs.CelebrateMessage(2.0))
except: except:
pass pass
ba.timer(timeStart, self._randomPlatform) bs.timer(timeStart, self._randomPlatform)
ba.timer(timeStart, self.startCounter) bs.timer(timeStart, self.startCounter)
self.spawnAllMap() self.spawnAllMap()
self.flashHide() self.flashHide()
# Various high-level game events come through this method. # Various high-level game events come through this method.
def handlemessage(self, msg: Any) -> Any: def handlemessage(self, msg: Any) -> Any:
if isinstance(msg, ba.PlayerDiedMessage): if isinstance(msg, bs.PlayerDiedMessage):
# Augment standard behavior. # Augment standard behavior.
super().handlemessage(msg) super().handlemessage(msg)
curtime = ba.time() curtime = bs.time()
# Record the player's moment of death. # Record the player's moment of death.
# assert isinstance(msg.spaz.player # assert isinstance(msg.spaz.player
@ -873,15 +859,15 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
# (more accurate looking). # (more accurate looking).
# In teams/ffa, allow a one-second fudge-factor so we can # In teams/ffa, allow a one-second fudge-factor so we can
# get more draws if players die basically at the same time. # 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 # Teams will still show up if we check now.. check in
# the next cycle. # 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. # Also record this for a final setting of the clock.
self._last_player_death_time = curtime self._last_player_death_time = curtime
else: else:
ba.timer(1.0, self._check_end_game) bs.timer(1.0, self._check_end_game)
else: else:
# Default handler: # Default handler:
return super().handlemessage(msg) return super().handlemessage(msg)
@ -897,7 +883,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
# In co-op, we go till everyone is dead.. otherwise we go # In co-op, we go till everyone is dead.. otherwise we go
# until one team remains. # until one team remains.
if isinstance(self.session, ba.CoopSession): if isinstance(self.session, bs.CoopSession):
if living_team_count <= 0: if living_team_count <= 0:
self.end_game() self.end_game()
else: else:
@ -905,7 +891,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self.end_game() self.end_game()
def end_game(self) -> None: def end_game(self) -> None:
cur_time = ba.time() cur_time = bs.time()
assert self._timer is not None assert self._timer is not None
start_time = self._timer.getstarttime() start_time = self._timer.getstarttime()
@ -936,7 +922,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
# Ok now calc game results: set a score for each team and then tell # Ok now calc game results: set a score for each team and then tell
# the game to end. # the game to end.
results = ba.GameResults() results = bs.GameResults()
# Remember that 'free-for-all' mode is simply a special form # Remember that 'free-for-all' mode is simply a special form
# of 'teams' mode where each player gets their own team, so we can # of 'teams' mode where each player gets their own team, so we can
@ -965,7 +951,7 @@ class MGdefs():
(0.0, 0.0, 0.0) + (29.23565494, 14.19991443, 29.92689344) (0.0, 0.0, 0.0) + (29.23565494, 14.19991443, 29.92689344)
class MGmap(ba.Map): class MGmap(bs.Map):
defs = MGdefs() defs = MGdefs()
name = 'Sky Tiles' name = 'Sky Tiles'
@ -981,23 +967,23 @@ class MGmap(ba.Map):
@classmethod @classmethod
def on_preload(cls) -> Any: def on_preload(cls) -> Any:
data: Dict[str, Any] = { data: Dict[str, Any] = {
'bgtex': ba.gettexture('menuBG'), 'bgtex': bs.gettexture('menuBG'),
'bgmodel': ba.getmodel('thePadBG') 'bgmesh': bs.getmesh('thePadBG')
} }
return data return data
def __init__(self) -> None: def __init__(self) -> None:
super().__init__() super().__init__()
shared = SharedObjects.get() shared = SharedObjects.get()
self.node = ba.newnode( self.node = bs.newnode(
'terrain', 'terrain',
attrs={ attrs={
'model': self.preloaddata['bgmodel'], 'mesh': self.preloaddata['bgmesh'],
'lighting': False, 'lighting': False,
'background': True, 'background': True,
'color_texture': self.preloaddata['bgtex'] 'color_texture': self.preloaddata['bgtex']
}) })
gnode = ba.getactivity().globalsnode gnode = bs.getactivity().globalsnode
gnode.tint = (1.3, 1.2, 1.0) gnode.tint = (1.3, 1.2, 1.0)
gnode.ambient_color = (1.3, 1.2, 1.0) gnode.ambient_color = (1.3, 1.2, 1.0)
gnode.vignette_outer = (0.57, 0.57, 0.57) gnode.vignette_outer = (0.57, 0.57, 0.57)
@ -1006,12 +992,12 @@ class MGmap(ba.Map):
gnode.vr_near_clip = 0.5 gnode.vr_near_clip = 0.5
ba._map.register_map(MGmap) bs._map.register_map(MGmap)
# ba_meta export plugin # ba_meta export plugin
class byFreaku(ba.Plugin): class byFreaku(babase.Plugin):
def __init__(self): def __init__(self):
## Campaign support ## ## Campaign support ##
ba.app.add_coop_practice_level(ba.Level(name='Memory Game', displayname='${GAME}', gametype=MGgame, settings={ babase.app.classic.add_coop_practice_level(bs.Level(
}, preview_texture_name='achievementOffYouGo')) name='Memory Game', displayname='${GAME}', gametype=MGgame, settings={}, preview_texture_name='achievementOffYouGo'))

View file

@ -1,5 +1,5 @@
# Made by MattZ45986 on GitHub # Made by MattZ45986 on GitHub
# Ported by: Freaku / @[Just] Freak#4999 # Ported by your friend: Freaku
# Bug Fixes & Improvements as well... # Bug Fixes & Improvements as well...
@ -10,76 +10,69 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import _ba import _babase
import ba
import random import random
import math import math
from bastd.actor.flag import Flag, FlagPickedUpMessage import bascenev1 as bs
from bastd.actor.playerspaz import PlayerSpaz from bascenev1lib.actor.flag import Flag, FlagPickedUpMessage
from bascenev1lib.actor.playerspaz import PlayerSpaz
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any, Type, List, Dict, Tuple, Union, Sequence, Optional from typing import Any, Type, List, Dict, Tuple, Union, Sequence, Optional
class Player(ba.Player['Team']): class Player(bs.Player['Team']):
def __init__(self) -> None: def __init__(self) -> None:
self.done: bool = False self.done: bool = False
self.survived: bool = True self.survived: bool = True
class Team(ba.Team[Player]): class Team(bs.Team[Player]):
def __init__(self) -> None: def __init__(self) -> None:
self.score = 0 self.score = 0
# ba_meta require api 7 # ba_meta require api 8
# ba_meta export game # ba_meta export bascenev1.GameActivity
class MFGame(ba.TeamGameActivity[Player, Team]): class MFGame(bs.TeamGameActivity[Player, Team]):
name = 'Musical Flags' name = 'Musical Flags'
description = "Don't be the one stuck without a flag!" description = "Don't be the one stuck without a flag!"
@classmethod @classmethod
def get_available_settings( def get_available_settings(
cls, sessiontype: Type[ba.Session]) -> List[ba.Setting]: cls, sessiontype: Type[bs.Session]) -> List[babase.Setting]:
settings = [ settings = [
ba.IntChoiceSetting( bs.IntSetting(
'Time Limit', 'Max Round Time',
choices=[ min_value=15,
('None', 0), default=25,
('1 Minute', 60), increment=5,
('2 Minutes', 120),
('5 Minutes', 300),
('10 Minutes', 600),
('20 Minutes', 1200),
],
default=0,
), ),
ba.BoolSetting('Epic Mode', default=False), bs.BoolSetting('Epic Mode', default=False),
ba.BoolSetting('Enable Running', default=True), bs.BoolSetting('Enable Running', default=True),
ba.BoolSetting('Enable Punching', default=False), bs.BoolSetting('Enable Punching', default=False),
ba.BoolSetting('Enable Bottom Credit', True) bs.BoolSetting('Enable Bottom Credit', True)
] ]
return settings return settings
@classmethod @classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool: def supports_session_type(cls, sessiontype: Type[bs.Session]) -> bool:
return (issubclass(sessiontype, ba.DualTeamSession) return (issubclass(sessiontype, bs.DualTeamSession)
or issubclass(sessiontype, ba.FreeForAllSession)) or issubclass(sessiontype, bs.FreeForAllSession))
@classmethod @classmethod
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]: def get_supported_maps(cls, sessiontype: Type[bs.Session]) -> List[str]:
return ['Doom Shroom'] return ['Doom Shroom']
def __init__(self, settings: dict): def __init__(self, settings: dict):
super().__init__(settings) super().__init__(settings)
self.nodes = [] self.nodes = []
self._dingsound = ba.getsound('dingSmall') self._dingsound = bs.getsound('dingSmall')
self._epic_mode = bool(settings['Epic Mode']) self._epic_mode = bool(settings['Epic Mode'])
self.credit_text = bool(settings['Enable Bottom Credit']) self.credit_text = bool(settings['Enable Bottom Credit'])
self._time_limit = float(settings['Time Limit'])
self.is_punch = bool(settings['Enable Punching']) self.is_punch = bool(settings['Enable Punching'])
self.is_run = bool(settings['Enable Running']) self.is_run = bool(settings['Enable Running'])
self._textRound = ba.newnode('text', self._textRound = bs.newnode('text',
attrs={'text': '', attrs={'text': '',
'position': (0, -38), 'position': (0, -38),
'scale': 1, 'scale': 1,
@ -91,10 +84,16 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
'h_attach': 'center', 'h_attach': 'center',
'h_align': 'center', 'h_align': 'center',
'v_align': 'center'}) 'v_align': 'center'})
self.round_time = int(settings['Max Round Time'])
self.reset_round_time = int(settings['Max Round Time'])
self.should_die_occur = True
self.round_time_textnode = bs.newnode('text',
attrs={
'text': "", 'flatness': 1.0, 'h_align': 'center', 'h_attach': 'center', 'v_attach': 'top', 'v_align': 'center', 'position': (0, -15), 'scale': 0.9, 'color': (1, 0.7, 0.9)})
self.slow_motion = self._epic_mode self.slow_motion = self._epic_mode
# A cool music, matching our gamemode theme # A cool music, matching our gamemode theme
self.default_music = ba.MusicType.FLAG_CATCHER self.default_music = bs.MusicType.FLAG_CATCHER
def get_instance_description(self) -> Union[str, Sequence]: def get_instance_description(self) -> Union[str, Sequence]:
return 'Catch Flag for yourself' return 'Catch Flag for yourself'
@ -104,8 +103,8 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
def on_player_join(self, player: Player) -> None: def on_player_join(self, player: Player) -> None:
if self.has_begun(): if self.has_begun():
ba.screenmessage( bs.broadcastmessage(
ba.Lstr(resource='playerDelayedJoinText', bs.Lstr(resource='playerDelayedJoinText',
subs=[('${PLAYER}', player.getname(full=True))]), subs=[('${PLAYER}', player.getname(full=True))]),
color=(0, 1, 0), transient=True) color=(0, 1, 0), transient=True)
player.survived = False player.survived = False
@ -115,7 +114,7 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
def on_player_leave(self, player: Player) -> None: def on_player_leave(self, player: Player) -> None:
super().on_player_leave(player) super().on_player_leave(player)
# A departing player may trigger game-over. # A departing player may trigger game-over.
self.checkEnd() bs.timer(0, self.checkEnd)
def on_begin(self) -> None: def on_begin(self) -> None:
super().on_begin() super().on_begin()
@ -124,9 +123,8 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
self.nodes = [] self.nodes = []
self.flags = [] self.flags = []
self.spawned = [] self.spawned = []
self.setup_standard_time_limit(self._time_limit)
if self.credit_text: if self.credit_text:
t = ba.newnode('text', t = bs.newnode('text',
attrs={'text': "Ported by Freaku\nMade by MattZ45986", # Disable 'Enable Bottom Credits' when making playlist, No need to edit this lovely... attrs={'text': "Ported by Freaku\nMade by MattZ45986", # Disable 'Enable Bottom Credits' when making playlist, No need to edit this lovely...
'scale': 0.7, 'scale': 0.7,
'position': (0, 0), 'position': (0, 0),
@ -137,7 +135,32 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
'v_attach': 'bottom'}) 'v_attach': 'bottom'})
self.makeRound() self.makeRound()
self._textRound.text = 'Round ' + str(self.roundNum) self._textRound.text = 'Round ' + str(self.roundNum)
ba.timer(5, self.checkEnd) bs.timer(3, self.checkEnd)
self.keepcalling = bs.timer(1, self._timeround, True)
def _timeround(self):
if self.round_time == 0 and self.should_die_occur:
self.should_die_occur = False
self.round_time_textnode.opacity = 0
bs.broadcastmessage('Proceeding Round...')
for player in self.spawned:
if not player.done:
try:
player.survived = False
player.actor.handlemessage(bs.StandMessage((0, 3, -2)))
bs.timer(0.5, bs.Call(player.actor.handlemessage, bs.FreezeMessage()))
bs.timer(1.5, bs.Call(player.actor.handlemessage, bs.FreezeMessage()))
bs.timer(2.5, bs.Call(player.actor.handlemessage, bs.FreezeMessage()))
bs.timer(3, bs.Call(player.actor.handlemessage, bs.ShouldShatterMessage()))
except:
pass
bs.timer(3.5, self.killRound)
bs.timer(3.55, self.makeRound)
self.round_time_textnode.opacity = 0
self.round_time = self.reset_round_time
else:
self.round_time_textnode.text = "Time: " + str(self.round_time)
self.round_time -= 1
def makeRound(self): def makeRound(self):
for player in self.players: for player in self.players:
@ -147,6 +170,9 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
self._textRound.text = 'Round ' + str(self.roundNum) self._textRound.text = 'Round ' + str(self.roundNum)
self.flags = [] self.flags = []
self.spawned = [] self.spawned = []
self.should_die_occur = True
self.round_time = self.reset_round_time
self.round_time_textnode.opacity = 1
angle = random.randint(0, 359) angle = random.randint(0, 359)
c = 0 c = 0
for player in self.players: for player in self.players:
@ -165,6 +191,13 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
self.checkEnd() self.checkEnd()
colors = [(1, 0, 0), (0, 1, 0), (0, 0, 1), (1, 1, 0), (1, 0, 1), (0, 1, 1), (0, 0, 0), colors = [(1, 0, 0), (0, 1, 0), (0, 0, 1), (1, 1, 0), (1, 0, 1), (0, 1, 1), (0, 0, 0),
(0.5, 0.8, 0), (0, 0.8, 0.5), (0.8, 0.25, 0.7), (0, 0.27, 0.55), (2, 2, 0.6), (0.4, 3, 0.85)] (0.5, 0.8, 0), (0, 0.8, 0.5), (0.8, 0.25, 0.7), (0, 0.27, 0.55), (2, 2, 0.6), (0.4, 3, 0.85)]
# Add support for more than 13 players
if c > 12:
for i in range(c-12):
colors.append((random.uniform(0.1, 1), random.uniform(
0.1, 1), random.uniform(0.1, 1)))
# Smart Mathematics: # Smart Mathematics:
# All Flags spawn same distance from the players # All Flags spawn same distance from the players
for i in range(c-1): for i in range(c-1):
@ -179,19 +212,19 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
self.numPickedUp = 0 self.numPickedUp = 0
for player in self.players: for player in self.players:
if player.is_alive(): if player.is_alive():
player.actor.handlemessage(ba.DieMessage()) player.actor.handlemessage(bs.DieMessage())
for flag in self.flags: for flag in self.flags:
flag.node.delete() flag.node.delete()
for light in self.nodes: for light in self.nodes:
light.delete() light.delete()
def spawn_player(self, player: Player, pos: tuple = (0, 0, 0)) -> ba.Actor: def spawn_player(self, player: Player, pos: tuple = (0, 0, 0)) -> bs.Actor:
spaz = self.spawn_player_spaz(player) spaz = self.spawn_player_spaz(player)
if pos == (0, 0, 0): if pos == (0, 0, 0):
pos = (-.5+random.random()*2, 3+random.random()*2, -5+random.random()*2) pos = (-.5+random.random()*2, 3+random.random()*2, -5+random.random()*2)
spaz.connect_controls_to_player(enable_punch=self.is_punch, spaz.connect_controls_to_player(enable_punch=self.is_punch,
enable_bomb=False, enable_run=self.is_run) enable_bomb=False, enable_run=self.is_run)
spaz.handlemessage(ba.StandMessage(pos)) spaz.handlemessage(bs.StandMessage(pos))
return spaz return spaz
def check_respawn(self, player): def check_respawn(self, player):
@ -200,36 +233,38 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
def handlemessage(self, msg: Any) -> Any: def handlemessage(self, msg: Any) -> Any:
if isinstance(msg, ba.PlayerDiedMessage): if isinstance(msg, bs.PlayerDiedMessage):
super().handlemessage(msg) super().handlemessage(msg)
player = msg.getplayer(Player) player = msg.getplayer(Player)
ba.timer(0.1, ba.Call(self.check_respawn, player)) bs.timer(0.1, bs.Call(self.check_respawn, player))
ba.timer(0.5, self.checkEnd) bs.timer(0.5, self.checkEnd)
elif isinstance(msg, FlagPickedUpMessage): elif isinstance(msg, FlagPickedUpMessage):
self.numPickedUp += 1 self.numPickedUp += 1
msg.node.getdelegate(PlayerSpaz, True).getplayer(Player, True).done = True msg.node.getdelegate(PlayerSpaz, True).getplayer(Player, True).done = True
l = ba.newnode('light', l = bs.newnode('light',
owner=None, owner=None,
attrs={'color': msg.node.color, attrs={'color': msg.node.color,
'position': (msg.node.position_center), 'position': (msg.node.position_center),
'intensity': 1}) 'intensity': 1})
self.nodes.append(l) self.nodes.append(l)
msg.flag.handlemessage(ba.DieMessage()) msg.flag.handlemessage(bs.DieMessage())
msg.node.handlemessage(ba.DieMessage()) msg.node.handlemessage(bs.DieMessage())
msg.node.delete() msg.node.delete()
if self.numPickedUp == len(self.flags): if self.numPickedUp == len(self.flags):
self.round_time_textnode.opacity = 0
self.round_time = self.reset_round_time
for player in self.spawned: for player in self.spawned:
if not player.done: if not player.done:
try: try:
player.survived = False player.survived = False
ba.screenmessage("No Flag? "+player.getname()) bs.broadcastmessage("No Flag? "+player.getname())
player.actor.handlemessage(ba.StandMessage((0, 3, -2))) player.actor.handlemessage(bs.StandMessage((0, 3, -2)))
ba.timer(0.5, ba.Call(player.actor.handlemessage, ba.FreezeMessage())) bs.timer(0.5, bs.Call(player.actor.handlemessage, bs.FreezeMessage()))
ba.timer(3, ba.Call(player.actor.handlemessage, ba.ShouldShatterMessage())) bs.timer(3, bs.Call(player.actor.handlemessage, bs.ShouldShatterMessage()))
except: except:
pass pass
ba.timer(3.5, self.killRound) bs.timer(3.5, self.killRound)
ba.timer(3.55, self.makeRound) bs.timer(3.55, self.makeRound)
else: else:
return super().handlemessage(msg) return super().handlemessage(msg)
return None return None
@ -243,10 +278,10 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
for player in self.players: for player in self.players:
if player.survived: if player.survived:
player.team.score += 10 player.team.score += 10
ba.timer(2.5, self.end_game) bs.timer(2.5, self.end_game)
def end_game(self) -> None: def end_game(self) -> None:
results = ba.GameResults() results = bs.GameResults()
for team in self.teams: for team in self.teams:
results.set_team_score(team, team.score) results.set_team_score(team, team.score)
self.end(results=results) self.end(results=results)

View file

@ -1,6 +1,6 @@
# Volley Ball (final) # Volley Ball (final)
# Made by your friend: Freaku / @[Just] Freak#4999 # Made by your friend: Freaku
# Join BCS: # Join BCS:
@ -28,25 +28,24 @@
## 2022 ## 2022
- Code cleanup - Code cleanup
- No longer requires a plugin
- More accurate Goal positions - More accurate Goal positions
""" """
# ba_meta require api 7 # ba_meta require api 8
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import _ba import babase
import ba
import random import random
from bastd.actor.playerspaz import PlayerSpaz import bascenev1 as bs
from bastd.actor.scoreboard import Scoreboard from bascenev1lib.actor.playerspaz import PlayerSpaz
from bastd.actor.powerupbox import PowerupBoxFactory from bascenev1lib.actor.scoreboard import Scoreboard
from bastd.actor.bomb import BombFactory from bascenev1lib.actor.powerupbox import PowerupBoxFactory
from bastd.gameutils import SharedObjects from bascenev1lib.actor.bomb import BombFactory
from bascenev1lib.gameutils import SharedObjects
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any, Sequence, Dict, Type, List, Optional, Union from typing import Any, Sequence, Dict, Type, List, Optional, Union
@ -59,7 +58,7 @@ class PuckDiedMessage:
self.puck = puck self.puck = puck
class Puck(ba.Actor): class Puck(bs.Actor):
def __init__(self, position: Sequence[float] = (0.0, 1.0, 0.0)): def __init__(self, position: Sequence[float] = (0.0, 1.0, 0.0)):
super().__init__() super().__init__()
shared = SharedObjects.get() shared = SharedObjects.get()
@ -72,16 +71,16 @@ class Puck(ba.Actor):
assert activity is not None assert activity is not None
assert isinstance(activity, VolleyBallGame) assert isinstance(activity, VolleyBallGame)
pmats = [shared.object_material, activity.puck_material] pmats = [shared.object_material, activity.puck_material]
self.node = ba.newnode('prop', self.node = bs.newnode('prop',
delegate=self, delegate=self,
attrs={ attrs={
'model': activity.puck_model, 'mesh': activity.puck_mesh,
'color_texture': activity.puck_tex, 'color_texture': activity.puck_tex,
'body': 'sphere', 'body': 'sphere',
'reflection': 'soft', 'reflection': 'soft',
'reflection_scale': [0.2], 'reflection_scale': [0.2],
'shadow_size': 0.6, 'shadow_size': 0.6,
'model_scale': 0.4, 'mesh_scale': 0.4,
'body_scale': 1.07, 'body_scale': 1.07,
'is_area_of_interest': True, 'is_area_of_interest': True,
'position': self._spawn_pos, 'position': self._spawn_pos,
@ -91,11 +90,11 @@ class Puck(ba.Actor):
# Since it rolls on spawn, lets make gravity # Since it rolls on spawn, lets make gravity
# to 0, and when another node (bomb/spaz) # to 0, and when another node (bomb/spaz)
# touches it. It'll act back as our normie puck! # 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 # When other node touches, it realises its new gravity_scale
def handlemessage(self, msg: Any) -> Any: def handlemessage(self, msg: Any) -> Any:
if isinstance(msg, ba.DieMessage): if isinstance(msg, bs.DieMessage):
assert self.node assert self.node
self.node.delete() self.node.delete()
activity = self._activity() activity = self._activity()
@ -103,11 +102,11 @@ class Puck(ba.Actor):
activity.handlemessage(PuckDiedMessage(self)) activity.handlemessage(PuckDiedMessage(self))
# If we go out of bounds, move back to where we started. # 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 assert self.node
self.node.position = self._spawn_pos self.node.position = self._spawn_pos
elif isinstance(msg, ba.HitMessage): elif isinstance(msg, bs.HitMessage):
assert self.node assert self.node
assert msg.force_direction is not None assert msg.force_direction is not None
self.node.handlemessage( self.node.handlemessage(
@ -128,29 +127,29 @@ class Puck(ba.Actor):
super().handlemessage(msg) super().handlemessage(msg)
class Player(ba.Player['Team']): class Player(bs.Player['Team']):
"""Our player type for this game.""" """Our player type for this game."""
class Team(ba.Team[Player]): class Team(bs.Team[Player]):
"""Our team type for this game.""" """Our team type for this game."""
def __init__(self) -> None: def __init__(self) -> None:
self.score = 0 self.score = 0
# ba_meta export game # ba_meta export bascenev1.GameActivity
class VolleyBallGame(ba.TeamGameActivity[Player, Team]): class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
name = 'Volley Ball' name = 'Volley Ball'
description = 'Score some goals.\nby \ue048Freaku' description = 'Score some goals.\nby \ue048Freaku'
available_settings = [ available_settings = [
ba.IntSetting( bs.IntSetting(
'Score to Win', 'Score to Win',
min_value=1, min_value=1,
default=1, default=1,
increment=1, increment=1,
), ),
ba.IntChoiceSetting( bs.IntChoiceSetting(
'Time Limit', 'Time Limit',
choices=[ choices=[
('None', 0), ('None', 0),
@ -162,7 +161,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
], ],
default=0, default=0,
), ),
ba.FloatChoiceSetting( bs.FloatChoiceSetting(
'Respawn Times', 'Respawn Times',
choices=[ choices=[
('Shorter', 0.25), ('Shorter', 0.25),
@ -173,36 +172,36 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
], ],
default=1.0, default=1.0,
), ),
ba.BoolSetting('Epic Mode', True), bs.BoolSetting('Epic Mode', True),
ba.BoolSetting('Night Mode', False), bs.BoolSetting('Night Mode', False),
ba.BoolSetting('Icy Floor', True), bs.BoolSetting('Icy Floor', True),
ba.BoolSetting('Disable Punch', False), bs.BoolSetting('Disable Punch', False),
ba.BoolSetting('Disable Bombs', False), bs.BoolSetting('Disable Bombs', False),
ba.BoolSetting('Enable Bottom Credits', True), bs.BoolSetting('Enable Bottom Credits', True),
] ]
default_music = ba.MusicType.HOCKEY default_music = bs.MusicType.HOCKEY
@classmethod @classmethod
def supports_session_type(cls, sessiontype: Type[ba.Session]) -> bool: def supports_session_type(cls, sessiontype: Type[bs.Session]) -> bool:
return issubclass(sessiontype, ba.DualTeamSession) return issubclass(sessiontype, bs.DualTeamSession)
@classmethod @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'] return ['Open Field', 'Closed Arena']
def __init__(self, settings: dict): def __init__(self, settings: dict):
super().__init__(settings) super().__init__(settings)
shared = SharedObjects.get() shared = SharedObjects.get()
self._scoreboard = Scoreboard() self._scoreboard = Scoreboard()
self._cheer_sound = ba.getsound('cheer') self._cheer_sound = bs.getsound('cheer')
self._chant_sound = ba.getsound('crowdChant') self._chant_sound = bs.getsound('crowdChant')
self._foghorn_sound = ba.getsound('foghorn') self._foghorn_sound = bs.getsound('foghorn')
self._swipsound = ba.getsound('swip') self._swipsound = bs.getsound('swip')
self._whistle_sound = ba.getsound('refWhistle') self._whistle_sound = bs.getsound('refWhistle')
self.puck_model = ba.getmodel('shield') self.puck_mesh = bs.getmesh('shield')
self.puck_tex = ba.gettexture('gameCircleIcon') self.puck_tex = bs.gettexture('gameCircleIcon')
self._puck_sound = ba.getsound('metalHit') self._puck_sound = bs.getsound('metalHit')
self.puck_material = ba.Material() self.puck_material = bs.Material()
self.puck_material.add_actions(actions=(('modify_part_collision', self.puck_material.add_actions(actions=(('modify_part_collision',
'friction', 0.5))) 'friction', 0.5)))
self.puck_material.add_actions(conditions=('they_have_material', self.puck_material.add_actions(conditions=('they_have_material',
@ -233,16 +232,16 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
conditions=('they_have_material', conditions=('they_have_material',
PowerupBoxFactory.get().powerup_material), PowerupBoxFactory.get().powerup_material),
actions=(('modify_part_collision', 'physical', False), actions=(('modify_part_collision', 'physical', False),
('message', 'their_node', 'at_connect', ba.DieMessage()))) ('message', 'their_node', 'at_connect', bs.DieMessage())))
self._score_region_material = ba.Material() self._score_region_material = bs.Material()
self._score_region_material.add_actions( self._score_region_material.add_actions(
conditions=('they_have_material', self.puck_material), conditions=('they_have_material', self.puck_material),
actions=(('modify_part_collision', 'collide', actions=(('modify_part_collision', 'collide',
True), ('modify_part_collision', 'physical', False), True), ('modify_part_collision', 'physical', False),
('call', 'at_connect', self._handle_score))) ('call', 'at_connect', self._handle_score)))
self._wall_material = ba.Material() self._wall_material = bs.Material()
self._fake_wall_material = ba.Material() self._fake_wall_material = bs.Material()
self._wall_material.add_actions( self._wall_material.add_actions(
actions=( actions=(
@ -282,7 +281,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
)) ))
self.blocks = [] self.blocks = []
self._net_wall_material = ba.Material() self._net_wall_material = bs.Material()
self._net_wall_material.add_actions( self._net_wall_material.add_actions(
conditions=('they_have_material', shared.player_material), conditions=('they_have_material', shared.player_material),
actions=( actions=(
@ -309,7 +308,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
self.net_blocc = [] self.net_blocc = []
self._puck_spawn_pos: Optional[Sequence[float]] = None 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._puck: Optional[Puck] = None
self._score_to_win = int(settings['Score to Win']) self._score_to_win = int(settings['Score to Win'])
self._punchie_ = bool(settings['Disable Punch']) self._punchie_ = bool(settings['Disable Punch'])
@ -321,8 +320,8 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
self._epic_mode = bool(settings['Epic Mode']) self._epic_mode = bool(settings['Epic Mode'])
# Base class overrides. # Base class overrides.
self.slow_motion = self._epic_mode self.slow_motion = self._epic_mode
self.default_music = (ba.MusicType.EPIC if self._epic_mode else self.default_music = (bs.MusicType.EPIC if self._epic_mode else
ba.MusicType.TO_THE_DEATH) bs.MusicType.TO_THE_DEATH)
def get_instance_description(self) -> Union[str, Sequence]: def get_instance_description(self) -> Union[str, Sequence]:
if self._score_to_win == 1: if self._score_to_win == 1:
@ -339,15 +338,15 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
self.setup_standard_time_limit(self._time_limit) self.setup_standard_time_limit(self._time_limit)
if self._night_mode: 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._puck_spawn_pos = self.map.get_flag_position(None)
self._spawn_puck() self._spawn_puck()
# Set up the two score regions. # Set up the two score regions.
self._score_regions = [] self._score_regions = []
self._score_regions.append( self._score_regions.append(
ba.NodeActor( bs.NodeActor(
ba.newnode('region', bs.newnode('region',
attrs={ attrs={
'position': (5.7, 0, -0.065), 'position': (5.7, 0, -0.065),
'scale': (10.7, 0.001, 8), 'scale': (10.7, 0.001, 8),
@ -355,8 +354,8 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
'materials': [self._score_region_material] 'materials': [self._score_region_material]
}))) })))
self._score_regions.append( self._score_regions.append(
ba.NodeActor( bs.NodeActor(
ba.newnode('region', bs.newnode('region',
attrs={ attrs={
'position': (-5.7, 0, -0.065), 'position': (-5.7, 0, -0.065),
'scale': (10.7, 0.001, 8), 'scale': (10.7, 0.001, 8),
@ -364,9 +363,9 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
'materials': [self._score_region_material] 'materials': [self._score_region_material]
}))) })))
self._update_scoreboard() self._update_scoreboard()
ba.playsound(self._chant_sound) self._chant_sound.play()
if self.credit_text: if self.credit_text:
t = ba.newnode('text', t = bs.newnode('text',
attrs={'text': "Created by Freaku\nVolleyBall", # Disable 'Enable Bottom Credits' when making playlist, No need to edit this lovely... attrs={'text': "Created by Freaku\nVolleyBall", # Disable 'Enable Bottom Credits' when making playlist, No need to edit this lovely...
'scale': 0.7, 'scale': 0.7,
'position': (0, 0), 'position': (0, 0),
@ -376,23 +375,23 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
'h_align': 'center', 'h_align': 'center',
'v_attach': 'bottom'}) 'v_attach': 'bottom'})
shared = SharedObjects.get() shared = SharedObjects.get()
self.blocks.append(ba.NodeActor(ba.newnode('region', attrs={'position': (0, 2.4, 0), 'scale': ( 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, )}))) 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': ( 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, )}))) 0.6, 2.4, 20), 'type': 'box', 'materials': (self._net_wall_material, )})))
def on_team_join(self, team: Team) -> None: def on_team_join(self, team: Team) -> None:
self._update_scoreboard() self._update_scoreboard()
def _handle_puck_player_collide(self) -> None: def _handle_puck_player_collide(self) -> None:
collision = ba.getcollision() collision = bs.getcollision()
try: try:
puck = collision.sourcenode.getdelegate(Puck, True) puck = collision.sourcenode.getdelegate(Puck, True)
player = collision.opposingnode.getdelegate(PlayerSpaz, player = collision.opposingnode.getdelegate(PlayerSpaz,
True).getplayer( True).getplayer(
Player, True) Player, True)
except ba.NotFoundError: except bs.NotFoundError:
return return
puck.last_players_to_touch[player.team.id] = player puck.last_players_to_touch[player.team.id] = player
@ -409,7 +408,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
if self._puck.scored: if self._puck.scored:
return return
region = ba.getcollision().sourcenode region = bs.getcollision().sourcenode
index = 0 index = 0
for index in range(len(self._score_regions)): for index in range(len(self._score_regions)):
if region == self._score_regions[index].node: if region == self._score_regions[index].node:
@ -431,7 +430,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
for player in team.players: for player in team.players:
if player.actor: 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 # If we've got the player from the scoring team that last
# touched us, give them points. # touched us, give them points.
@ -446,28 +445,28 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
if team.score >= self._score_to_win: if team.score >= self._score_to_win:
self.end_game() self.end_game()
ba.playsound(self._foghorn_sound) self._foghorn_sound.play()
ba.playsound(self._cheer_sound) self._cheer_sound.play()
self._puck.scored = True self._puck.scored = True
# Kill the puck (it'll respawn itself shortly). # Kill the puck (it'll respawn itself shortly).
ba.emitfx(position=ba.getcollision().position, count=int( bs.emitfx(position=bs.getcollision().position, count=int(
6.0 + 7.0 * 12), scale=3, spread=0.5, chunk_type='spark') 6.0 + 7.0 * 12), scale=3, spread=0.5, chunk_type='spark')
ba.timer(0.7, self._kill_puck) bs.timer(0.7, self._kill_puck)
ba.cameraflash(duration=7.0) bs.cameraflash(duration=7.0)
self._update_scoreboard() self._update_scoreboard()
def end_game(self) -> None: def end_game(self) -> None:
results = ba.GameResults() results = bs.GameResults()
for team in self.teams: for team in self.teams:
results.set_team_score(team, team.score) results.set_team_score(team, team.score)
self.end(results=results) self.end(results=results)
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
super().on_transition_in() super().on_transition_in()
activity = ba.getactivity() activity = bs.getactivity()
if self._icy_flooor: if self._icy_flooor:
activity.map.is_hockey = True activity.map.is_hockey = True
@ -477,7 +476,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
self._scoreboard.set_team_value(team, team.score, winscore) self._scoreboard.set_team_value(team, team.score, winscore)
# overriding the default character spawning.. # 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) spaz = self.spawn_player_spaz(player)
if self._bombies_: if self._bombies_:
@ -493,7 +492,7 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
def handlemessage(self, msg: Any) -> Any: def handlemessage(self, msg: Any) -> Any:
# Respawn dead players if they're still in the game. # Respawn dead players if they're still in the game.
if isinstance(msg, ba.PlayerDiedMessage): if isinstance(msg, bs.PlayerDiedMessage):
# Augment standard behavior... # Augment standard behavior...
super().handlemessage(msg) super().handlemessage(msg)
self.respawn_player(msg.getplayer(Player)) self.respawn_player(msg.getplayer(Player))
@ -501,18 +500,18 @@ class VolleyBallGame(ba.TeamGameActivity[Player, Team]):
# Respawn dead pucks. # Respawn dead pucks.
elif isinstance(msg, PuckDiedMessage): elif isinstance(msg, PuckDiedMessage):
if not self.has_ended(): if not self.has_ended():
ba.timer(2.2, self._spawn_puck) bs.timer(2.2, self._spawn_puck)
else: else:
super().handlemessage(msg) super().handlemessage(msg)
def _flash_puck_spawn(self) -> None: def _flash_puck_spawn(self) -> None:
# Effect >>>>>> Flashly # Effect >>>>>> Flashly
ba.emitfx(position=self._puck_spawn_pos, count=int( bs.emitfx(position=self._puck_spawn_pos, count=int(
6.0 + 7.0 * 12), scale=1.7, spread=0.4, chunk_type='spark') 6.0 + 7.0 * 12), scale=1.7, spread=0.4, chunk_type='spark')
def _spawn_puck(self) -> None: def _spawn_puck(self) -> None:
ba.playsound(self._swipsound) self._swipsound.play()
ba.playsound(self._whistle_sound) self._whistle_sound.play()
self._flash_puck_spawn() self._flash_puck_spawn()
assert self._puck_spawn_pos is not None assert self._puck_spawn_pos is not None
self._puck = Puck(position=self._puck_spawn_pos) self._puck = Puck(position=self._puck_spawn_pos)
@ -538,7 +537,7 @@ class PointzzforH:
points['spawn2'] = (6.857415055, 0.03938567998, 0.0) + (1.0, 1.0, 3.0) points['spawn2'] = (6.857415055, 0.03938567998, 0.0) + (1.0, 1.0, 3.0)
class VolleyBallMap(ba.Map): class VolleyBallMap(bs.Map):
defs = Pointzz() defs = Pointzz()
name = "Open Field" name = "Open Field"
@ -553,10 +552,10 @@ class VolleyBallMap(ba.Map):
@classmethod @classmethod
def on_preload(cls) -> Any: def on_preload(cls) -> Any:
data: Dict[str, Any] = { data: Dict[str, Any] = {
'model': ba.getmodel('footballStadium'), 'mesh': bs.getmesh('footballStadium'),
'vr_fill_model': ba.getmodel('footballStadiumVRFill'), 'vr_fill_mesh': bs.getmesh('footballStadiumVRFill'),
'collide_model': ba.getcollidemodel('footballStadiumCollide'), 'collision_mesh': bs.getcollisionmesh('footballStadiumCollide'),
'tex': ba.gettexture('footballStadium') 'tex': bs.gettexture('footballStadium')
} }
return data return data
@ -565,60 +564,60 @@ class VolleyBallMap(ba.Map):
shared = SharedObjects.get() shared = SharedObjects.get()
x = -5 x = -5
while 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]}) '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]}) '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]}) '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]}) '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]}) 'color': (1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]})
x = x + 0.5 x = x + 0.5
y = -1 y = -1
while y > -11: 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]}) '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]}) '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]}) '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]}) 'color': (1, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]})
y -= 1 y -= 1
z = 0 z = 0
while z < 5: 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]}) '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]}) '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]}) '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]}) 'color': (0, 0, 1), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]})
z += 1 z += 1
self.node = ba.newnode( self.node = bs.newnode(
'terrain', 'terrain',
delegate=self, delegate=self,
attrs={ attrs={
'model': self.preloaddata['model'], 'mesh': self.preloaddata['mesh'],
'collide_model': self.preloaddata['collide_model'], 'collision_mesh': self.preloaddata['collision_mesh'],
'color_texture': self.preloaddata['tex'], 'color_texture': self.preloaddata['tex'],
'materials': [shared.footing_material] 'materials': [shared.footing_material]
}) })
ba.newnode('terrain', bs.newnode('terrain',
attrs={ attrs={
'model': self.preloaddata['vr_fill_model'], 'mesh': self.preloaddata['vr_fill_mesh'],
'lighting': False, 'lighting': False,
'vr_only': True, 'vr_only': True,
'background': True, 'background': True,
'color_texture': self.preloaddata['tex'] 'color_texture': self.preloaddata['tex']
}) })
gnode = ba.getactivity().globalsnode gnode = bs.getactivity().globalsnode
gnode.tint = (1.3, 1.2, 1.0) gnode.tint = (1.3, 1.2, 1.0)
gnode.ambient_color = (1.3, 1.2, 1.0) gnode.ambient_color = (1.3, 1.2, 1.0)
gnode.vignette_outer = (0.57, 0.57, 0.57) gnode.vignette_outer = (0.57, 0.57, 0.57)
@ -627,7 +626,7 @@ class VolleyBallMap(ba.Map):
gnode.vr_near_clip = 0.5 gnode.vr_near_clip = 0.5
class VolleyBallMapH(ba.Map): class VolleyBallMapH(bs.Map):
defs = PointzzforH() defs = PointzzforH()
name = 'Closed Arena' name = 'Closed Arena'
@ -642,13 +641,13 @@ class VolleyBallMapH(ba.Map):
@classmethod @classmethod
def on_preload(cls) -> Any: def on_preload(cls) -> Any:
data: Dict[str, Any] = { data: Dict[str, Any] = {
'models': (ba.getmodel('hockeyStadiumOuter'), 'meshs': (bs.getmesh('hockeyStadiumOuter'),
ba.getmodel('hockeyStadiumInner')), bs.getmesh('hockeyStadiumInner')),
'vr_fill_model': ba.getmodel('footballStadiumVRFill'), 'vr_fill_mesh': bs.getmesh('footballStadiumVRFill'),
'collide_model': ba.getcollidemodel('hockeyStadiumCollide'), 'collision_mesh': bs.getcollisionmesh('hockeyStadiumCollide'),
'tex': ba.gettexture('hockeyStadium'), 'tex': bs.gettexture('hockeyStadium'),
} }
mat = ba.Material() mat = bs.Material()
mat.add_actions(actions=('modify_part_collision', 'friction', 0.01)) mat.add_actions(actions=('modify_part_collision', 'friction', 0.01))
data['ice_material'] = mat data['ice_material'] = mat
return data return data
@ -658,66 +657,66 @@ class VolleyBallMapH(ba.Map):
shared = SharedObjects.get() shared = SharedObjects.get()
x = -5 x = -5
while 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]}) '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]}) '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]}) '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]}) '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]}) 'color': (1, 1, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]})
x = x + 0.5 x = x + 0.5
y = -1 y = -1
while y > -11: 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]}) '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]}) '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]}) '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]}) 'color': (1, 0, 0), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]})
y -= 1 y -= 1
z = 0 z = 0
while z < 5: 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]}) '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]}) '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]}) '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]}) 'color': (0, 0, 1), 'opacity': 1, 'draw_beauty': True, 'additive': False, 'size': [0.40]})
z += 1 z += 1
self.node = ba.newnode('terrain', self.node = bs.newnode('terrain',
delegate=self, delegate=self,
attrs={ attrs={
'model': 'mesh':
None, None,
'collide_model': 'collision_mesh':
# we dont want Goalposts... # we dont want Goalposts...
ba.getcollidemodel('footballStadiumCollide'), bs.getcollisionmesh('footballStadiumCollide'),
'color_texture': 'color_texture':
self.preloaddata['tex'], self.preloaddata['tex'],
'materials': [ 'materials': [
shared.footing_material] shared.footing_material]
}) })
ba.newnode('terrain', bs.newnode('terrain',
attrs={ attrs={
'model': self.preloaddata['vr_fill_model'], 'mesh': self.preloaddata['vr_fill_mesh'],
'vr_only': True, 'vr_only': True,
'lighting': False, 'lighting': False,
'background': True, 'background': True,
}) })
mats = [shared.footing_material] mats = [shared.footing_material]
self.floor = ba.newnode('terrain', self.floor = bs.newnode('terrain',
attrs={ attrs={
'model': self.preloaddata['models'][1], 'mesh': self.preloaddata['meshs'][1],
'color_texture': self.preloaddata['tex'], 'color_texture': self.preloaddata['tex'],
'opacity': 0.92, 'opacity': 0.92,
'opacity_in_low_or_medium_quality': 1.0, 'opacity_in_low_or_medium_quality': 1.0,
@ -725,16 +724,16 @@ class VolleyBallMapH(ba.Map):
'color': (0.4, 0.9, 0) 'color': (0.4, 0.9, 0)
}) })
self.background = ba.newnode( self.background = bs.newnode(
'terrain', 'terrain',
attrs={ attrs={
'model': ba.getmodel('natureBackground'), 'mesh': bs.getmesh('natureBackground'),
'lighting': False, 'lighting': False,
'background': True, 'background': True,
'color': (0.5, 0.30, 0.4) 'color': (0.5, 0.30, 0.4)
}) })
gnode = ba.getactivity().globalsnode gnode = bs.getactivity().globalsnode
gnode.floor_reflection = True gnode.floor_reflection = True
gnode.debris_friction = 0.3 gnode.debris_friction = 0.3
gnode.debris_kill_height = -0.3 gnode.debris_kill_height = -0.3
@ -747,5 +746,17 @@ class VolleyBallMapH(ba.Map):
#self.is_hockey = True #self.is_hockey = True
ba._map.register_map(VolleyBallMap) bs._map.register_map(VolleyBallMap)
ba._map.register_map(VolleyBallMapH) 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

View file

@ -293,10 +293,16 @@
{ {
"name": "Freaku", "name": "Freaku",
"email": "", "email": "",
"discord": "[Just] Freak#4999" "discord": ""
} }
], ],
"versions": { "versions": {
"2.0.0": {
"api_version": 8,
"commit_sha": "48f9302",
"released_on": "28-07-2023",
"md5sum": "31df84f027c98e86336a420aa509e47f"
},
"1.0.0": { "1.0.0": {
"api_version": 7, "api_version": 7,
"commit_sha": "6beb8ddf", "commit_sha": "6beb8ddf",
@ -312,10 +318,16 @@
{ {
"name": "Freaku", "name": "Freaku",
"email": "", "email": "",
"discord": "[Just] Freak#4999" "discord": ""
} }
], ],
"versions": { "versions": {
"2.0.0": {
"api_version": 8,
"commit_sha": "48f9302",
"released_on": "28-07-2023",
"md5sum": "ef2dbcac9190a61753e2c3c0f8afc22c"
},
"1.1.0": { "1.1.0": {
"api_version": 7, "api_version": 7,
"commit_sha": "383f774", "commit_sha": "383f774",
@ -505,10 +517,16 @@
{ {
"name": "Freaku", "name": "Freaku",
"email": "", "email": "",
"discord": "[Just] Freak#4999" "discord": ""
} }
], ],
"versions": { "versions": {
"2.0.0": {
"api_version": 8,
"commit_sha": "48f9302",
"released_on": "28-07-2023",
"md5sum": "8a63ad58d24e2b61bb63645f74d876e8"
},
"1.0.0": { "1.0.0": {
"api_version": 7, "api_version": 7,
"commit_sha": "b581d90", "commit_sha": "b581d90",

View file

@ -1,4 +1,4 @@
# Ported by: Freaku / @[Just] Freak#4999 # Ported by your friend: Freaku
# Join BCS: # Join BCS:
# https://discord.gg/ucyaesh # https://discord.gg/ucyaesh
@ -8,27 +8,30 @@
# https://github.com/Freaku17/BombSquad-Mods-byFreaku # https://github.com/Freaku17/BombSquad-Mods-byFreaku
# ba_meta require api 7 # ba_meta require api 8
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import _ba import _babase
import ba import babase
import random import random
import math import math
from bastd.gameutils import SharedObjects import bauiv1 as bui
from bastd.actor.bomb import Bomb import bascenev1 as bs
from bastd.actor.popuptext import PopupText from bascenev1lib.gameutils import SharedObjects
from bascenev1lib.actor.bomb import Bomb
from bascenev1lib.actor.popuptext import PopupText
from bauiv1lib.party import PartyWindow
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Optional from typing import Optional
class Floater(ba.Actor): class Floater(bs.Actor):
def __init__(self, bounds): def __init__(self, bounds):
super().__init__() super().__init__()
shared = SharedObjects.get() shared = SharedObjects.get()
self.controlled = False self.controlled = False
self.source_player = None self.source_player = None
self.floaterMaterial = ba.Material() self.floaterMaterial = bs.Material()
self.floaterMaterial.add_actions( self.floaterMaterial.add_actions(
conditions=('they_have_material', conditions=('they_have_material',
shared.player_material), shared.player_material),
@ -48,21 +51,21 @@ class Floater(ba.Actor):
self.py = "random.uniform(self.pos[1],self.pos[4])" self.py = "random.uniform(self.pos[1],self.pos[4])"
self.pz = "random.uniform(self.pos[2],self.pos[5])" self.pz = "random.uniform(self.pos[2],self.pos[5])"
self.node = ba.newnode( self.node = bs.newnode(
'prop', 'prop',
delegate=self, delegate=self,
owner=None, owner=None,
attrs={ attrs={
'position': (eval(self.px), eval(self.py), eval(self.pz)), 'position': (eval(self.px), eval(self.py), eval(self.pz)),
'model': 'mesh':
ba.getmodel('landMine'), bs.getmesh('landMine'),
'light_model': 'light_mesh':
ba.getmodel('landMine'), bs.getmesh('landMine'),
'body': 'body':
'landMine', 'landMine',
'body_scale': 'body_scale':
3, 3,
'model_scale': 'mesh_scale':
3.1, 3.1,
'shadow_size': 'shadow_size':
0.25, 0.25,
@ -71,21 +74,21 @@ class Floater(ba.Actor):
'gravity_scale': 'gravity_scale':
0.0, 0.0,
'color_texture': 'color_texture':
ba.gettexture('achievementFlawlessVictory'), bs.gettexture('achievementFlawlessVictory'),
'reflection': 'reflection':
'soft', 'soft',
'reflection_scale': [0.25], 'reflection_scale': [0.25],
'materials': 'materials':
[shared.footing_material, self.floaterMaterial] [shared.footing_material, self.floaterMaterial]
}) })
self.node2 = ba.newnode( self.node2 = bs.newnode(
'prop', 'prop',
owner=self.node, owner=self.node,
attrs={ attrs={
'position': (0, 0, 0), 'position': (0, 0, 0),
'body': 'body':
'sphere', 'sphere',
'model': 'mesh':
None, None,
'color_texture': 'color_texture':
None, None,
@ -96,7 +99,7 @@ class Floater(ba.Actor):
'density': 'density':
999999, 999999,
'reflection_scale': [1.0], 'reflection_scale': [1.0],
'model_scale': 'mesh_scale':
1.0, 1.0,
'gravity_scale': 'gravity_scale':
0, 0,
@ -110,7 +113,7 @@ class Floater(ba.Actor):
self.node.connectattr('position', self.node2, 'position') self.node.connectattr('position', self.node2, 'position')
def pop(self): PopupText(text="Ported by \ue048Freaku", scale=1.3, position=( def pop(self): PopupText(text="Ported by \ue048Freaku", scale=1.3, position=(
self.node.position[0], self.node.position[1]-1, self.node.position[2]), color=(0, 1, 1)).autoretain() # Edit = YouNoob... self.node.position[0], self.node.position[1]-1, self.node.position[2]), color=(0, 1, 1)).autoretain()
def checkCanControl(self): def checkCanControl(self):
if not self.node.exists(): if not self.node.exists():
@ -172,7 +175,7 @@ class Floater(ba.Actor):
if self.source_player is None: if self.source_player is None:
return return
if self.source_player.is_alive(): if self.source_player.is_alive():
ba.timer(1, self.checkPlayerDie) bs.timer(1, self.checkPlayerDie)
return return
else: else:
self.dis() self.dis()
@ -199,22 +202,22 @@ class Floater(ba.Actor):
pn = self.node.position pn = self.node.position
dist = self.distance(pn[0], pn[1], pn[2], px, py, pz) dist = self.distance(pn[0], pn[1], pn[2], px, py, pz)
self.node.velocity = ((px - pn[0]) / dist, (py - pn[1]) / dist, (pz - pn[2]) / dist) self.node.velocity = ((px - pn[0]) / dist, (py - pn[1]) / dist, (pz - pn[2]) / dist)
ba.timer(dist-1, ba.WeakCall(self.move), suppress_format_warning=True) bs.timer(dist-1, bs.WeakCall(self.move)) # suppress_format_warning=True)
def handlemessage(self, msg): def handlemessage(self, msg):
if isinstance(msg, ba.DieMessage): if isinstance(msg, bs.DieMessage):
self.node.delete() self.node.delete()
self.node2.delete() self.node2.delete()
self.controlled = False self.controlled = False
elif isinstance(msg, ba.OutOfBoundsMessage): elif isinstance(msg, bs.OutOfBoundsMessage):
self.handlemessage(ba.DieMessage()) self.handlemessage(bs.DieMessage())
else: else:
super().handlemessage(msg) super().handlemessage(msg)
def assignFloInputs(clientID: int): def assignFloInputs(clientID: int):
with ba.Context(_ba.get_foreground_host_activity()): activity = bs.get_foreground_host_activity()
activity = ba.getactivity() with activity.context:
if not hasattr(activity, 'flo') or not activity.flo.node.exists(): if not hasattr(activity, 'flo') or not activity.flo.node.exists():
try: try:
activity.flo = Floater(activity.map.get_def_bound_box('map_bounds')) activity.flo = Floater(activity.map.get_def_bound_box('map_bounds'))
@ -222,13 +225,13 @@ def assignFloInputs(clientID: int):
return # Perhaps using in main-menu/score-screen return # Perhaps using in main-menu/score-screen
floater = activity.flo floater = activity.flo
if floater.controlled: if floater.controlled:
ba.screenmessage('Floater is already being controlled', bs.broadcastmessage('Floater is already being controlled',
color=(1, 0, 0), transient=True, clients=[clientID]) color=(1, 0, 0), transient=True, clients=[clientID])
return return
ba.screenmessage('You Gained Control Over The Floater!\n Press Bomb to Throw Bombs and Punch to leave!', clients=[ bs.broadcastmessage('You Gained Control Over The Floater!\n Press Bomb to Throw Bombs and Punch to leave!', clients=[
clientID], transient=True, color=(0, 1, 1)) clientID], transient=True, color=(0, 1, 1))
for i in _ba.get_foreground_host_activity().players: for i in activity.players:
if i.sessionplayer.inputdevice.client_id == clientID: if i.sessionplayer.inputdevice.client_id == clientID:
def dis(i, floater): def dis(i, floater):
i.actor.node.invincible = False i.actor.node.invincible = False
@ -238,41 +241,54 @@ def assignFloInputs(clientID: int):
ps = i.actor.node.position ps = i.actor.node.position
i.actor.node.invincible = True i.actor.node.invincible = True
floater.node.position = (ps[0], ps[1] + 1.0, ps[2]) floater.node.position = (ps[0], ps[1] + 1.0, ps[2])
ba.timer(1, floater.pop) bs.timer(1, floater.pop)
i.actor.node.hold_node = ba.Node(None) i.actor.node.hold_node = bs.Node(None)
i.actor.node.hold_node = floater.node2 i.actor.node.hold_node = floater.node2
i.actor.connect_controls_to_player() i.actor.connect_controls_to_player()
i.actor.disconnect_controls_from_player() i.actor.disconnect_controls_from_player()
i.resetinput() i.resetinput()
floater.source_player = i floater.source_player = i
floater.con() floater.con()
i.assigninput(ba.InputType.PICK_UP_PRESS, floater.up) i.assigninput(babase.InputType.PICK_UP_PRESS, floater.up)
i.assigninput(ba.InputType.PICK_UP_RELEASE, floater.upR) i.assigninput(babase.InputType.PICK_UP_RELEASE, floater.upR)
i.assigninput(ba.InputType.JUMP_PRESS, floater.down) i.assigninput(babase.InputType.JUMP_PRESS, floater.down)
i.assigninput(ba.InputType.BOMB_PRESS, floater.drop) i.assigninput(babase.InputType.BOMB_PRESS, floater.drop)
i.assigninput(ba.InputType.PUNCH_PRESS, ba.Call(dis, i, floater)) i.assigninput(babase.InputType.PUNCH_PRESS, babase.Call(dis, i, floater))
i.assigninput(ba.InputType.UP_DOWN, floater.updown) i.assigninput(babase.InputType.UP_DOWN, floater.updown)
i.assigninput(ba.InputType.LEFT_RIGHT, floater.leftright) i.assigninput(babase.InputType.LEFT_RIGHT, floater.leftright)
old_fcm = _ba.chatmessage # Display chat icon, but if user open/close gather it may disappear
bui.set_party_icon_always_visible(True)
def new_chat_message(msg: Union[str, ba.Lstr], clients: Sequence[int] = None, sender_override: str = None): old_piv = bui.set_party_icon_always_visible
old_fcm(msg, clients, sender_override)
if msg == '/floater':
def new_piv(*args, **kwargs):
# Do not let chat icon go away
old_piv(True)
bui.set_party_icon_always_visible = new_piv
old_fcm = bs.chatmessage
def new_chat_message(*args, **kwargs):
old_fcm(*args, **kwargs)
if args[0] == '/floater':
try: try:
assignFloInputs(-1) assignFloInputs(-1)
except: except:
pass pass
_ba.chatmessage = new_chat_message bs.chatmessage = new_chat_message
if not _ba.is_party_icon_visible():
_ba.set_party_icon_always_visible(True)
# ba_meta export plugin # ba_meta export plugin
class byFreaku(ba.Plugin): class byFreaku(babase.Plugin):
def __init__(self): pass def __init__(self): pass

View file

@ -1,4 +1,4 @@
# Made by: Freaku / @[Just] Freak#4999 # Made by your friend: Freaku
# • Icon Keyboard • # • Icon Keyboard •
# Make your chats look even more cooler! # Make your chats look even more cooler!
@ -6,51 +6,52 @@
# Double tap the space to change between keyboards... # Double tap the space to change between keyboards...
# ba_meta require api 7 # ba_meta require api 8
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import ba import babase
from _ba import charstr as uwu import bascenev1 as bs
from babase import charstr as uwu
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any, Optional, Dict, List, Tuple, Type, Iterable from typing import Any, Optional, Dict, List, Tuple, Type, Iterable
# ba_meta export keyboard # ba_meta export keyboard
class IconKeyboard_byFreaku(ba.Keyboard): class IconKeyboard_byFreaku(babase.Keyboard):
"""Keyboard go brrrrrrr""" """Keyboard go brrrrrrr"""
name = 'Icons by \ue048Freaku' name = 'Icons by \ue048Freaku'
chars = [(uwu(ba.SpecialChar.TICKET), chars = [(uwu(babase.SpecialChar.TICKET),
uwu(ba.SpecialChar.CROWN), uwu(babase.SpecialChar.CROWN),
uwu(ba.SpecialChar.DRAGON), uwu(babase.SpecialChar.DRAGON),
uwu(ba.SpecialChar.SKULL), uwu(babase.SpecialChar.SKULL),
uwu(ba.SpecialChar.HEART), uwu(babase.SpecialChar.HEART),
uwu(ba.SpecialChar.FEDORA), uwu(babase.SpecialChar.FEDORA),
uwu(ba.SpecialChar.HAL), uwu(babase.SpecialChar.HAL),
uwu(ba.SpecialChar.YIN_YANG), uwu(babase.SpecialChar.YIN_YANG),
uwu(ba.SpecialChar.EYE_BALL), uwu(babase.SpecialChar.EYE_BALL),
uwu(ba.SpecialChar.HELMET), uwu(babase.SpecialChar.HELMET),
uwu(ba.SpecialChar.OUYA_BUTTON_U)), uwu(babase.SpecialChar.OUYA_BUTTON_U)),
(uwu(ba.SpecialChar.MUSHROOM), (uwu(babase.SpecialChar.MUSHROOM),
uwu(ba.SpecialChar.NINJA_STAR), uwu(babase.SpecialChar.NINJA_STAR),
uwu(ba.SpecialChar.VIKING_HELMET), uwu(babase.SpecialChar.VIKING_HELMET),
uwu(ba.SpecialChar.MOON), uwu(babase.SpecialChar.MOON),
uwu(ba.SpecialChar.SPIDER), uwu(babase.SpecialChar.SPIDER),
uwu(ba.SpecialChar.FIREBALL), uwu(babase.SpecialChar.FIREBALL),
uwu(ba.SpecialChar.MIKIROG), uwu(babase.SpecialChar.MIKIROG),
uwu(ba.SpecialChar.OUYA_BUTTON_O), uwu(babase.SpecialChar.OUYA_BUTTON_O),
uwu(ba.SpecialChar.LOCAL_ACCOUNT), uwu(babase.SpecialChar.LOCAL_ACCOUNT),
uwu(ba.SpecialChar.LOGO)), uwu(babase.SpecialChar.LOGO)),
(uwu(ba.SpecialChar.TICKET), (uwu(babase.SpecialChar.TICKET),
uwu(ba.SpecialChar.FLAG_INDIA), uwu(babase.SpecialChar.FLAG_INDIA),
uwu(ba.SpecialChar.OCULUS_LOGO), uwu(babase.SpecialChar.OCULUS_LOGO),
uwu(ba.SpecialChar.STEAM_LOGO), uwu(babase.SpecialChar.STEAM_LOGO),
uwu(ba.SpecialChar.NVIDIA_LOGO), uwu(babase.SpecialChar.NVIDIA_LOGO),
uwu(ba.SpecialChar.GAME_CENTER_LOGO), uwu(babase.SpecialChar.GAME_CENTER_LOGO),
uwu(ba.SpecialChar.GOOGLE_PLAY_GAMES_LOGO), uwu(babase.SpecialChar.GOOGLE_PLAY_GAMES_LOGO),
uwu(ba.SpecialChar.ALIBABA_LOGO))] uwu(babase.SpecialChar.EXPLODINARY_LOGO))]
nums = [] nums = []
pages: Dict[str, Tuple[str, ...]] = {} pages: Dict[str, Tuple[str, ...]] = {}

View file

@ -1,8 +1,9 @@
# By Freaku / @[Just] Freak#4999 # Made by your friend: Freaku
import ba import babase
from bastd.maps import TowerD import bascenev1 as bs
from bascenev1lib.maps import TowerD
@classmethod @classmethod
@ -11,8 +12,8 @@ def new_play_types(cls):
return ['melee', 'keep_away', 'team_flag', 'king_of_the_hill'] return ['melee', 'keep_away', 'team_flag', 'king_of_the_hill']
# ba_meta require api 7 # ba_meta require api 8
# ba_meta export plugin # ba_meta export plugin
class byFreaku(ba.Plugin): class byFreaku(babase.Plugin):
def on_app_running(self): def on_app_running(self):
TowerD.get_play_types = new_play_types TowerD.get_play_types = new_play_types