mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
merge conflicts
This commit is contained in:
commit
212be77f9e
2 changed files with 127 additions and 110 deletions
|
|
@ -313,7 +313,12 @@
|
|||
}
|
||||
],
|
||||
"versions": {
|
||||
"1.0.0": null
|
||||
"1.0.0": {
|
||||
"api_version": 7,
|
||||
"commit_sha": "7bc4d9e",
|
||||
"released_on": "26-11-2022",
|
||||
"md5sum": "0ef6342b43ca82cdfbb6276d6119a488"
|
||||
}
|
||||
}
|
||||
},
|
||||
"server_switch": {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# ba_meta require api 7
|
||||
# AutoStunt mod by - Mr.Smoothy x Rikko
|
||||
# AutoStunt mod by - Mr.Smoothy x Rikko
|
||||
# https://discord.gg/ucyaesh
|
||||
# https://bombsquad.ga
|
||||
# Dont modify redistribute this plugin , if want to use features of this plugin in your mod write logic in seprate file
|
||||
|
|
@ -35,35 +35,43 @@ original_chatmessage = _ba.chatmessage
|
|||
|
||||
|
||||
class ControlsUI:
|
||||
|
||||
def on_jump_press(activity):
|
||||
activity._jump_image.node.color = list(channel * 2 for channel in activity._jump_image.node.color[:3]) + [1]
|
||||
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
activity.set_stick_image_position(activity,x=activity.stick_image_position_x,y=value)
|
||||
|
||||
def on_move_lr(activity,value):
|
||||
activity.set_stick_image_position(activity,x=value,y=activity.stick_image_position_y)
|
||||
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):
|
||||
activity.set_stick_image_position(activity, x=activity.stick_image_position_x, y=value)
|
||||
|
||||
def on_move_lr(activity, value):
|
||||
activity.set_stick_image_position(activity, x=value, y=activity.stick_image_position_y)
|
||||
|
||||
def display(activity):
|
||||
activity._jump_image.node.color = list(activity._jump_image.node.color[:3]) + [1]
|
||||
|
|
@ -94,6 +102,8 @@ CONTROLS_UI_MAP = {
|
|||
"UP_DOWN": ControlsUI.on_move_ud,
|
||||
"LEFT_RIGHT": ControlsUI.on_move_lr
|
||||
}
|
||||
|
||||
|
||||
class NewSpaz(bastd.actor.spaz.Spaz):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
|
@ -113,6 +123,7 @@ class NewSpaz(bastd.actor.spaz.Spaz):
|
|||
"RUN": self.on_run,
|
||||
}
|
||||
|
||||
|
||||
class NewPlayerSpaz(bastd.actor.playerspaz.PlayerSpaz):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
|
@ -134,7 +145,6 @@ class NewPlayerSpaz(bastd.actor.playerspaz.PlayerSpaz):
|
|||
self.mirror_spaz = []
|
||||
self.source_player.in_replay = False
|
||||
self.source_player.mirror_mode = False
|
||||
|
||||
|
||||
def _handle_action(self, action, value: Optional[float] = None) -> None:
|
||||
if self.source_player.sessionplayer in PLAYERS_STUNT_INFO:
|
||||
|
|
@ -148,20 +158,17 @@ class NewPlayerSpaz(bastd.actor.playerspaz.PlayerSpaz):
|
|||
elif self.source_player.in_replay:
|
||||
ui_activation = CONTROLS_UI_MAP.get(action)
|
||||
if ui_activation:
|
||||
if action in ["UP_DOWN","LEFT_RIGHT"]:
|
||||
ui_activation(self.source_player.actor._activity(),value)
|
||||
if action in ["UP_DOWN", "LEFT_RIGHT"]:
|
||||
ui_activation(self.source_player.actor._activity(), value)
|
||||
else:
|
||||
ui_activation(self.source_player.actor._activity())
|
||||
elif self.source_player.mirror_mode:
|
||||
for mspaz in self.mirror_spaz:
|
||||
if mspaz and mspaz.node.exists():
|
||||
if action in ["UP_DOWN","LEFT_RIGHT","RUN"]:
|
||||
if action in ["UP_DOWN", "LEFT_RIGHT", "RUN"]:
|
||||
mspaz.move_map[action](value)
|
||||
else:
|
||||
mspaz.move_map[action]()
|
||||
|
||||
|
||||
|
||||
|
||||
def on_move_up_down(self, value: float, *args, **kwargs) -> None:
|
||||
self._handle_action("UP_DOWN", value)
|
||||
|
|
@ -228,10 +235,12 @@ def get_player_from_client_id(client_id, activity=None):
|
|||
return player
|
||||
raise ba.SessionPlayerNotFound()
|
||||
|
||||
|
||||
def mirror(clieid):
|
||||
player = get_player_from_client_id(clieid)
|
||||
spawn_mirror_spaz(player)
|
||||
|
||||
|
||||
def capture(player):
|
||||
with ba.Context(player.actor._activity()):
|
||||
player.recording_start_time = ba.time()
|
||||
|
|
@ -277,15 +286,18 @@ def replay(player, stunt_name):
|
|||
time_to_hide_controls = last_move_time + 1
|
||||
ba.timer(time_to_hide_controls, ba.Call(handle_player_replay_end, player))
|
||||
|
||||
|
||||
def spawn_mirror_spaz(player):
|
||||
player.mirror_mode = True
|
||||
with ba.Context(player.actor._activity()):
|
||||
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 = 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.node.name = player.actor.node.name
|
||||
bot.node.name_color = player.actor.node.name_color
|
||||
player.actor.mirror_spaz.append(bot)
|
||||
|
||||
|
||||
def ghost(player, stunt_name):
|
||||
stunt_path = f"{os.path.join(BASE_STUNTS_DIRECTORY, stunt_name)}.json"
|
||||
if stunt_name in STUNT_CACHE:
|
||||
|
|
@ -299,11 +311,10 @@ def ghost(player, stunt_name):
|
|||
ba.screenmessage(f"{stunt_name} doesn't exists")
|
||||
return
|
||||
player.in_replay = True
|
||||
|
||||
|
||||
with ba.Context(player.actor._activity()):
|
||||
bot=spaz.Spaz((1,0,0),character="Spaz").autoretain()
|
||||
bot.handlemessage(ba.StandMessage(player.actor.node.position,93))
|
||||
bot = spaz.Spaz((1, 0, 0), character="Spaz").autoretain()
|
||||
bot.handlemessage(ba.StandMessage(player.actor.node.position, 93))
|
||||
give_ghost_power(bot)
|
||||
ControlsUI.display(player.actor._activity())
|
||||
for move in stunt:
|
||||
|
|
@ -317,7 +328,7 @@ def ghost(player, stunt_name):
|
|||
if ui_activation:
|
||||
ba.timer(
|
||||
move["time"],
|
||||
ba.Call(ui_activation,player.actor._activity())
|
||||
ba.Call(ui_activation, player.actor._activity())
|
||||
)
|
||||
else:
|
||||
ba.timer(
|
||||
|
|
@ -329,34 +340,35 @@ def ghost(player, stunt_name):
|
|||
if ui_activation:
|
||||
ba.timer(
|
||||
move["time"],
|
||||
ba.Call(ui_activation,player.actor._activity(), move["move"]["value"] )
|
||||
ba.Call(ui_activation, player.actor._activity(), move["move"]["value"])
|
||||
)
|
||||
last_move_time = move["time"]
|
||||
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(bot.node.delete))
|
||||
|
||||
|
||||
def give_ghost_power(spaz):
|
||||
spaz.node.invincible = True
|
||||
shared = SharedObjects.get()
|
||||
factory = SpazFactory.get()
|
||||
ghost=ba.Material()
|
||||
ghost = ba.Material()
|
||||
# smoothy hecks
|
||||
ghost.add_actions(
|
||||
conditions=(('they_have_material', factory.spaz_material), 'or',
|
||||
('they_have_material', shared.player_material), 'or',
|
||||
('they_have_material', shared.attack_material), 'or',
|
||||
('they_have_material', shared.pickup_material), 'or',
|
||||
('they_have_material', PowerupBoxFactory.get().powerup_accept_material)),
|
||||
actions=(
|
||||
conditions=(('they_have_material', factory.spaz_material), 'or',
|
||||
('they_have_material', shared.player_material), 'or',
|
||||
('they_have_material', shared.attack_material), 'or',
|
||||
('they_have_material', shared.pickup_material), 'or',
|
||||
('they_have_material', PowerupBoxFactory.get().powerup_accept_material)),
|
||||
actions=(
|
||||
('modify_part_collision', 'collide', False),
|
||||
('modify_part_collision', 'physical', False)
|
||||
))
|
||||
mats=list(spaz.node.materials)
|
||||
roller=list(spaz.node.roller_materials)
|
||||
ext=list(spaz.node.extras_material)
|
||||
pick=list(spaz.node.pickup_materials)
|
||||
punch=list(spaz.node.punch_materials)
|
||||
))
|
||||
mats = list(spaz.node.materials)
|
||||
roller = list(spaz.node.roller_materials)
|
||||
ext = list(spaz.node.extras_material)
|
||||
pick = list(spaz.node.pickup_materials)
|
||||
punch = list(spaz.node.punch_materials)
|
||||
|
||||
mats.append(ghost)
|
||||
roller.append(ghost)
|
||||
|
|
@ -364,13 +376,13 @@ def give_ghost_power(spaz):
|
|||
pick.append(ghost)
|
||||
punch.append(ghost)
|
||||
|
||||
spaz.node.materials=tuple(mats)
|
||||
spaz.node.roller_materials=tuple(roller)
|
||||
spaz.node.extras_material=tuple(ext)
|
||||
spaz.node.pickup_materials=tuple(pick)
|
||||
spaz.node.punch_materials=tuple(pick)
|
||||
spaz.node.materials = tuple(mats)
|
||||
spaz.node.roller_materials = tuple(roller)
|
||||
spaz.node.extras_material = tuple(ext)
|
||||
spaz.node.pickup_materials = tuple(pick)
|
||||
spaz.node.punch_materials = tuple(pick)
|
||||
|
||||
|
||||
|
||||
def new_chatmessage(msg):
|
||||
if not msg.startswith("*"):
|
||||
return original_chatmessage(msg)
|
||||
|
|
@ -422,88 +434,90 @@ def new_chatmessage(msg):
|
|||
spawn_mirror_spaz(player)
|
||||
return original_chatmessage(msg)
|
||||
|
||||
|
||||
def set_stick_image_position(self, x: float, y: float) -> None:
|
||||
|
||||
# Clamp this to a circle.
|
||||
len_squared = x * x + y * y
|
||||
if len_squared > 1.0:
|
||||
length = math.sqrt(len_squared)
|
||||
mult = 1.0 / length
|
||||
x *= mult
|
||||
y *= mult
|
||||
# Clamp this to a circle.
|
||||
len_squared = x * x + y * y
|
||||
if len_squared > 1.0:
|
||||
length = math.sqrt(len_squared)
|
||||
mult = 1.0 / length
|
||||
x *= mult
|
||||
y *= mult
|
||||
|
||||
self.stick_image_position_x = x
|
||||
self.stick_image_position_y = y
|
||||
offs = 50.0
|
||||
assert self._scale is not None
|
||||
p = [
|
||||
self._stick_nub_position[0] + x * offs * 0.6,
|
||||
self._stick_nub_position[1] + y * offs * 0.6
|
||||
]
|
||||
c = list(self._stick_nub_image_color)
|
||||
if abs(x) > 0.1 or abs(y) > 0.1:
|
||||
c[0] *= 2.0
|
||||
c[1] *= 4.0
|
||||
c[2] *= 2.0
|
||||
assert self._stick_nub_image is not None
|
||||
self._stick_nub_image.position = p
|
||||
self._stick_nub_image.color = c
|
||||
c = list(self._stick_base_image_color)
|
||||
if abs(x) > 0.1 or abs(y) > 0.1:
|
||||
c[0] *= 1.5
|
||||
c[1] *= 1.5
|
||||
c[2] *= 1.5
|
||||
assert self._stick_base_image is not None
|
||||
self._stick_base_image.color = c
|
||||
|
||||
self.stick_image_position_x = x
|
||||
self.stick_image_position_y = y
|
||||
offs = 50.0
|
||||
assert self._scale is not None
|
||||
p = [
|
||||
self._stick_nub_position[0] + x * offs * 0.6,
|
||||
self._stick_nub_position[1] + y * offs * 0.6
|
||||
]
|
||||
c = list(self._stick_nub_image_color)
|
||||
if abs(x) > 0.1 or abs(y) > 0.1:
|
||||
c[0] *= 2.0
|
||||
c[1] *= 4.0
|
||||
c[2] *= 2.0
|
||||
assert self._stick_nub_image is not None
|
||||
self._stick_nub_image.position = p
|
||||
self._stick_nub_image.color = c
|
||||
c = list(self._stick_base_image_color)
|
||||
if abs(x) > 0.1 or abs(y) > 0.1:
|
||||
c[0] *= 1.5
|
||||
c[1] *= 1.5
|
||||
c[2] *= 1.5
|
||||
assert self._stick_base_image is not None
|
||||
self._stick_base_image.color = c
|
||||
|
||||
def on_begin(self, *args, **kwargs) -> None:
|
||||
self._jump_image = Image(
|
||||
ba.gettexture('buttonJump'),
|
||||
position=(385,160),
|
||||
scale=(50,50),
|
||||
color=[0.1,0.45,0.1,0]
|
||||
position=(385, 160),
|
||||
scale=(50, 50),
|
||||
color=[0.1, 0.45, 0.1, 0]
|
||||
)
|
||||
self._pickup_image = Image(
|
||||
ba.gettexture('buttonPickUp'),
|
||||
position=(385,240),
|
||||
scale=(50,50),
|
||||
color=[0,0.35,0,0]
|
||||
position=(385, 240),
|
||||
scale=(50, 50),
|
||||
color=[0, 0.35, 0, 0]
|
||||
)
|
||||
self._punch_image = Image(
|
||||
ba.gettexture('buttonPunch'),
|
||||
position=(345,200),
|
||||
scale=(50,50),
|
||||
color=[0.45,0.45,0,0]
|
||||
position=(345, 200),
|
||||
scale=(50, 50),
|
||||
color=[0.45, 0.45, 0, 0]
|
||||
)
|
||||
self._bomb_image = Image(
|
||||
ba.gettexture('buttonBomb'),
|
||||
position=(425,200),
|
||||
scale=(50,50),
|
||||
color=[0.45,0.1,0.1,0]
|
||||
position=(425, 200),
|
||||
scale=(50, 50),
|
||||
color=[0.45, 0.1, 0.1, 0]
|
||||
)
|
||||
self.stick_image_position_x = self.stick_image_position_y = 0.0
|
||||
self._stick_base_position = p = (-328,200)
|
||||
self._stick_base_position = p = (-328, 200)
|
||||
self._stick_base_image_color = c2 = (0.25, 0.25, 0.25, 1.0)
|
||||
self._stick_base_image = ba.newnode(
|
||||
'image',
|
||||
attrs={
|
||||
'texture': ba.gettexture('nub'),
|
||||
'absolute_scale': True,
|
||||
'vr_depth': -40,
|
||||
'position': p,
|
||||
'scale': ( 220.0*0.6, 220.0*0.6),
|
||||
'color': c2
|
||||
})
|
||||
'image',
|
||||
attrs={
|
||||
'texture': ba.gettexture('nub'),
|
||||
'absolute_scale': True,
|
||||
'vr_depth': -40,
|
||||
'position': p,
|
||||
'scale': (220.0*0.6, 220.0*0.6),
|
||||
'color': c2
|
||||
})
|
||||
self._stick_nub_position = p = (-328, 200)
|
||||
self._stick_nub_image_color = c3 = (0.4, 0.4, 0.4, 1.0)
|
||||
self._stick_nub_image = ba.newnode('image',
|
||||
attrs={
|
||||
'texture': ba.gettexture('nub'),
|
||||
'absolute_scale': True,
|
||||
'position': p,
|
||||
'scale': (110*0.6, 110*0.66),
|
||||
'color': c3
|
||||
})
|
||||
attrs={
|
||||
'texture': ba.gettexture('nub'),
|
||||
'absolute_scale': True,
|
||||
'position': p,
|
||||
'scale': (110*0.6, 110*0.66),
|
||||
'color': c3
|
||||
})
|
||||
self._stick_base_image.opacity = 0.0
|
||||
self._stick_nub_image.opacity = 0.0
|
||||
self.set_stick_image_position = set_stick_image_position
|
||||
|
|
@ -520,8 +534,6 @@ class byHeySmoothy(ba.Plugin):
|
|||
bastd.actor.spaz.Spaz = NewSpaz
|
||||
|
||||
|
||||
|
||||
|
||||
# lets define a sample elimination game that can use super power of this plugin
|
||||
|
||||
# ba_meta export game
|
||||
|
|
@ -531,4 +543,4 @@ class BroEliminaition(EliminationGame):
|
|||
|
||||
def spawn_player(self, player) -> ba.Actor:
|
||||
super().spawn_player(player)
|
||||
spawn_mirror_spaz(player)
|
||||
spawn_mirror_spaz(player)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue