Update my utilities for 1.7.20+ (API 8)

This commit is contained in:
! Freaku 2023-07-28 17:03:36 +05:30 committed by GitHub
parent cd29dacf98
commit d6dc6c246a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 118 additions and 109 deletions

View file

@ -1,34 +1,35 @@
# Ported by: Freaku / @[Just] Freak#4999 # Ported by your friend: Freaku
# Join BCS: #Join BCS:
# https://discord.gg/ucyaesh # https://discord.gg/ucyaesh
# My GitHub: #My GitHub:
# https://github.com/Freaku17/BombSquad-Mods-byFreaku # https://github.com/Freaku17/BombSquad-Mods-byFreaku
# ba_meta require api 7
# ba_meta require api 8
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import _ba import _babase, babase, random, math
import ba import bauiv1 as bui
import random import bascenev1 as bs
import math from bascenev1lib.gameutils import SharedObjects
from bastd.gameutils import SharedObjects from bascenev1lib.actor.bomb import Bomb
from bastd.actor.bomb import Bomb from bascenev1lib.actor.popuptext import PopupText
from bastd.actor.popuptext import PopupText from bauiv1lib.party import PartyWindow
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Optional from typing import Optional
class Floater(ba.Actor): class Floater(bs.Actor):
def __init__(self, bounds): def __init__(self, bounds):
super().__init__() super().__init__()
shared = SharedObjects.get() shared = SharedObjects.get()
self.controlled = False self.controlled = False
self.source_player = None self.source_player = None
self.floaterMaterial = ba.Material() self.floaterMaterial = bs.Material()
self.floaterMaterial.add_actions( self.floaterMaterial.add_actions(
conditions=('they_have_material', conditions=('they_have_material',
shared.player_material), shared.player_material),
@ -48,21 +49,21 @@ class Floater(ba.Actor):
self.py = "random.uniform(self.pos[1],self.pos[4])" self.py = "random.uniform(self.pos[1],self.pos[4])"
self.pz = "random.uniform(self.pos[2],self.pos[5])" self.pz = "random.uniform(self.pos[2],self.pos[5])"
self.node = ba.newnode( self.node = bs.newnode(
'prop', 'prop',
delegate=self, delegate=self,
owner=None, owner=None,
attrs={ attrs={
'position': (eval(self.px), eval(self.py), eval(self.pz)), 'position': (eval(self.px), eval(self.py), eval(self.pz)),
'model': 'mesh':
ba.getmodel('landMine'), bs.getmesh('landMine'),
'light_model': 'light_mesh':
ba.getmodel('landMine'), bs.getmesh('landMine'),
'body': 'body':
'landMine', 'landMine',
'body_scale': 'body_scale':
3, 3,
'model_scale': 'mesh_scale':
3.1, 3.1,
'shadow_size': 'shadow_size':
0.25, 0.25,
@ -71,21 +72,21 @@ class Floater(ba.Actor):
'gravity_scale': 'gravity_scale':
0.0, 0.0,
'color_texture': 'color_texture':
ba.gettexture('achievementFlawlessVictory'), bs.gettexture('achievementFlawlessVictory'),
'reflection': 'reflection':
'soft', 'soft',
'reflection_scale': [0.25], 'reflection_scale': [0.25],
'materials': 'materials':
[shared.footing_material, self.floaterMaterial] [shared.footing_material, self.floaterMaterial]
}) })
self.node2 = ba.newnode( self.node2 = bs.newnode(
'prop', 'prop',
owner=self.node, owner=self.node,
attrs={ attrs={
'position': (0, 0, 0), 'position': (0, 0, 0),
'body': 'body':
'sphere', 'sphere',
'model': 'mesh':
None, None,
'color_texture': 'color_texture':
None, None,
@ -96,7 +97,7 @@ class Floater(ba.Actor):
'density': 'density':
999999, 999999,
'reflection_scale': [1.0], 'reflection_scale': [1.0],
'model_scale': 'mesh_scale':
1.0, 1.0,
'gravity_scale': 'gravity_scale':
0, 0,
@ -109,8 +110,7 @@ class Floater(ba.Actor):
}) })
self.node.connectattr('position', self.node2, 'position') self.node.connectattr('position', self.node2, 'position')
def pop(self): PopupText(text="Ported by \ue048Freaku", scale=1.3, position=( def pop(self): PopupText(text="Ported by \ue048Freaku", scale=1.3, position=(self.node.position[0],self.node.position[1]-1,self.node.position[2]), color=(0,1,1)).autoretain()
self.node.position[0], self.node.position[1]-1, self.node.position[2]), color=(0, 1, 1)).autoretain() # Edit = YouNoob...
def checkCanControl(self): def checkCanControl(self):
if not self.node.exists(): if not self.node.exists():
@ -172,7 +172,7 @@ class Floater(ba.Actor):
if self.source_player is None: if self.source_player is None:
return return
if self.source_player.is_alive(): if self.source_player.is_alive():
ba.timer(1, self.checkPlayerDie) bs.timer(1, self.checkPlayerDie)
return return
else: else:
self.dis() self.dis()
@ -186,8 +186,7 @@ class Floater(ba.Actor):
np = self.node.position np = self.node.position
except: except:
np = (0, 0, 0) np = (0, 0, 0)
self.b = Bomb(bomb_type=random.choice(['normal', 'ice', 'sticky', 'impact', 'land_mine', 'tnt']), self.b = Bomb(bomb_type=random.choice(['normal', 'ice', 'sticky', 'impact', 'land_mine', 'tnt']), source_player=self.source_player, position=(np[0], np[1] - 1, np[2]), velocity=(0, -1, 0)).autoretain()
source_player=self.source_player, position=(np[0], np[1] - 1, np[2]), velocity=(0, -1, 0)).autoretain()
if self.b.bomb_type in ['impact', 'land_mine']: if self.b.bomb_type in ['impact', 'land_mine']:
self.b.arm() self.b.arm()
@ -199,36 +198,36 @@ class Floater(ba.Actor):
pn = self.node.position pn = self.node.position
dist = self.distance(pn[0], pn[1], pn[2], px, py, pz) dist = self.distance(pn[0], pn[1], pn[2], px, py, pz)
self.node.velocity = ((px - pn[0]) / dist, (py - pn[1]) / dist, (pz - pn[2]) / dist) self.node.velocity = ((px - pn[0]) / dist, (py - pn[1]) / dist, (pz - pn[2]) / dist)
ba.timer(dist-1, ba.WeakCall(self.move), suppress_format_warning=True) bs.timer(dist-1, bs.WeakCall(self.move)) #suppress_format_warning=True)
def handlemessage(self, msg): def handlemessage(self, msg):
if isinstance(msg, ba.DieMessage): if isinstance(msg, bs.DieMessage):
self.node.delete() self.node.delete()
self.node2.delete() self.node2.delete()
self.controlled = False self.controlled = False
elif isinstance(msg, ba.OutOfBoundsMessage): elif isinstance(msg, bs.OutOfBoundsMessage):
self.handlemessage(ba.DieMessage()) self.handlemessage(bs.DieMessage())
else: else:
super().handlemessage(msg) super().handlemessage(msg)
def assignFloInputs(clientID: int): def assignFloInputs(clientID: int):
with ba.Context(_ba.get_foreground_host_activity()): activity = bs.get_foreground_host_activity()
activity = ba.getactivity() with activity.context:
if not hasattr(activity, 'flo') or not activity.flo.node.exists(): if not hasattr(activity, 'flo') or not activity.flo.node.exists():
try: try: activity.flo = Floater(activity.map.get_def_bound_box('map_bounds'))
activity.flo = Floater(activity.map.get_def_bound_box('map_bounds')) except: return #Perhaps using in main-menu/score-screen
except:
return # Perhaps using in main-menu/score-screen
floater = activity.flo floater = activity.flo
if floater.controlled: if floater.controlled:
ba.screenmessage('Floater is already being controlled', bs.broadcastmessage('Floater is already being controlled', color=(1, 0, 0), transient=True, clients=[clientID])
color=(1, 0, 0), transient=True, clients=[clientID])
return return
ba.screenmessage('You Gained Control Over The Floater!\n Press Bomb to Throw Bombs and Punch to leave!', clients=[ bs.broadcastmessage('You Gained Control Over The Floater!\n Press Bomb to Throw Bombs and Punch to leave!', clients=[clientID], transient=True, color=(0, 1, 1))
clientID], transient=True, color=(0, 1, 1))
for i in _ba.get_foreground_host_activity().players: for i in activity.players:
if i.sessionplayer.inputdevice.client_id == clientID: if i.sessionplayer.inputdevice.client_id == clientID:
def dis(i, floater): def dis(i, floater):
i.actor.node.invincible = False i.actor.node.invincible = False
@ -238,41 +237,42 @@ def assignFloInputs(clientID: int):
ps = i.actor.node.position ps = i.actor.node.position
i.actor.node.invincible = True i.actor.node.invincible = True
floater.node.position = (ps[0], ps[1] + 1.0, ps[2]) floater.node.position = (ps[0], ps[1] + 1.0, ps[2])
ba.timer(1, floater.pop) bs.timer(1, floater.pop)
i.actor.node.hold_node = ba.Node(None) i.actor.node.hold_node = bs.Node(None)
i.actor.node.hold_node = floater.node2 i.actor.node.hold_node = floater.node2
i.actor.connect_controls_to_player() i.actor.connect_controls_to_player()
i.actor.disconnect_controls_from_player() i.actor.disconnect_controls_from_player()
i.resetinput() i.resetinput()
floater.source_player = i floater.source_player = i
floater.con() floater.con()
i.assigninput(ba.InputType.PICK_UP_PRESS, floater.up) i.assigninput(babase.InputType.PICK_UP_PRESS, floater.up)
i.assigninput(ba.InputType.PICK_UP_RELEASE, floater.upR) i.assigninput(babase.InputType.PICK_UP_RELEASE, floater.upR)
i.assigninput(ba.InputType.JUMP_PRESS, floater.down) i.assigninput(babase.InputType.JUMP_PRESS, floater.down)
i.assigninput(ba.InputType.BOMB_PRESS, floater.drop) i.assigninput(babase.InputType.BOMB_PRESS, floater.drop)
i.assigninput(ba.InputType.PUNCH_PRESS, ba.Call(dis, i, floater)) i.assigninput(babase.InputType.PUNCH_PRESS, babase.Call(dis, i, floater))
i.assigninput(ba.InputType.UP_DOWN, floater.updown) i.assigninput(babase.InputType.UP_DOWN, floater.updown)
i.assigninput(ba.InputType.LEFT_RIGHT, floater.leftright) i.assigninput(babase.InputType.LEFT_RIGHT, floater.leftright)
old_fcm = _ba.chatmessage # Display chat icon, but if user open/close gather it may disappear
bui.set_party_icon_always_visible(True)
def new_chat_message(msg: Union[str, ba.Lstr], clients: Sequence[int] = None, sender_override: str = None): old_piv = bui.set_party_icon_always_visible
old_fcm(msg, clients, sender_override) def new_piv(*args, **kwargs):
if msg == '/floater': # Do not let chat icon go away
try: old_piv(True)
assignFloInputs(-1) bui.set_party_icon_always_visible = new_piv
except:
pass
_ba.chatmessage = new_chat_message old_fcm = bs.chatmessage
if not _ba.is_party_icon_visible(): def new_chat_message(*args, **kwargs):
_ba.set_party_icon_always_visible(True) old_fcm(*args, **kwargs)
if args[0] == '/floater':
try: assignFloInputs(-1)
except: pass
bs.chatmessage = new_chat_message
# ba_meta export plugin # ba_meta export plugin
class byFreaku(babase.Plugin):
def __init__(self): pass
class byFreaku(ba.Plugin):
def __init__(self): pass

View file

@ -1,4 +1,4 @@
# Made by: Freaku / @[Just] Freak#4999 # Made by your friend: Freaku
# • Icon Keyboard • # • Icon Keyboard •
# Make your chats look even more cooler! # Make your chats look even more cooler!
@ -6,51 +6,59 @@
# Double tap the space to change between keyboards... # Double tap the space to change between keyboards...
# ba_meta require api 7
# ba_meta require api 8
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import ba import babase
from _ba import charstr as uwu import bascenev1 as bs
from babase import charstr as uwu
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any, Optional, Dict, List, Tuple, Type, Iterable from typing import Any, Optional, Dict, List, Tuple,Type, Iterable
# ba_meta export keyboard # ba_meta export keyboard
class IconKeyboard_byFreaku(ba.Keyboard): class IconKeyboard_byFreaku(babase.Keyboard):
"""Keyboard go brrrrrrr""" """Keyboard go brrrrrrr"""
name = 'Icons by \ue048Freaku' name = 'Icons by \ue048Freaku'
chars = [(uwu(ba.SpecialChar.TICKET), chars = [(uwu(babase.SpecialChar.TICKET),
uwu(ba.SpecialChar.CROWN), uwu(babase.SpecialChar.CROWN),
uwu(ba.SpecialChar.DRAGON), uwu(babase.SpecialChar.DRAGON),
uwu(ba.SpecialChar.SKULL), uwu(babase.SpecialChar.SKULL),
uwu(ba.SpecialChar.HEART), uwu(babase.SpecialChar.HEART),
uwu(ba.SpecialChar.FEDORA), uwu(babase.SpecialChar.FEDORA),
uwu(ba.SpecialChar.HAL), uwu(babase.SpecialChar.HAL),
uwu(ba.SpecialChar.YIN_YANG), uwu(babase.SpecialChar.YIN_YANG),
uwu(ba.SpecialChar.EYE_BALL), uwu(babase.SpecialChar.EYE_BALL),
uwu(ba.SpecialChar.HELMET), uwu(babase.SpecialChar.HELMET),
uwu(ba.SpecialChar.OUYA_BUTTON_U)), uwu(babase.SpecialChar.OUYA_BUTTON_U)),
(uwu(ba.SpecialChar.MUSHROOM), (uwu(babase.SpecialChar.MUSHROOM),
uwu(ba.SpecialChar.NINJA_STAR), uwu(babase.SpecialChar.NINJA_STAR),
uwu(ba.SpecialChar.VIKING_HELMET), uwu(babase.SpecialChar.VIKING_HELMET),
uwu(ba.SpecialChar.MOON), uwu(babase.SpecialChar.MOON),
uwu(ba.SpecialChar.SPIDER), uwu(babase.SpecialChar.SPIDER),
uwu(ba.SpecialChar.FIREBALL), uwu(babase.SpecialChar.FIREBALL),
uwu(ba.SpecialChar.MIKIROG), uwu(babase.SpecialChar.MIKIROG),
uwu(ba.SpecialChar.OUYA_BUTTON_O), uwu(babase.SpecialChar.OUYA_BUTTON_O),
uwu(ba.SpecialChar.LOCAL_ACCOUNT), uwu(babase.SpecialChar.LOCAL_ACCOUNT),
uwu(ba.SpecialChar.LOGO)), uwu(babase.SpecialChar.LOGO)),
(uwu(ba.SpecialChar.TICKET), (uwu(babase.SpecialChar.TICKET),
uwu(ba.SpecialChar.FLAG_INDIA), uwu(babase.SpecialChar.FLAG_INDIA),
uwu(ba.SpecialChar.OCULUS_LOGO), uwu(babase.SpecialChar.OCULUS_LOGO),
uwu(ba.SpecialChar.STEAM_LOGO), uwu(babase.SpecialChar.STEAM_LOGO),
uwu(ba.SpecialChar.NVIDIA_LOGO), uwu(babase.SpecialChar.NVIDIA_LOGO),
uwu(ba.SpecialChar.GAME_CENTER_LOGO), uwu(babase.SpecialChar.GAME_CENTER_LOGO),
uwu(ba.SpecialChar.GOOGLE_PLAY_GAMES_LOGO), uwu(babase.SpecialChar.GOOGLE_PLAY_GAMES_LOGO),
uwu(ba.SpecialChar.ALIBABA_LOGO))] uwu(babase.SpecialChar.EXPLODINARY_LOGO))]
nums = [] nums = []
pages: Dict[str, Tuple[str, ...]] = {} pages: Dict[str, Tuple[str, ...]] = {}

View file

@ -1,8 +1,9 @@
# By Freaku / @[Just] Freak#4999 # Made by your friend: Freaku
import ba import babase
from bastd.maps import TowerD import bascenev1 as bs
from bascenev1lib.maps import TowerD
@classmethod @classmethod
@ -11,8 +12,8 @@ def new_play_types(cls):
return ['melee', 'keep_away', 'team_flag', 'king_of_the_hill'] return ['melee', 'keep_away', 'team_flag', 'king_of_the_hill']
# ba_meta require api 7 # ba_meta require api 8
# ba_meta export plugin # ba_meta export plugin
class byFreaku(ba.Plugin): class byFreaku(babase.Plugin):
def on_app_running(self): def on_app_running(self):
TowerD.get_play_types = new_play_types TowerD.get_play_types = new_play_types