mirror of
https://github.com/Freaku17/BombSquad-Mods-byFreaku
synced 2025-11-16 21:05:59 +00:00
Rename & update musical_flags.py for 1.7.37+ (API 9)
• Removed base64 encoded text (trusting the community that they won't change the name & steal credits) • Properly formatted for readability
This commit is contained in:
parent
be780a4580
commit
24d1fad594
1 changed files with 87 additions and 67 deletions
|
|
@ -1,5 +1,5 @@
|
|||
## Made by MattZ45986 on GitHub
|
||||
## Ported by your friend: Freaku
|
||||
# Made by MattZ45986 on GitHub
|
||||
# Ported by your friend: Freaku
|
||||
|
||||
|
||||
# Bug Fixes & Improvements as well...
|
||||
|
|
@ -8,11 +8,11 @@
|
|||
# https://discord.gg/ucyaesh
|
||||
|
||||
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from typing import TYPE_CHECKING
|
||||
import _babase, random, math
|
||||
import _babase
|
||||
import random
|
||||
import math
|
||||
import bascenev1 as bs
|
||||
from bascenev1lib.actor.flag import Flag, FlagPickedUpMessage
|
||||
from bascenev1lib.actor.playerspaz import PlayerSpaz
|
||||
|
|
@ -20,18 +20,18 @@ if TYPE_CHECKING:
|
|||
from typing import Any, Type, List, Dict, Tuple, Union, Sequence, Optional
|
||||
|
||||
|
||||
|
||||
class Player(bs.Player['Team']):
|
||||
def __init__(self) -> None:
|
||||
self.done: bool = False
|
||||
self.survived: bool = True
|
||||
|
||||
|
||||
class Team(bs.Team[Player]):
|
||||
def __init__(self) -> None:
|
||||
self.score = 0
|
||||
|
||||
|
||||
# ba_meta require api 8
|
||||
# ba_meta require api 9
|
||||
# ba_meta export bascenev1.GameActivity
|
||||
class MFGame(bs.TeamGameActivity[Player, Team]):
|
||||
name = 'Musical Flags'
|
||||
|
|
@ -123,8 +123,16 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
|
|||
self.nodes = []
|
||||
self.flags = []
|
||||
self.spawned = []
|
||||
import base64
|
||||
exec(base64.b64decode("aWYgc2VsZi5jcmVkaXRfdGV4dDoKICAgICMjIFBlb3BsZSBzdGVhbGVkIGNyZWRpdHMgc28gdGhhdHMgd2h5IEkgZW5jb2RlZCB0aGlzLi4uCiAgICAjIyBFdmVuIHRobyB0aGVyZSBpcyBhIG9wdGlvbiwgdGhleSBjaGFuZ2VkIGNyZWF0ZWQgYnkKICAgICMjIGxpa2Ugd3RmIGlzIHRoaWVyIHByb2JsZW0/PwoKICAgICMjIEFueXdheXMgaGF2ZSBhIGdvb2QgZGF5IQogICAgdCA9IGJzLm5ld25vZGUoJ3RleHQnLAogICAgICAgICAgICAgICBhdHRycz17ICd0ZXh0JzoiUG9ydGVkIGJ5IO6BiEZyZWFrdVxuTWFkZSBieSBNYXR0WjQ1OTg2IiwgIyMgRGlzYWJsZSAnRW5hYmxlIEJvdHRvbSBDcmVkaXRzJyB3aGVuIG1ha2luZyBwbGF5bGlzdCwgTm8gbmVlZCB0byBlZGl0IHRoaXMgbG92ZWx5Li4uCiAgICAgICAgJ3NjYWxlJzowLjcsCiAgICAgICAgJ3Bvc2l0aW9uJzooMCwwKSwKICAgICAgICAnc2hhZG93JzowLjUsCiAgICAgICAgJ2ZsYXRuZXNzJzoxLjIsCiAgICAgICAgJ2NvbG9yJzooMSwgMSwgMSksCiAgICAgICAgJ2hfYWxpZ24nOidjZW50ZXInLAogICAgICAgICd2X2F0dGFjaCc6J2JvdHRvbSd9KQ==").decode('UTF-8'))
|
||||
if self.credit_text:
|
||||
t = bs.newnode('text',
|
||||
attrs={'text': "Ported by Freaku\nMade by MattZ45986", # Disable 'Enable Bottom Credits' when making playlist, No need to edit this lovely...
|
||||
'scale': 0.7,
|
||||
'position': (0, 0),
|
||||
'shadow': 0.5,
|
||||
'flatness': 1.2,
|
||||
'color': (1, 1, 1),
|
||||
'h_align': 'center',
|
||||
'v_attach': 'bottom'})
|
||||
self.makeRound()
|
||||
self._textRound.text = 'Round ' + str(self.roundNum)
|
||||
bs.timer(3, self.checkEnd)
|
||||
|
|
@ -144,7 +152,8 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
|
|||
bs.timer(1.5, bs.Call(player.actor.handlemessage, bs.FreezeMessage()))
|
||||
bs.timer(2.5, bs.Call(player.actor.handlemessage, bs.FreezeMessage()))
|
||||
bs.timer(3, bs.Call(player.actor.handlemessage, bs.ShouldShatterMessage()))
|
||||
except: pass
|
||||
except:
|
||||
pass
|
||||
bs.timer(3.5, self.killRound)
|
||||
bs.timer(3.55, self.makeRound)
|
||||
self.round_time_textnode.opacity = 0
|
||||
|
|
@ -155,7 +164,8 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
|
|||
|
||||
def makeRound(self):
|
||||
for player in self.players:
|
||||
if player.survived: player.team.score += 1
|
||||
if player.survived:
|
||||
player.team.score += 1
|
||||
self.roundNum += 1
|
||||
self._textRound.text = 'Round ' + str(self.roundNum)
|
||||
self.flags = []
|
||||
|
|
@ -166,7 +176,8 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
|
|||
angle = random.randint(0, 359)
|
||||
c = 0
|
||||
for player in self.players:
|
||||
if player.survived: c+=1
|
||||
if player.survived:
|
||||
c += 1
|
||||
spacing = 10
|
||||
for player in self.players:
|
||||
player.done = False
|
||||
|
|
@ -174,14 +185,18 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
|
|||
if not player.is_alive():
|
||||
self.spawn_player(player, (.5, 5, -4))
|
||||
self.spawned.append(player)
|
||||
try: spacing = 360 // (c)
|
||||
except: self.checkEnd()
|
||||
colors = [(1,0,0),(0,1,0),(0,0,1),(1,1,0),(1,0,1),(0,1,1),(0,0,0),(0.5,0.8,0),(0,0.8,0.5),(0.8,0.25,0.7),(0,0.27,0.55),(2,2,0.6),(0.4,3,0.85)]
|
||||
try:
|
||||
spacing = 360 // (c)
|
||||
except:
|
||||
self.checkEnd()
|
||||
colors = [(1, 0, 0), (0, 1, 0), (0, 0, 1), (1, 1, 0), (1, 0, 1), (0, 1, 1), (0, 0, 0),
|
||||
(0.5, 0.8, 0), (0, 0.8, 0.5), (0.8, 0.25, 0.7), (0, 0.27, 0.55), (2, 2, 0.6), (0.4, 3, 0.85)]
|
||||
|
||||
# Add support for more than 13 players
|
||||
if c > 12:
|
||||
for i in range(c-12):
|
||||
colors.append((random.uniform(0.1, 1), random.uniform(0.1, 1), random.uniform(0.1, 1)))
|
||||
colors.append((random.uniform(0.1, 1), random.uniform(
|
||||
0.1, 1), random.uniform(0.1, 1)))
|
||||
|
||||
# Smart Mathematics:
|
||||
# All Flags spawn same distance from the players
|
||||
|
|
@ -196,15 +211,19 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
|
|||
def killRound(self):
|
||||
self.numPickedUp = 0
|
||||
for player in self.players:
|
||||
if player.is_alive(): player.actor.handlemessage(bs.DieMessage())
|
||||
for flag in self.flags: flag.node.delete()
|
||||
for light in self.nodes: light.delete()
|
||||
if player.is_alive():
|
||||
player.actor.handlemessage(bs.DieMessage())
|
||||
for flag in self.flags:
|
||||
flag.node.delete()
|
||||
for light in self.nodes:
|
||||
light.delete()
|
||||
|
||||
def spawn_player(self, player: Player, pos: tuple = (0, 0, 0)) -> bs.Actor:
|
||||
spaz = self.spawn_player_spaz(player)
|
||||
if pos == (0, 0, 0):
|
||||
pos = (-.5+random.random()*2, 3+random.random()*2, -5+random.random()*2)
|
||||
spaz.connect_controls_to_player(enable_punch=self.is_punch, enable_bomb=False, enable_run=self.is_run)
|
||||
spaz.connect_controls_to_player(enable_punch=self.is_punch,
|
||||
enable_bomb=False, enable_run=self.is_run)
|
||||
spaz.handlemessage(bs.StandMessage(pos))
|
||||
return spaz
|
||||
|
||||
|
|
@ -242,7 +261,8 @@ class MFGame(bs.TeamGameActivity[Player, Team]):
|
|||
player.actor.handlemessage(bs.StandMessage((0, 3, -2)))
|
||||
bs.timer(0.5, bs.Call(player.actor.handlemessage, bs.FreezeMessage()))
|
||||
bs.timer(3, bs.Call(player.actor.handlemessage, bs.ShouldShatterMessage()))
|
||||
except: pass
|
||||
except:
|
||||
pass
|
||||
bs.timer(3.5, self.killRound)
|
||||
bs.timer(3.55, self.makeRound)
|
||||
else:
|
||||
Loading…
Add table
Add a link
Reference in a new issue