mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-11-07 17:36:00 +00:00
[ci] auto-format
This commit is contained in:
parent
37dfd46953
commit
7bc4d9e3f3
1 changed files with 122 additions and 110 deletions
|
|
@ -38,29 +38,37 @@ class ControlsUI:
|
||||||
def on_jump_press(activity):
|
def on_jump_press(activity):
|
||||||
print("jumped pressed in UI control")
|
print("jumped pressed in UI control")
|
||||||
print(activity._jump_image.node.color)
|
print(activity._jump_image.node.color)
|
||||||
activity._jump_image.node.color = list(channel * 2 for channel in activity._jump_image.node.color[:3]) + [1]
|
activity._jump_image.node.color = list(
|
||||||
|
channel * 2 for channel in activity._jump_image.node.color[:3]) + [1]
|
||||||
print(activity._jump_image.node.color)
|
print(activity._jump_image.node.color)
|
||||||
|
|
||||||
def on_jump_release(activity):
|
def on_jump_release(activity):
|
||||||
activity._jump_image.node.color = list(channel * 0.5 for channel in activity._jump_image.node.color[:3]) + [1]
|
activity._jump_image.node.color = list(
|
||||||
|
channel * 0.5 for channel in activity._jump_image.node.color[:3]) + [1]
|
||||||
|
|
||||||
def on_pickup_press(activity):
|
def on_pickup_press(activity):
|
||||||
activity._pickup_image.node.color = list(channel * 2 for channel in activity._pickup_image.node.color[:3]) + [1]
|
activity._pickup_image.node.color = list(
|
||||||
|
channel * 2 for channel in activity._pickup_image.node.color[:3]) + [1]
|
||||||
|
|
||||||
def on_pickup_release(activity):
|
def on_pickup_release(activity):
|
||||||
activity._pickup_image.node.color = list(channel * 0.5 for channel in activity._pickup_image.node.color[:3]) + [1]
|
activity._pickup_image.node.color = list(
|
||||||
|
channel * 0.5 for channel in activity._pickup_image.node.color[:3]) + [1]
|
||||||
|
|
||||||
def on_punch_press(activity):
|
def on_punch_press(activity):
|
||||||
activity._punch_image.node.color = list(channel * 2 for channel in activity._punch_image.node.color[:3]) + [1]
|
activity._punch_image.node.color = list(
|
||||||
|
channel * 2 for channel in activity._punch_image.node.color[:3]) + [1]
|
||||||
|
|
||||||
def on_punch_release(activity):
|
def on_punch_release(activity):
|
||||||
activity._punch_image.node.color = list(channel * 0.5 for channel in activity._punch_image.node.color[:3]) + [1]
|
activity._punch_image.node.color = list(
|
||||||
|
channel * 0.5 for channel in activity._punch_image.node.color[:3]) + [1]
|
||||||
|
|
||||||
def on_bomb_press(activity):
|
def on_bomb_press(activity):
|
||||||
activity._bomb_image.node.color = list(channel * 2 for channel in activity._bomb_image.node.color[:3]) + [1]
|
activity._bomb_image.node.color = list(
|
||||||
|
channel * 2 for channel in activity._bomb_image.node.color[:3]) + [1]
|
||||||
|
|
||||||
def on_bomb_release(activity):
|
def on_bomb_release(activity):
|
||||||
activity._bomb_image.node.color = list(channel * 0.5 for channel in activity._bomb_image.node.color[:3]) + [1]
|
activity._bomb_image.node.color = list(
|
||||||
|
channel * 0.5 for channel in activity._bomb_image.node.color[:3]) + [1]
|
||||||
|
|
||||||
def on_move_ud(activity, value):
|
def on_move_ud(activity, value):
|
||||||
activity.set_stick_image_position(activity, x=activity.stick_image_position_x, y=value)
|
activity.set_stick_image_position(activity, x=activity.stick_image_position_x, y=value)
|
||||||
|
|
@ -97,6 +105,8 @@ CONTROLS_UI_MAP = {
|
||||||
"UP_DOWN": ControlsUI.on_move_ud,
|
"UP_DOWN": ControlsUI.on_move_ud,
|
||||||
"LEFT_RIGHT": ControlsUI.on_move_lr
|
"LEFT_RIGHT": ControlsUI.on_move_lr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class NewSpaz(bastd.actor.spaz.Spaz):
|
class NewSpaz(bastd.actor.spaz.Spaz):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
@ -116,6 +126,7 @@ class NewSpaz(bastd.actor.spaz.Spaz):
|
||||||
"RUN": self.on_run,
|
"RUN": self.on_run,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class NewPlayerSpaz(bastd.actor.playerspaz.PlayerSpaz):
|
class NewPlayerSpaz(bastd.actor.playerspaz.PlayerSpaz):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
@ -138,7 +149,6 @@ class NewPlayerSpaz(bastd.actor.playerspaz.PlayerSpaz):
|
||||||
self.source_player.in_replay = False
|
self.source_player.in_replay = False
|
||||||
self.source_player.mirror_mode = False
|
self.source_player.mirror_mode = False
|
||||||
|
|
||||||
|
|
||||||
def _handle_action(self, action, value: Optional[float] = None) -> None:
|
def _handle_action(self, action, value: Optional[float] = None) -> None:
|
||||||
if self.source_player.sessionplayer in PLAYERS_STUNT_INFO:
|
if self.source_player.sessionplayer in PLAYERS_STUNT_INFO:
|
||||||
PLAYERS_STUNT_INFO[self.source_player.sessionplayer].append({
|
PLAYERS_STUNT_INFO[self.source_player.sessionplayer].append({
|
||||||
|
|
@ -163,9 +173,6 @@ class NewPlayerSpaz(bastd.actor.playerspaz.PlayerSpaz):
|
||||||
else:
|
else:
|
||||||
mspaz.move_map[action]()
|
mspaz.move_map[action]()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def on_move_up_down(self, value: float, *args, **kwargs) -> None:
|
def on_move_up_down(self, value: float, *args, **kwargs) -> None:
|
||||||
self._handle_action("UP_DOWN", value)
|
self._handle_action("UP_DOWN", value)
|
||||||
super().on_move_up_down(value, *args, **kwargs)
|
super().on_move_up_down(value, *args, **kwargs)
|
||||||
|
|
@ -231,10 +238,12 @@ def get_player_from_client_id(client_id, activity=None):
|
||||||
return player
|
return player
|
||||||
raise ba.SessionPlayerNotFound()
|
raise ba.SessionPlayerNotFound()
|
||||||
|
|
||||||
|
|
||||||
def mirror(clieid):
|
def mirror(clieid):
|
||||||
player = get_player_from_client_id(clieid)
|
player = get_player_from_client_id(clieid)
|
||||||
spawn_mirror_spaz(player)
|
spawn_mirror_spaz(player)
|
||||||
|
|
||||||
|
|
||||||
def capture(player):
|
def capture(player):
|
||||||
with ba.Context(player.actor._activity()):
|
with ba.Context(player.actor._activity()):
|
||||||
player.recording_start_time = ba.time()
|
player.recording_start_time = ba.time()
|
||||||
|
|
@ -280,15 +289,18 @@ def replay(player, stunt_name):
|
||||||
time_to_hide_controls = last_move_time + 1
|
time_to_hide_controls = last_move_time + 1
|
||||||
ba.timer(time_to_hide_controls, ba.Call(handle_player_replay_end, player))
|
ba.timer(time_to_hide_controls, ba.Call(handle_player_replay_end, player))
|
||||||
|
|
||||||
|
|
||||||
def spawn_mirror_spaz(player):
|
def spawn_mirror_spaz(player):
|
||||||
player.mirror_mode = True
|
player.mirror_mode = True
|
||||||
with ba.Context(player.actor._activity()):
|
with ba.Context(player.actor._activity()):
|
||||||
bot = spaz.Spaz(player.color, player.highlight, character=player.character).autoretain()
|
bot = spaz.Spaz(player.color, player.highlight, character=player.character).autoretain()
|
||||||
bot.handlemessage(ba.StandMessage((player.actor.node.position[0], player.actor.node.position[1], player.actor.node.position[2]+1), 93))
|
bot.handlemessage(ba.StandMessage(
|
||||||
|
(player.actor.node.position[0], player.actor.node.position[1], player.actor.node.position[2]+1), 93))
|
||||||
bot.node.name = player.actor.node.name
|
bot.node.name = player.actor.node.name
|
||||||
bot.node.name_color = player.actor.node.name_color
|
bot.node.name_color = player.actor.node.name_color
|
||||||
player.actor.mirror_spaz.append(bot)
|
player.actor.mirror_spaz.append(bot)
|
||||||
|
|
||||||
|
|
||||||
def ghost(player, stunt_name):
|
def ghost(player, stunt_name):
|
||||||
stunt_path = f"{os.path.join(BASE_STUNTS_DIRECTORY, stunt_name)}.json"
|
stunt_path = f"{os.path.join(BASE_STUNTS_DIRECTORY, stunt_name)}.json"
|
||||||
if stunt_name in STUNT_CACHE:
|
if stunt_name in STUNT_CACHE:
|
||||||
|
|
@ -303,7 +315,6 @@ def ghost(player, stunt_name):
|
||||||
return
|
return
|
||||||
player.in_replay = True
|
player.in_replay = True
|
||||||
|
|
||||||
|
|
||||||
with ba.Context(player.actor._activity()):
|
with ba.Context(player.actor._activity()):
|
||||||
bot = spaz.Spaz((1, 0, 0), character="Spaz").autoretain()
|
bot = spaz.Spaz((1, 0, 0), character="Spaz").autoretain()
|
||||||
bot.handlemessage(ba.StandMessage(player.actor.node.position, 93))
|
bot.handlemessage(ba.StandMessage(player.actor.node.position, 93))
|
||||||
|
|
@ -339,6 +350,7 @@ def ghost(player, stunt_name):
|
||||||
ba.timer(time_to_hide_controls, ba.Call(handle_player_replay_end, player))
|
ba.timer(time_to_hide_controls, ba.Call(handle_player_replay_end, player))
|
||||||
ba.timer(time_to_hide_controls, ba.Call(bot.node.delete))
|
ba.timer(time_to_hide_controls, ba.Call(bot.node.delete))
|
||||||
|
|
||||||
|
|
||||||
def give_ghost_power(spaz):
|
def give_ghost_power(spaz):
|
||||||
spaz.node.invincible = True
|
spaz.node.invincible = True
|
||||||
shared = SharedObjects.get()
|
shared = SharedObjects.get()
|
||||||
|
|
@ -425,6 +437,7 @@ def new_chatmessage(msg):
|
||||||
spawn_mirror_spaz(player)
|
spawn_mirror_spaz(player)
|
||||||
return original_chatmessage(msg)
|
return original_chatmessage(msg)
|
||||||
|
|
||||||
|
|
||||||
def set_stick_image_position(self, x: float, y: float) -> None:
|
def set_stick_image_position(self, x: float, y: float) -> None:
|
||||||
|
|
||||||
# Clamp this to a circle.
|
# Clamp this to a circle.
|
||||||
|
|
@ -459,6 +472,7 @@ def set_stick_image_position(self, x: float, y: float) -> None:
|
||||||
assert self._stick_base_image is not None
|
assert self._stick_base_image is not None
|
||||||
self._stick_base_image.color = c
|
self._stick_base_image.color = c
|
||||||
|
|
||||||
|
|
||||||
def on_begin(self, *args, **kwargs) -> None:
|
def on_begin(self, *args, **kwargs) -> None:
|
||||||
self._jump_image = Image(
|
self._jump_image = Image(
|
||||||
ba.gettexture('buttonJump'),
|
ba.gettexture('buttonJump'),
|
||||||
|
|
@ -523,8 +537,6 @@ class byHeySmoothy(ba.Plugin):
|
||||||
bastd.actor.spaz.Spaz = NewSpaz
|
bastd.actor.spaz.Spaz = NewSpaz
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# lets define a sample elimination game that can use super power of this plugin
|
# lets define a sample elimination game that can use super power of this plugin
|
||||||
|
|
||||||
# ba_meta export game
|
# ba_meta export game
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue