mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
[ci] auto-format
This commit is contained in:
parent
85304770d3
commit
d58e326d4c
5 changed files with 564 additions and 530 deletions
|
|
@ -13,6 +13,8 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
Spaz.oldhandlemessage = Spaz.handlemessage
|
||||
|
||||
|
||||
def handlemessage(self, msg: Any) -> Any:
|
||||
if isinstance(msg, ba.DieMessage):
|
||||
if self.node:
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ else:
|
|||
teams_text = 'Teams'
|
||||
ffa_text = 'FFA'
|
||||
|
||||
|
||||
class ConfigNumberEdit:
|
||||
|
||||
def __init__(self,
|
||||
|
|
@ -102,6 +103,7 @@ class ConfigNumberEdit:
|
|||
cfg['Config Max Players'][self._config] = self._value
|
||||
cfg.apply_and_commit()
|
||||
|
||||
|
||||
class SettingsMaxPlayers(PopupWindow):
|
||||
|
||||
def __init__(self):
|
||||
|
|
@ -180,6 +182,7 @@ class SettingsMaxPlayers(PopupWindow):
|
|||
ba.playsound(ba.getsound('swish'))
|
||||
self._transition_out()
|
||||
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Instantiate a co-op mode session."""
|
||||
# pylint: disable=cyclic-import
|
||||
|
|
@ -230,6 +233,7 @@ def __init__(self) -> None:
|
|||
self._next_game_level_name: Optional[str] = None
|
||||
self._update_on_deck_game_instances()
|
||||
|
||||
|
||||
def get_max_players(self) -> int:
|
||||
"""Return max number of ba.Players allowed to join the game at once."""
|
||||
if self.use_teams:
|
||||
|
|
@ -240,11 +244,15 @@ def get_max_players(self) -> int:
|
|||
'Free-for-All Max Players',
|
||||
cfg['Config Max Players']['ffa_max_players'])
|
||||
|
||||
|
||||
GatherWindow.__old_init__ = GatherWindow.__init__
|
||||
|
||||
|
||||
def __gather_init__(self,
|
||||
transition: Optional[str] = 'in_right',
|
||||
origin_widget: ba.Widget = None):
|
||||
transition: Optional[str] = 'in_right',
|
||||
origin_widget: ba.Widget = None):
|
||||
self.__old_init__(transition, origin_widget)
|
||||
|
||||
def _do_max_players():
|
||||
SettingsMaxPlayers()
|
||||
self._max_players_button = ba.buttonwidget(
|
||||
|
|
@ -260,6 +268,7 @@ def __gather_init__(self,
|
|||
button_type='regular',
|
||||
on_activate_call=_do_max_players)
|
||||
|
||||
|
||||
def _save_state(self) -> None:
|
||||
try:
|
||||
for tab in self._tabs.values():
|
||||
|
|
@ -287,6 +296,7 @@ def _save_state(self) -> None:
|
|||
except Exception:
|
||||
ba.print_exception(f'Error saving state for {self}.')
|
||||
|
||||
|
||||
def _restore_state(self) -> None:
|
||||
from efro.util import enum_by_value
|
||||
try:
|
||||
|
|
@ -326,6 +336,8 @@ def _restore_state(self) -> None:
|
|||
ba.print_exception('Error restoring gather-win state.')
|
||||
|
||||
# ba_meta export plugin
|
||||
|
||||
|
||||
class MaxPlayersPlugin(ba.Plugin):
|
||||
|
||||
def has_settings_ui(self) -> bool:
|
||||
|
|
@ -338,7 +350,7 @@ class MaxPlayersPlugin(ba.Plugin):
|
|||
old_config = ba.app.config['Config Max Players']
|
||||
for setting in cmp:
|
||||
if setting not in old_config:
|
||||
ba.app.config['Config Max Players'].update({setting:cmp[setting]})
|
||||
ba.app.config['Config Max Players'].update({setting: cmp[setting]})
|
||||
remove_list = []
|
||||
for setting in old_config:
|
||||
if setting not in cmp:
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ if TYPE_CHECKING:
|
|||
lang = ba.app.lang.language
|
||||
|
||||
if lang == 'Spanish':
|
||||
custom_txt = 'personalizar...'
|
||||
custom_txt = 'personalizar...'
|
||||
else:
|
||||
custom_txt = 'custom...'
|
||||
custom_txt = 'custom...'
|
||||
|
||||
|
||||
if 'quick_game_button' in ba.app.config:
|
||||
|
|
@ -31,6 +31,7 @@ else:
|
|||
ba.app.config['quick_game_button'] = config
|
||||
ba.app.config.commit()
|
||||
|
||||
|
||||
def start_game(session: ba.Session, fadeout: bool = True):
|
||||
def callback():
|
||||
if fadeout:
|
||||
|
|
@ -50,6 +51,7 @@ def start_game(session: ba.Session, fadeout: bool = True):
|
|||
else:
|
||||
callback()
|
||||
|
||||
|
||||
class SimplePlaylist:
|
||||
|
||||
def __init__(self,
|
||||
|
|
@ -66,6 +68,7 @@ class SimplePlaylist:
|
|||
settings = self.settings['settings']
|
||||
return dict(resolved_type=self.gametype, settings=settings)
|
||||
|
||||
|
||||
class CustomSession(FreeForAllSession):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -305,6 +308,8 @@ class SelectGameWindow(PlaylistAddGameWindow):
|
|||
|
||||
|
||||
PlayWindow._old_init = PlayWindow.__init__
|
||||
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self._old_init()
|
||||
|
||||
|
|
@ -331,6 +336,7 @@ def __init__(self, *args, **kwargs):
|
|||
|
||||
self._restore_state()
|
||||
|
||||
|
||||
def states(self) -> None:
|
||||
return {
|
||||
'Team Games': self._teams_button,
|
||||
|
|
@ -340,6 +346,7 @@ def states(self) -> None:
|
|||
'Quick Game': self._quick_game_button
|
||||
}
|
||||
|
||||
|
||||
def _save_state(self) -> None:
|
||||
swapped = {v: k for k, v in states(self).items()}
|
||||
if self._root_widget.get_selected_child() in swapped:
|
||||
|
|
@ -349,6 +356,7 @@ def _save_state(self) -> None:
|
|||
else:
|
||||
ba.print_exception(f'Error saving state for {self}.')
|
||||
|
||||
|
||||
def _restore_state(self) -> None:
|
||||
if not hasattr(self, '_quick_game_button'):
|
||||
return # ensure that our monkey patched init ran
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ import random
|
|||
from bastd.actor import bomb
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Sequence
|
||||
from typing import Sequence
|
||||
|
||||
|
||||
class NewBlast(bomb.Blast):
|
||||
def __init__(
|
||||
def __init__(
|
||||
self,
|
||||
position: Sequence[float] = (0.0, 1.0, 0.0),
|
||||
velocity: Sequence[float] = (0.0, 0.0, 0.0),
|
||||
|
|
@ -24,25 +24,25 @@ class NewBlast(bomb.Blast):
|
|||
hit_type: str = 'explosion',
|
||||
hit_subtype: str = 'normal',
|
||||
):
|
||||
super().__init__(position, velocity, blast_radius, blast_type,
|
||||
source_player, hit_type, hit_subtype)
|
||||
scorch_radius = light_radius = self.radius
|
||||
if self.blast_type == 'tnt':
|
||||
scorch_radius *= 1.15
|
||||
scorch = ba.newnode(
|
||||
'scorch',
|
||||
attrs={
|
||||
'position': position,
|
||||
'size': scorch_radius * 0.5,
|
||||
'big': (self.blast_type == 'tnt'),
|
||||
},
|
||||
)
|
||||
random_color = (random.random(), random.random(), random.random())
|
||||
scorch.color = ba.safecolor(random_color)
|
||||
ba.animate(scorch, 'presence', {3.000: 1, 13.000: 0})
|
||||
ba.timer(13.0, scorch.delete)
|
||||
super().__init__(position, velocity, blast_radius, blast_type,
|
||||
source_player, hit_type, hit_subtype)
|
||||
scorch_radius = light_radius = self.radius
|
||||
if self.blast_type == 'tnt':
|
||||
scorch_radius *= 1.15
|
||||
scorch = ba.newnode(
|
||||
'scorch',
|
||||
attrs={
|
||||
'position': position,
|
||||
'size': scorch_radius * 0.5,
|
||||
'big': (self.blast_type == 'tnt'),
|
||||
},
|
||||
)
|
||||
random_color = (random.random(), random.random(), random.random())
|
||||
scorch.color = ba.safecolor(random_color)
|
||||
ba.animate(scorch, 'presence', {3.000: 1, 13.000: 0})
|
||||
ba.timer(13.0, scorch.delete)
|
||||
|
||||
|
||||
# ba_meta export plugin
|
||||
class RandomColorsPlugin(ba.Plugin):
|
||||
bomb.Blast = NewBlast
|
||||
bomb.Blast = NewBlast
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue