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
|
|
@ -1,24 +1,27 @@
|
||||||
# Ported by your friend: Freaku
|
# 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 8
|
# ba_meta require api 8
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
import _babase, babase, random, math
|
import _babase
|
||||||
|
import babase
|
||||||
|
import random
|
||||||
|
import math
|
||||||
import bauiv1 as bui
|
import bauiv1 as bui
|
||||||
import bascenev1 as bs
|
import bascenev1 as bs
|
||||||
from bascenev1lib.gameutils import SharedObjects
|
from bascenev1lib.gameutils import SharedObjects
|
||||||
from bascenev1lib.actor.bomb import Bomb
|
from bascenev1lib.actor.bomb import Bomb
|
||||||
from bascenev1lib.actor.popuptext import PopupText
|
from bascenev1lib.actor.popuptext import PopupText
|
||||||
from bauiv1lib.party import PartyWindow
|
from bauiv1lib.party import PartyWindow
|
||||||
|
import bauiv1lib.mainmenu
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
|
@ -187,7 +190,8 @@ class Floater(bs.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']), 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']:
|
if self.b.bomb_type in ['impact', 'land_mine']:
|
||||||
self.b.arm()
|
self.b.arm()
|
||||||
|
|
||||||
|
|
@ -199,7 +203,7 @@ class Floater(bs.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)
|
||||||
bs.timer(dist-1, bs.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, bs.DieMessage):
|
if isinstance(msg, bs.DieMessage):
|
||||||
|
|
@ -212,21 +216,21 @@ class Floater(bs.Actor):
|
||||||
super().handlemessage(msg)
|
super().handlemessage(msg)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def assignFloInputs(clientID: int):
|
def assignFloInputs(clientID: int):
|
||||||
activity = bs.get_foreground_host_activity()
|
activity = bs.get_foreground_host_activity()
|
||||||
with activity.context:
|
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: activity.flo = Floater(activity.map.get_def_bound_box('map_bounds'))
|
try:
|
||||||
except: return #Perhaps using in main-menu/score-screen
|
activity.flo = Floater(activity.map.get_def_bound_box('map_bounds'))
|
||||||
|
except:
|
||||||
|
return # Perhaps using in main-menu/score-screen
|
||||||
floater = activity.flo
|
floater = activity.flo
|
||||||
if floater.controlled:
|
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
|
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:
|
for i in activity.players:
|
||||||
if i.sessionplayer.inputdevice.client_id == clientID:
|
if i.sessionplayer.inputdevice.client_id == clientID:
|
||||||
|
|
@ -255,25 +259,40 @@ def assignFloInputs(clientID: int):
|
||||||
i.assigninput(babase.InputType.LEFT_RIGHT, floater.leftright)
|
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
|
old_piv = bui.set_party_icon_always_visible
|
||||||
|
|
||||||
|
|
||||||
def new_piv(*args, **kwargs):
|
def new_piv(*args, **kwargs):
|
||||||
# Do not let chat icon go away
|
# Do not let chat icon go away
|
||||||
old_piv(True)
|
old_piv(True)
|
||||||
|
|
||||||
|
|
||||||
bui.set_party_icon_always_visible = new_piv
|
bui.set_party_icon_always_visible = new_piv
|
||||||
|
|
||||||
|
|
||||||
old_fcm = bs.chatmessage
|
old_fcm = bs.chatmessage
|
||||||
|
|
||||||
|
|
||||||
def new_chat_message(*args, **kwargs):
|
def new_chat_message(*args, **kwargs):
|
||||||
old_fcm(*args, **kwargs)
|
old_fcm(*args, **kwargs)
|
||||||
if args[0] == '/floater':
|
if args[0] == '/floater':
|
||||||
try: assignFloInputs(-1)
|
try:
|
||||||
except: pass
|
assignFloInputs(-1)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
bs.chatmessage = new_chat_message
|
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
|
# ba_meta export plugin
|
||||||
class byFreaku(babase.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