[ci] auto-format

This commit is contained in:
SenjuZoro 2023-07-24 00:25:32 +00:00 committed by github-actions[bot]
parent 12d51c3b1d
commit 2b046cb433

View file

@ -27,12 +27,15 @@ if TYPE_CHECKING:
class TouchedToSpaz(object): class TouchedToSpaz(object):
pass pass
class TouchedToAnything(object): class TouchedToAnything(object):
pass pass
class TouchedToFootingMaterial(object): class TouchedToFootingMaterial(object):
pass pass
class QuakeBallFactory(object): class QuakeBallFactory(object):
"""Components used by QuakeBall stuff """Components used by QuakeBall stuff
@ -40,6 +43,7 @@ class QuakeBallFactory(object):
""" """
_STORENAME = babase.storagename() _STORENAME = babase.storagename()
@classmethod @classmethod
def get(cls) -> QuakeBallFactory: def get(cls) -> QuakeBallFactory:
"""Get/create a shared bascenev1lib.actor.bomb.BombFactory object.""" """Get/create a shared bascenev1lib.actor.bomb.BombFactory object."""
@ -137,7 +141,7 @@ class QuakeBall(bs.Actor):
b_shared.ball_material]}) b_shared.ball_material]})
self.light_node = bs.newnode('light', attrs={ self.light_node = bs.newnode('light', attrs={
'position':position, 'position': position,
'color': color, 'color': color,
'radius': 0.1+light_radius, 'radius': 0.1+light_radius,
'volume_intensity_scale': 15.0}) 'volume_intensity_scale': 15.0})
@ -181,12 +185,12 @@ class QuakeBall(bs.Actor):
velocity = self.node.velocity velocity = self.node.velocity
explosion = bs.newnode('explosion', attrs={ explosion = bs.newnode('explosion', attrs={
'position': self.node.position, 'position': self.node.position,
'velocity': (velocity[0], max(-1.0,velocity[1]), velocity[2]), 'velocity': (velocity[0], max(-1.0, velocity[1]), velocity[2]),
'radius': 1, 'radius': 1,
'big': False}) 'big': False})
bs.getsound(random.choice(['impactHard', 'impactHard2', 'impactHard3'])).play(), bs.getsound(random.choice(['impactHard', 'impactHard2', 'impactHard3'])).play(),
position=self.node.position position = self.node.position
self.emit_time = None self.emit_time = None
self.light_node.delete() self.light_node.delete()
@ -198,7 +202,7 @@ class QuakeBall(bs.Actor):
elif isinstance(m, bs.HitMessage): elif isinstance(m, bs.HitMessage):
self.node.handlemessage('impulse', m.pos[0], m.pos[1], m.pos[2], self.node.handlemessage('impulse', m.pos[0], m.pos[1], m.pos[2],
m.velocity[0], m.velocity[1], m.velocity[2], m.velocity[0], m.velocity[1], m.velocity[2],
1.0*m.magnitude, 1.0*m.velocity_magnitude, m.radius,0, 1.0*m.magnitude, 1.0*m.velocity_magnitude, m.radius, 0,
m.force_direction[0], m.force_direction[1], m.force_direction[2]) m.force_direction[0], m.force_direction[1], m.force_direction[2])
elif isinstance(m, TouchedToSpaz): elif isinstance(m, TouchedToSpaz):
@ -225,13 +229,11 @@ class QuakeBall(bs.Actor):
elif isinstance(m, TouchedToFootingMaterial): elif isinstance(m, TouchedToFootingMaterial):
bs.getsound('blip').play(), bs.getsound('blip').play(),
position=self.node.position position = self.node.position
else: else:
super().handlemessage(m) super().handlemessage(m)
class Player(bs.Player['Team']): class Player(bs.Player['Team']):
... ...
@ -243,6 +245,8 @@ class Team(bs.Team[Player]):
self.score = 0 self.score = 0
# ba_meta export bascenev1.GameActivity # ba_meta export bascenev1.GameActivity
class QuakeGame(bs.TeamGameActivity[Player, Team]): class QuakeGame(bs.TeamGameActivity[Player, Team]):
"""A game type based on acquiring kills.""" """A game type based on acquiring kills."""
@ -378,9 +382,9 @@ class QuakeGame(bs.TeamGameActivity[Player, Team]):
random.uniform(-4.5, 4.5)) \ random.uniform(-4.5, 4.5)) \
if i > count/2 else (random.uniform(10, 1), 6, random.uniform(-4.5, 4.5)) if i > count/2 else (random.uniform(10, 1), 6, random.uniform(-4.5, 4.5))
else: else:
radius = (random.uniform(-10,1), radius = (random.uniform(-10, 1),
6, 6,
random.uniform(-8,8)) \ random.uniform(-8, 8)) \
if i > count/2 else (random.uniform(10, 1), 6, random.uniform(-8, 8)) if i > count/2 else (random.uniform(10, 1), 6, random.uniform(-8, 8))
Obstacle( Obstacle(
@ -391,9 +395,10 @@ class QuakeGame(bs.TeamGameActivity[Player, Team]):
shape=int(self.settings['Obstacles Shape'])).autoretain() shape=int(self.settings['Obstacles Shape'])).autoretain()
if self.settings['Graphics'] == 2: if self.settings['Graphics'] == 2:
bs.getactivity().globalsnode.tint = (bs.getactivity().globalsnode.tint[0]-0.6, bs.getactivity().globalsnode.tint[1]-0.6, bs.getactivity().globalsnode.tint[2]-0.6) bs.getactivity().globalsnode.tint = (bs.getactivity(
).globalsnode.tint[0]-0.6, bs.getactivity().globalsnode.tint[1]-0.6, bs.getactivity().globalsnode.tint[2]-0.6)
light = bs.newnode('light', attrs={ light = bs.newnode('light', attrs={
'position': (9, 10, 0) if map == 'Football Stadium' else (6, 7, -2) \ 'position': (9, 10, 0) if map == 'Football Stadium' else (6, 7, -2)
if not map == 'Rampage' else (6, 11, -2) if not map == 'The Pad' else (6, 8.5, -2), if not map == 'Rampage' else (6, 11, -2) if not map == 'The Pad' else (6, 8.5, -2),
'color': (0.4, 0.4, 0.45), 'color': (0.4, 0.4, 0.45),
'radius': 1, 'radius': 1,
@ -401,7 +406,7 @@ class QuakeGame(bs.TeamGameActivity[Player, Team]):
'volume_intensity_scale': 10.0}) 'volume_intensity_scale': 10.0})
light2 = bs.newnode('light', attrs={ light2 = bs.newnode('light', attrs={
'position': (-9, 10, 0) if map == 'Football Stadium' else (-6, 7, -2) \ 'position': (-9, 10, 0) if map == 'Football Stadium' else (-6, 7, -2)
if not map == 'Rampage' else (-6, 11, -2) if not map == 'The Pad' else (-6, 8.5, -2), if not map == 'Rampage' else (-6, 11, -2) if not map == 'The Pad' else (-6, 8.5, -2),
'color': (0.4, 0.4, 0.45), 'color': (0.4, 0.4, 0.45),
'radius': 1, 'radius': 1,
@ -409,7 +414,8 @@ class QuakeGame(bs.TeamGameActivity[Player, Team]):
'volume_intensity_scale': 10.0}) 'volume_intensity_scale': 10.0})
if len(self.teams) > 0: if len(self.teams) > 0:
self._score_to_win = self.settings['Kills to Win Per Player']*max(1, max(len(t.players) for t in self.teams)) self._score_to_win = self.settings['Kills to Win Per Player'] * \
max(1, max(len(t.players) for t in self.teams))
else: else:
self._score_to_win = self.settings['Kills to Win Per Player'] self._score_to_win = self.settings['Kills to Win Per Player']
self._update_scoreboard() self._update_scoreboard()
@ -437,7 +443,7 @@ class QuakeGame(bs.TeamGameActivity[Player, Team]):
delete_light() delete_light()
del_checker() del_checker()
self._checker = bs.Timer(0.1,babase.Call(check_exists), repeat=True) self._checker = bs.Timer(0.1, babase.Call(check_exists), repeat=True)
def del_checker(): def del_checker():
if self._checker is not None: if self._checker is not None:
@ -461,7 +467,8 @@ class QuakeGame(bs.TeamGameActivity[Player, Team]):
enable_run=True, enable_run=True,
enable_fly=False) enable_fly=False)
if self.settings['Fast Movespeed']: spaz.node.hockey = True if self.settings['Fast Movespeed']:
spaz.node.hockey = True
spaz.spaz_light = bs.newnode('light', attrs={ spaz.spaz_light = bs.newnode('light', attrs={
'position': (0, 0, 0), 'position': (0, 0, 0),
'color': spaz.node.color, 'color': spaz.node.color,
@ -542,6 +549,7 @@ class QuakeGame(bs.TeamGameActivity[Player, Team]):
results.set_team_score(team, team.score) results.set_team_score(team, team.score)
self.end(results=results) self.end(results=results)
class Obstacle(bs.Actor): class Obstacle(bs.Actor):
def __init__(self, def __init__(self,
@ -567,10 +575,10 @@ class Obstacle(bs.Actor):
body = 'capsule' body = 'capsule'
elif shape == 5: elif shape == 5:
pair = random.choice([ pair = random.choice([
{'mesh':'tnt', 'body':'crate'}, {'mesh': 'tnt', 'body': 'crate'},
{'mesh':'bomb', 'body':'sphere'}, {'mesh': 'bomb', 'body': 'sphere'},
{'mesh':'puckModel', 'body':'puck'}, {'mesh': 'puckModel', 'body': 'puck'},
{'mesh':'egg', 'body':'capsule'} {'mesh': 'egg', 'body': 'capsule'}
]) ])
mesh = pair['mesh'] mesh = pair['mesh']
body = pair['body'] body = pair['body']
@ -590,7 +598,7 @@ class Obstacle(bs.Actor):
if graphics == 2: if graphics == 2:
self.light_node = bs.newnode('light', attrs={ self.light_node = bs.newnode('light', attrs={
'position': (0, 0, 0), 'position': (0, 0, 0),
'color': ((0.8, 0.2, 0.2) if i < count/2 else (0.2, 0.2, 0.8)) \ 'color': ((0.8, 0.2, 0.2) if i < count/2 else (0.2, 0.2, 0.8))
if not random_color else ((random.uniform(0, 1.1), random.uniform(0, 1.1), random.uniform(0, 1.1))), if not random_color else ((random.uniform(0, 1.1), random.uniform(0, 1.1), random.uniform(0, 1.1))),
'radius': 0.2, 'radius': 0.2,
'intensity': 1, 'intensity': 1,
@ -612,5 +620,5 @@ class Obstacle(bs.Actor):
elif isinstance(m, bs.HitMessage): elif isinstance(m, bs.HitMessage):
self.node.handlemessage('impulse', m.pos[0], m.pos[1], m.pos[2], self.node.handlemessage('impulse', m.pos[0], m.pos[1], m.pos[2],
m.velocity[0], m.velocity[1], m.velocity[2], m.velocity[0], m.velocity[1], m.velocity[2],
m.magnitude, m.velocity_magnitude, m.radius,0, m.magnitude, m.velocity_magnitude, m.radius, 0,
m.velocity[0], m.velocity[1], m.velocity[2]) m.velocity[0], m.velocity[1], m.velocity[2])