[ci] auto-format

This commit is contained in:
Freaku17 2023-07-28 11:37:09 +00:00 committed by github-actions[bot]
parent 3f65846527
commit 7dcf3c711e
9 changed files with 553 additions and 564 deletions

View file

@ -4,7 +4,6 @@
# https://discord.gg/ucyaesh
# ba_meta require api 8
from __future__ import annotations
@ -19,7 +18,6 @@ if TYPE_CHECKING:
from typing import Any, Type, List, Dict, Tuple, Union, Sequence, Optional
class State:
def __init__(self, bomb=None, grab=False, punch=False, curse=False, required=False, final=False, name=''):
self.bomb = bomb
@ -57,8 +55,10 @@ states = [ State(bomb='normal', name='Basic Bombs'),
State(punch=True, name='Punching only'),
State(curse=True, name='Cursed', final=True)]
class Player(bs.Player['Team']):
"""Our player type for this game."""
def __init__(self):
self.state = None

View file

@ -2,7 +2,8 @@
import babase
import bascenev1 as bs, random
import bascenev1 as bs
import random
from bascenev1lib.actor.bomb import Bomb
from bascenev1lib.game.meteorshower import Player, MeteorShowerGame
@ -30,17 +31,18 @@ class IcyEmitsGame(MeteorShowerGame):
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]
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)))
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

@ -12,32 +12,29 @@ from __future__ import annotations
# (& some improvements)
# incase someone is wondering how is map floating. Check out
# def spawnAllMap(self)
# ba_meta require api 8
from typing import TYPE_CHECKING, overload
import _babase, babase, random
import _babase
import babase
import random
import bascenev1 as bs
from bascenev1lib.gameutils import SharedObjects
if TYPE_CHECKING:
from typing import Any, Sequence, Optional, List, Dict, Type, Union, Any, Literal
class OnTimer(bs.Actor):
"""Timer which counts but doesn't show on-screen"""
def __init__(self) -> None:
super().__init__()
self._starttime_ms: int | None = None
self.node = bs.newnode('text', attrs={ 'v_attach': 'top', 'h_attach': 'center', 'h_align': 'center', 'color': (1, 1, 0.5, 1), 'flatness': 0.5, 'shadow': 0.5, 'position': (0, -70), 'scale': 0, 'text': ''})
self.node = bs.newnode('text', attrs={'v_attach': 'top', 'h_attach': 'center', 'h_align': 'center', 'color': (
1, 1, 0.5, 1), 'flatness': 0.5, 'shadow': 0.5, 'position': (0, -70), 'scale': 0, 'text': ''})
self.inputnode = bs.newnode(
'timedisplay', attrs={'timemin': 0, 'showsubseconds': True}
)
@ -101,8 +98,6 @@ class OnTimer(bs.Actor):
self.node.delete()
class Player(bs.Player['Team']):
"""Our player type for this game."""
@ -120,7 +115,8 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
name = 'Memory Game'
description = 'Memories tiles and survive till the end!'
available_settings = [bs.BoolSetting('Epic Mode', default=False), bs.BoolSetting('Enable Bottom Credits', True)]
available_settings = [bs.BoolSetting(
'Epic Mode', default=False), bs.BoolSetting('Enable Bottom Credits', True)]
scoreconfig = bs.ScoreConfig(label='Survived', scoretype=bs.ScoreType.MILLISECONDS, version='B')
# Print messages when players die (since its meaningful in this game).
@ -248,7 +244,6 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
'opacity': 0.0,
'attach': 'topCenter'})
def on_transition_in(self) -> None:
super().on_transition_in()
self._bellLow = bs.getsound('bellLow')
@ -300,7 +295,7 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
self.coldel16 = True
if self.credit_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,
'position': (0, 0),
'shadow': 0.5,
@ -318,6 +313,7 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
def startCounter(self):
self._textCounter.text = '10'
def count9():
def count8():
def count7():
@ -385,7 +381,8 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
# overriding the default character spawning..
def spawn_player(self, player: Player) -> bs.Actor:
spaz = self.spawn_player_spaz(player)
pos = (self._spawnCenter[0] + random.uniform(-1.5, 2.5), self._spawnCenter[1], self._spawnCenter[2] + random.uniform(-2.5, 1.5))
pos = (self._spawnCenter[0] + random.uniform(-1.5, 2.5),
self._spawnCenter[1], self._spawnCenter[2] + random.uniform(-2.5, 1.5))
spaz.connect_controls_to_player(enable_punch=False, enable_bomb=False, enable_pickup=False)
spaz.handlemessage(bs.StandMessage(pos))
return spaz
@ -436,6 +433,7 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
def _stop(self):
self._textureSelected = self._randomSelect()
def circle():
def circle2():
def circle3():
@ -687,112 +685,128 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
self.mapFGP = bs.newnode('prop',
attrs={'body': 'puck', 'position': (4.5, 2, -9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGPTex = None
self.mapFGPcol = bs.newnode('region',attrs={'position': (4.5,2,-9),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGPcol = bs.newnode('region', attrs={'position': (4.5, 2, -9), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel = False
if self.coldel2:
self.mapFGP2 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (4.5, 2, -6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP2Tex = None
self.mapFGP2col = bs.newnode('region',attrs={'position': (4.5,2,-6),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGP2col = bs.newnode('region', attrs={'position': (4.5, 2, -6), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel2 = False
if self.coldel3:
self.mapFGP3 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (4.5, 2, -3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP3Tex = None
self.mapFGP3col = bs.newnode('region',attrs={'position': (4.5,2,-3),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGP3col = bs.newnode('region', attrs={'position': (4.5, 2, -3), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel3 = False
if self.coldel4:
self.mapFGP4 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (4.5, 2, 0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP4Tex = None
self.mapFGP4col = bs.newnode('region',attrs={'position': (4.5,2,0),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGP4col = bs.newnode('region', attrs={'position': (4.5, 2, 0), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel4 = False
if self.coldel5:
self.mapFGP5 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (1.5, 2, -9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP5Tex = None
self.mapFGP5col = bs.newnode('region',attrs={'position': (1.5,2,-9),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGP5col = bs.newnode('region', attrs={'position': (1.5, 2, -9), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel5 = False
if self.coldel6:
self.mapFGP6 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (1.5, 2, -6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP6Tex = None
self.mapFGP6col = bs.newnode('region',attrs={'position': (1.5,2,-6),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGP6col = bs.newnode('region', attrs={'position': (1.5, 2, -6), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel6 = False
if self.coldel7:
self.mapFGP7 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (1.5, 2, -3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP7Tex = None
self.mapFGP7col = bs.newnode('region',attrs={'position': (1.5,2,-3),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGP7col = bs.newnode('region', attrs={'position': (1.5, 2, -3), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel7 = False
if self.coldel8:
self.mapFGP8 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (1.5, 2, 0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP8Tex = None
self.mapFGP8col = bs.newnode('region',attrs={'position': (1.5,2,0),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGP8col = bs.newnode('region', attrs={'position': (1.5, 2, 0), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel8 = False
if self.coldel9:
self.mapFGP9 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-1.5, 2, -9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP9Tex = None
self.mapFGP9col = bs.newnode('region',attrs={'position': (-1.5,2,-9),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGP9col = bs.newnode('region', attrs={'position': (-1.5, 2, -9), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel9 = False
if self.coldel10:
self.mapFGP10 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-1.5, 2, -6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP10Tex = None
self.mapFGP10col = bs.newnode('region',attrs={'position': (-1.5,2,-6),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGP10col = bs.newnode('region', attrs={'position': (-1.5, 2, -6), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel10 = False
if self.coldel11:
self.mapFGP11 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-1.5, 2, -3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP11Tex = None
self.mapFGP11col = bs.newnode('region',attrs={'position': (-1.5,2,-3),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGP11col = bs.newnode('region', attrs={'position': (-1.5, 2, -3), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel11 = False
if self.coldel12:
self.mapFGP12 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-1.5, 2, 0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP12Tex = None
self.mapFGP12col = bs.newnode('region',attrs={'position': (-1.5,2,0),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGP12col = bs.newnode('region', attrs={'position': (-1.5, 2, 0), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel12 = False
if self.coldel13:
self.mapFGP13 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-4.5, 2, -9), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP13Tex = None
self.mapFGP13col = bs.newnode('region',attrs={'position': (-4.5,2,-9),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGP13col = bs.newnode('region', attrs={'position': (-4.5, 2, -9), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel13 = False
if self.coldel14:
self.mapFGP14 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-4.5, 2, -6), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP14Tex = None
self.mapFGP14col = bs.newnode('region',attrs={'position': (-4.5,2,-6),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGP14col = bs.newnode('region', attrs={'position': (-4.5, 2, -6), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel14 = False
if self.coldel15:
self.mapFGP15 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-4.5, 2, -3), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP15Tex = None
self.mapFGP15col = bs.newnode('region',attrs={'position': (-4.5,2,-3),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGP15col = bs.newnode('region', attrs={'position': (-4.5, 2, -3), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel15 = False
if self.coldel16:
self.mapFGP16 = bs.newnode('prop',
attrs={'body': 'puck', 'position': (-4.5, 2, 0), 'mesh': self._mapFGPModel, 'mesh_scale': 3.73, 'body_scale': 3.73, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP16Tex = None
self.mapFGP16col = bs.newnode('region',attrs={'position': (-4.5,2,0),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)})
self.mapFGP16col = bs.newnode('region', attrs={'position': (-4.5, 2, 0), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel16 = False
def _platformTexDefault(self):
@ -876,7 +890,6 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
if living_team_count <= 1:
self.end_game()
def end_game(self) -> None:
cur_time = bs.time()
assert self._timer is not None
@ -929,18 +942,14 @@ class MGgame(bs.TeamGameActivity[Player, Team]):
self.end(results=results)
class MGdefs():
points = {}
boxes = {}
boxes['area_of_interest_bounds'] = (0.3544110667, 4.493562578, -2.518391331) + (0.0, 0.0, 0.0) + (16.64754831, 8.06138989, 18.5029888)
boxes['map_bounds'] = (0.2608783669, 4.899663734, -3.543675157) + (0.0, 0.0, 0.0) + (29.23565494, 14.19991443, 29.92689344)
boxes['area_of_interest_bounds'] = (
0.3544110667, 4.493562578, -2.518391331) + (0.0, 0.0, 0.0) + (16.64754831, 8.06138989, 18.5029888)
boxes['map_bounds'] = (0.2608783669, 4.899663734, -3.543675157) + \
(0.0, 0.0, 0.0) + (29.23565494, 14.19991443, 29.92689344)
class MGmap(bs.Map):
defs = MGdefs()
@ -983,16 +992,12 @@ class MGmap(bs.Map):
gnode.vr_near_clip = 0.5
bs._map.register_map(MGmap)
# ba_meta export plugin
class byFreaku(babase.Plugin):
def __init__(self):
## Campaign support ##
babase.app.classic.add_coop_practice_level(bs.Level(name='Memory Game', displayname='${GAME}', gametype=MGgame, settings={}, preview_texture_name='achievementOffYouGo'))
babase.app.classic.add_coop_practice_level(bs.Level(
name='Memory Game', displayname='${GAME}', gametype=MGgame, settings={}, preview_texture_name='achievementOffYouGo'))

View file

@ -1,5 +1,5 @@
## Made by MattZ45986 on GitHub
## Ported by your friend: Freaku
# Made by MattZ45986 on GitHub
# Ported by your friend: Freaku
# Bug Fixes & Improvements as well...
@ -8,11 +8,11 @@
# https://discord.gg/ucyaesh
from __future__ import annotations
from typing import TYPE_CHECKING
import _babase, random, math
import _babase
import random
import math
import bascenev1 as bs
from bascenev1lib.actor.flag import Flag, FlagPickedUpMessage
from bascenev1lib.actor.playerspaz import PlayerSpaz
@ -20,12 +20,12 @@ if TYPE_CHECKING:
from typing import Any, Type, List, Dict, Tuple, Union, Sequence, Optional
class Player(bs.Player['Team']):
def __init__(self) -> None:
self.done: bool = False
self.survived: bool = True
class Team(bs.Team[Player]):
def __init__(self) -> None:
self.score = 0
@ -125,7 +125,7 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
self.spawned = []
if self.credit_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,
'position': (0, 0),
'shadow': 0.5,
@ -152,7 +152,8 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
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
except:
pass
bs.timer(3.5, self.killRound)
bs.timer(3.55, self.makeRound)
self.round_time_textnode.opacity = 0
@ -163,7 +164,8 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
def makeRound(self):
for player in self.players:
if player.survived: player.team.score += 1
if player.survived:
player.team.score += 1
self.roundNum += 1
self._textRound.text = 'Round ' + str(self.roundNum)
self.flags = []
@ -174,7 +176,8 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
angle = random.randint(0, 359)
c = 0
for player in self.players:
if player.survived: c+=1
if player.survived:
c += 1
spacing = 10
for player in self.players:
player.done = False
@ -182,14 +185,18 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
if not player.is_alive():
self.spawn_player(player, (.5, 5, -4))
self.spawned.append(player)
try: spacing = 360 // (c)
except: self.checkEnd()
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)]
try:
spacing = 360 // (c)
except:
self.checkEnd()
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)]
# 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)))
colors.append((random.uniform(0.1, 1), random.uniform(
0.1, 1), random.uniform(0.1, 1)))
# Smart Mathematics:
# All Flags spawn same distance from the players
@ -204,15 +211,19 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
def killRound(self):
self.numPickedUp = 0
for player in self.players:
if player.is_alive(): player.actor.handlemessage(bs.DieMessage())
for flag in self.flags: flag.node.delete()
for light in self.nodes: light.delete()
if player.is_alive():
player.actor.handlemessage(bs.DieMessage())
for flag in self.flags:
flag.node.delete()
for light in self.nodes:
light.delete()
def spawn_player(self, player: Player, pos: tuple = (0, 0, 0)) -> bs.Actor:
spaz = self.spawn_player_spaz(player)
if pos == (0, 0, 0):
pos = (-.5+random.random()*2, 3+random.random()*2, -5+random.random()*2)
spaz.connect_controls_to_player(enable_punch=self.is_punch, enable_bomb=False, enable_run=self.is_run)
spaz.connect_controls_to_player(enable_punch=self.is_punch,
enable_bomb=False, enable_run=self.is_run)
spaz.handlemessage(bs.StandMessage(pos))
return spaz
@ -250,7 +261,8 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
player.actor.handlemessage(bs.StandMessage((0, 3, -2)))
bs.timer(0.5, bs.Call(player.actor.handlemessage, bs.FreezeMessage()))
bs.timer(3, bs.Call(player.actor.handlemessage, bs.ShouldShatterMessage()))
except: pass
except:
pass
bs.timer(3.5, self.killRound)
bs.timer(3.55, self.makeRound)
else:

View file

@ -3,20 +3,14 @@
# Made by your friend: Freaku
# Join BCS:
# https://discord.gg/ucyaesh
# My GitHub:
# https://github.com/Freaku17/BombSquad-Mods-byFreaku
# CHANGELOG:
"""
## 2021
@ -38,21 +32,14 @@
"""
# ba_meta require api 8
from __future__ import annotations
from typing import TYPE_CHECKING
import babase, random
import babase
import random
import bascenev1 as bs
from bascenev1lib.actor.playerspaz import PlayerSpaz
from bascenev1lib.actor.scoreboard import Scoreboard
@ -64,7 +51,6 @@ if TYPE_CHECKING:
from typing import Any, Sequence, Dict, Type, List, Optional, Union
class PuckDiedMessage:
"""Inform something that a puck has died."""
@ -107,7 +93,6 @@ class Puck(bs.Actor):
bs.animate(self.node, 'gravity_scale', {0: -0.1, 0.2: 1}, False)
# When other node touches, it realises its new gravity_scale
def handlemessage(self, msg: Any) -> Any:
if isinstance(msg, bs.DieMessage):
assert self.node
@ -148,6 +133,7 @@ class Player(bs.Player['Team']):
class Team(bs.Team[Player]):
"""Our team type for this game."""
def __init__(self) -> None:
self.score = 0
@ -254,7 +240,6 @@ class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
True), ('modify_part_collision', 'physical', False),
('call', 'at_connect', self._handle_score)))
self._wall_material = bs.Material()
self._fake_wall_material = bs.Material()
self._wall_material.add_actions(
@ -296,7 +281,6 @@ class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
))
self.blocks = []
self._net_wall_material = bs.Material()
self._net_wall_material.add_actions(
conditions=('they_have_material', shared.player_material),
@ -323,7 +307,6 @@ class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
))
self.net_blocc = []
self._puck_spawn_pos: Optional[Sequence[float]] = None
self._score_regions: Optional[List[bs.NodeActor]] = None
self._puck: Optional[Puck] = None
@ -383,7 +366,7 @@ class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
self._chant_sound.play()
if self.credit_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,
'position': (0, 0),
'shadow': 0.5,
@ -392,9 +375,11 @@ class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
'h_align': 'center',
'v_attach': 'bottom'})
shared = SharedObjects.get()
self.blocks.append(bs.NodeActor(bs.newnode('region',attrs={'position': (0,2.4,0),'scale': (0.8,6,20),'type': 'box','materials': (self._fake_wall_material, )})))
self.blocks.append(bs.NodeActor(bs.newnode('region', attrs={'position': (0, 2.4, 0), 'scale': (
0.8, 6, 20), 'type': 'box', 'materials': (self._fake_wall_material, )})))
self.net_blocc.append(bs.NodeActor(bs.newnode('region',attrs={'position': (0,0,0),'scale': (0.6,2.4,20),'type': 'box','materials': (self._net_wall_material, )})))
self.net_blocc.append(bs.NodeActor(bs.newnode('region', attrs={'position': (0, 0, 0), 'scale': (
0.6, 2.4, 20), 'type': 'box', 'materials': (self._net_wall_material, )})))
def on_team_join(self, team: Team) -> None:
self._update_scoreboard()
@ -434,8 +419,6 @@ class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
scoring_team = team
team.score += 1
# Change puck Spawn
if team.id == 0: # left side scored
self._puck_spawn_pos = (5, 0.42, 0)
@ -445,7 +428,6 @@ class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
self._puck_spawn_pos = (0, 0.42, 0)
# Easy pizzy
for player in team.players:
if player.actor:
player.actor.handlemessage(bs.CelebrateMessage(2.0))
@ -469,10 +451,10 @@ class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
self._puck.scored = True
# Kill the puck (it'll respawn itself shortly).
bs.emitfx(position= bs.getcollision().position, count=int(6.0 + 7.0 * 12), scale=3, spread=0.5, chunk_type='spark')
bs.emitfx(position=bs.getcollision().position, count=int(
6.0 + 7.0 * 12), scale=3, spread=0.5, chunk_type='spark')
bs.timer(0.7, self._kill_puck)
bs.cameraflash(duration=7.0)
self._update_scoreboard()
@ -502,7 +484,6 @@ class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
spaz.bomb_count = 0
# Imagine not being able to swipe those colorful buttons ;(
if self._punchie_:
spaz.connect_controls_to_player(enable_punch=False)
@ -525,7 +506,8 @@ class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
def _flash_puck_spawn(self) -> None:
# Effect >>>>>> Flashly
bs.emitfx(position= self._puck_spawn_pos, count=int(6.0 + 7.0 * 12), scale=1.7, spread=0.4, chunk_type='spark')
bs.emitfx(position=self._puck_spawn_pos, count=int(
6.0 + 7.0 * 12), scale=1.7, spread=0.4, chunk_type='spark')
def _spawn_puck(self) -> None:
self._swipsound.play()
@ -535,45 +517,26 @@ class VolleyBallGame(bs.TeamGameActivity[Player, Team]):
self._puck = Puck(position=self._puck_spawn_pos)
class Pointzz:
points, boxes = {}, {}
points['spawn1'] = (-8.03866, 0.02275, 0.0) + (0.5, 0.05, 4.0)
points['spawn2'] = (8.82311, 0.01092, 0.0) + (0.5, 0.05, 4.0)
boxes['area_of_interest_bounds'] = (0.0, 1.18575, 0.43262) + (0, 0, 0) + (29.81803, 11.57249, 18.89134)
boxes['area_of_interest_bounds'] = (0.0, 1.18575, 0.43262) + \
(0, 0, 0) + (29.81803, 11.57249, 18.89134)
boxes['map_bounds'] = (0.0, 1.185751251, 0.4326226188) + (0.0, 0.0, 0.0) + (
42.09506485, 22.81173179, 29.76723155)
class PointzzforH:
points, boxes = {}, {}
boxes['area_of_interest_bounds'] = (0.0, 0.7956858119, 0.0) + (0.0, 0.0, 0.0) + (30.80223883, 0.5961646365, 13.88431707)
boxes['area_of_interest_bounds'] = (0.0, 0.7956858119, 0.0) + \
(0.0, 0.0, 0.0) + (30.80223883, 0.5961646365, 13.88431707)
boxes['map_bounds'] = (0.0, 0.7956858119, -0.4689020853) + (0.0, 0.0, 0.0) + (
35.16182389, 12.18696164, 21.52869693)
points['spawn1'] = (-6.835352227, 0.02305323209, 0.0) + (1.0, 1.0, 3.0)
points['spawn2'] = (6.857415055, 0.03938567998, 0.0) + (1.0, 1.0, 3.0)
class VolleyBallMap(bs.Map):
defs = Pointzz()
name = "Open Field"
@ -663,7 +626,6 @@ class VolleyBallMap(bs.Map):
gnode.vr_near_clip = 0.5
class VolleyBallMapH(bs.Map):
defs = PointzzforH()
name = 'Closed Arena'
@ -737,7 +699,8 @@ class VolleyBallMapH(bs.Map):
'mesh':
None,
'collision_mesh':
bs.getcollisionmesh('footballStadiumCollide'), # we dont want Goalposts...
# we dont want Goalposts...
bs.getcollisionmesh('footballStadiumCollide'),
'color_texture':
self.preloaddata['tex'],
'materials': [
@ -783,8 +746,6 @@ class VolleyBallMapH(bs.Map):
#self.is_hockey = True
bs._map.register_map(VolleyBallMap)
bs._map.register_map(VolleyBallMapH)

View file

@ -8,11 +8,13 @@
# https://github.com/Freaku17/BombSquad-Mods-byFreaku
# ba_meta require api 8
from __future__ import annotations
from typing import TYPE_CHECKING
import _babase, babase, random, math
import _babase
import babase
import random
import math
import bauiv1 as bui
import bascenev1 as bs
from bascenev1lib.gameutils import SharedObjects
@ -110,7 +112,8 @@ class Floater(bs.Actor):
})
self.node.connectattr('position', self.node2, '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()
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()
def checkCanControl(self):
if not self.node.exists():
@ -186,7 +189,8 @@ class Floater(bs.Actor):
np = self.node.position
except:
np = (0, 0, 0)
self.b = Bomb(bomb_type=random.choice(['normal', 'ice', 'sticky', 'impact', 'land_mine', 'tnt']), source_player=self.source_player, position=(np[0], np[1] - 1, np[2]), velocity=(0, -1, 0)).autoretain()
self.b = Bomb(bomb_type=random.choice(['normal', 'ice', 'sticky', 'impact', 'land_mine', 'tnt']),
source_player=self.source_player, position=(np[0], np[1] - 1, np[2]), velocity=(0, -1, 0)).autoretain()
if self.b.bomb_type in ['impact', 'land_mine']:
self.b.arm()
@ -211,21 +215,21 @@ class Floater(bs.Actor):
super().handlemessage(msg)
def assignFloInputs(clientID: int):
activity = bs.get_foreground_host_activity()
with activity.context:
if not hasattr(activity, 'flo') or not activity.flo.node.exists():
try: activity.flo = Floater(activity.map.get_def_bound_box('map_bounds'))
except: return #Perhaps using in main-menu/score-screen
try:
activity.flo = Floater(activity.map.get_def_bound_box('map_bounds'))
except:
return # Perhaps using in main-menu/score-screen
floater = activity.flo
if floater.controlled:
bs.broadcastmessage('Floater is already being controlled', color=(1, 0, 0), transient=True, clients=[clientID])
bs.broadcastmessage('Floater is already being controlled',
color=(1, 0, 0), transient=True, clients=[clientID])
return
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))
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))
for i in activity.players:
if i.sessionplayer.inputdevice.client_id == clientID:
@ -259,20 +263,32 @@ bui.set_party_icon_always_visible(True)
old_piv = bui.set_party_icon_always_visible
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: assignFloInputs(-1)
except: pass
try:
assignFloInputs(-1)
except:
pass
bs.chatmessage = new_chat_message
# ba_meta export plugin
class byFreaku(babase.Plugin):
def __init__(self): pass

View file

@ -6,8 +6,6 @@
# Double tap the space to change between keyboards...
# ba_meta require api 8
from __future__ import annotations
@ -22,11 +20,6 @@ if TYPE_CHECKING:
from typing import Any, Optional, Dict, List, Tuple, Type, Iterable
# ba_meta export keyboard
class IconKeyboard_byFreaku(babase.Keyboard):
"""Keyboard go brrrrrrr"""