mirror of
https://github.com/Freaku17/BombSquad-Mods-byFreaku
synced 2026-08-20 07:32:35 +00:00
Update Floater for 1.7.30 support
This commit is contained in:
parent
87a48cd6ce
commit
7c8cb854be
1 changed files with 40 additions and 21 deletions
|
|
@ -8,17 +8,20 @@
|
|||
# https://github.com/Freaku17/BombSquad-Mods-byFreaku
|
||||
|
||||
|
||||
|
||||
# ba_meta require api 8
|
||||
from __future__ import annotations
|
||||
from typing import TYPE_CHECKING
|
||||
import _babase, babase, random, math
|
||||
import _babase
|
||||
import babase
|
||||
import random
|
||||
import math
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
from bascenev1lib.gameutils import SharedObjects
|
||||
from bascenev1lib.actor.bomb import Bomb
|
||||
from bascenev1lib.actor.popuptext import PopupText
|
||||
from bauiv1lib.party import PartyWindow
|
||||
import bauiv1lib.mainmenu
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional
|
||||
|
||||
|
|
@ -187,7 +190,8 @@ class Floater(bs.Actor):
|
|||
np = self.node.position
|
||||
except:
|
||||
np = (0, 0, 0)
|
||||
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()
|
||||
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()
|
||||
if self.b.bomb_type in ['impact', 'land_mine']:
|
||||
self.b.arm()
|
||||
|
||||
|
|
@ -212,21 +216,21 @@ class Floater(bs.Actor):
|
|||
super().handlemessage(msg)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def assignFloInputs(clientID: int):
|
||||
activity = bs.get_foreground_host_activity()
|
||||
with activity.context:
|
||||
if not hasattr(activity, 'flo') or not activity.flo.node.exists():
|
||||
try: activity.flo = Floater(activity.map.get_def_bound_box('map_bounds'))
|
||||
except: return #Perhaps using in main-menu/score-screen
|
||||
try:
|
||||
activity.flo = Floater(activity.map.get_def_bound_box('map_bounds'))
|
||||
except:
|
||||
return # Perhaps using in main-menu/score-screen
|
||||
floater = activity.flo
|
||||
if floater.controlled:
|
||||
bs.broadcastmessage('Floater is already being controlled', color=(1, 0, 0), transient=True, clients=[clientID])
|
||||
bs.broadcastmessage('Floater is already being controlled',
|
||||
color=(1, 0, 0), transient=True, clients=[clientID])
|
||||
return
|
||||
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))
|
||||
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))
|
||||
|
||||
for i in activity.players:
|
||||
if i.sessionplayer.inputdevice.client_id == clientID:
|
||||
|
|
@ -255,25 +259,40 @@ def assignFloInputs(clientID: int):
|
|||
i.assigninput(babase.InputType.LEFT_RIGHT, floater.leftright)
|
||||
|
||||
|
||||
# Display chat icon, but if user open/close gather it may disappear
|
||||
bui.set_party_icon_always_visible(True)
|
||||
|
||||
|
||||
old_piv = bui.set_party_icon_always_visible
|
||||
|
||||
|
||||
def new_piv(*args, **kwargs):
|
||||
# Do not let chat icon go away
|
||||
old_piv(True)
|
||||
|
||||
|
||||
bui.set_party_icon_always_visible = new_piv
|
||||
|
||||
|
||||
old_fcm = bs.chatmessage
|
||||
|
||||
|
||||
def new_chat_message(*args, **kwargs):
|
||||
old_fcm(*args, **kwargs)
|
||||
if args[0] == '/floater':
|
||||
try: assignFloInputs(-1)
|
||||
except: pass
|
||||
try:
|
||||
assignFloInputs(-1)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
bs.chatmessage = new_chat_message
|
||||
|
||||
|
||||
class NewMainMenuWindow(bauiv1lib.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)
|
||||
|
||||
|
||||
# ba_meta export plugin
|
||||
class byFreaku(babase.Plugin):
|
||||
def __init__(self): pass
|
||||
def on_app_running(self):
|
||||
bauiv1lib.mainmenu.MainMenuWindow = NewMainMenuWindow
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue