mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-11-07 17:36:00 +00:00
Autopep8
This commit is contained in:
parent
9041d5cbf7
commit
6bdc35eda4
2 changed files with 491 additions and 503 deletions
|
|
@ -34,7 +34,8 @@ from __future__ import annotations
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import ba,_ba
|
import ba
|
||||||
|
import _ba
|
||||||
from bastd.actor.playerspaz import PlayerSpaz
|
from bastd.actor.playerspaz import PlayerSpaz
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -46,12 +47,14 @@ from ba._profile import get_player_profile_colors
|
||||||
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
|
||||||
import weakref
|
import weakref
|
||||||
import os,json
|
import os
|
||||||
|
import json
|
||||||
from ba import _lobby
|
from ba import _lobby
|
||||||
from bastd.actor.spazappearance import *
|
from bastd.actor.spazappearance import *
|
||||||
from ba._lobby import ChangeMessage
|
from ba._lobby import ChangeMessage
|
||||||
from ba._lobby import PlayerReadyMessage
|
from ba._lobby import PlayerReadyMessage
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, vpos: float, sessionplayer: _ba.SessionPlayer,
|
def __init__(self, vpos: float, sessionplayer: _ba.SessionPlayer,
|
||||||
lobby: 'Lobby') -> None:
|
lobby: 'Lobby') -> None:
|
||||||
self._deek_sound = _ba.getsound('deek')
|
self._deek_sound = _ba.getsound('deek')
|
||||||
|
|
@ -75,7 +78,8 @@ def __init__(self, vpos: float, sessionplayer: _ba.SessionPlayer,
|
||||||
|
|
||||||
app = _ba.app
|
app = _ba.app
|
||||||
|
|
||||||
self.bakwas_chars=["Lee","Todd McBurton","Zola","Butch","Witch","warrior","Middle-Man","Alien","OldLady","Gladiator","Wrestler","Gretel","Robot"]
|
self.bakwas_chars = ["Lee", "Todd McBurton", "Zola", "Butch", "Witch", "warrior",
|
||||||
|
"Middle-Man", "Alien", "OldLady", "Gladiator", "Wrestler", "Gretel", "Robot"]
|
||||||
|
|
||||||
# Load available player profiles either from the local config or
|
# Load available player profiles either from the local config or
|
||||||
# from the remote device.
|
# from the remote device.
|
||||||
|
|
@ -147,8 +151,6 @@ def __init__(self, vpos: float, sessionplayer: _ba.SessionPlayer,
|
||||||
self._set_ready(False)
|
self._set_ready(False)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _set_ready(self, ready: bool) -> None:
|
def _set_ready(self, ready: bool) -> None:
|
||||||
|
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
|
|
@ -237,8 +239,6 @@ def _set_ready(self, ready: bool) -> None:
|
||||||
self._update_text()
|
self._update_text()
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Inform the session that this player is ready.
|
# Inform the session that this player is ready.
|
||||||
_ba.getsession().handlemessage(PlayerReadyMessage(self))
|
_ba.getsession().handlemessage(PlayerReadyMessage(self))
|
||||||
|
|
||||||
|
|
@ -303,6 +303,7 @@ def handlemessage(self, msg: Any) -> Any:
|
||||||
elif msg.what == 'ready':
|
elif msg.what == 'ready':
|
||||||
self._handle_ready_msg(msg.value)
|
self._handle_ready_msg(msg.value)
|
||||||
|
|
||||||
|
|
||||||
def _update_text(self) -> None:
|
def _update_text(self) -> None:
|
||||||
assert self._text_node is not None
|
assert self._text_node is not None
|
||||||
if self._ready:
|
if self._ready:
|
||||||
|
|
@ -347,6 +348,8 @@ def _update_text(self) -> None:
|
||||||
self._text_node.text = text
|
self._text_node.text = text
|
||||||
|
|
||||||
# ba_meta export plugin
|
# ba_meta export plugin
|
||||||
|
|
||||||
|
|
||||||
class HeySmoothy(ba.Plugin):
|
class HeySmoothy(ba.Plugin):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
@ -355,6 +358,3 @@ class HeySmoothy(ba.Plugin):
|
||||||
|
|
||||||
_lobby.Chooser._update_text = _update_text
|
_lobby.Chooser._update_text = _update_text
|
||||||
_lobby.Chooser.handlemessage = handlemessage
|
_lobby.Chooser.handlemessage = handlemessage
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,14 +50,16 @@ from __future__ import annotations
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import ba,_ba
|
import ba
|
||||||
|
import _ba
|
||||||
from bastd.actor.playerspaz import PlayerSpaz
|
from bastd.actor.playerspaz import PlayerSpaz
|
||||||
from bastd.actor.scoreboard import Scoreboard
|
from bastd.actor.scoreboard import Scoreboard
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
import os,json
|
import os
|
||||||
|
import json
|
||||||
from bastd.actor.spazappearance import *
|
from bastd.actor.spazappearance import *
|
||||||
spazoutfit = {
|
spazoutfit = {
|
||||||
"color_mask": "neoSpazColorMask",
|
"color_mask": "neoSpazColorMask",
|
||||||
|
|
@ -83,6 +85,7 @@ spazoutfit={
|
||||||
}
|
}
|
||||||
character = None
|
character = None
|
||||||
|
|
||||||
|
|
||||||
class Player(ba.Player['Team']):
|
class Player(ba.Player['Team']):
|
||||||
"""Our player type for this game."""
|
"""Our player type for this game."""
|
||||||
|
|
||||||
|
|
@ -140,7 +143,6 @@ class CharacterBuilder(ba.TeamGameActivity[Player, Team]):
|
||||||
ba.BoolSetting('Epic Mode', default=False),
|
ba.BoolSetting('Epic Mode', default=False),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
if issubclass(sessiontype, ba.FreeForAllSession):
|
if issubclass(sessiontype, ba.FreeForAllSession):
|
||||||
settings.append(
|
settings.append(
|
||||||
ba.BoolSetting('Allow Negative Scores', default=False))
|
ba.BoolSetting('Allow Negative Scores', default=False))
|
||||||
|
|
@ -158,7 +160,6 @@ class CharacterBuilder(ba.TeamGameActivity[Player, Team]):
|
||||||
|
|
||||||
def __init__(self, settings: dict):
|
def __init__(self, settings: dict):
|
||||||
|
|
||||||
|
|
||||||
super().__init__(settings)
|
super().__init__(settings)
|
||||||
|
|
||||||
self.initdic()
|
self.initdic()
|
||||||
|
|
@ -241,7 +242,6 @@ class CharacterBuilder(ba.TeamGameActivity[Player, Team]):
|
||||||
def on_begin(self) -> None:
|
def on_begin(self) -> None:
|
||||||
super().on_begin()
|
super().on_begin()
|
||||||
|
|
||||||
|
|
||||||
def nextBodyPart(self):
|
def nextBodyPart(self):
|
||||||
self.bodyindex = (self.bodyindex+1) % len(self.dic.keys())
|
self.bodyindex = (self.bodyindex+1) % len(self.dic.keys())
|
||||||
self.bodypart.delete()
|
self.bodypart.delete()
|
||||||
|
|
@ -257,8 +257,6 @@ class CharacterBuilder(ba.TeamGameActivity[Player, Team]):
|
||||||
'position': (-4, 6, -4)
|
'position': (-4, 6, -4)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def prevBodyPart(self):
|
def prevBodyPart(self):
|
||||||
self.bodyindex = (self.bodyindex-1) % len(self.dic.keys())
|
self.bodyindex = (self.bodyindex-1) % len(self.dic.keys())
|
||||||
self.bodypart.delete()
|
self.bodypart.delete()
|
||||||
|
|
@ -374,15 +372,10 @@ class CharacterBuilder(ba.TeamGameActivity[Player, Team]):
|
||||||
player = msg.getplayer(Player)
|
player = msg.getplayer(Player)
|
||||||
self.respawn_player(player)
|
self.respawn_player(player)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return super().handlemessage(msg)
|
return super().handlemessage(msg)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def setcurrentcharacter(self, charname):
|
def setcurrentcharacter(self, charname):
|
||||||
global spazoutfit
|
global spazoutfit
|
||||||
char = ba.app.spaz_appearances[charname]
|
char = ba.app.spaz_appearances[charname]
|
||||||
|
|
@ -399,7 +392,6 @@ class CharacterBuilder(ba.TeamGameActivity[Player, Team]):
|
||||||
spazoutfit['color_mask'] = char.color_mask_texture
|
spazoutfit['color_mask'] = char.color_mask_texture
|
||||||
spazoutfit['color_texture'] = char.color_texture
|
spazoutfit['color_texture'] = char.color_texture
|
||||||
|
|
||||||
|
|
||||||
def _update_scoreboard(self) -> None:
|
def _update_scoreboard(self) -> None:
|
||||||
for team in self.teams:
|
for team in self.teams:
|
||||||
self._scoreboard.set_team_value(team, team.score,
|
self._scoreboard.set_team_value(team, team.score,
|
||||||
|
|
@ -410,6 +402,7 @@ class CharacterBuilder(ba.TeamGameActivity[Player, Team]):
|
||||||
for team in self.teams:
|
for team in self.teams:
|
||||||
results.set_team_score(team, team.score)
|
results.set_team_score(team, team.score)
|
||||||
self.end(results=results)
|
self.end(results=results)
|
||||||
|
|
||||||
def initdic(self):
|
def initdic(self):
|
||||||
self.dic = {"head": ["bomb", "landMine", "trees", "wing", "eyeLid", "impactBomb"],
|
self.dic = {"head": ["bomb", "landMine", "trees", "wing", "eyeLid", "impactBomb"],
|
||||||
"hand": ["hairTuft3", "bomb", "powerup"],
|
"hand": ["hairTuft3", "bomb", "powerup"],
|
||||||
|
|
@ -425,7 +418,8 @@ class CharacterBuilder(ba.TeamGameActivity[Player, Team]):
|
||||||
"color_mask": ["egg1", "egg2", "egg3", "bombColor", "crossOutMask", "fontExtras3"]
|
"color_mask": ["egg1", "egg2", "egg3", "bombColor", "crossOutMask", "fontExtras3"]
|
||||||
|
|
||||||
}
|
}
|
||||||
chars=["neoSpaz","zoe","ninja","kronk","mel","jack","santa","frosty","bones","bear","penguin","ali","cyborg","agent","wizard","pixie","bunny"]
|
chars = ["neoSpaz", "zoe", "ninja", "kronk", "mel", "jack", "santa", "frosty",
|
||||||
|
"bones", "bear", "penguin", "ali", "cyborg", "agent", "wizard", "pixie", "bunny"]
|
||||||
for char in chars:
|
for char in chars:
|
||||||
self.dic["head"].append(char+"Head")
|
self.dic["head"].append(char+"Head")
|
||||||
self.dic["hand"].append(char+"Hand")
|
self.dic["hand"].append(char+"Hand")
|
||||||
|
|
@ -444,6 +438,7 @@ class CharacterBuilder(ba.TeamGameActivity[Player, Team]):
|
||||||
|
|
||||||
cm = _ba.chatmessage
|
cm = _ba.chatmessage
|
||||||
|
|
||||||
|
|
||||||
def _new_chatmessage(msg):
|
def _new_chatmessage(msg):
|
||||||
if msg.split(" ")[0] == "export":
|
if msg.split(" ")[0] == "export":
|
||||||
if len(msg.split(" ")) > 1:
|
if len(msg.split(" ")) > 1:
|
||||||
|
|
@ -455,6 +450,8 @@ def _new_chatmessage(msg):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
cm(msg)
|
cm(msg)
|
||||||
|
|
||||||
|
|
||||||
_ba.chatmessage = _new_chatmessage
|
_ba.chatmessage = _new_chatmessage
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -472,6 +469,7 @@ def savecharacter(name):
|
||||||
else:
|
else:
|
||||||
_ba.screenmessage("Works offline with Character Maker")
|
_ba.screenmessage("Works offline with Character Maker")
|
||||||
|
|
||||||
|
|
||||||
def importcharacter(name):
|
def importcharacter(name):
|
||||||
if name in ba.app.spaz_appearances:
|
if name in ba.app.spaz_appearances:
|
||||||
global character
|
global character
|
||||||
|
|
@ -482,7 +480,6 @@ def importcharacter(name):
|
||||||
except:
|
except:
|
||||||
_ba.screenmessage("works offline with character maker")
|
_ba.screenmessage("works offline with character maker")
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
_ba.screenmessage("invalid name check typo \n name is case sensitive")
|
_ba.screenmessage("invalid name check typo \n name is case sensitive")
|
||||||
|
|
||||||
|
|
@ -513,11 +510,6 @@ def registercharacter(name,char):
|
||||||
t.style = char['style']
|
t.style = char['style']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ba_meta export plugin
|
# ba_meta export plugin
|
||||||
class HeySmoothy(ba.Plugin):
|
class HeySmoothy(ba.Plugin):
|
||||||
|
|
||||||
|
|
@ -532,7 +524,3 @@ class HeySmoothy(ba.Plugin):
|
||||||
with open(path+file, 'r') as f:
|
with open(path+file, 'r') as f:
|
||||||
character = json.load(f)
|
character = json.load(f)
|
||||||
registercharacter(file, character)
|
registercharacter(file, character)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue