mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
Done with utilities. Need some testing on ultraparty and few fix on auto stunt and quick customgame
This commit is contained in:
parent
39845e7b61
commit
77d16e63c7
19 changed files with 1221 additions and 1093 deletions
|
|
@ -1,3 +1,4 @@
|
|||
# Porting to api 8 made easier by baport.(https://github.com/bombsquad-community/baport)
|
||||
"""Disco Light Mod: V1.0
|
||||
Made by Cross Joy"""
|
||||
|
||||
|
|
@ -5,7 +6,7 @@ Made by Cross Joy"""
|
|||
# Can visit my github https://github.com/CrossJoy/Bombsquad-Modding
|
||||
|
||||
# You can contact me through discord:
|
||||
# My Discord Id: Cross Joy#0721
|
||||
# My Discord Id: crossjoy
|
||||
# My BS Discord Server: https://discord.gg/JyBY6haARJ
|
||||
|
||||
|
||||
|
|
@ -25,19 +26,22 @@ Made by Cross Joy"""
|
|||
# Other clients/players can't use the commands.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ba_meta require api 7
|
||||
# ba_meta require api 8
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import ba
|
||||
import _ba
|
||||
from ba import _gameutils
|
||||
from baenv import TARGET_BALLISTICA_BUILD as build_number
|
||||
from bauiv1lib import mainmenu
|
||||
import babase
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
import _babase
|
||||
from bascenev1 import _gameutils, animate
|
||||
import random
|
||||
|
||||
from ba import animate
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Sequence, Union
|
||||
|
|
@ -51,38 +55,38 @@ def is_game_version_lower_than(version):
|
|||
version is lower than the passed version. Useful for addressing
|
||||
any breaking changes within game versions.
|
||||
"""
|
||||
game_version = tuple(map(int, ba.app.version.split(".")))
|
||||
game_version = tuple(map(int, babase.app.version if build_number < 21282 else babase.app.env.split(".")))
|
||||
version = tuple(map(int, version.split(".")))
|
||||
return game_version < version
|
||||
|
||||
|
||||
if is_game_version_lower_than("1.7.7"):
|
||||
ba_internal = _ba
|
||||
else:
|
||||
ba_internal = ba.internal
|
||||
# if is_game_version_lower_than("1.7.7"):
|
||||
# ba_internal = _ba
|
||||
# else:
|
||||
# ba_internal = babase.internal
|
||||
|
||||
|
||||
# Activate disco light.
|
||||
def start():
|
||||
activity = _ba.get_foreground_host_activity()
|
||||
activity = bs.get_foreground_host_activity()
|
||||
|
||||
with ba.Context(activity):
|
||||
with activity.context:
|
||||
partyLight(True)
|
||||
rainbow(activity)
|
||||
|
||||
|
||||
# Deactivate disco light.
|
||||
def stop():
|
||||
activity = _ba.get_foreground_host_activity()
|
||||
activity = bs.get_foreground_host_activity()
|
||||
|
||||
with ba.Context(activity):
|
||||
with activity.context:
|
||||
partyLight(False)
|
||||
stop_rainbow(activity)
|
||||
|
||||
|
||||
# Create and animate colorful spotlight.
|
||||
def partyLight(switch=True):
|
||||
from ba._nodeactor import NodeActor
|
||||
from bascenev1._nodeactor import NodeActor
|
||||
x_spread = 10
|
||||
y_spread = 5
|
||||
positions = [[-x_spread, -y_spread], [0, -y_spread], [0, y_spread],
|
||||
|
|
@ -91,14 +95,14 @@ def partyLight(switch=True):
|
|||
times = [0, 2700, 1000, 1800, 500, 1400]
|
||||
|
||||
# Store this on the current activity, so we only have one at a time.
|
||||
activity = _ba.getactivity()
|
||||
activity = bs.getactivity()
|
||||
activity.camera_flash_data = [] # type: ignore
|
||||
for i in range(6):
|
||||
r = random.choice([0.5, 1])
|
||||
g = random.choice([0.5, 1])
|
||||
b = random.choice([0.5, 1])
|
||||
light = NodeActor(
|
||||
_ba.newnode('light',
|
||||
bs.newnode('light',
|
||||
attrs={
|
||||
'position': (positions[i][0], 0, positions[i][1]),
|
||||
'radius': 1.0,
|
||||
|
|
@ -108,7 +112,7 @@ def partyLight(switch=True):
|
|||
}))
|
||||
sval = 1.87
|
||||
iscale = 1.3
|
||||
tcombine = _ba.newnode('combine',
|
||||
tcombine = bs.newnode('combine',
|
||||
owner=light.node,
|
||||
attrs={
|
||||
'size': 3,
|
||||
|
|
@ -149,7 +153,7 @@ def partyLight(switch=True):
|
|||
loop=True,
|
||||
offset=times[i])
|
||||
if not switch:
|
||||
_ba.timer(0.1,
|
||||
bs.timer(0.1,
|
||||
light.node.delete)
|
||||
activity.camera_flash_data.append(light) # type: ignore
|
||||
|
||||
|
|
@ -158,7 +162,7 @@ def partyLight(switch=True):
|
|||
def rainbow(self) -> None:
|
||||
"""Create RGB tint."""
|
||||
c_existing = self.globalsnode.tint
|
||||
cnode = _ba.newnode('combine',
|
||||
cnode = bs.newnode('combine',
|
||||
attrs={
|
||||
'input0': c_existing[0],
|
||||
'input1': c_existing[1],
|
||||
|
|
@ -187,11 +191,14 @@ def rainbow(self) -> None:
|
|||
# Revert to the original map tint.
|
||||
def stop_rainbow(self):
|
||||
"""Revert to the original map tint."""
|
||||
c_existing = self.globalsnode.tint
|
||||
map_name = self.map.getname()
|
||||
tint = check_map_tint(map_name)
|
||||
try:
|
||||
c_existing = self.globalsnode.tint
|
||||
map_name = self.map.getname()
|
||||
tint = check_map_tint(map_name)
|
||||
except:
|
||||
tint = (1, 1, 1)
|
||||
|
||||
cnode = _ba.newnode('combine',
|
||||
cnode = bs.newnode('combine',
|
||||
attrs={
|
||||
'input0': c_existing[0],
|
||||
'input1': c_existing[1],
|
||||
|
|
@ -249,11 +256,11 @@ def check_map_tint(map_name):
|
|||
|
||||
|
||||
# Get the original game codes.
|
||||
old_fcm = ba_internal.chatmessage
|
||||
old_fcm = bs.chatmessage
|
||||
|
||||
|
||||
# New chat func to add some commands to activate/deactivate the disco light.
|
||||
def new_chat_message(msg: Union[str, ba.Lstr], clients: Sequence[int] = None,
|
||||
def new_chat_message(msg: Union[str, babase.Lstr], clients: Sequence[int] = None,
|
||||
sender_override: str = None):
|
||||
old_fcm(msg, clients, sender_override)
|
||||
if msg == '/disco':
|
||||
|
|
@ -261,13 +268,18 @@ def new_chat_message(msg: Union[str, ba.Lstr], clients: Sequence[int] = None,
|
|||
if msg == '/disco off':
|
||||
stop()
|
||||
|
||||
|
||||
class NewMainMenuWindow(mainmenu.MainMenuWindow):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
# Display chat icon, but if user open/close gather it may disappear
|
||||
bui.set_party_icon_always_visible(True)
|
||||
|
||||
# Replace new chat func to the original game codes.
|
||||
ba_internal.chatmessage = new_chat_message
|
||||
if not ba_internal.is_party_icon_visible():
|
||||
ba_internal.set_party_icon_always_visible(True)
|
||||
bs.chatmessage = new_chat_message
|
||||
|
||||
|
||||
# ba_meta export plugin
|
||||
class ByCrossJoy(ba.Plugin):
|
||||
def __init__(self): pass
|
||||
class ByCrossJoy(babase.Plugin):
|
||||
def on_app_running(self):
|
||||
mainmenu.MainMenuWindow = NewMainMenuWindow
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue