diff --git a/plugins/minigames/better_deathmatch.py b/plugins/minigames/better_deathmatch.py index 34116a5..6882c8a 100644 --- a/plugins/minigames/better_deathmatch.py +++ b/plugins/minigames/better_deathmatch.py @@ -1,6 +1,6 @@ # Ported to api 8 by brostos using baport.(https://github.com/bombsquad-community/baport) -#BetterDeathMatch -#Made by your friend: @[Just] Freak#4999 +# BetterDeathMatch +# Made by your friend: @[Just] Freak#4999 """Defines a very-customisable DeathMatch mini-game""" @@ -77,7 +77,7 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]): bs.BoolSetting('Epic Mode', default=False), -## Add settings ## + ## Add settings ## bs.BoolSetting('Enable Gloves', False), bs.BoolSetting('Enable Powerups', True), bs.BoolSetting('Night Mode', False), @@ -85,10 +85,9 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]): bs.BoolSetting('One Punch Kill', False), bs.BoolSetting('Spawn with Shield', False), bs.BoolSetting('Punching Only', False), -## Add settings ## + ## Add settings ## ] - # In teams mode, a suicide gives a point to the other team, but in # free-for-all it subtracts from your own score. By default we clamp # this at zero to benefit new players, but pro players might like to @@ -126,7 +125,6 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]): self._only_punch = bool(settings['Punching Only']) ## Take applied settings ## - self._epic_mode = bool(settings['Epic Mode']) self._kills_to_win_per_player = int( settings['Kills to Win Per Player']) @@ -151,6 +149,8 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]): ## Run settings related: IcyFloor ## + + def on_transition_in(self) -> None: super().on_transition_in() activity = bs.getactivity() @@ -160,8 +160,6 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]): return ## Run settings related: IcyFloor ## - - def on_begin(self) -> None: super().on_begin() self.setup_standard_time_limit(self._time_limit) @@ -172,15 +170,14 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]): bs.getactivity().globalsnode.tint = (0.5, 0.7, 1) else: pass -#-# Tried return here, pfft. Took me 30mins to figure out why pwps spawning only on NightMode -#-# Now its fixed :) +# -# Tried return here, pfft. Took me 30mins to figure out why pwps spawning only on NightMode +# -# Now its fixed :) if self._enable_powerups: self.setup_standard_powerup_drops() else: pass ## Run settings related: NightMode,Powerups ## - # Base kills needed to win on the size of the largest team. self._score_to_win = (self._kills_to_win_per_player * max(1, max(len(t.players) for t in self.teams))) @@ -244,6 +241,8 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]): ## Run settings related: Spaz ## + + def spawn_player(self, player: Player) -> bs.Actor: spaz = self.spawn_player_spaz(player) if self._boxing_gloves: @@ -258,7 +257,6 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]): return spaz ## Run settings related: Spaz ## - def _update_scoreboard(self) -> None: for team in self.teams: self._scoreboard.set_team_value(team, team.score, diff --git a/plugins/minigames/better_elimination.py b/plugins/minigames/better_elimination.py index 6ff2910..8edd4c1 100644 --- a/plugins/minigames/better_elimination.py +++ b/plugins/minigames/better_elimination.py @@ -1,8 +1,8 @@ # Ported to api 8 by brostos using baport.(https://github.com/bombsquad-community/baport) -#BetterElimination -#Made by your friend: @[Just] Freak#4999 +# BetterElimination +# Made by your friend: @[Just] Freak#4999 -#Huge Thx to Nippy for "Live Team Balance" +# Huge Thx to Nippy for "Live Team Balance" """Defines a very-customisable Elimination mini-game""" @@ -222,7 +222,7 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]): bs.BoolSetting('Epic Mode', default=False), -## Add settings ## + ## Add settings ## bs.BoolSetting('Live Team Balance (by Nippy#2677)', True), bs.BoolSetting('Enable Gloves', False), bs.BoolSetting('Enable Powerups', True), @@ -231,7 +231,7 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]): bs.BoolSetting('One Punch Kill', False), bs.BoolSetting('Spawn with Shield', False), bs.BoolSetting('Punching Only', False), -## Add settings ## + ## Add settings ## ] if issubclass(sessiontype, bs.DualTeamSession): settings.append(bs.BoolSetting('Solo Mode', default=False)) @@ -299,7 +299,7 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]): player.team.survival_seconds = 0 bui.screenmessage( babase.Lstr(resource='playerDelayedJoinText', - subs=[('${PLAYER}', player.getname(full=True))]), + subs=[('${PLAYER}', player.getname(full=True))]), color=(0, 1, 0), ) return @@ -321,6 +321,8 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]): ## Run settings related: IcyFloor ## + + def on_transition_in(self) -> None: super().on_transition_in() activity = bs.getactivity() @@ -330,8 +332,6 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]): return ## Run settings related: IcyFloor ## - - def on_begin(self) -> None: super().on_begin() self._start_time = bs.time() @@ -343,15 +343,14 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]): bs.getactivity().globalsnode.tint = (0.5, 0.7, 1) else: pass -#-# Tried return here, pfft. Took me 30mins to figure out why pwps spawning only on NightMode -#-# Now its fixed :) +# -# Tried return here, pfft. Took me 30mins to figure out why pwps spawning only on NightMode +# -# Now its fixed :) if self._enable_powerups: self.setup_standard_powerup_drops() else: pass ## Run settings related: NightMode,Powerups ## - if self._solo_mode: self._vs_text = bs.NodeActor( bs.newnode('text', @@ -526,7 +525,6 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]): return actor ## Run settings related: Spaz ## - def _print_lives(self, player: Player) -> None: from bascenev1lib.actor import popuptext @@ -542,24 +540,25 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]): position=player.node.position).autoretain() def on_player_leave(self, player: Player) -> None: - ########################################################Nippy#2677 - team_count=1 #Just initiating - if player.lives>0 and self._live_team_balance: - team_mem=[] + # Nippy#2677 + team_count = 1 # Just initiating + if player.lives > 0 and self._live_team_balance: + team_mem = [] for teamer in player.team.players: - if player!=teamer: - team_mem.append(teamer) #Got Dead players Team - live=player.lives - team_count=len(team_mem) - for i in range(int((live if live%2==0 else live+1)/2)): #Extending Player List for Sorted Players + if player != teamer: + team_mem.append(teamer) # Got Dead players Team + live = player.lives + team_count = len(team_mem) + # Extending Player List for Sorted Players + for i in range(int((live if live % 2 == 0 else live+1)/2)): team_mem.extend(team_mem) - if team_count>0: + if team_count > 0: for i in range(live): - team_mem[i].lives+=1 + team_mem[i].lives += 1 - if team_count<=0 : #Draw if Player Leaves + if team_count <= 0: # Draw if Player Leaves self.end_game() - ########################################################Nippy#2677 + # Nippy#2677 super().on_player_leave(player) player.icons = [] diff --git a/plugins/minigames/bot_shower.py b/plugins/minigames/bot_shower.py index ebbd14b..bbc6da9 100644 --- a/plugins/minigames/bot_shower.py +++ b/plugins/minigames/bot_shower.py @@ -123,7 +123,7 @@ class BotShowerGame(bs.TeamGameActivity[Player, Team]): if self.has_begun(): bui.screenmessage( babase.Lstr(resource='playerDelayedJoinText', - subs=[('${PLAYER}', player.getname(full=True))]), + subs=[('${PLAYER}', player.getname(full=True))]), color=(1, 1, 0), ) @@ -147,7 +147,8 @@ class BotShowerGame(bs.TeamGameActivity[Player, Team]): def _spawn_bot(self) -> None: assert self._bots is not None - self._bots.spawn_bot(random.choice(self._bot_type), pos=(random.uniform(-11, 11), (9.8 if self.map.getname() == 'Football Stadium' else 5.0), random.uniform(-5, 5))) + self._bots.spawn_bot(random.choice(self._bot_type), pos=( + random.uniform(-11, 11), (9.8 if self.map.getname() == 'Football Stadium' else 5.0), random.uniform(-5, 5))) def _check_end_game(self) -> None: living_team_count = 0 @@ -192,4 +193,4 @@ class BotShowerGame(bs.TeamGameActivity[Player, Team]): results.set_team_score(team, int(1000.0 * longest_life)) - self.end(results=results) \ No newline at end of file + self.end(results=results) diff --git a/plugins/minigames/down_into_the_abyss.py b/plugins/minigames/down_into_the_abyss.py index 2ecac4e..ab26ef5 100644 --- a/plugins/minigames/down_into_the_abyss.py +++ b/plugins/minigames/down_into_the_abyss.py @@ -22,768 +22,769 @@ from bascenev1lib.actor.powerupbox import PowerupBoxFactory from bascenev1lib.actor.onscreentimer import OnScreenTimer if TYPE_CHECKING: - from typing import Any, Sequence + from typing import Any, Sequence lang = bs.app.lang.language if lang == 'Spanish': - name = 'Abajo en el Abismo' - description = 'Sobrevive tanto como puedas' - help = 'El mapa es 3D, ¡ten cuidado!' - author = 'Autor: Deva' - github = 'GitHub: spdv123' - blog = 'Blog: superdeva.info' - peaceTime = 'Tiempo de Paz' - npcDensity = 'Densidad de Enemigos' - hint_use_punch = '¡Ahora puedes golpear a los enemigos!' + name = 'Abajo en el Abismo' + description = 'Sobrevive tanto como puedas' + help = 'El mapa es 3D, ¡ten cuidado!' + author = 'Autor: Deva' + github = 'GitHub: spdv123' + blog = 'Blog: superdeva.info' + peaceTime = 'Tiempo de Paz' + npcDensity = 'Densidad de Enemigos' + hint_use_punch = '¡Ahora puedes golpear a los enemigos!' elif lang == 'Chinese': - name = '无尽深渊' - description = '在无穷尽的坠落中存活更长时间' - help = '' - author = '作者: Deva' - github = 'GitHub: spdv123' - blog = '博客: superdeva.info' - peaceTime = '和平时间' - npcDensity = 'NPC密度' - hint_use_punch = u'现在可以使用拳头痛扁你的敌人了' + name = '无尽深渊' + description = '在无穷尽的坠落中存活更长时间' + help = '' + author = '作者: Deva' + github = 'GitHub: spdv123' + blog = '博客: superdeva.info' + peaceTime = '和平时间' + npcDensity = 'NPC密度' + hint_use_punch = u'现在可以使用拳头痛扁你的敌人了' else: - name = 'Down Into The Abyss' - description = 'Survive as long as you can' - help = 'The map is 3D, be careful!' - author = 'Author: Deva' - github = 'GitHub: spdv123' - blog = 'Blog: superdeva.info' - peaceTime = 'Peace Time' - npcDensity = 'NPC Density' - hint_use_punch = 'You can punch your enemies now!' + name = 'Down Into The Abyss' + description = 'Survive as long as you can' + help = 'The map is 3D, be careful!' + author = 'Author: Deva' + github = 'GitHub: spdv123' + blog = 'Blog: superdeva.info' + peaceTime = 'Peace Time' + npcDensity = 'NPC Density' + hint_use_punch = 'You can punch your enemies now!' class AbyssMap(bs.Map): - from bascenev1lib.mapdata import happy_thoughts as defs - # Add the y-dimension space for players - defs.boxes['map_bounds'] = (-0.8748348681, 9.212941713, -9.729538885) \ - + (0.0, 0.0, 0.0) \ - + (36.09666006, 26.19950145, 20.89541168) - name = 'Abyss Unhappy' + from bascenev1lib.mapdata import happy_thoughts as defs + # Add the y-dimension space for players + defs.boxes['map_bounds'] = (-0.8748348681, 9.212941713, -9.729538885) \ + + (0.0, 0.0, 0.0) \ + + (36.09666006, 26.19950145, 20.89541168) + name = 'Abyss Unhappy' - @classmethod - def get_play_types(cls) -> list[str]: - """Return valid play types for this map.""" - return ['abyss'] + @classmethod + def get_play_types(cls) -> list[str]: + """Return valid play types for this map.""" + return ['abyss'] - @classmethod - def get_preview_texture_name(cls) -> str: - return 'alwaysLandPreview' + @classmethod + def get_preview_texture_name(cls) -> str: + return 'alwaysLandPreview' - @classmethod - def on_preload(cls) -> Any: - data: dict[str, Any] = { - 'mesh': bs.getmesh('alwaysLandLevel'), - 'bottom_mesh': bs.getmesh('alwaysLandLevelBottom'), - 'bgmesh': bs.getmesh('alwaysLandBG'), - 'collision_mesh': bs.getcollisionmesh('alwaysLandLevelCollide'), - 'tex': bs.gettexture('alwaysLandLevelColor'), - 'bgtex': bs.gettexture('alwaysLandBGColor'), - 'vr_fill_mound_mesh': bs.getmesh('alwaysLandVRFillMound'), - 'vr_fill_mound_tex': bs.gettexture('vrFillMound') - } - return data + @classmethod + def on_preload(cls) -> Any: + data: dict[str, Any] = { + 'mesh': bs.getmesh('alwaysLandLevel'), + 'bottom_mesh': bs.getmesh('alwaysLandLevelBottom'), + 'bgmesh': bs.getmesh('alwaysLandBG'), + 'collision_mesh': bs.getcollisionmesh('alwaysLandLevelCollide'), + 'tex': bs.gettexture('alwaysLandLevelColor'), + 'bgtex': bs.gettexture('alwaysLandBGColor'), + 'vr_fill_mound_mesh': bs.getmesh('alwaysLandVRFillMound'), + 'vr_fill_mound_tex': bs.gettexture('vrFillMound') + } + return data - @classmethod - def get_music_type(cls) -> bs.MusicType: - return bs.MusicType.FLYING + @classmethod + def get_music_type(cls) -> bs.MusicType: + return bs.MusicType.FLYING + + def __init__(self) -> None: + super().__init__(vr_overlay_offset=(0, -3.7, 2.5)) + self.background = bs.newnode( + 'terrain', + attrs={ + 'mesh': self.preloaddata['bgmesh'], + 'lighting': False, + 'background': True, + 'color_texture': self.preloaddata['bgtex'] + }) + bs.newnode('terrain', + attrs={ + 'mesh': self.preloaddata['vr_fill_mound_mesh'], + 'lighting': False, + 'vr_only': True, + 'color': (0.2, 0.25, 0.2), + 'background': True, + 'color_texture': self.preloaddata['vr_fill_mound_tex'] + }) + gnode = bs.getactivity().globalsnode + gnode.happy_thoughts_mode = True + gnode.shadow_offset = (0.0, 8.0, 5.0) + gnode.tint = (1.3, 1.23, 1.0) + gnode.ambient_color = (1.3, 1.23, 1.0) + gnode.vignette_outer = (0.64, 0.59, 0.69) + gnode.vignette_inner = (0.95, 0.95, 0.93) + gnode.vr_near_clip = 1.0 + self.is_flying = True - def __init__(self) -> None: - super().__init__(vr_overlay_offset=(0, -3.7, 2.5)) - self.background = bs.newnode( - 'terrain', - attrs={ - 'mesh': self.preloaddata['bgmesh'], - 'lighting': False, - 'background': True, - 'color_texture': self.preloaddata['bgtex'] - }) - bs.newnode('terrain', - attrs={ - 'mesh': self.preloaddata['vr_fill_mound_mesh'], - 'lighting': False, - 'vr_only': True, - 'color': (0.2, 0.25, 0.2), - 'background': True, - 'color_texture': self.preloaddata['vr_fill_mound_tex'] - }) - gnode = bs.getactivity().globalsnode - gnode.happy_thoughts_mode = True - gnode.shadow_offset = (0.0, 8.0, 5.0) - gnode.tint = (1.3, 1.23, 1.0) - gnode.ambient_color = (1.3, 1.23, 1.0) - gnode.vignette_outer = (0.64, 0.59, 0.69) - gnode.vignette_inner = (0.95, 0.95, 0.93) - gnode.vr_near_clip = 1.0 - self.is_flying = True register_map(AbyssMap) class SpazTouchFoothold: - pass + pass + class BombToDieMessage: - pass + pass class Foothold(bs.Actor): - def __init__(self, - position: Sequence[float] = (0.0, 1.0, 0.0), - power: str = 'random', - size: float = 6.0, - breakable: bool = True, - moving: bool = False): - super().__init__() - shared = SharedObjects.get() - powerup = PowerupBoxFactory.get() + def __init__(self, + position: Sequence[float] = (0.0, 1.0, 0.0), + power: str = 'random', + size: float = 6.0, + breakable: bool = True, + moving: bool = False): + super().__init__() + shared = SharedObjects.get() + powerup = PowerupBoxFactory.get() - fmesh = bs.getmesh('landMine') - fmeshs = bs.getmesh('powerupSimple') - self.died = False - self.breakable = breakable - self.moving = moving # move right and left - self.lrSig = 1 # left or right signal - self.lrSpeedPlus = random.uniform(1 / 2.0, 1 / 0.7) - self._npcBots = SpazBotSet() + fmesh = bs.getmesh('landMine') + fmeshs = bs.getmesh('powerupSimple') + self.died = False + self.breakable = breakable + self.moving = moving # move right and left + self.lrSig = 1 # left or right signal + self.lrSpeedPlus = random.uniform(1 / 2.0, 1 / 0.7) + self._npcBots = SpazBotSet() - self.foothold_material = bs.Material() - self.impact_sound = bui.getsound('impactMedium') + self.foothold_material = bs.Material() + self.impact_sound = bui.getsound('impactMedium') - self.foothold_material.add_actions( - conditions=(('they_dont_have_material', shared.player_material), - 'and', - ('they_have_material', shared.object_material), - 'or', - ('they_have_material', shared.footing_material)), - actions=(('modify_node_collision', 'collide', True), - )) + self.foothold_material.add_actions( + conditions=(('they_dont_have_material', shared.player_material), + 'and', + ('they_have_material', shared.object_material), + 'or', + ('they_have_material', shared.footing_material)), + actions=(('modify_node_collision', 'collide', True), + )) - self.foothold_material.add_actions( - conditions=('they_have_material', shared.player_material), - actions=(('modify_part_collision', 'physical', True), - ('modify_part_collision', 'stiffness', 0.05), - ('message', 'our_node', 'at_connect', SpazTouchFoothold()), - )) + self.foothold_material.add_actions( + conditions=('they_have_material', shared.player_material), + actions=(('modify_part_collision', 'physical', True), + ('modify_part_collision', 'stiffness', 0.05), + ('message', 'our_node', 'at_connect', SpazTouchFoothold()), + )) - self.foothold_material.add_actions( - conditions=('they_have_material', self.foothold_material), - actions=('modify_node_collision', 'collide', False), - ) + self.foothold_material.add_actions( + conditions=('they_have_material', self.foothold_material), + actions=('modify_node_collision', 'collide', False), + ) - tex = { - 'punch': powerup.tex_punch, - 'sticky_bombs': powerup.tex_sticky_bombs, - 'ice_bombs': powerup.tex_ice_bombs, - 'impact_bombs': powerup.tex_impact_bombs, - 'health': powerup.tex_health, - 'curse': powerup.tex_curse, - 'shield': powerup.tex_shield, - 'land_mines': powerup.tex_land_mines, - 'tnt': bs.gettexture('tnt'), - }.get(power, bs.gettexture('tnt')) + tex = { + 'punch': powerup.tex_punch, + 'sticky_bombs': powerup.tex_sticky_bombs, + 'ice_bombs': powerup.tex_ice_bombs, + 'impact_bombs': powerup.tex_impact_bombs, + 'health': powerup.tex_health, + 'curse': powerup.tex_curse, + 'shield': powerup.tex_shield, + 'land_mines': powerup.tex_land_mines, + 'tnt': bs.gettexture('tnt'), + }.get(power, bs.gettexture('tnt')) - powerupdist = { - powerup.tex_bomb: 3, - powerup.tex_ice_bombs: 2, - powerup.tex_punch: 3, - powerup.tex_impact_bombs: 3, - powerup.tex_land_mines: 3, - powerup.tex_sticky_bombs: 4, - powerup.tex_shield: 4, - powerup.tex_health: 3, - powerup.tex_curse: 1, - bs.gettexture('tnt'): 2 - } + powerupdist = { + powerup.tex_bomb: 3, + powerup.tex_ice_bombs: 2, + powerup.tex_punch: 3, + powerup.tex_impact_bombs: 3, + powerup.tex_land_mines: 3, + powerup.tex_sticky_bombs: 4, + powerup.tex_shield: 4, + powerup.tex_health: 3, + powerup.tex_curse: 1, + bs.gettexture('tnt'): 2 + } - self.randtex = [] + self.randtex = [] - for keyTex in powerupdist: - for i in range(powerupdist[keyTex]): - self.randtex.append(keyTex) + for keyTex in powerupdist: + for i in range(powerupdist[keyTex]): + self.randtex.append(keyTex) - if power == 'random': - random.seed() - tex = random.choice(self.randtex) + if power == 'random': + random.seed() + tex = random.choice(self.randtex) - self.tex = tex - self.powerup_type = { - powerup.tex_punch: 'punch', - powerup.tex_bomb: 'triple_bombs', - powerup.tex_ice_bombs: 'ice_bombs', - powerup.tex_impact_bombs: 'impact_bombs', - powerup.tex_land_mines: 'land_mines', - powerup.tex_sticky_bombs: 'sticky_bombs', - powerup.tex_shield: 'shield', - powerup.tex_health: 'health', - powerup.tex_curse: 'curse', - bs.gettexture('tnt'): 'tnt' - }.get(self.tex, '') + self.tex = tex + self.powerup_type = { + powerup.tex_punch: 'punch', + powerup.tex_bomb: 'triple_bombs', + powerup.tex_ice_bombs: 'ice_bombs', + powerup.tex_impact_bombs: 'impact_bombs', + powerup.tex_land_mines: 'land_mines', + powerup.tex_sticky_bombs: 'sticky_bombs', + powerup.tex_shield: 'shield', + powerup.tex_health: 'health', + powerup.tex_curse: 'curse', + bs.gettexture('tnt'): 'tnt' + }.get(self.tex, '') - self._spawn_pos = (position[0], position[1], position[2]) + self._spawn_pos = (position[0], position[1], position[2]) - self.node = bs.newnode( - 'prop', - delegate=self, - attrs={ - 'body': 'landMine', - 'position': self._spawn_pos, - 'mesh': fmesh, - 'light_mesh': fmeshs, - 'shadow_size': 0.5, - 'velocity': (0, 0, 0), - 'density': 90000000000, - 'sticky': False, - 'body_scale': size, - 'mesh_scale': size, - 'color_texture': tex, - 'reflection': 'powerup', - 'is_area_of_interest': True, - 'gravity_scale': 0.0, - 'reflection_scale': [0], - 'materials': [self.foothold_material, - shared.object_material, - shared.footing_material] - }) - self.touchedSpazs = set() - self.keep_vel() + self.node = bs.newnode( + 'prop', + delegate=self, + attrs={ + 'body': 'landMine', + 'position': self._spawn_pos, + 'mesh': fmesh, + 'light_mesh': fmeshs, + 'shadow_size': 0.5, + 'velocity': (0, 0, 0), + 'density': 90000000000, + 'sticky': False, + 'body_scale': size, + 'mesh_scale': size, + 'color_texture': tex, + 'reflection': 'powerup', + 'is_area_of_interest': True, + 'gravity_scale': 0.0, + 'reflection_scale': [0], + 'materials': [self.foothold_material, + shared.object_material, + shared.footing_material] + }) + self.touchedSpazs = set() + self.keep_vel() - def keep_vel(self) -> None: - if self.node and not self.died: - speed = bs.getactivity().cur_speed - if self.moving: - if abs(self.node.position[0]) > 10: - self.lrSig *= -1 - self.node.velocity = ( - self.lrSig * speed * self.lrSpeedPlus,speed, 0) - bs.timer(0.1, bs.WeakCall(self.keep_vel)) - else: - self.node.velocity = (0, speed, 0) - # self.node.extraacceleration = (0, self.speed, 0) - bs.timer(0.1, bs.WeakCall(self.keep_vel)) + def keep_vel(self) -> None: + if self.node and not self.died: + speed = bs.getactivity().cur_speed + if self.moving: + if abs(self.node.position[0]) > 10: + self.lrSig *= -1 + self.node.velocity = ( + self.lrSig * speed * self.lrSpeedPlus, speed, 0) + bs.timer(0.1, bs.WeakCall(self.keep_vel)) + else: + self.node.velocity = (0, speed, 0) + # self.node.extraacceleration = (0, self.speed, 0) + bs.timer(0.1, bs.WeakCall(self.keep_vel)) - def tnt_explode(self) -> None: - pos = self.node.position - Blast(position=pos, - blast_radius=6.0, - blast_type='tnt', - source_player=None).autoretain() + def tnt_explode(self) -> None: + pos = self.node.position + Blast(position=pos, + blast_radius=6.0, + blast_type='tnt', + source_player=None).autoretain() - def spawn_npc(self) -> None: - if not self.breakable: - return - if self._npcBots.have_living_bots(): - return - if random.randint(0, 3) >= bs.getactivity().npc_density: - return - pos = self.node.position - pos = (pos[0], pos[1] + 1, pos[2]) - self._npcBots.spawn_bot( - bot_type=random.choice([ChargerBotPro, TriggerBotPro]), - pos=pos, - spawn_time=10) + def spawn_npc(self) -> None: + if not self.breakable: + return + if self._npcBots.have_living_bots(): + return + if random.randint(0, 3) >= bs.getactivity().npc_density: + return + pos = self.node.position + pos = (pos[0], pos[1] + 1, pos[2]) + self._npcBots.spawn_bot( + bot_type=random.choice([ChargerBotPro, TriggerBotPro]), + pos=pos, + spawn_time=10) - def handlemessage(self, msg: Any) -> Any: - if isinstance(msg, bs.DieMessage): - if self.node: - self.node.delete() - self.died = True - elif isinstance(msg, bs.OutOfBoundsMessage): - self.handlemessage(bs.DieMessage()) - elif isinstance(msg, BombToDieMessage): - if self.powerup_type == 'tnt': - self.tnt_explode() - self.handlemessage(bs.DieMessage()) - elif isinstance(msg, bs.HitMessage): - ispunched = (msg.srcnode and msg.srcnode.getnodetype() == 'spaz') - if not ispunched: - if self.breakable: - self.handlemessage(BombToDieMessage()) - elif isinstance(msg, SpazTouchFoothold): - node = bs.getcollision().opposingnode - if node is not None and node: - try: - spaz = node.getdelegate(object) - if not isinstance(spaz, AbyssPlayerSpaz): - return - if spaz in self.touchedSpazs: - return - self.touchedSpazs.add(spaz) - self.spawn_npc() - spaz.fix_2D_position() - if self.powerup_type not in ['', 'tnt']: - node.handlemessage( - bs.PowerupMessage(self.powerup_type)) - except Exception as e: - print(e) - pass + def handlemessage(self, msg: Any) -> Any: + if isinstance(msg, bs.DieMessage): + if self.node: + self.node.delete() + self.died = True + elif isinstance(msg, bs.OutOfBoundsMessage): + self.handlemessage(bs.DieMessage()) + elif isinstance(msg, BombToDieMessage): + if self.powerup_type == 'tnt': + self.tnt_explode() + self.handlemessage(bs.DieMessage()) + elif isinstance(msg, bs.HitMessage): + ispunched = (msg.srcnode and msg.srcnode.getnodetype() == 'spaz') + if not ispunched: + if self.breakable: + self.handlemessage(BombToDieMessage()) + elif isinstance(msg, SpazTouchFoothold): + node = bs.getcollision().opposingnode + if node is not None and node: + try: + spaz = node.getdelegate(object) + if not isinstance(spaz, AbyssPlayerSpaz): + return + if spaz in self.touchedSpazs: + return + self.touchedSpazs.add(spaz) + self.spawn_npc() + spaz.fix_2D_position() + if self.powerup_type not in ['', 'tnt']: + node.handlemessage( + bs.PowerupMessage(self.powerup_type)) + except Exception as e: + print(e) + pass class AbyssPlayerSpaz(PlayerSpaz): - def __init__(self, - player: bs.Player, - color: Sequence[float] = (1.0, 1.0, 1.0), - highlight: Sequence[float] = (0.5, 0.5, 0.5), - character: str = 'Spaz', - powerups_expire: bool = True): - super().__init__(player=player, - color=color, - highlight=highlight, - character=character, - powerups_expire=powerups_expire) - self.node.fly = False - self.node.hockey = True - self.hitpoints_max = self.hitpoints = 1500 # more HP to handle drop - bs.timer(bs.getactivity().peace_time, - bs.WeakCall(self.safe_connect_controls_to_player)) + def __init__(self, + player: bs.Player, + color: Sequence[float] = (1.0, 1.0, 1.0), + highlight: Sequence[float] = (0.5, 0.5, 0.5), + character: str = 'Spaz', + powerups_expire: bool = True): + super().__init__(player=player, + color=color, + highlight=highlight, + character=character, + powerups_expire=powerups_expire) + self.node.fly = False + self.node.hockey = True + self.hitpoints_max = self.hitpoints = 1500 # more HP to handle drop + bs.timer(bs.getactivity().peace_time, + bs.WeakCall(self.safe_connect_controls_to_player)) - def safe_connect_controls_to_player(self) -> None: - try: - self.connect_controls_to_player() - except: - pass + def safe_connect_controls_to_player(self) -> None: + try: + self.connect_controls_to_player() + except: + pass - def on_move_up_down(self, value: float) -> None: - """ - Called to set the up/down joystick amount on this spaz; - used for player or AI connections. - value will be between -32768 to 32767 - WARNING: deprecated; use on_move instead. - """ - if not self.node: - return - if self.node.run > 0.1: - self.node.move_up_down = value - else: - self.node.move_up_down = value / 3. + def on_move_up_down(self, value: float) -> None: + """ + Called to set the up/down joystick amount on this spaz; + used for player or AI connections. + value will be between -32768 to 32767 + WARNING: deprecated; use on_move instead. + """ + if not self.node: + return + if self.node.run > 0.1: + self.node.move_up_down = value + else: + self.node.move_up_down = value / 3. - def on_move_left_right(self, value: float) -> None: - """ - Called to set the left/right joystick amount on this spaz; - used for player or AI connections. - value will be between -32768 to 32767 - WARNING: deprecated; use on_move instead. - """ - if not self.node: - return - if self.node.run > 0.1: - self.node.move_left_right = value - else: - self.node.move_left_right = value / 1.5 + def on_move_left_right(self, value: float) -> None: + """ + Called to set the left/right joystick amount on this spaz; + used for player or AI connections. + value will be between -32768 to 32767 + WARNING: deprecated; use on_move instead. + """ + if not self.node: + return + if self.node.run > 0.1: + self.node.move_left_right = value + else: + self.node.move_left_right = value / 1.5 - def fix_2D_position(self) -> None: - self.node.fly = True - bs.timer(0.02, bs.WeakCall(self.disable_fly)) + def fix_2D_position(self) -> None: + self.node.fly = True + bs.timer(0.02, bs.WeakCall(self.disable_fly)) - def disable_fly(self) -> None: - if self.node: - self.node.fly = False + def disable_fly(self) -> None: + if self.node: + self.node.fly = False - def curse(self) -> None: - """ - Give this poor spaz a curse; - he will explode in 5 seconds. - """ - if not self._cursed: - factory = SpazFactory.get() - self._cursed = True + def curse(self) -> None: + """ + Give this poor spaz a curse; + he will explode in 5 seconds. + """ + if not self._cursed: + factory = SpazFactory.get() + self._cursed = True - # Add the curse material. - for attr in ['materials', 'roller_materials']: - materials = getattr(self.node, attr) - if factory.curse_material not in materials: - setattr(self.node, attr, - materials + (factory.curse_material, )) + # Add the curse material. + for attr in ['materials', 'roller_materials']: + materials = getattr(self.node, attr) + if factory.curse_material not in materials: + setattr(self.node, attr, + materials + (factory.curse_material, )) - # None specifies no time limit - assert self.node - if self.curse_time == -1: - self.node.curse_death_time = -1 - else: - # Note: curse-death-time takes milliseconds. - tval = bs.time() - assert isinstance(tval, (float, int)) - self.node.curse_death_time = bs.time() + 15 - bs.timer(15, bs.WeakCall(self.curse_explode)) + # None specifies no time limit + assert self.node + if self.curse_time == -1: + self.node.curse_death_time = -1 + else: + # Note: curse-death-time takes milliseconds. + tval = bs.time() + assert isinstance(tval, (float, int)) + self.node.curse_death_time = bs.time() + 15 + bs.timer(15, bs.WeakCall(self.curse_explode)) - def handlemessage(self, msg: Any) -> Any: - dontUp = False + def handlemessage(self, msg: Any) -> Any: + dontUp = False - if isinstance(msg, PickupMessage): - dontUp = True - collision = bs.getcollision() - opposingnode = collision.opposingnode - opposingbody = collision.opposingbody + if isinstance(msg, PickupMessage): + dontUp = True + collision = bs.getcollision() + opposingnode = collision.opposingnode + opposingbody = collision.opposingbody - if opposingnode is None or not opposingnode: - return True - opposingdelegate = opposingnode.getdelegate(object) - # Don't pick up the foothold - if isinstance(opposingdelegate, Foothold): - return True + if opposingnode is None or not opposingnode: + return True + opposingdelegate = opposingnode.getdelegate(object) + # Don't pick up the foothold + if isinstance(opposingdelegate, Foothold): + return True - # dont allow picking up of invincible dudes - try: - if opposingnode.invincible: - return True - except Exception: - pass + # dont allow picking up of invincible dudes + try: + if opposingnode.invincible: + return True + except Exception: + pass - # if we're grabbing the pelvis of a non-shattered spaz, - # we wanna grab the torso instead - if (opposingnode.getnodetype() == 'spaz' - and not opposingnode.shattered and opposingbody == 4): - opposingbody = 1 + # if we're grabbing the pelvis of a non-shattered spaz, + # we wanna grab the torso instead + if (opposingnode.getnodetype() == 'spaz' + and not opposingnode.shattered and opposingbody == 4): + opposingbody = 1 + # Special case - if we're holding a flag, don't replace it + # (hmm - should make this customizable or more low level). + held = self.node.hold_node + if held and held.getnodetype() == 'flag': + return True - # Special case - if we're holding a flag, don't replace it - # (hmm - should make this customizable or more low level). - held = self.node.hold_node - if held and held.getnodetype() == 'flag': - return True + # Note: hold_body needs to be set before hold_node. + self.node.hold_body = opposingbody + self.node.hold_node = opposingnode - # Note: hold_body needs to be set before hold_node. - self.node.hold_body = opposingbody - self.node.hold_node = opposingnode - - if not dontUp: - PlayerSpaz.handlemessage(self, msg) + if not dontUp: + PlayerSpaz.handlemessage(self, msg) class Player(bs.Player['Team']): - """Our player type for this game.""" + """Our player type for this game.""" - def __init__(self) -> None: - super().__init__() - self.death_time: float | None = None - self.notIn: bool = None + def __init__(self) -> None: + super().__init__() + self.death_time: float | None = None + self.notIn: bool = None class Team(bs.Team[Player]): - """Our team type for this game.""" + """Our team type for this game.""" # ba_meta export bascenev1.GameActivity class AbyssGame(bs.TeamGameActivity[Player, Team]): - name = name - description = description - scoreconfig = bs.ScoreConfig(label='Survived', - scoretype=bs.ScoreType.MILLISECONDS, - version='B') + name = name + description = description + scoreconfig = bs.ScoreConfig(label='Survived', + scoretype=bs.ScoreType.MILLISECONDS, + version='B') - # Print messages when players die (since its meaningful in this game). - announce_player_deaths = True + # Print messages when players die (since its meaningful in this game). + announce_player_deaths = True - # We're currently hard-coded for one map. - @classmethod - def get_supported_maps(cls, sessiontype: type[bs.Session]) -> list[str]: - return ['Abyss Unhappy'] + # We're currently hard-coded for one map. + @classmethod + def get_supported_maps(cls, sessiontype: type[bs.Session]) -> list[str]: + return ['Abyss Unhappy'] - @classmethod - def get_available_settings( - cls, sessiontype: type[bs.Session]) -> list[babase.Setting]: - settings = [ - bs.FloatChoiceSetting( - peaceTime, - choices=[ - ('None', 0.0), - ('Shorter', 2.5), - ('Short', 5.0), - ('Normal', 10.0), - ('Long', 15.0), - ('Longer', 20.0), - ], - default=10.0, - ), - bs.FloatChoiceSetting( - npcDensity, - choices=[ - ('0%', 0), - ('25%', 1), - ('50%', 2), - ('75%', 3), - ('100%', 4), - ], - default=2, - ), - bs.BoolSetting('Epic Mode', default=False), - ] - return settings + @classmethod + def get_available_settings( + cls, sessiontype: type[bs.Session]) -> list[babase.Setting]: + settings = [ + bs.FloatChoiceSetting( + peaceTime, + choices=[ + ('None', 0.0), + ('Shorter', 2.5), + ('Short', 5.0), + ('Normal', 10.0), + ('Long', 15.0), + ('Longer', 20.0), + ], + default=10.0, + ), + bs.FloatChoiceSetting( + npcDensity, + choices=[ + ('0%', 0), + ('25%', 1), + ('50%', 2), + ('75%', 3), + ('100%', 4), + ], + default=2, + ), + bs.BoolSetting('Epic Mode', default=False), + ] + return settings - # We support teams, free-for-all, and co-op sessions. - @classmethod - def supports_session_type(cls, sessiontype: type[bs.Session]) -> bool: - return (issubclass(sessiontype, bs.DualTeamSession) - or issubclass(sessiontype, bs.FreeForAllSession) - or issubclass(sessiontype, bs.CoopSession)) + # We support teams, free-for-all, and co-op sessions. + @classmethod + def supports_session_type(cls, sessiontype: type[bs.Session]) -> bool: + return (issubclass(sessiontype, bs.DualTeamSession) + or issubclass(sessiontype, bs.FreeForAllSession) + or issubclass(sessiontype, bs.CoopSession)) - def __init__(self, settings: dict): - super().__init__(settings) - self._epic_mode = settings.get('Epic Mode', False) - self._last_player_death_time: float | None = None - self._timer: OnScreenTimer | None = None - self.fix_y = -5.614479365 - self.start_z = 0 - self.init_position = (0, self.start_z, self.fix_y) - self.team_init_positions = [(-5, self.start_z, self.fix_y), - (5, self.start_z, self.fix_y)] - self.cur_speed = 2.5 - # TODO: The variable below should be set in settings - self.peace_time = float(settings[peaceTime]) - self.npc_density = float(settings[npcDensity]) + def __init__(self, settings: dict): + super().__init__(settings) + self._epic_mode = settings.get('Epic Mode', False) + self._last_player_death_time: float | None = None + self._timer: OnScreenTimer | None = None + self.fix_y = -5.614479365 + self.start_z = 0 + self.init_position = (0, self.start_z, self.fix_y) + self.team_init_positions = [(-5, self.start_z, self.fix_y), + (5, self.start_z, self.fix_y)] + self.cur_speed = 2.5 + # TODO: The variable below should be set in settings + self.peace_time = float(settings[peaceTime]) + self.npc_density = float(settings[npcDensity]) - # Some base class overrides: - self.default_music = (bs.MusicType.EPIC - if self._epic_mode else bs.MusicType.SURVIVAL) - if self._epic_mode: - self.slow_motion = True + # Some base class overrides: + self.default_music = (bs.MusicType.EPIC + if self._epic_mode else bs.MusicType.SURVIVAL) + if self._epic_mode: + self.slow_motion = True - self._game_credit = bs.NodeActor( - bs.newnode( - 'text', - attrs={ - 'v_attach': 'bottom', - 'h_align': 'center', - 'vr_depth': 0, - 'color': (0.0, 0.7, 1.0), - 'shadow': 1.0 if True else 0.5, - 'flatness': 1.0 if True else 0.5, - 'position': (0, 0), - 'scale': 0.8, - 'text': ' | '.join([author, github, blog]) - })) + self._game_credit = bs.NodeActor( + bs.newnode( + 'text', + attrs={ + 'v_attach': 'bottom', + 'h_align': 'center', + 'vr_depth': 0, + 'color': (0.0, 0.7, 1.0), + 'shadow': 1.0 if True else 0.5, + 'flatness': 1.0 if True else 0.5, + 'position': (0, 0), + 'scale': 0.8, + 'text': ' | '.join([author, github, blog]) + })) - def get_instance_description(self) -> str | Sequence: - return description + def get_instance_description(self) -> str | Sequence: + return description - def get_instance_description_short(self) -> str | Sequence: - return self.get_instance_description() + '\n' + help + def get_instance_description_short(self) -> str | Sequence: + return self.get_instance_description() + '\n' + help - def on_player_join(self, player: Player) -> None: - if self.has_begun(): - player.notIn = True - bs.broadcastmessage(babase.Lstr( - resource='playerDelayedJoinText', - subs=[('${PLAYER}', player.getname(full=True))]), - color=(0, 1, 0)) - self.spawn_player(player) + def on_player_join(self, player: Player) -> None: + if self.has_begun(): + player.notIn = True + bs.broadcastmessage(babase.Lstr( + resource='playerDelayedJoinText', + subs=[('${PLAYER}', player.getname(full=True))]), + color=(0, 1, 0)) + self.spawn_player(player) - def on_begin(self) -> None: - super().on_begin() - self._timer = OnScreenTimer() - self._timer.start() + def on_begin(self) -> None: + super().on_begin() + self._timer = OnScreenTimer() + self._timer.start() - self.level_cnt = 1 + self.level_cnt = 1 - if self.teams_or_ffa() == 'teams': - ip0 = self.team_init_positions[0] - ip1 = self.team_init_positions[1] - Foothold( - (ip0[0], ip0[1] - 2, ip0[2]), - power='shield', breakable=False).autoretain() - Foothold( - (ip1[0], ip1[1] - 2, ip1[2]), - power='shield', breakable=False).autoretain() - else: - ip = self.init_position - Foothold( - (ip[0], ip[1] - 2, ip[2]), - power='shield', breakable=False).autoretain() + if self.teams_or_ffa() == 'teams': + ip0 = self.team_init_positions[0] + ip1 = self.team_init_positions[1] + Foothold( + (ip0[0], ip0[1] - 2, ip0[2]), + power='shield', breakable=False).autoretain() + Foothold( + (ip1[0], ip1[1] - 2, ip1[2]), + power='shield', breakable=False).autoretain() + else: + ip = self.init_position + Foothold( + (ip[0], ip[1] - 2, ip[2]), + power='shield', breakable=False).autoretain() - bs.timer(int(5.0 / self.cur_speed), - bs.WeakCall(self.add_foothold), repeat=True) + bs.timer(int(5.0 / self.cur_speed), + bs.WeakCall(self.add_foothold), repeat=True) - # Repeat check game end - bs.timer(1.0, self._check_end_game, repeat=True) - bs.timer(self.peace_time + 0.1, - bs.WeakCall(self.tip_hint, hint_use_punch)) - bs.timer(6.0, bs.WeakCall(self.faster_speed), repeat=True) + # Repeat check game end + bs.timer(1.0, self._check_end_game, repeat=True) + bs.timer(self.peace_time + 0.1, + bs.WeakCall(self.tip_hint, hint_use_punch)) + bs.timer(6.0, bs.WeakCall(self.faster_speed), repeat=True) - def tip_hint(self, text: str) -> None: - bs.broadcastmessage(text, color=(0.2, 0.2, 1)) + def tip_hint(self, text: str) -> None: + bs.broadcastmessage(text, color=(0.2, 0.2, 1)) - def faster_speed(self) -> None: - self.cur_speed *= 1.15 + def faster_speed(self) -> None: + self.cur_speed *= 1.15 - def add_foothold(self) -> None: - ip = self.init_position - ip_1 = (ip[0] - 7, ip[1], ip[2]) - ip_2 = (ip[0] + 7, ip[1], ip[2]) - ru = random.uniform - self.level_cnt += 1 - if self.level_cnt % 3: - Foothold(( - ip_1[0] + ru(-5, 5), - ip[1] - 2, - ip[2] + ru(-0.0, 0.0))).autoretain() - Foothold(( - ip_2[0] + ru(-5, 5), - ip[1] - 2, - ip[2] + ru(-0.0, 0.0))).autoretain() - else: - Foothold(( - ip[0] + ru(-8, 8), - ip[1] - 2, - ip[2]), moving=True).autoretain() + def add_foothold(self) -> None: + ip = self.init_position + ip_1 = (ip[0] - 7, ip[1], ip[2]) + ip_2 = (ip[0] + 7, ip[1], ip[2]) + ru = random.uniform + self.level_cnt += 1 + if self.level_cnt % 3: + Foothold(( + ip_1[0] + ru(-5, 5), + ip[1] - 2, + ip[2] + ru(-0.0, 0.0))).autoretain() + Foothold(( + ip_2[0] + ru(-5, 5), + ip[1] - 2, + ip[2] + ru(-0.0, 0.0))).autoretain() + else: + Foothold(( + ip[0] + ru(-8, 8), + ip[1] - 2, + ip[2]), moving=True).autoretain() - def teams_or_ffa(self) -> None: - if isinstance(self.session, bs.DualTeamSession): - return 'teams' - return 'ffa' + def teams_or_ffa(self) -> None: + if isinstance(self.session, bs.DualTeamSession): + return 'teams' + return 'ffa' - def spawn_player_spaz(self, - player: Player, - position: Sequence[float] = (0, 0, 0), - angle: float | None = None) -> PlayerSpaz: - # pylint: disable=too-many-locals - # pylint: disable=cyclic-import - from babase import _math - from bascenev1._gameutils import animate + def spawn_player_spaz(self, + player: Player, + position: Sequence[float] = (0, 0, 0), + angle: float | None = None) -> PlayerSpaz: + # pylint: disable=too-many-locals + # pylint: disable=cyclic-import + from babase import _math + from bascenev1._gameutils import animate - position = self.init_position - if self.teams_or_ffa() == 'teams': - position = self.team_init_positions[player.team.id % 2] - angle = None + position = self.init_position + if self.teams_or_ffa() == 'teams': + position = self.team_init_positions[player.team.id % 2] + angle = None - name = player.getname() - color = player.color - highlight = player.highlight + name = player.getname() + color = player.color + highlight = player.highlight - light_color = _math.normalized_color(color) - display_color = _babase.safecolor(color, target_intensity=0.75) - spaz = AbyssPlayerSpaz(color=color, - highlight=highlight, - character=player.character, - player=player) + light_color = _math.normalized_color(color) + display_color = _babase.safecolor(color, target_intensity=0.75) + spaz = AbyssPlayerSpaz(color=color, + highlight=highlight, + character=player.character, + player=player) - player.actor = spaz - assert spaz.node + player.actor = spaz + assert spaz.node - spaz.node.name = name - spaz.node.name_color = display_color - spaz.connect_controls_to_player(enable_punch=False, - enable_bomb=True, - enable_pickup=False) + spaz.node.name = name + spaz.node.name_color = display_color + spaz.connect_controls_to_player(enable_punch=False, + enable_bomb=True, + enable_pickup=False) - # Move to the stand position and add a flash of light. - spaz.handlemessage( - bs.StandMessage( - position, - angle if angle is not None else random.uniform(0, 360))) - self._spawn_sound.play(1, position=spaz.node.position) - light = bs.newnode('light', attrs={'color': light_color}) - spaz.node.connectattr('position', light, 'position') - animate(light, 'intensity', {0: 0, 0.25: 1, 0.5: 0}) - bs.timer(0.5, light.delete) - return spaz + # Move to the stand position and add a flash of light. + spaz.handlemessage( + bs.StandMessage( + position, + angle if angle is not None else random.uniform(0, 360))) + self._spawn_sound.play(1, position=spaz.node.position) + light = bs.newnode('light', attrs={'color': light_color}) + spaz.node.connectattr('position', light, 'position') + animate(light, 'intensity', {0: 0, 0.25: 1, 0.5: 0}) + bs.timer(0.5, light.delete) + return spaz - def handlemessage(self, msg: Any) -> Any: - if isinstance(msg, bs.PlayerDiedMessage): + def handlemessage(self, msg: Any) -> Any: + if isinstance(msg, bs.PlayerDiedMessage): - # Augment standard behavior. - super().handlemessage(msg) + # Augment standard behavior. + super().handlemessage(msg) - curtime = bs.time() + curtime = bs.time() - # Record the player's moment of death. - # assert isinstance(msg.spaz.player - msg.getplayer(Player).death_time = curtime + # Record the player's moment of death. + # assert isinstance(msg.spaz.player + msg.getplayer(Player).death_time = curtime - # In co-op mode, end the game the instant everyone dies - # (more accurate looking). - # In teams/ffa, allow a one-second fudge-factor so we can - # get more draws if players die basically at the same time. - if isinstance(self.session, bs.CoopSession): - # Teams will still show up if we check now.. check in - # the next cycle. - babase.pushcall(self._check_end_game) + # In co-op mode, end the game the instant everyone dies + # (more accurate looking). + # In teams/ffa, allow a one-second fudge-factor so we can + # get more draws if players die basically at the same time. + if isinstance(self.session, bs.CoopSession): + # Teams will still show up if we check now.. check in + # the next cycle. + babase.pushcall(self._check_end_game) - # Also record this for a final setting of the clock. - self._last_player_death_time = curtime - else: - bs.timer(1.0, self._check_end_game) + # Also record this for a final setting of the clock. + self._last_player_death_time = curtime + else: + bs.timer(1.0, self._check_end_game) - else: - # Default handler: - return super().handlemessage(msg) - return None + else: + # Default handler: + return super().handlemessage(msg) + return None - def _check_end_game(self) -> None: - living_team_count = 0 - for team in self.teams: - for player in team.players: - if player.is_alive(): - living_team_count += 1 - break + def _check_end_game(self) -> None: + living_team_count = 0 + for team in self.teams: + for player in team.players: + if player.is_alive(): + living_team_count += 1 + break - # In co-op, we go till everyone is dead.. otherwise we go - # until one team remains. - if isinstance(self.session, bs.CoopSession): - if living_team_count <= 0: - self.end_game() - else: - if living_team_count <= 0: - self.end_game() + # In co-op, we go till everyone is dead.. otherwise we go + # until one team remains. + if isinstance(self.session, bs.CoopSession): + if living_team_count <= 0: + self.end_game() + else: + if living_team_count <= 0: + self.end_game() - def end_game(self) -> None: - cur_time = bs.time() - assert self._timer is not None - start_time = self._timer.getstarttime() + def end_game(self) -> None: + cur_time = bs.time() + assert self._timer is not None + start_time = self._timer.getstarttime() - # Mark death-time as now for any still-living players - # and award players points for how long they lasted. - # (these per-player scores are only meaningful in team-games) - for team in self.teams: - for player in team.players: - survived = False - if player.notIn: - player.death_time = 0 + # Mark death-time as now for any still-living players + # and award players points for how long they lasted. + # (these per-player scores are only meaningful in team-games) + for team in self.teams: + for player in team.players: + survived = False + if player.notIn: + player.death_time = 0 - # Throw an extra fudge factor in so teams that - # didn't die come out ahead of teams that did. - if player.death_time is None: - survived = True - player.death_time = cur_time + 1 + # Throw an extra fudge factor in so teams that + # didn't die come out ahead of teams that did. + if player.death_time is None: + survived = True + player.death_time = cur_time + 1 - # Award a per-player score depending on how many seconds - # they lasted (per-player scores only affect teams mode; - # everywhere else just looks at the per-team score). - score = int(player.death_time - self._timer.getstarttime()) - if survived: - score += 50 # A bit extra for survivors. - self.stats.player_scored(player, score, screenmessage=False) + # Award a per-player score depending on how many seconds + # they lasted (per-player scores only affect teams mode; + # everywhere else just looks at the per-team score). + score = int(player.death_time - self._timer.getstarttime()) + if survived: + score += 50 # A bit extra for survivors. + self.stats.player_scored(player, score, screenmessage=False) - # Stop updating our time text, and set the final time to match - # exactly when our last guy died. - self._timer.stop(endtime=self._last_player_death_time) + # Stop updating our time text, and set the final time to match + # exactly when our last guy died. + self._timer.stop(endtime=self._last_player_death_time) - # Ok now calc game results: set a score for each team and then tell - # the game to end. - results = bs.GameResults() + # Ok now calc game results: set a score for each team and then tell + # the game to end. + results = bs.GameResults() - # Remember that 'free-for-all' mode is simply a special form - # of 'teams' mode where each player gets their own team, so we can - # just always deal in teams and have all cases covered. - for team in self.teams: + # Remember that 'free-for-all' mode is simply a special form + # of 'teams' mode where each player gets their own team, so we can + # just always deal in teams and have all cases covered. + for team in self.teams: - # Set the team score to the max time survived by any player on - # that team. - longest_life = 0.0 - for player in team.players: - assert player.death_time is not None - longest_life = max(longest_life, - player.death_time - start_time) + # Set the team score to the max time survived by any player on + # that team. + longest_life = 0.0 + for player in team.players: + assert player.death_time is not None + longest_life = max(longest_life, + player.death_time - start_time) - # Submit the score value in milliseconds. - results.set_team_score(team, int(1000.0 * longest_life)) + # Submit the score value in milliseconds. + results.set_team_score(team, int(1000.0 * longest_life)) - self.end(results=results) + self.end(results=results) diff --git a/plugins/minigames/explodo_run.py b/plugins/minigames/explodo_run.py index be013c7..cac6a65 100644 --- a/plugins/minigames/explodo_run.py +++ b/plugins/minigames/explodo_run.py @@ -17,19 +17,22 @@ from bascenev1lib.actor.onscreentimer import OnScreenTimer if TYPE_CHECKING: from typing import Any, Type, Dict, List, Optional + def ba_get_api_version(): return 8 + def ba_get_levels(): - return [bs._level.Level( - 'Explodo Run', - gametype=ExplodoRunGame, - settings={}, - preview_texture_name='rampagePreview'),bs._level.Level( - 'Epic Explodo Run', - gametype=ExplodoRunGame, - settings={'Epic Mode':True}, - preview_texture_name='rampagePreview')] + return [bs._level.Level( + 'Explodo Run', + gametype=ExplodoRunGame, + settings={}, + preview_texture_name='rampagePreview'), bs._level.Level( + 'Epic Explodo Run', + gametype=ExplodoRunGame, + settings={'Epic Mode': True}, + preview_texture_name='rampagePreview')] + class Player(bs.Player['Team']): """Our player type for this game.""" @@ -39,6 +42,8 @@ class Team(bs.Team[Player]): """Our team type for this game.""" # ba_meta export bascenev1.GameActivity + + class ExplodoRunGame(bs.TeamGameActivity[Player, Team]): name = "Explodo Run" description = "Run For Your Life :))" @@ -47,8 +52,8 @@ class ExplodoRunGame(bs.TeamGameActivity[Player, Team]): scoretype=bs.ScoreType.MILLISECONDS, lower_is_better=False) default_music = bs.MusicType.TO_THE_DEATH - - def __init__(self, settings:dict): + + def __init__(self, settings: dict): settings['map'] = "Rampage" self._epic_mode = settings.get('Epic Mode', False) if self._epic_mode: @@ -59,27 +64,28 @@ class ExplodoRunGame(bs.TeamGameActivity[Player, Team]): self._won = False self._bots = SpazBotSet() self.wave = 1 - + def on_begin(self) -> None: super().on_begin() - + self._timer = OnScreenTimer() bs.timer(2.5, self._timer.start) - - #Bots Hehe - bs.timer(2.5,self.street) + + # Bots Hehe + bs.timer(2.5, self.street) def street(self): for a in range(self.wave): - p1 = random.choice([-5,-2.5,0,2.5,5]) - p3 = random.choice([-4.5,-4.14,-5,-3]) - time = random.choice([1,1.5,2.5,2]) - self._bots.spawn_bot(ExplodeyBot, pos=(p1,5.5,p3),spawn_time = time) + p1 = random.choice([-5, -2.5, 0, 2.5, 5]) + p3 = random.choice([-4.5, -4.14, -5, -3]) + time = random.choice([1, 1.5, 2.5, 2]) + self._bots.spawn_bot(ExplodeyBot, pos=(p1, 5.5, p3), spawn_time=time) self.wave += 1 - + def botrespawn(self): if not self._bots.have_living_bots(): self.street() + def handlemessage(self, msg: Any) -> Any: # A player has died. @@ -87,7 +93,7 @@ class ExplodoRunGame(bs.TeamGameActivity[Player, Team]): super().handlemessage(msg) # Augment standard behavior. self._won = True self.end_game() - + # A spaz-bot has died. elif isinstance(msg, SpazBotDiedMessage): # Unfortunately the bot-set will always tell us there are living @@ -128,5 +134,3 @@ class ExplodoRunGame(bs.TeamGameActivity[Player, Team]): # Ends the activity. self.end(results) - - \ No newline at end of file diff --git a/plugins/minigames/extinction.py b/plugins/minigames/extinction.py index 39266e5..22ca2fc 100644 --- a/plugins/minigames/extinction.py +++ b/plugins/minigames/extinction.py @@ -21,6 +21,7 @@ if TYPE_CHECKING: def ba_get_api_version(): return 8 + def ba_get_levels(): return [babase._level.Level( 'Extinction', @@ -33,23 +34,24 @@ def ba_get_levels(): settings={'Epic Mode': True}, preview_texture_name='footballStadiumPreview')] + class Meteor(bs.Actor): """A giant meteor instead of bombs.""" - + def __init__(self, pos: Sequence[float] = (0.0, 1.0, 0.0), velocity: Sequence[float] = (0.0, 0.0, 0.0)): super().__init__() - + shared = SharedObjects.get() factory = BombFactory.get() - + materials = (shared.object_material, factory.impact_blast_material) - + self.pos = (pos[0], pos[1], pos[2]) self.velocity = (velocity[0], velocity[1], velocity[2]) - + self.node = bs.newnode( 'prop', delegate=self, @@ -66,13 +68,13 @@ class Meteor(bs.Actor): 'reflection_scale': [0.45], 'materials': materials }) - + def explode(self) -> None: Blast(position=self.node.position, velocity=self.node.velocity, blast_type='tnt', blast_radius=2.0) - + def handlemessage(self, msg: Any) -> Any: if isinstance(msg, bs.DieMessage): if self.node: @@ -86,11 +88,12 @@ class Meteor(bs.Actor): class Player(bs.Player['Team']): """Our player type for this game.""" - + def __init__(self): super().__init__() self.death_time: Optional[float] = None + class Team(bs.Team[Player]): """Our team type for this game.""" @@ -98,112 +101,112 @@ class Team(bs.Team[Player]): # ba_meta export bascenev1.GameActivity class NewMeteorShowerGame(bs.TeamGameActivity[Player, Team]): """Minigame by Jetz.""" - + name = 'Extinction' description = 'Survive the Extinction.' available_settings = [ bs.BoolSetting('Epic Mode', default=False)] - + announce_player_deaths = True - + @classmethod def get_supported_maps(cls, sessiontype: Type[bs.Session]) -> List[str]: return ['Football Stadium'] - + @classmethod def supports_session_type(cls, sessiontype: Type[bs.Session]) -> bool: return (issubclass(sessiontype, bs.FreeForAllSession) or issubclass(sessiontype, bs.DualTeamSession)) - + def __init__(self, settings: dict): super().__init__(settings) - + self._epic_mode = bool(settings['Epic Mode']) self._last_player_death_time: Optiobal[float] = None self._meteor_time = 2.0 self._timer: Optional[OnScreenTimer] = None - + self.default_music = (bs.MusicType.EPIC if self._epic_mode else bs.MusicType.SURVIVAL) - + if self._epic_mode: self.slow_motion = True - + def on_begin(self) -> None: super().on_begin() - + delay = 5.0 if len(self.players) > 2 else 2.5 if self._epic_mode: delay *= 0.25 bs.timer(delay, self._decrement_meteor_time, repeat=True) - + delay = 3.0 if self._epic_mode: delay *= 0.25 bs.timer(delay, self._set_meteor_timer) - + self._timer = OnScreenTimer() self._timer.start() self._check_end_game() - + def on_player_join(self, player: Player) -> None: if self.has_begun(): bs.broadcastmessage( babase.Lstr(resource='playerDelayedJoinText', - subs=[('${PLAYER}', player.getname(full=True))]), + subs=[('${PLAYER}', player.getname(full=True))]), color=(0, 1, 0), ) assert self._timer is not None player.death_time = self._timer.getstarttime() return self.spawn_player(player) - + def spawn_player(self, player: Player) -> None: spaz = self.spawn_player_spaz(player) - + spaz.connect_controls_to_player(enable_punch=False, enable_pickup=False, enable_bomb=False, enable_jump=False) spaz.play_big_death_sound = True - + return spaz - + def on_player_leave(self, player: Player) -> None: super().on_player_leave(player) - + self._check_end_game() - + def handlemessage(self, msg: Any) -> Any: if isinstance(msg, bs.PlayerDiedMessage): curtime = bs.time() - + msg.getplayer(Player).death_time = curtime bs.timer(1.0, self._check_end_game) else: return super().handlemessage(msg) - + def _spawn_meteors(self) -> None: pos = (random.randint(-6, 7), 12, random.uniform(-2, 1)) velocity = (random.randint(-11, 11), 0, random.uniform(-5, 5)) Meteor(pos=pos, velocity=velocity).autoretain() - + def _spawn_meteors_cluster(self) -> None: delay = 0.0 for _i in range(random.randrange(1, 3)): bs.timer(delay, self._spawn_meteors) delay += 1 self._set_meteor_timer() - + def _decrement_meteor_time(self) -> None: self._meteor_time = max(0.01, self._meteor_time * 0.9) - + def _set_meteor_timer(self) -> None: bs.timer((1.0 + 0.2 * random.random()) * self._meteor_time, self._spawn_meteors_cluster) - + def _check_end_game(self) -> None: living_team_count = 0 for team in self.teams: @@ -211,44 +214,44 @@ class NewMeteorShowerGame(bs.TeamGameActivity[Player, Team]): if player.is_alive(): living_team_count += 1 break - + if isinstance(self.session, bs.CoopSession): if living_team_count <= 0: self.end_game() else: if living_team_count <= 1: self.end_game() - + def end_game(self) -> None: cur_time = bs.time() assert self._timer is not None start_time = self._timer.getstarttime() - + for team in self.teams: for player in team.players: survived = False - + if player.death_time is None: survived = True player.death_time = cur_time + 1 - + score = int(player.death_time - self._timer.getstarttime()) if survived: score += 50 self.stats.player_scored(player, score, screenmessage=False) - + self._timer.stop(endtime=self._last_player_death_time) - + results = bs.GameResults() - + for team in self.teams: - + longest_life = 0.0 for player in team.players: assert player.death_time is not None longest_life = max(longest_life, player.death_time - start_time) - + results.set_team_score(team, int(1000.0 * longest_life)) - - self.end(results=results) \ No newline at end of file + + self.end(results=results) diff --git a/plugins/minigames/fat_pigs.py b/plugins/minigames/fat_pigs.py index aed1a69..78c56c3 100644 --- a/plugins/minigames/fat_pigs.py +++ b/plugins/minigames/fat_pigs.py @@ -3,7 +3,7 @@ # - - - - - - - - - - - - - - - - - - - - - # - Fat-Pigs! by Zacker Tz || Zacker#5505 - -# - Version 0.01 :v - +# - Version 0.01 :v - # - - - - - - - - - - - - - - - - - - - - - from __future__ import annotations @@ -24,12 +24,13 @@ if TYPE_CHECKING: # - - - - - - - Mini - Settings - - - - - - - - - - - - - - - - # -zkBombs_limit = 3 # Number of bombs you can use | Default = 3 -zkPunch = False # Enable/Disable punchs | Default = False -zkPickup = False # Enable/Disable pickup | Default = False +zkBombs_limit = 3 # Number of bombs you can use | Default = 3 +zkPunch = False # Enable/Disable punchs | Default = False +zkPickup = False # Enable/Disable pickup | Default = False # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # + class Player(bs.Player['Team']): """Our player type for this game.""" @@ -40,7 +41,9 @@ class Team(bs.Team[Player]): def __init__(self) -> None: self.score = 0 -# ba_meta export bascenev1.GameActivity +# ba_meta export bascenev1.GameActivity + + class FatPigs(bs.TeamGameActivity[Player, Team]): """A game type based on acquiring kills.""" @@ -139,20 +142,18 @@ class FatPigs(bs.TeamGameActivity[Player, Team]): super().on_begin() self.setup_standard_time_limit(self._time_limit) # self.setup_standard_powerup_drops() - #Ambiente + # Ambiente gnode = bs.getactivity().globalsnode gnode.tint = (0.8, 1.2, 0.8) gnode.ambient_color = (0.7, 1.0, 0.6) - gnode.vignette_outer = (0.4, 0.6, 0.4) #C + gnode.vignette_outer = (0.4, 0.6, 0.4) # C # gnode.vignette_inner = (0.9, 0.9, 0.9) - - # Base kills needed to win on the size of the largest team. self._score_to_win = (self._kills_to_win_per_player * max(1, max(len(t.players) for t in self.teams))) self._update_scoreboard() - + delay = 5.0 if len(self.players) > 2 else 2.5 if self._epic_mode: delay *= 0.25 @@ -169,18 +170,17 @@ class FatPigs(bs.TeamGameActivity[Player, Team]): # Check for immediate end (if we've only got 1 player, etc). bs.timer(5.0, self._check_end_game) - + t = bs.newnode('text', - attrs={ 'text':"Minigame by Zacker Tz", - 'scale':0.7, - 'position':(0.001,625), - 'shadow':0.5, - 'opacity':0.7, - 'flatness':1.2, - 'color':(0.6, 1, 0.6), - 'h_align':'center', - 'v_attach':'bottom'}) - + attrs={'text': "Minigame by Zacker Tz", + 'scale': 0.7, + 'position': (0.001, 625), + 'shadow': 0.5, + 'opacity': 0.7, + 'flatness': 1.2, + 'color': (0.6, 1, 0.6), + 'h_align': 'center', + 'v_attach': 'bottom'}) def spawn_player(self, player: Player) -> bs.Actor: spaz = self.spawn_player_spaz(player) @@ -190,13 +190,13 @@ class FatPigs(bs.TeamGameActivity[Player, Team]): spaz.connect_controls_to_player(enable_punch=zkPunch, enable_bomb=True, enable_pickup=zkPickup) - + spaz.bomb_count = zkBombs_limit spaz._max_bomb_count = zkBombs_limit spaz.bomb_type_default = 'sticky' spaz.bomb_type = 'sticky' - #cerdo gordo + # cerdo gordo spaz.node.color_mask_texture = bs.gettexture('melColorMask') spaz.node.color_texture = bs.gettexture('melColor') spaz.node.head_mesh = bs.getmesh('melHead') @@ -210,19 +210,19 @@ class FatPigs(bs.TeamGameActivity[Player, Team]): spaz.node.toes_mesh = bs.getmesh('melToes') spaz.node.style = 'mel' # Sounds cerdo gordo - mel_sounds = [bs.getsound('mel01'), bs.getsound('mel02'),bs.getsound('mel03'),bs.getsound('mel04'),bs.getsound('mel05'), - bs.getsound('mel06'),bs.getsound('mel07'),bs.getsound('mel08'),bs.getsound('mel09'),bs.getsound('mel10')] + mel_sounds = [bs.getsound('mel01'), bs.getsound('mel02'), bs.getsound('mel03'), bs.getsound('mel04'), bs.getsound('mel05'), + bs.getsound('mel06'), bs.getsound('mel07'), bs.getsound('mel08'), bs.getsound('mel09'), bs.getsound('mel10')] spaz.node.jump_sounds = mel_sounds spaz.node.attack_sounds = mel_sounds spaz.node.impact_sounds = mel_sounds spaz.node.pickup_sounds = mel_sounds spaz.node.death_sounds = [bs.getsound('melDeath01')] spaz.node.fall_sounds = [bs.getsound('melFall01')] - + def _set_meteor_timer(self) -> None: bs.timer((1.0 + 0.2 * random.random()) * self._meteor_time, - self._drop_bomb_cluster) - + self._drop_bomb_cluster) + def _drop_bomb_cluster(self) -> None: # Random note: code like this is a handy way to plot out extents @@ -245,15 +245,14 @@ class FatPigs(bs.TeamGameActivity[Player, Team]): vel = ((-5.0 + random.random() * 30.0) * dropdir, -4.0, 0) bs.timer(delay, babase.Call(self._drop_bomb, pos, vel)) delay += 0.1 - self._set_meteor_timer() - + self._set_meteor_timer() + def _drop_bomb(self, position: Sequence[float], velocity: Sequence[float]) -> None: - Bomb(position=position, velocity=velocity,bomb_type='sticky').autoretain() + Bomb(position=position, velocity=velocity, bomb_type='sticky').autoretain() def _decrement_meteor_time(self) -> None: self._meteor_time = max(0.01, self._meteor_time * 0.9) - def handlemessage(self, msg: Any) -> Any: @@ -326,7 +325,7 @@ class FatPigs(bs.TeamGameActivity[Player, Team]): self.end_game() else: if living_team_count <= 1: - self.end_game() + self.end_game() def _update_scoreboard(self) -> None: for team in self.teams: diff --git a/plugins/utilities/xyz_tool.py b/plugins/utilities/xyz_tool.py index 2ad1efd..c3cf567 100644 --- a/plugins/utilities/xyz_tool.py +++ b/plugins/utilities/xyz_tool.py @@ -20,28 +20,35 @@ DECIMAL_LIMIT = 7 PlayerSpaz.supershit = PlayerSpaz.__init__ + + def ShitInit(self, - player: bs.Player, - color: Sequence[float] = (1.0, 1.0, 1.0), - highlight: Sequence[float] = (0.5, 0.5, 0.5), - character: str = 'Spaz', - powerups_expire: bool = True) -> None: + player: bs.Player, + color: Sequence[float] = (1.0, 1.0, 1.0), + highlight: Sequence[float] = (0.5, 0.5, 0.5), + character: str = 'Spaz', + powerups_expire: bool = True) -> None: self.supershit(player, color, highlight, character, powerups_expire) - self.offt = bs.newnode('math', owner=self.node, attrs={'input1': (1.2, 1.8, -0.7),'operation': 'add'}) + self.offt = bs.newnode('math', owner=self.node, attrs={ + 'input1': (1.2, 1.8, -0.7), 'operation': 'add'}) self.node.connectattr('torso_position', self.offt, 'input2') - self.txt = bs.newnode('text', owner=self.node, attrs={'text': '3.0','in_world': True,'text':'0','shadow': 1.0,'color': (1,0,0),'flatness': 0.5,'scale': 0.01,'h_align': 'right'}) + self.txt = bs.newnode('text', owner=self.node, attrs={'text': '3.0', 'in_world': True, 'text': '0', 'shadow': 1.0, 'color': ( + 1, 0, 0), 'flatness': 0.5, 'scale': 0.01, 'h_align': 'right'}) p = self.node.position self.xyz = 0 self.txt.text = "X: " + str(p[0]) + "\nY: " + str(p[1]) + "\nZ: " + str(p[2]) self.offt.connectattr('output', self.txt, 'position') + def update(): p = self.node.position is_moving = abs(self.node.move_up_down) >= 0.01 or abs(self.node.move_left_right) >= 0.01 if is_moving: - self.xyz = (p[0],p[1],p[2]) - self.txt.text = "X: " + str(round(self.xyz[0],DECIMAL_LIMIT)) + "\nY: " + str(round(self.xyz[1],DECIMAL_LIMIT)) + "\nZ: " + str(round(self.xyz[2],DECIMAL_LIMIT)) - bs.timer(0.1,update,repeat=True) - + self.xyz = (p[0], p[1], p[2]) + self.txt.text = "X: " + str(round(self.xyz[0], DECIMAL_LIMIT)) + "\nY: " + str( + round(self.xyz[1], DECIMAL_LIMIT)) + "\nZ: " + str(round(self.xyz[2], DECIMAL_LIMIT)) + bs.timer(0.1, update, repeat=True) + + def replaceable_punch(self) -> None: """ Called to 'press punch' on this spaz; @@ -55,10 +62,11 @@ def replaceable_punch(self) -> None: index += len(files) c27 = str(index + 1) with open(path_aid + '/coords' + c27 + '.txt', 'w') as gg: - gg.write("X: " + str(round(self.xyz[0],DECIMAL_LIMIT)) + "\nY: " + str(round(self.xyz[1],DECIMAL_LIMIT)) + "\nZ: " + str(round(self.xyz[2],DECIMAL_LIMIT)) + '\n\n' + '(' + str(round(self.xyz[0],DECIMAL_LIMIT)) + ', ' + str(round(self.xyz[1],DECIMAL_LIMIT)) + ', ' + str(round(self.xyz[2],DECIMAL_LIMIT)) + ')') + gg.write("X: " + str(round(self.xyz[0], DECIMAL_LIMIT)) + "\nY: " + str(round(self.xyz[1], DECIMAL_LIMIT)) + "\nZ: " + str(round(self.xyz[2], DECIMAL_LIMIT)) + + '\n\n' + '(' + str(round(self.xyz[0], DECIMAL_LIMIT)) + ', ' + str(round(self.xyz[1], DECIMAL_LIMIT)) + ', ' + str(round(self.xyz[2], DECIMAL_LIMIT)) + ')') bui.screenmessage("Coordinates saved in: " + "BombSquad/Saved XYZ/" + "coords" + c27) if _babase.app.classic.platform == 'android': - _babase.android_media_scan_file(path_aid) + _babase.android_media_scan_file(path_aid) t_ms = bs.time() * 1000 assert isinstance(t_ms, int) if t_ms - self.last_punch_time_ms >= self._punch_cooldown: @@ -69,17 +77,20 @@ def replaceable_punch(self) -> None: self.node.punch_pressed = True if not self.node.hold_node: bs.timer( - 0.1, - bs.WeakCall(self._safe_play_sound, - SpazFactory.get().swish_sound, 0.8)) + 0.1, + bs.WeakCall(self._safe_play_sound, + SpazFactory.get().swish_sound, 0.8)) self._turbo_filter_add_press('punch') # ba_meta export plugin + + class ragingspeedhorn(babase.Plugin): try: - oath = _babase.env()['python_directory_user'] + '/Saved XYZ' - os.makedirs(oath,exist_ok=False) - except: pass + oath = _babase.env()['python_directory_user'] + '/Saved XYZ' + os.makedirs(oath, exist_ok=False) + except: + pass PlayerSpaz.on_punch_press = replaceable_punch PlayerSpaz.__init__ = ShitInit - PlayerSpaz.xyz = 0 \ No newline at end of file + PlayerSpaz.xyz = 0