[ci] auto-format

This commit is contained in:
Freaku17 2022-09-01 12:56:24 +00:00 committed by github-actions[bot]
parent f935050a81
commit 858030b852
3 changed files with 362 additions and 329 deletions

View file

@ -12,41 +12,42 @@ from __future__ import annotations
# (& some improvements) # (& some improvements)
# incase someone is wondering how is map floating. Check out # incase someone is wondering how is map floating. Check out
# def spawnAllMap(self) # def spawnAllMap(self)
# ba_meta require api 7 # ba_meta require api 7
from typing import TYPE_CHECKING, overload from typing import TYPE_CHECKING, overload
import _ba,ba,random import _ba
import ba
import random
from bastd.gameutils import SharedObjects from bastd.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(ba.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: Optional[int] = None
self.node = ba.newnode('text', attrs={ 'v_attach': 'top', 'h_attach': 'center', 'h_align': 'center', 'color': (1, 1, 0.5, 1), 'flatness': 0.5, 'shadow': 0.5, 'position': (0, -70), 'scale': 0, 'text': ''}) self.node = ba.newnode('text', attrs={'v_attach': 'top', 'h_attach': 'center', 'h_align': 'center', 'color': (
self.inputnode = ba.newnode('timedisplay', attrs={ 'timemin': 0, 'showsubseconds': True }) 1, 1, 0.5, 1), 'flatness': 0.5, 'shadow': 0.5, 'position': (0, -70), 'scale': 0, 'text': ''})
self.inputnode = ba.newnode('timedisplay', attrs={
'timemin': 0, 'showsubseconds': True})
self.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) tval = ba.time(timeformat=ba.TimeFormat.MILLISECONDS)
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') ba.getactivity().globalsnode.connectattr('time', self.inputnode, 'time2')
def has_started(self) -> bool: def has_started(self) -> bool:
return self._starttime_ms is not None return self._starttime_ms is not None
def stop(self, def stop(self,
endtime: Union[int, float] = None, endtime: Union[int, float] = None,
timeformat: ba.TimeFormat = ba.TimeFormat.SECONDS) -> None: timeformat: ba.TimeFormat = ba.TimeFormat.SECONDS) -> None:
@ -67,13 +68,16 @@ class OnTimer(ba.Actor):
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. # Overloads so type checker knows our exact return type based in args.
@overload @overload
def getstarttime(self, timeformat: Literal[ba.TimeFormat.SECONDS] = ba.TimeFormat.SECONDS) -> float: def getstarttime(self, timeformat: Literal[ba.TimeFormat.SECONDS] = ba.TimeFormat.SECONDS) -> float:
... ...
@overload @overload
def getstarttime(self, def getstarttime(self,
timeformat: Literal[ba.TimeFormat.MILLISECONDS]) -> int: timeformat: Literal[ba.TimeFormat.MILLISECONDS]) -> int:
... ...
def getstarttime( def getstarttime(
self, self,
timeformat: ba.TimeFormat = ba.TimeFormat.SECONDS timeformat: ba.TimeFormat = ba.TimeFormat.SECONDS
@ -108,8 +112,6 @@ class OnTimer(ba.Actor):
self.node.delete() self.node.delete()
class Player(ba.Player['Team']): class Player(ba.Player['Team']):
"""Our player type for this game.""" """Our player type for this game."""
@ -127,7 +129,8 @@ class MGgame(ba.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('Epic Mode', default=False), ba.BoolSetting('Enable Bottom Credits', True)] available_settings = [ba.BoolSetting(
'Epic Mode', default=False), ba.BoolSetting('Enable Bottom Credits', True)]
scoreconfig = ba.ScoreConfig(label='Survived', scoretype=ba.ScoreType.MILLISECONDS, version='B') scoreconfig = ba.ScoreConfig(label='Survived', scoretype=ba.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).
@ -159,9 +162,9 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
if self._epic_mode: if self._epic_mode:
self.slow_motion = True self.slow_motion = True
shared = SharedObjects.get() shared = SharedObjects.get()
self._collide_with_player=ba.Material() self._collide_with_player = ba.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 = ba.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
@ -184,7 +187,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self._mapFGSpaz = ba.gettexture('neoSpazIcon') self._mapFGSpaz = ba.gettexture('neoSpazIcon')
self._mapFGZoe = ba.gettexture('zoeIcon') self._mapFGZoe = ba.gettexture('zoeIcon')
self._mapFGSnake = ba.gettexture('ninjaIcon') self._mapFGSnake = ba.gettexture('ninjaIcon')
self._mapFGKronk= ba.gettexture('kronkIcon') self._mapFGKronk = ba.gettexture('kronkIcon')
self._mapFGMel = ba.gettexture('melIcon') self._mapFGMel = ba.gettexture('melIcon')
self._mapFGJack = ba.gettexture('jackIcon') self._mapFGJack = ba.gettexture('jackIcon')
self._mapFGSanta = ba.gettexture('santaIcon') self._mapFGSanta = ba.gettexture('santaIcon')
@ -203,10 +206,10 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self._image = ba.newnode('image', self._image = ba.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 = ba.newnode('text',
attrs={'text': '10', attrs={'text': '10',
@ -236,26 +239,25 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self._imageCircle = ba.newnode('image', self._imageCircle = ba.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 = ba.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 = ba.newnode('image',
attrs={'texture': self._circleTex, attrs={'texture': self._circleTex,
'position': (75, -125), 'position': (75, -125),
'scale': (20,20), 'scale': (20, 20),
'color': (0.2, 0.2, 0.2), 'color': (0.2, 0.2, 0.2),
'opacity': 0.0, 'opacity': 0.0,
'attach': 'topCenter'}) 'attach': 'topCenter'})
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
super().on_transition_in() super().on_transition_in()
self._bellLow = ba.getsound('bellLow') self._bellLow = ba.getsound('bellLow')
@ -307,14 +309,14 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self.coldel16 = True self.coldel16 = True
if self.credit_text: if self.credit_text:
t = ba.newnode('text', t = ba.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),
'shadow':0.5, 'shadow': 0.5,
'flatness':1.2, 'flatness': 1.2,
'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()
@ -325,6 +327,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
def startCounter(self): def startCounter(self):
self._textCounter.text = '10' self._textCounter.text = '10'
def count9(): def count9():
def count8(): def count8():
def count7(): def count7():
@ -374,7 +377,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
ba.screenmessage( ba.screenmessage(
ba.Lstr(resource='playerDelayedJoinText', ba.Lstr(resource='playerDelayedJoinText',
subs=[('${PLAYER}', player.getname(full=True))]), subs=[('${PLAYER}', player.getname(full=True))]),
color=(0, 1, 0),transient=True,clients=[player.sessionplayer.inputdevice.client_id]) color=(0, 1, 0), transient=True, clients=[player.sessionplayer.inputdevice.client_id])
# For score purposes, mark them as having died right as the # For score purposes, mark them as having died right as the
# game started. # game started.
assert self._timer is not None assert self._timer is not None
@ -392,7 +395,8 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
# overriding the default character spawning.. # overriding the default character spawning..
def spawn_player(self, player: Player) -> ba.Actor: def spawn_player(self, player: Player) -> ba.Actor:
spaz = self.spawn_player_spaz(player) spaz = self.spawn_player_spaz(player)
pos = (self._spawnCenter[0] + random.uniform(-1.5, 2.5), self._spawnCenter[1], self._spawnCenter[2] + random.uniform(-2.5, 1.5)) pos = (self._spawnCenter[0] + random.uniform(-1.5, 2.5),
self._spawnCenter[1], self._spawnCenter[2] + random.uniform(-2.5, 1.5))
spaz.connect_controls_to_player(enable_punch=False, enable_bomb=False, enable_pickup=False) spaz.connect_controls_to_player(enable_punch=False, enable_bomb=False, enable_pickup=False)
spaz.handlemessage(ba.StandMessage(pos)) spaz.handlemessage(ba.StandMessage(pos))
return spaz return spaz
@ -406,13 +410,13 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self._textureSelected = random.choice([self._mapFGIceTex, self._textureSelected = random.choice([self._mapFGIceTex,
self._mapFGShieldTex]) self._mapFGShieldTex])
self._image.texture = self._textureSelected self._image.texture = self._textureSelected
elif self._levelStage in [3,4,5]: elif self._levelStage in [3, 4, 5]:
self._textureSelected = random.choice([self._mapFGStickyTex, self._textureSelected = random.choice([self._mapFGStickyTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGImpactTex, self._mapFGImpactTex,
self._mapFGMinesTex]) self._mapFGMinesTex])
self._image.texture = self._textureSelected self._image.texture = self._textureSelected
elif self._levelStage in [6,7,8,9]: elif self._levelStage in [6, 7, 8, 9]:
self._textureSelected = random.choice([self._mapFGCurseTex, self._textureSelected = random.choice([self._mapFGCurseTex,
self._mapFGHealthTex, self._mapFGHealthTex,
self._mapFGIceTex, self._mapFGIceTex,
@ -443,6 +447,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
def _stop(self): def _stop(self):
self._textureSelected = self._randomSelect() self._textureSelected = self._randomSelect()
def circle(): def circle():
def circle2(): def circle2():
def circle3(): def circle3():
@ -462,7 +467,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
def _randomPlatform(self): def _randomPlatform(self):
if self._levelStage == 1: if self._levelStage == 1:
randomTexture=[self._mapFGMinesTex, randomTexture = [self._mapFGMinesTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGMinesTex, self._mapFGMinesTex,
@ -479,7 +484,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self._mapFGStickyTex, self._mapFGStickyTex,
self._mapFGStickyTex] self._mapFGStickyTex]
elif self._levelStage == 2: elif self._levelStage == 2:
randomTexture=[self._mapFGIceTex, randomTexture = [self._mapFGIceTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGIceTex, self._mapFGIceTex,
self._mapFGIceTex, self._mapFGIceTex,
@ -495,8 +500,8 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self._mapFGShieldTex, self._mapFGShieldTex,
self._mapFGShieldTex, self._mapFGShieldTex,
self._mapFGShieldTex] self._mapFGShieldTex]
elif self._levelStage in [3,4,5]: elif self._levelStage in [3, 4, 5]:
randomTexture=[self._mapFGStickyTex, randomTexture = [self._mapFGStickyTex,
self._mapFGStickyTex, self._mapFGStickyTex,
self._mapFGStickyTex, self._mapFGStickyTex,
self._mapFGStickyTex, self._mapFGStickyTex,
@ -512,8 +517,8 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGMinesTex, self._mapFGMinesTex,
self._mapFGMinesTex] self._mapFGMinesTex]
elif self._levelStage in [6,7,8,9]: elif self._levelStage in [6, 7, 8, 9]:
randomTexture=[self._mapFGHealthTex, randomTexture = [self._mapFGHealthTex,
self._mapFGShieldTex, self._mapFGShieldTex,
self._mapFGCurseTex, self._mapFGCurseTex,
self._mapFGCurseTex, self._mapFGCurseTex,
@ -530,7 +535,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self._mapFGShieldTex, self._mapFGShieldTex,
self._mapFGShieldTex] self._mapFGShieldTex]
elif self._levelStage >= 10: elif self._levelStage >= 10:
randomTexture=[self._mapFGSpaz, randomTexture = [self._mapFGSpaz,
self._mapFGZoe, self._mapFGZoe,
self._mapFGSnake, self._mapFGSnake,
self._mapFGKronk, self._mapFGKronk,
@ -551,7 +556,7 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self.mapFGP3Tex, self.mapFGP4Tex, self.mapFGP3Tex, self.mapFGP4Tex,
self.mapFGP5Tex, self.mapFGP6Tex, self.mapFGP5Tex, self.mapFGP6Tex,
self.mapFGP7Tex, self.mapFGP8Tex, self.mapFGP7Tex, self.mapFGP8Tex,
self.mapFGP9Tex,self.mapFGP10Tex, self.mapFGP9Tex, self.mapFGP10Tex,
self.mapFGP11Tex, self.mapFGP12Tex, self.mapFGP11Tex, self.mapFGP12Tex,
self.mapFGP13Tex, self.mapFGP14Tex, self.mapFGP13Tex, self.mapFGP14Tex,
self.mapFGP15Tex, self.mapFGP16Tex) = ( self.mapFGP15Tex, self.mapFGP16Tex) = (
@ -692,114 +697,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 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (3,2,-9), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (3, 2, -9), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGPTex = None self.mapFGPTex = None
self.mapFGPcol = ba.newnode('region',attrs={'position': (3,2,-9),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGPcol = ba.newnode('region', attrs={'position': (3, 2, -9), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel = False self.coldel = False
if self.coldel2: if self.coldel2:
self.mapFGP2 = ba.newnode('prop', self.mapFGP2 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (3,2,-6), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (3, 2, -6), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP2Tex = None self.mapFGP2Tex = None
self.mapFGP2col = ba.newnode('region',attrs={'position': (3,2,-6),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP2col = ba.newnode('region', attrs={'position': (3, 2, -6), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel2 = False self.coldel2 = False
if self.coldel3: if self.coldel3:
self.mapFGP3 = ba.newnode('prop', self.mapFGP3 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (3,2,-3), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (3, 2, -3), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP3Tex = None self.mapFGP3Tex = None
self.mapFGP3col = ba.newnode('region',attrs={'position': (3,2,-3),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP3col = ba.newnode('region', attrs={'position': (3, 2, -3), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel3 = False self.coldel3 = False
if self.coldel4: if self.coldel4:
self.mapFGP4 = ba.newnode('prop', self.mapFGP4 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (3,2,0), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (3, 2, 0), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP4Tex = None self.mapFGP4Tex = None
self.mapFGP4col = ba.newnode('region',attrs={'position': (3,2,0),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP4col = ba.newnode('region', attrs={'position': (3, 2, 0), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel4 = False self.coldel4 = False
if self.coldel5: if self.coldel5:
self.mapFGP5 = ba.newnode('prop', self.mapFGP5 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (0,2,-9), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (0, 2, -9), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP5Tex = None self.mapFGP5Tex = None
self.mapFGP5col = ba.newnode('region',attrs={'position': (0,2,-9),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP5col = ba.newnode('region', attrs={'position': (0, 2, -9), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel5 = False self.coldel5 = False
if self.coldel6: if self.coldel6:
self.mapFGP6 = ba.newnode('prop', self.mapFGP6 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (0,2,-6), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (0, 2, -6), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP6Tex = None self.mapFGP6Tex = None
self.mapFGP6col = ba.newnode('region',attrs={'position': (0,2,-6),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP6col = ba.newnode('region', attrs={'position': (0, 2, -6), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel6 = False self.coldel6 = False
if self.coldel7: if self.coldel7:
self.mapFGP7 = ba.newnode('prop', self.mapFGP7 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (0,2,-3), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (0, 2, -3), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP7Tex = None self.mapFGP7Tex = None
self.mapFGP7col = ba.newnode('region',attrs={'position': (0,2,-3),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP7col = ba.newnode('region', attrs={'position': (0, 2, -3), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel7 = False self.coldel7 = False
if self.coldel8: if self.coldel8:
self.mapFGP8 = ba.newnode('prop', self.mapFGP8 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (0,2,0), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (0, 2, 0), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP8Tex = None self.mapFGP8Tex = None
self.mapFGP8col = ba.newnode('region',attrs={'position': (0,2,0),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP8col = ba.newnode('region', attrs={'position': (0, 2, 0), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel8 = False self.coldel8 = False
if self.coldel9: if self.coldel9:
self.mapFGP9 = ba.newnode('prop', self.mapFGP9 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-3,2,-9), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-3, 2, -9), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP9Tex = None self.mapFGP9Tex = None
self.mapFGP9col = ba.newnode('region',attrs={'position': (-3,2,-9),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP9col = ba.newnode('region', attrs={'position': (-3, 2, -9), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel9 = False self.coldel9 = False
if self.coldel10: if self.coldel10:
self.mapFGP10 = ba.newnode('prop', self.mapFGP10 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-3,2,-6), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-3, 2, -6), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP10Tex = None self.mapFGP10Tex = None
self.mapFGP10col = ba.newnode('region',attrs={'position': (-3,2,-6),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP10col = ba.newnode('region', attrs={'position': (-3, 2, -6), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel10 = False self.coldel10 = False
if self.coldel11: if self.coldel11:
self.mapFGP11 = ba.newnode('prop', self.mapFGP11 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-3,2,-3), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-3, 2, -3), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP11Tex = None self.mapFGP11Tex = None
self.mapFGP11col = ba.newnode('region',attrs={'position': (-3,2,-3),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP11col = ba.newnode('region', attrs={'position': (-3, 2, -3), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel11 = False self.coldel11 = False
if self.coldel12: if self.coldel12:
self.mapFGP12 = ba.newnode('prop', self.mapFGP12 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-3,2,0), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-3, 2, 0), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP12Tex = None self.mapFGP12Tex = None
self.mapFGP12col = ba.newnode('region',attrs={'position': (-3,2,0),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP12col = ba.newnode('region', attrs={'position': (-3, 2, 0), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel12 = False self.coldel12 = False
if self.coldel13: if self.coldel13:
self.mapFGP13 = ba.newnode('prop', self.mapFGP13 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-6,2,-9), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-6, 2, -9), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP13Tex = None self.mapFGP13Tex = None
self.mapFGP13col = ba.newnode('region',attrs={'position': (-6,2,-9),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP13col = ba.newnode('region', attrs={'position': (-6, 2, -9), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel13 = False self.coldel13 = False
if self.coldel14: if self.coldel14:
self.mapFGP14 = ba.newnode('prop', self.mapFGP14 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-6,2,-6), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-6, 2, -6), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP14Tex = None self.mapFGP14Tex = None
self.mapFGP14col = ba.newnode('region',attrs={'position': (-6,2,-6),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP14col = ba.newnode('region', attrs={'position': (-6, 2, -6), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel14 = False self.coldel14 = False
if self.coldel15: if self.coldel15:
self.mapFGP15 = ba.newnode('prop', self.mapFGP15 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-6,2,-3), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-6, 2, -3), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP15Tex = None self.mapFGP15Tex = None
self.mapFGP15col = ba.newnode('region',attrs={'position': (-6,2,-3),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP15col = ba.newnode('region', attrs={'position': (-6, 2, -3), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel15 = False self.coldel15 = False
if self.coldel16: if self.coldel16:
self.mapFGP16 = ba.newnode('prop', self.mapFGP16 = ba.newnode('prop',
attrs={'body': 'puck', 'position': (-6,2,0), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale':0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]}) attrs={'body': 'puck', 'position': (-6, 2, 0), 'model': self._mapFGPModel, 'model_scale': 3.8, 'body_scale': 3.8, 'shadow_size': 0.5, 'gravity_scale': 0.0, 'color_texture': self._mapFGPDefaultTex, 'reflection': 'soft', 'reflection_scale': [1.0], 'is_area_of_interest': True, 'materials': [self.dont_collide]})
self.mapFGP16Tex = None self.mapFGP16Tex = None
self.mapFGP16col = ba.newnode('region',attrs={'position': (-6,2,0),'scale': (3.5,0.1,3.5),'type': 'box','materials': (self._collide_with_player, shared.footing_material)}) self.mapFGP16col = ba.newnode('region', attrs={'position': (-6, 2, 0), 'scale': (
3.5, 0.1, 3.5), 'type': 'box', 'materials': (self._collide_with_player, shared.footing_material)})
self.coldel16 = False self.coldel16 = False
def _platformTexDefault(self): def _platformTexDefault(self):
@ -883,7 +904,6 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
if living_team_count <= 1: if living_team_count <= 1:
self.end_game() self.end_game()
def end_game(self) -> None: def end_game(self) -> None:
cur_time = ba.time() cur_time = ba.time()
assert self._timer is not None assert self._timer is not None
@ -936,18 +956,14 @@ class MGgame(ba.TeamGameActivity[Player, Team]):
self.end(results=results) self.end(results=results)
class MGdefs(): class MGdefs():
points = {} points = {}
boxes = {} boxes = {}
boxes['area_of_interest_bounds'] = (0.3544110667, 4.493562578, -2.518391331) + (0.0, 0.0, 0.0) + (16.64754831, 8.06138989, 18.5029888) boxes['area_of_interest_bounds'] = (
boxes['map_bounds'] = (0.2608783669, 4.899663734, -3.543675157) + (0.0, 0.0, 0.0) + (29.23565494, 14.19991443, 29.92689344) 0.3544110667, 4.493562578, -2.518391331) + (0.0, 0.0, 0.0) + (16.64754831, 8.06138989, 18.5029888)
boxes['map_bounds'] = (0.2608783669, 4.899663734, -3.543675157) + \
(0.0, 0.0, 0.0) + (29.23565494, 14.19991443, 29.92689344)
class MGmap(ba.Map): class MGmap(ba.Map):
defs = MGdefs() defs = MGdefs()
@ -990,16 +1006,12 @@ class MGmap(ba.Map):
gnode.vr_near_clip = 0.5 gnode.vr_near_clip = 0.5
ba._map.register_map(MGmap) ba._map.register_map(MGmap)
# ba_meta export plugin # ba_meta export plugin
class byFreaku(ba.Plugin): class byFreaku(ba.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={}, preview_texture_name='achievementOffYouGo')) ba.app.add_coop_practice_level(ba.Level(name='Memory Game', displayname='${GAME}', gametype=MGgame, settings={
}, preview_texture_name='achievementOffYouGo'))

View file

@ -1,30 +1,31 @@
## Made by MattZ45986 on GitHub # Made by MattZ45986 on GitHub
## Ported by: Freaku / @[Just] Freak#4999 # Ported by: Freaku / @[Just] Freak#4999
#Bug Fixes & Improvements as well... # Bug Fixes & Improvements as well...
#Join BCS: # Join BCS:
# https://discord.gg/ucyaesh # https://discord.gg/ucyaesh
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import _ba,ba,random,math import _ba
from bastd.actor.flag import Flag,FlagPickedUpMessage import ba
import random
import math
from bastd.actor.flag import Flag, FlagPickedUpMessage
from bastd.actor.playerspaz import PlayerSpaz from bastd.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(ba.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(ba.Team[Player]):
def __init__(self) -> None: def __init__(self) -> None:
self.score = 0 self.score = 0
@ -106,7 +107,7 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
ba.screenmessage( ba.screenmessage(
ba.Lstr(resource='playerDelayedJoinText', ba.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
return return
self.spawn_player(player) self.spawn_player(player)
@ -126,61 +127,70 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
self.setup_standard_time_limit(self._time_limit) self.setup_standard_time_limit(self._time_limit)
if self.credit_text: if self.credit_text:
t = ba.newnode('text', t = ba.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),
'shadow':0.5, 'shadow': 0.5,
'flatness':1.2, 'flatness': 1.2,
'color':(1, 1, 1), 'color': (1, 1, 1),
'h_align':'center', 'h_align': 'center',
'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) ba.timer(5, self.checkEnd)
def makeRound(self): def makeRound(self):
for player in self.players: for player in self.players:
if player.survived: player.team.score += 1 if player.survived:
player.team.score += 1
self.roundNum += 1 self.roundNum += 1
self._textRound.text = 'Round ' + str(self.roundNum) self._textRound.text = 'Round ' + str(self.roundNum)
self.flags = [] self.flags = []
self.spawned = [] self.spawned = []
angle = random.randint(0,359) angle = random.randint(0, 359)
c=0 c = 0
for player in self.players: for player in self.players:
if player.survived: c+=1 if player.survived:
c += 1
spacing = 10 spacing = 10
for player in self.players: for player in self.players:
player.done = False player.done = False
if player.survived: if player.survived:
if not player.is_alive(): if not player.is_alive():
self.spawn_player(player,(.5,5,-4)) self.spawn_player(player, (.5, 5, -4))
self.spawned.append(player) self.spawned.append(player)
try: spacing = 360 // (c) try:
except: self.checkEnd() spacing = 360 // (c)
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)] 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)]
# 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):
angle += spacing angle += spacing
angle %= 360 angle %= 360
x=6 * math.sin(math.degrees(angle)) x = 6 * math.sin(math.degrees(angle))
z=6 * math.cos(math.degrees(angle)) z = 6 * math.cos(math.degrees(angle))
flag = Flag(position=(x+.5,5,z-4), color=colors[i]).autoretain() flag = Flag(position=(x+.5, 5, z-4), color=colors[i]).autoretain()
self.flags.append(flag) self.flags.append(flag)
def killRound(self): def killRound(self):
self.numPickedUp = 0 self.numPickedUp = 0
for player in self.players: for player in self.players:
if player.is_alive(): player.actor.handlemessage(ba.DieMessage()) if player.is_alive():
for flag in self.flags: flag.node.delete() player.actor.handlemessage(ba.DieMessage())
for light in self.nodes: light.delete() 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)) -> ba.Actor: def spawn_player(self, player: Player, pos: tuple = (0, 0, 0)) -> ba.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, 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(ba.StandMessage(pos)) spaz.handlemessage(ba.StandMessage(pos))
return spaz return spaz
@ -200,9 +210,9 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
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 = ba.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(ba.DieMessage())
msg.node.handlemessage(ba.DieMessage()) msg.node.handlemessage(ba.DieMessage())
@ -213,12 +223,13 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
try: try:
player.survived = False player.survived = False
ba.screenmessage("No Flag? "+player.getname()) ba.screenmessage("No Flag? "+player.getname())
player.actor.handlemessage(ba.StandMessage((0,3,-2))) player.actor.handlemessage(ba.StandMessage((0, 3, -2)))
ba.timer(0.5,ba.Call(player.actor.handlemessage, ba.FreezeMessage())) ba.timer(0.5, ba.Call(player.actor.handlemessage, ba.FreezeMessage()))
ba.timer(3,ba.Call(player.actor.handlemessage, ba.ShouldShatterMessage())) ba.timer(3, ba.Call(player.actor.handlemessage, ba.ShouldShatterMessage()))
except: pass except:
ba.timer(3.5,self.killRound) pass
ba.timer(3.55,self.makeRound) ba.timer(3.5, self.killRound)
ba.timer(3.55, self.makeRound)
else: else:
return super().handlemessage(msg) return super().handlemessage(msg)
return None return None
@ -227,7 +238,7 @@ class MFGame(ba.TeamGameActivity[Player, Team]):
i = 0 i = 0
for player in self.players: for player in self.players:
if player.survived: if player.survived:
i+=1 i += 1
if i <= 1: if i <= 1:
for player in self.players: for player in self.players:
if player.survived: if player.survived:

View file

@ -1,18 +1,20 @@
#Ported by: Freaku / @[Just] Freak#4999 # Ported by: Freaku / @[Just] Freak#4999
#Join BCS: # Join BCS:
# https://discord.gg/ucyaesh # https://discord.gg/ucyaesh
#My GitHub: # My GitHub:
# https://github.com/Freaku17/BombSquad-Mods-byFreaku # https://github.com/Freaku17/BombSquad-Mods-byFreaku
# ba_meta require api 7 # ba_meta require api 7
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import _ba,ba,random,math import _ba
import ba
import random
import math
from bastd.gameutils import SharedObjects from bastd.gameutils import SharedObjects
from bastd.actor.bomb import Bomb from bastd.actor.bomb import Bomb
from bastd.actor.popuptext import PopupText from bastd.actor.popuptext import PopupText
@ -107,7 +109,8 @@ 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=(self.node.position[0],self.node.position[1]-1,self.node.position[2]), color=(0,1,1)).autoretain() #Edit = YouNoob... 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...
def checkCanControl(self): def checkCanControl(self):
if not self.node.exists(): if not self.node.exists():
@ -183,7 +186,8 @@ class Floater(ba.Actor):
np = self.node.position np = self.node.position
except: except:
np = (0, 0, 0) 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']: if self.b.bomb_type in ['impact', 'land_mine']:
self.b.arm() self.b.arm()
@ -208,21 +212,21 @@ class Floater(ba.Actor):
super().handlemessage(msg) super().handlemessage(msg)
def assignFloInputs(clientID: int): def assignFloInputs(clientID: int):
with ba.Context(_ba.get_foreground_host_activity()): with ba.Context(_ba.get_foreground_host_activity()):
activity = ba.getactivity() activity = ba.getactivity()
if not hasattr(activity, 'flo') or not activity.flo.node.exists(): if not hasattr(activity, 'flo') or not activity.flo.node.exists():
try: activity.flo = Floater(activity.map.get_def_bound_box('map_bounds')) try:
except: return #Perhaps using in main-menu/score-screen activity.flo = Floater(activity.map.get_def_bound_box('map_bounds'))
except:
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', color=(1, 0, 0), transient=True, clients=[clientID]) ba.screenmessage('Floater is already being controlled',
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=[clientID], transient=True, color=(0, 1, 1)) ba.screenmessage('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 _ba.get_foreground_host_activity().players: for i in _ba.get_foreground_host_activity().players:
if i.sessionplayer.inputdevice.client_id == clientID: if i.sessionplayer.inputdevice.client_id == clientID:
@ -251,16 +255,22 @@ def assignFloInputs(clientID: int):
i.assigninput(ba.InputType.LEFT_RIGHT, floater.leftright) i.assigninput(ba.InputType.LEFT_RIGHT, floater.leftright)
old_fcm = _ba.chatmessage old_fcm = _ba.chatmessage
def new_chat_message(msg: Union[str, ba.Lstr], clients: Sequence[int] = None, sender_override: str = None): def new_chat_message(msg: Union[str, ba.Lstr], clients: Sequence[int] = None, sender_override: str = None):
old_fcm(msg, clients, sender_override) old_fcm(msg, clients, sender_override)
if msg == '/floater': if msg == '/floater':
try: assignFloInputs(-1) try:
except: pass assignFloInputs(-1)
except:
pass
_ba.chatmessage = new_chat_message _ba.chatmessage = new_chat_message
# ba_meta export plugin # ba_meta export plugin
class byFreaku(ba.Plugin): class byFreaku(ba.Plugin):
def __init__(self): pass def __init__(self): pass