mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-11-07 17:36:00 +00:00
Merge branch 'main' of https://github.com/brostosjoined/plugin-manager
This commit is contained in:
commit
35d4e45915
2 changed files with 542 additions and 493 deletions
|
|
@ -70,7 +70,8 @@ class BotChaseGame(bs.TeamGameActivity[Player, Team]):
|
|||
|
||||
@classmethod
|
||||
def supports_session_type(cls, sessiontype: Type[bs.Session]) -> bool:
|
||||
return (issubclass(sessiontype, bs.FreeForAllSession) or issubclass(sessiontype, bs.DualTeamSession) or issubclass(sessiontype, bs.CoopSession)) # Coop session unused
|
||||
# Coop session unused
|
||||
return (issubclass(sessiontype, bs.FreeForAllSession) or issubclass(sessiontype, bs.DualTeamSession) or issubclass(sessiontype, bs.CoopSession))
|
||||
|
||||
def __init__(self, settings: dict):
|
||||
super().__init__(settings)
|
||||
|
|
@ -136,8 +137,10 @@ class BotChaseGame(bs.TeamGameActivity[Player, Team]):
|
|||
|
||||
def on_begin(self) -> None:
|
||||
super().on_begin()
|
||||
self._bots.spawn_bot(MrSpazBot, pos=(random.choice([1, -1, 2, -2]), 1.34, random.choice([1, -1, 2, -2])), spawn_time=2.0)
|
||||
self._bots.spawn_bot(MrSpazBot, pos=(random.choice([1, -1, 2, -2]), 1.34, random.choice([1, -1, 2, -2])), spawn_time=2.0)
|
||||
self._bots.spawn_bot(MrSpazBot, pos=(random.choice(
|
||||
[1, -1, 2, -2]), 1.34, random.choice([1, -1, 2, -2])), spawn_time=2.0)
|
||||
self._bots.spawn_bot(MrSpazBot, pos=(random.choice(
|
||||
[1, -1, 2, -2]), 1.34, random.choice([1, -1, 2, -2])), spawn_time=2.0)
|
||||
|
||||
self._timer = OnScreenTimer()
|
||||
self._timer.start()
|
||||
|
|
@ -167,7 +170,8 @@ class BotChaseGame(bs.TeamGameActivity[Player, Team]):
|
|||
return None
|
||||
|
||||
def _spawn_this_bot(self) -> None:
|
||||
self._bots.spawn_bot(MrSpazBot, pos=(random.choice([1, -1, 2, -2]), 1.34, random.choice([1, -1, 2, -2])), spawn_time=2.0)
|
||||
self._bots.spawn_bot(MrSpazBot, pos=(random.choice(
|
||||
[1, -1, 2, -2]), 1.34, random.choice([1, -1, 2, -2])), spawn_time=2.0)
|
||||
|
||||
def _check_end_game(self) -> None:
|
||||
living_team_count = 0
|
||||
|
|
|
|||
|
|
@ -37,14 +37,17 @@ import random
|
|||
def getData(data):
|
||||
return babase.app.config["colorsMod"][data]
|
||||
|
||||
|
||||
def getRandomColor():
|
||||
c = random.choice(getData("colors"))
|
||||
return c
|
||||
|
||||
|
||||
def doColorMenu(self):
|
||||
bui.containerwidget(edit=self._root_widget, transition='out_left')
|
||||
openWindow()
|
||||
|
||||
|
||||
def updateButton(self):
|
||||
color = (random.random(), random.random(), random.random())
|
||||
try:
|
||||
|
|
@ -52,6 +55,7 @@ def updateButton(self):
|
|||
except Exception:
|
||||
self._timer = None
|
||||
|
||||
|
||||
newConfig = {"colorPlayer": True,
|
||||
"higlightPlayer": False,
|
||||
"namePlayer": False,
|
||||
|
|
@ -72,9 +76,11 @@ newConfig = {"colorPlayer":True,
|
|||
"colors": [color for color in get_player_colors()],
|
||||
}
|
||||
|
||||
|
||||
def getDefaultSettings():
|
||||
return newConfig
|
||||
|
||||
|
||||
def getTranslation(text):
|
||||
actLan = bs.app.lang.language
|
||||
colorsModsLan = {
|
||||
|
|
@ -260,7 +266,6 @@ class ColorsMod(babase.Plugin):
|
|||
babase.app.config["colorsMod"] = newConfig
|
||||
babase.app.config.apply_and_commit()
|
||||
|
||||
|
||||
# MainMenuActivity.oldMakeWord = MainMenuActivity._make_word
|
||||
# def newMakeWord(self, word: str,
|
||||
# x: float,
|
||||
|
|
@ -279,6 +284,7 @@ class ColorsMod(babase.Plugin):
|
|||
#### GAME MODIFICATIONS ####
|
||||
|
||||
# ESCUDO DE COLORES
|
||||
|
||||
def new_equip_shields(self, decay: bool = False) -> None:
|
||||
if not self.node:
|
||||
babase.print_error('Can\'t equip shields; no node.')
|
||||
|
|
@ -297,8 +303,10 @@ class ColorsMod(babase.Plugin):
|
|||
if self.shield_decay_rate > 0:
|
||||
self.shield_decay_timer = bs.Timer(0.5, bs.WeakCall(self.shield_decay), repeat=True)
|
||||
self.shield.always_show_health_bar = True
|
||||
|
||||
def changeColor():
|
||||
if self.shield is None: return
|
||||
if self.shield is None:
|
||||
return
|
||||
if getData("shieldColor"):
|
||||
self.shield.color = c = getRandomColor()
|
||||
self._shieldTimer = bs.Timer(getData("timeDelay") / 1000, changeColor, repeat=True)
|
||||
|
|
@ -306,13 +314,15 @@ class ColorsMod(babase.Plugin):
|
|||
|
||||
# BOTS DE COLORES
|
||||
SpazBot.oldBotInit = SpazBot.__init__
|
||||
|
||||
def newBotInit(self, *args, **kwargs):
|
||||
self.oldBotInit(*args, **kwargs)
|
||||
s = 1
|
||||
if getData("glowBots"):
|
||||
s = getData("glowScale")
|
||||
|
||||
self.node.highlight = (self.node.highlight[0]*s,self.node.highlight[1]*s,self.node.highlight[2]*s)
|
||||
self.node.highlight = (self.node.highlight[0]*s,
|
||||
self.node.highlight[1]*s, self.node.highlight[2]*s)
|
||||
|
||||
def changeColor():
|
||||
if self.is_alive():
|
||||
|
|
@ -324,6 +334,7 @@ class ColorsMod(babase.Plugin):
|
|||
|
||||
# BANDERA DE COLORES
|
||||
Flag.oldFlagInit = Flag.__init__
|
||||
|
||||
def newFlaginit(self, position: Sequence[float] = (0.0, 1.0, 0.0),
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
materials: Sequence[bs.Material] = None,
|
||||
|
|
@ -336,7 +347,8 @@ class ColorsMod(babase.Plugin):
|
|||
if getData("flag"):
|
||||
c = getRandomColor()
|
||||
self.node.color = (c[0]*1.2, c[1]*1.2, c[2]*1.2)
|
||||
else: return
|
||||
else:
|
||||
return
|
||||
if touchable:
|
||||
self._timer = bs.Timer(getData("timeDelay") / 1000, cC, repeat=True)
|
||||
|
||||
|
|
@ -344,6 +356,7 @@ class ColorsMod(babase.Plugin):
|
|||
|
||||
# JUGADORES DE COLORES
|
||||
PlayerSpaz.oldInit = PlayerSpaz.__init__
|
||||
|
||||
def newInit(self, player: bs.Player,
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
highlight: Sequence[float] = (0.5, 0.5, 0.5),
|
||||
|
|
@ -369,8 +382,10 @@ class ColorsMod(babase.Plugin):
|
|||
s3 = getData("glowScale")
|
||||
|
||||
self.node.color = (self.node.color[0]*s, self.node.color[1]*s, self.node.color[2]*s)
|
||||
self.node.highlight = (self.node.highlight[0]*s2,self.node.highlight[1]*s2,self.node.highlight[2]*s2)
|
||||
self.node.name_color = (self.node.name_color[0]*s3,self.node.name_color[1]*s3,self.node.name_color[2]*s3)
|
||||
self.node.highlight = (
|
||||
self.node.highlight[0]*s2, self.node.highlight[1]*s2, self.node.highlight[2]*s2)
|
||||
self.node.name_color = (
|
||||
self.node.name_color[0]*s3, self.node.name_color[1]*s3, self.node.name_color[2]*s3)
|
||||
|
||||
def changeColor():
|
||||
if self.is_alive():
|
||||
|
|
@ -388,11 +403,13 @@ class ColorsMod(babase.Plugin):
|
|||
|
||||
# EXPLOSIONES DE COLORES
|
||||
bomb.Blast.oldBlastInit = bomb.Blast.__init__
|
||||
|
||||
def newBlastInit(self, position: Sequence[float] = (0.0, 1.0, 0.0), velocity: Sequence[float] = (0.0, 0.0, 0.0),
|
||||
blast_radius: float = 2.0, blast_type: str = 'normal', source_player: bs.Player = None,
|
||||
hit_type: str = 'explosion', hit_subtype: str = 'normal'):
|
||||
|
||||
self.oldBlastInit(position, velocity, blast_radius, blast_type, source_player, hit_type, hit_subtype)
|
||||
self.oldBlastInit(position, velocity, blast_radius, blast_type,
|
||||
source_player, hit_type, hit_subtype)
|
||||
|
||||
if getData("xplotionColor"):
|
||||
c = getRandomColor()
|
||||
|
|
@ -405,16 +422,21 @@ class ColorsMod(babase.Plugin):
|
|||
scl *= 3.0
|
||||
|
||||
for i in range(2):
|
||||
scorch = bs.newnode('scorch',attrs={'position':self.node.position, 'size':scorch_radius*0.5,'big':(self.blast_type == 'tnt')})
|
||||
if self.blast_type == 'ice': scorch.color =(1,1,1.5)
|
||||
else: scorch.color = c
|
||||
scorch = bs.newnode('scorch', attrs={
|
||||
'position': self.node.position, 'size': scorch_radius*0.5, 'big': (self.blast_type == 'tnt')})
|
||||
if self.blast_type == 'ice':
|
||||
scorch.color = (1, 1, 1.5)
|
||||
else:
|
||||
scorch.color = c
|
||||
if getData("xplotionColor"):
|
||||
if getData("delScorch"):
|
||||
bs.animate(scorch, "presence", {3: 1, 13: 0})
|
||||
bs.Timer(13, scorch.delete)
|
||||
|
||||
if self.blast_type == 'ice': return
|
||||
light = bs.newnode('light', attrs={ 'position': position,'volume_intensity_scale': 10.0,'color': c})
|
||||
if self.blast_type == 'ice':
|
||||
return
|
||||
light = bs.newnode('light', attrs={'position': position,
|
||||
'volume_intensity_scale': 10.0, 'color': c})
|
||||
|
||||
iscale = 1.6
|
||||
bs.animate(light, 'intensity', {
|
||||
|
|
@ -460,7 +482,8 @@ class ProfilesWindow(popup.PopupWindow):
|
|||
accountName: Optional[str]
|
||||
if bui.app.plus.get_v1_account_state() == 'signed_in':
|
||||
accountName = bui.app.plus.get_v1_account_display_string()
|
||||
else: accountName = None
|
||||
else:
|
||||
accountName = None
|
||||
# subHeight += (len(items)*45)
|
||||
|
||||
# creates our _root_widget
|
||||
|
|
@ -480,7 +503,6 @@ class ProfilesWindow(popup.PopupWindow):
|
|||
iconscale=1.2)
|
||||
bui.containerwidget(edit=self.root_widget, cancel_button=self._cancel_button)
|
||||
|
||||
|
||||
self._title_text = bui.textwidget(parent=self.root_widget,
|
||||
position=(self._width * 0.5, self._height - 20),
|
||||
size=(0, 0),
|
||||
|
|
@ -534,7 +556,8 @@ class ProfilesWindow(popup.PopupWindow):
|
|||
self._activeProfiles.append(self._selected)
|
||||
babase.app.config["colorsMod"]["activeProfiles"] = self._activeProfiles
|
||||
babase.app.config.apply_and_commit()
|
||||
else: bs.broadcastmessage(getTranslation('nothing_selected'))
|
||||
else:
|
||||
bs.broadcastmessage(getTranslation('nothing_selected'))
|
||||
|
||||
def removeProfile(self):
|
||||
if self._selected is not None:
|
||||
|
|
@ -542,13 +565,17 @@ class ProfilesWindow(popup.PopupWindow):
|
|||
self._activeProfiles.remove(self._selected)
|
||||
babase.app.config["colorsMod"]["activeProfiles"] = self._activeProfiles
|
||||
babase.app.config.apply_and_commit()
|
||||
else: print('not found')
|
||||
else: bs.broadcastmessage(getTranslation('nothing_selected'))
|
||||
else:
|
||||
print('not found')
|
||||
else:
|
||||
bs.broadcastmessage(getTranslation('nothing_selected'))
|
||||
|
||||
def select(self, name, m):
|
||||
self._selected = name
|
||||
if m == 0: self.removeProfile()
|
||||
else: self.addProfile()
|
||||
if m == 0:
|
||||
self.removeProfile()
|
||||
else:
|
||||
self.addProfile()
|
||||
|
||||
def _on_cancel_press(self) -> None:
|
||||
self._transition_out()
|
||||
|
|
@ -572,7 +599,7 @@ class ColorsMenu(PopupWindow):
|
|||
|
||||
self._scrollWidth = self._width*0.85
|
||||
self._scrollHeight = self._height - 120
|
||||
self._subWidth = self._scrollWidth*0.95;
|
||||
self._subWidth = self._scrollWidth*0.95
|
||||
self._subHeight = 200
|
||||
|
||||
self._current_tab = getData('actab')
|
||||
|
|
@ -601,7 +628,8 @@ class ColorsMenu(PopupWindow):
|
|||
position=(50, height-60), size=(120, 50),
|
||||
scale=0.8, text_scale=1.2, label=babase.Lstr(resource='backText'),
|
||||
button_type='back', on_activate_call=self._back)
|
||||
bui.buttonwidget(edit=self._backButton, button_type='backSmall',size=(50, 50),label=babase.charstr(babase.SpecialChar.BACK))
|
||||
bui.buttonwidget(edit=self._backButton, button_type='backSmall', size=(
|
||||
50, 50), label=babase.charstr(babase.SpecialChar.BACK))
|
||||
bui.containerwidget(edit=self._root_widget, cancel_button=b)
|
||||
|
||||
self._nextButton = bui.buttonwidget(parent=self._root_widget, autoselect=True,
|
||||
|
|
@ -626,7 +654,8 @@ class ColorsMenu(PopupWindow):
|
|||
[3, getTranslation('info_tab')],
|
||||
]
|
||||
|
||||
self._scrollwidget = sc = bui.scrollwidget(parent=self._root_widget,size=(self._subWidth,self._scrollHeight),border_opacity=0.3, highlight=False, position=((width*0.5)-(self._scrollWidth*0.47),50),capture_arrows=True,)
|
||||
self._scrollwidget = sc = bui.scrollwidget(parent=self._root_widget, size=(
|
||||
self._subWidth, self._scrollHeight), border_opacity=0.3, highlight=False, position=((width*0.5)-(self._scrollWidth*0.47), 50), capture_arrows=True,)
|
||||
|
||||
bui.widget(edit=sc, left_widget=self._prevButton)
|
||||
bui.widget(edit=sc, right_widget=self._nextButton)
|
||||
|
|
@ -639,7 +668,8 @@ class ColorsMenu(PopupWindow):
|
|||
position=(h, 20), size=(20, 20),
|
||||
scale=1.2, label='',
|
||||
color=(0.3, 0.9, 0.3),
|
||||
on_activate_call=babase.Call(self._setTab,self.tabs[i][0]),
|
||||
on_activate_call=babase.Call(
|
||||
self._setTab, self.tabs[i][0]),
|
||||
texture=bui.gettexture('nub'))
|
||||
self.tabButtons.append(tabButton)
|
||||
h += 50
|
||||
|
|
@ -648,13 +678,17 @@ class ColorsMenu(PopupWindow):
|
|||
|
||||
def nextTabContainer(self):
|
||||
tab = babase.app.config['colorsMod']['actab']
|
||||
if tab == 2: self._setTab(0)
|
||||
else: self._setTab(tab+1)
|
||||
if tab == 2:
|
||||
self._setTab(0)
|
||||
else:
|
||||
self._setTab(tab+1)
|
||||
|
||||
def prevTabContainer(self):
|
||||
tab = babase.app.config['colorsMod']['actab']
|
||||
if tab == 0: self._setTab(2)
|
||||
else: self._setTab(tab-1)
|
||||
if tab == 0:
|
||||
self._setTab(2)
|
||||
else:
|
||||
self._setTab(tab-1)
|
||||
|
||||
def _setTab(self, tab):
|
||||
|
||||
|
|
@ -747,7 +781,8 @@ class ColorsMenu(PopupWindow):
|
|||
v2 -= (50+180)
|
||||
self._previewImage = bui.imagewidget(parent=c, position=(self._subWidth*0.72-100, v2), size=(200, 200),
|
||||
mask_texture=bui.gettexture('characterIconMask'), tint_texture=tintTex,
|
||||
texture=tex, mesh_transparent=bui.getmesh('image1x1'),
|
||||
texture=tex, mesh_transparent=bui.getmesh(
|
||||
'image1x1'),
|
||||
tint_color=(tc[0]*gs, tc[1]*gs, tc[2]*gs), tint2_color=(t2c[0]*gs, t2c[1]*gs, t2c[2]*gs))
|
||||
|
||||
self._colorTimer = bui.AppTimer(getData("timeDelay") / 1000,
|
||||
|
|
@ -911,14 +946,17 @@ class ColorsMenu(PopupWindow):
|
|||
on_activate_call=bs.WeakCall(self.removeColor, colours[i]))
|
||||
else:
|
||||
w = bui.buttonwidget(
|
||||
parent= self._tabContainer, position=(x,y), size=bttnSize,color=(0.5, 0.4, 0.6),
|
||||
parent=self._tabContainer, position=(
|
||||
x, y), size=bttnSize, color=(0.5, 0.4, 0.6),
|
||||
autoselect=False, label="", texture=bui.gettexture('frameInset'))
|
||||
if i == l:
|
||||
bui.buttonwidget(edit=w,on_activate_call=bs.WeakCall(self._makePicker,w),label="+")
|
||||
bui.buttonwidget(edit=w, on_activate_call=bs.WeakCall(
|
||||
self._makePicker, w), label="+")
|
||||
if cont % 4 == 0:
|
||||
x = sp
|
||||
y -= ((bttnSize[0]) + 10)
|
||||
else: x += (bttnSize[0]) + 13
|
||||
else:
|
||||
x += (bttnSize[0]) + 13
|
||||
cont += 1
|
||||
|
||||
def addColor(self, color):
|
||||
|
|
@ -926,7 +964,8 @@ class ColorsMenu(PopupWindow):
|
|||
babase.app.config["colorsMod"]["colors"].append(color)
|
||||
babase.app.config.apply_and_commit()
|
||||
self._setTab(0)
|
||||
else: bs.broadcastmessage(getTranslation('color_already'))
|
||||
else:
|
||||
bs.broadcastmessage(getTranslation('color_already'))
|
||||
|
||||
def removeColor(self, color):
|
||||
if color is not None:
|
||||
|
|
@ -935,9 +974,12 @@ class ColorsMenu(PopupWindow):
|
|||
babase.app.config["colorsMod"]["colors"].remove(color)
|
||||
babase.app.config.apply_and_commit()
|
||||
self._setTab(0)
|
||||
else: print('not found')
|
||||
else: bs.broadcastmessage("Min. 2 colors", color=(0, 1, 0))
|
||||
else: bs.broadcastmessage(getTranslation('nothing_selected'))
|
||||
else:
|
||||
print('not found')
|
||||
else:
|
||||
bs.broadcastmessage("Min. 2 colors", color=(0, 1, 0))
|
||||
else:
|
||||
bs.broadcastmessage(getTranslation('nothing_selected'))
|
||||
|
||||
def _makePicker(self, origin):
|
||||
baseScale = 2.05 if babase.UIScale.SMALL else 1.6 if babase.UIScale.MEDIUM else 1.0
|
||||
|
|
@ -946,7 +988,8 @@ class ColorsMenu(PopupWindow):
|
|||
offset=(baseScale * (-100), 0), initial_color=initial_color, delegate=self, tag='color')
|
||||
|
||||
def color_picker_closing(self, picker):
|
||||
if not self._root_widget.exists(): return
|
||||
if not self._root_widget.exists():
|
||||
return
|
||||
tag = picker.get_tag()
|
||||
|
||||
def color_picker_selected_color(self, picker, color):
|
||||
|
|
@ -972,8 +1015,10 @@ class ColorsMenu(PopupWindow):
|
|||
|
||||
def _updatePreview(self):
|
||||
gs = gs2 = getData("glowScale")
|
||||
if not getData("glowColor"): gs =1
|
||||
if not getData("glowHighlight"): gs2 =1
|
||||
if not getData("glowColor"):
|
||||
gs = 1
|
||||
if not getData("glowHighlight"):
|
||||
gs2 = 1
|
||||
|
||||
c = (1, 1, 1)
|
||||
if getData("colorPlayer"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue