mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
[ci] auto-format
This commit is contained in:
parent
35d4e45915
commit
e7158a0878
8 changed files with 824 additions and 808 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Ported to api 8 by brostos using baport.(https://github.com/bombsquad-community/baport)
|
||||
#BetterDeathMatch
|
||||
#Made by your friend: @[Just] Freak#4999
|
||||
# BetterDeathMatch
|
||||
# Made by your friend: @[Just] Freak#4999
|
||||
|
||||
"""Defines a very-customisable DeathMatch mini-game"""
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]):
|
|||
bs.BoolSetting('Epic Mode', default=False),
|
||||
|
||||
|
||||
## Add settings ##
|
||||
## Add settings ##
|
||||
bs.BoolSetting('Enable Gloves', False),
|
||||
bs.BoolSetting('Enable Powerups', True),
|
||||
bs.BoolSetting('Night Mode', False),
|
||||
|
|
@ -85,10 +85,9 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]):
|
|||
bs.BoolSetting('One Punch Kill', False),
|
||||
bs.BoolSetting('Spawn with Shield', False),
|
||||
bs.BoolSetting('Punching Only', False),
|
||||
## Add settings ##
|
||||
## Add settings ##
|
||||
]
|
||||
|
||||
|
||||
# In teams mode, a suicide gives a point to the other team, but in
|
||||
# free-for-all it subtracts from your own score. By default we clamp
|
||||
# this at zero to benefit new players, but pro players might like to
|
||||
|
|
@ -126,7 +125,6 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]):
|
|||
self._only_punch = bool(settings['Punching Only'])
|
||||
## Take applied settings ##
|
||||
|
||||
|
||||
self._epic_mode = bool(settings['Epic Mode'])
|
||||
self._kills_to_win_per_player = int(
|
||||
settings['Kills to Win Per Player'])
|
||||
|
|
@ -151,6 +149,8 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]):
|
|||
|
||||
|
||||
## Run settings related: IcyFloor ##
|
||||
|
||||
|
||||
def on_transition_in(self) -> None:
|
||||
super().on_transition_in()
|
||||
activity = bs.getactivity()
|
||||
|
|
@ -160,8 +160,6 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]):
|
|||
return
|
||||
## Run settings related: IcyFloor ##
|
||||
|
||||
|
||||
|
||||
def on_begin(self) -> None:
|
||||
super().on_begin()
|
||||
self.setup_standard_time_limit(self._time_limit)
|
||||
|
|
@ -172,15 +170,14 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]):
|
|||
bs.getactivity().globalsnode.tint = (0.5, 0.7, 1)
|
||||
else:
|
||||
pass
|
||||
#-# Tried return here, pfft. Took me 30mins to figure out why pwps spawning only on NightMode
|
||||
#-# Now its fixed :)
|
||||
# -# Tried return here, pfft. Took me 30mins to figure out why pwps spawning only on NightMode
|
||||
# -# Now its fixed :)
|
||||
if self._enable_powerups:
|
||||
self.setup_standard_powerup_drops()
|
||||
else:
|
||||
pass
|
||||
## Run settings related: NightMode,Powerups ##
|
||||
|
||||
|
||||
# Base kills needed to win on the size of the largest team.
|
||||
self._score_to_win = (self._kills_to_win_per_player *
|
||||
max(1, max(len(t.players) for t in self.teams)))
|
||||
|
|
@ -244,6 +241,8 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]):
|
|||
|
||||
|
||||
## Run settings related: Spaz ##
|
||||
|
||||
|
||||
def spawn_player(self, player: Player) -> bs.Actor:
|
||||
spaz = self.spawn_player_spaz(player)
|
||||
if self._boxing_gloves:
|
||||
|
|
@ -258,7 +257,6 @@ class BetterDeathMatchGame(bs.TeamGameActivity[Player, Team]):
|
|||
return spaz
|
||||
## Run settings related: Spaz ##
|
||||
|
||||
|
||||
def _update_scoreboard(self) -> None:
|
||||
for team in self.teams:
|
||||
self._scoreboard.set_team_value(team, team.score,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# Ported to api 8 by brostos using baport.(https://github.com/bombsquad-community/baport)
|
||||
#BetterElimination
|
||||
#Made by your friend: @[Just] Freak#4999
|
||||
# BetterElimination
|
||||
# Made by your friend: @[Just] Freak#4999
|
||||
|
||||
#Huge Thx to Nippy for "Live Team Balance"
|
||||
# Huge Thx to Nippy for "Live Team Balance"
|
||||
|
||||
|
||||
"""Defines a very-customisable Elimination mini-game"""
|
||||
|
|
@ -222,7 +222,7 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]):
|
|||
bs.BoolSetting('Epic Mode', default=False),
|
||||
|
||||
|
||||
## Add settings ##
|
||||
## Add settings ##
|
||||
bs.BoolSetting('Live Team Balance (by Nippy#2677)', True),
|
||||
bs.BoolSetting('Enable Gloves', False),
|
||||
bs.BoolSetting('Enable Powerups', True),
|
||||
|
|
@ -231,7 +231,7 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]):
|
|||
bs.BoolSetting('One Punch Kill', False),
|
||||
bs.BoolSetting('Spawn with Shield', False),
|
||||
bs.BoolSetting('Punching Only', False),
|
||||
## Add settings ##
|
||||
## Add settings ##
|
||||
]
|
||||
if issubclass(sessiontype, bs.DualTeamSession):
|
||||
settings.append(bs.BoolSetting('Solo Mode', default=False))
|
||||
|
|
@ -299,7 +299,7 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]):
|
|||
player.team.survival_seconds = 0
|
||||
bui.screenmessage(
|
||||
babase.Lstr(resource='playerDelayedJoinText',
|
||||
subs=[('${PLAYER}', player.getname(full=True))]),
|
||||
subs=[('${PLAYER}', player.getname(full=True))]),
|
||||
color=(0, 1, 0),
|
||||
)
|
||||
return
|
||||
|
|
@ -321,6 +321,8 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]):
|
|||
|
||||
|
||||
## Run settings related: IcyFloor ##
|
||||
|
||||
|
||||
def on_transition_in(self) -> None:
|
||||
super().on_transition_in()
|
||||
activity = bs.getactivity()
|
||||
|
|
@ -330,8 +332,6 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]):
|
|||
return
|
||||
## Run settings related: IcyFloor ##
|
||||
|
||||
|
||||
|
||||
def on_begin(self) -> None:
|
||||
super().on_begin()
|
||||
self._start_time = bs.time()
|
||||
|
|
@ -343,15 +343,14 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]):
|
|||
bs.getactivity().globalsnode.tint = (0.5, 0.7, 1)
|
||||
else:
|
||||
pass
|
||||
#-# Tried return here, pfft. Took me 30mins to figure out why pwps spawning only on NightMode
|
||||
#-# Now its fixed :)
|
||||
# -# Tried return here, pfft. Took me 30mins to figure out why pwps spawning only on NightMode
|
||||
# -# Now its fixed :)
|
||||
if self._enable_powerups:
|
||||
self.setup_standard_powerup_drops()
|
||||
else:
|
||||
pass
|
||||
## Run settings related: NightMode,Powerups ##
|
||||
|
||||
|
||||
if self._solo_mode:
|
||||
self._vs_text = bs.NodeActor(
|
||||
bs.newnode('text',
|
||||
|
|
@ -526,7 +525,6 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]):
|
|||
return actor
|
||||
## Run settings related: Spaz ##
|
||||
|
||||
|
||||
def _print_lives(self, player: Player) -> None:
|
||||
from bascenev1lib.actor import popuptext
|
||||
|
||||
|
|
@ -542,24 +540,25 @@ class BetterEliminationGame(bs.TeamGameActivity[Player, Team]):
|
|||
position=player.node.position).autoretain()
|
||||
|
||||
def on_player_leave(self, player: Player) -> None:
|
||||
########################################################Nippy#2677
|
||||
team_count=1 #Just initiating
|
||||
if player.lives>0 and self._live_team_balance:
|
||||
team_mem=[]
|
||||
# Nippy#2677
|
||||
team_count = 1 # Just initiating
|
||||
if player.lives > 0 and self._live_team_balance:
|
||||
team_mem = []
|
||||
for teamer in player.team.players:
|
||||
if player!=teamer:
|
||||
team_mem.append(teamer) #Got Dead players Team
|
||||
live=player.lives
|
||||
team_count=len(team_mem)
|
||||
for i in range(int((live if live%2==0 else live+1)/2)): #Extending Player List for Sorted Players
|
||||
if player != teamer:
|
||||
team_mem.append(teamer) # Got Dead players Team
|
||||
live = player.lives
|
||||
team_count = len(team_mem)
|
||||
# Extending Player List for Sorted Players
|
||||
for i in range(int((live if live % 2 == 0 else live+1)/2)):
|
||||
team_mem.extend(team_mem)
|
||||
if team_count>0:
|
||||
if team_count > 0:
|
||||
for i in range(live):
|
||||
team_mem[i].lives+=1
|
||||
team_mem[i].lives += 1
|
||||
|
||||
if team_count<=0 : #Draw if Player Leaves
|
||||
if team_count <= 0: # Draw if Player Leaves
|
||||
self.end_game()
|
||||
########################################################Nippy#2677
|
||||
# Nippy#2677
|
||||
super().on_player_leave(player)
|
||||
player.icons = []
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ class BotShowerGame(bs.TeamGameActivity[Player, Team]):
|
|||
if self.has_begun():
|
||||
bui.screenmessage(
|
||||
babase.Lstr(resource='playerDelayedJoinText',
|
||||
subs=[('${PLAYER}', player.getname(full=True))]),
|
||||
subs=[('${PLAYER}', player.getname(full=True))]),
|
||||
color=(1, 1, 0),
|
||||
)
|
||||
|
||||
|
|
@ -147,7 +147,8 @@ class BotShowerGame(bs.TeamGameActivity[Player, Team]):
|
|||
|
||||
def _spawn_bot(self) -> None:
|
||||
assert self._bots is not None
|
||||
self._bots.spawn_bot(random.choice(self._bot_type), pos=(random.uniform(-11, 11), (9.8 if self.map.getname() == 'Football Stadium' else 5.0), random.uniform(-5, 5)))
|
||||
self._bots.spawn_bot(random.choice(self._bot_type), pos=(
|
||||
random.uniform(-11, 11), (9.8 if self.map.getname() == 'Football Stadium' else 5.0), random.uniform(-5, 5)))
|
||||
|
||||
def _check_end_game(self) -> None:
|
||||
living_team_count = 0
|
||||
|
|
@ -192,4 +193,4 @@ class BotShowerGame(bs.TeamGameActivity[Player, Team]):
|
|||
|
||||
results.set_team_score(team, int(1000.0 * longest_life))
|
||||
|
||||
self.end(results=results)
|
||||
self.end(results=results)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -17,19 +17,22 @@ from bascenev1lib.actor.onscreentimer import OnScreenTimer
|
|||
if TYPE_CHECKING:
|
||||
from typing import Any, Type, Dict, List, Optional
|
||||
|
||||
|
||||
def ba_get_api_version():
|
||||
return 8
|
||||
|
||||
|
||||
def ba_get_levels():
|
||||
return [bs._level.Level(
|
||||
'Explodo Run',
|
||||
gametype=ExplodoRunGame,
|
||||
settings={},
|
||||
preview_texture_name='rampagePreview'),bs._level.Level(
|
||||
'Epic Explodo Run',
|
||||
gametype=ExplodoRunGame,
|
||||
settings={'Epic Mode':True},
|
||||
preview_texture_name='rampagePreview')]
|
||||
return [bs._level.Level(
|
||||
'Explodo Run',
|
||||
gametype=ExplodoRunGame,
|
||||
settings={},
|
||||
preview_texture_name='rampagePreview'), bs._level.Level(
|
||||
'Epic Explodo Run',
|
||||
gametype=ExplodoRunGame,
|
||||
settings={'Epic Mode': True},
|
||||
preview_texture_name='rampagePreview')]
|
||||
|
||||
|
||||
class Player(bs.Player['Team']):
|
||||
"""Our player type for this game."""
|
||||
|
|
@ -39,6 +42,8 @@ class Team(bs.Team[Player]):
|
|||
"""Our team type for this game."""
|
||||
|
||||
# ba_meta export bascenev1.GameActivity
|
||||
|
||||
|
||||
class ExplodoRunGame(bs.TeamGameActivity[Player, Team]):
|
||||
name = "Explodo Run"
|
||||
description = "Run For Your Life :))"
|
||||
|
|
@ -47,8 +52,8 @@ class ExplodoRunGame(bs.TeamGameActivity[Player, Team]):
|
|||
scoretype=bs.ScoreType.MILLISECONDS,
|
||||
lower_is_better=False)
|
||||
default_music = bs.MusicType.TO_THE_DEATH
|
||||
|
||||
def __init__(self, settings:dict):
|
||||
|
||||
def __init__(self, settings: dict):
|
||||
settings['map'] = "Rampage"
|
||||
self._epic_mode = settings.get('Epic Mode', False)
|
||||
if self._epic_mode:
|
||||
|
|
@ -59,27 +64,28 @@ class ExplodoRunGame(bs.TeamGameActivity[Player, Team]):
|
|||
self._won = False
|
||||
self._bots = SpazBotSet()
|
||||
self.wave = 1
|
||||
|
||||
|
||||
def on_begin(self) -> None:
|
||||
super().on_begin()
|
||||
|
||||
|
||||
self._timer = OnScreenTimer()
|
||||
bs.timer(2.5, self._timer.start)
|
||||
|
||||
#Bots Hehe
|
||||
bs.timer(2.5,self.street)
|
||||
|
||||
# Bots Hehe
|
||||
bs.timer(2.5, self.street)
|
||||
|
||||
def street(self):
|
||||
for a in range(self.wave):
|
||||
p1 = random.choice([-5,-2.5,0,2.5,5])
|
||||
p3 = random.choice([-4.5,-4.14,-5,-3])
|
||||
time = random.choice([1,1.5,2.5,2])
|
||||
self._bots.spawn_bot(ExplodeyBot, pos=(p1,5.5,p3),spawn_time = time)
|
||||
p1 = random.choice([-5, -2.5, 0, 2.5, 5])
|
||||
p3 = random.choice([-4.5, -4.14, -5, -3])
|
||||
time = random.choice([1, 1.5, 2.5, 2])
|
||||
self._bots.spawn_bot(ExplodeyBot, pos=(p1, 5.5, p3), spawn_time=time)
|
||||
self.wave += 1
|
||||
|
||||
|
||||
def botrespawn(self):
|
||||
if not self._bots.have_living_bots():
|
||||
self.street()
|
||||
|
||||
def handlemessage(self, msg: Any) -> Any:
|
||||
|
||||
# A player has died.
|
||||
|
|
@ -87,7 +93,7 @@ class ExplodoRunGame(bs.TeamGameActivity[Player, Team]):
|
|||
super().handlemessage(msg) # Augment standard behavior.
|
||||
self._won = True
|
||||
self.end_game()
|
||||
|
||||
|
||||
# A spaz-bot has died.
|
||||
elif isinstance(msg, SpazBotDiedMessage):
|
||||
# Unfortunately the bot-set will always tell us there are living
|
||||
|
|
@ -128,5 +134,3 @@ class ExplodoRunGame(bs.TeamGameActivity[Player, Team]):
|
|||
|
||||
# Ends the activity.
|
||||
self.end(results)
|
||||
|
||||
|
||||
|
|
@ -21,6 +21,7 @@ if TYPE_CHECKING:
|
|||
def ba_get_api_version():
|
||||
return 8
|
||||
|
||||
|
||||
def ba_get_levels():
|
||||
return [babase._level.Level(
|
||||
'Extinction',
|
||||
|
|
@ -33,23 +34,24 @@ def ba_get_levels():
|
|||
settings={'Epic Mode': True},
|
||||
preview_texture_name='footballStadiumPreview')]
|
||||
|
||||
|
||||
class Meteor(bs.Actor):
|
||||
"""A giant meteor instead of bombs."""
|
||||
|
||||
|
||||
def __init__(self,
|
||||
pos: Sequence[float] = (0.0, 1.0, 0.0),
|
||||
velocity: Sequence[float] = (0.0, 0.0, 0.0)):
|
||||
super().__init__()
|
||||
|
||||
|
||||
shared = SharedObjects.get()
|
||||
factory = BombFactory.get()
|
||||
|
||||
|
||||
materials = (shared.object_material,
|
||||
factory.impact_blast_material)
|
||||
|
||||
|
||||
self.pos = (pos[0], pos[1], pos[2])
|
||||
self.velocity = (velocity[0], velocity[1], velocity[2])
|
||||
|
||||
|
||||
self.node = bs.newnode(
|
||||
'prop',
|
||||
delegate=self,
|
||||
|
|
@ -66,13 +68,13 @@ class Meteor(bs.Actor):
|
|||
'reflection_scale': [0.45],
|
||||
'materials': materials
|
||||
})
|
||||
|
||||
|
||||
def explode(self) -> None:
|
||||
Blast(position=self.node.position,
|
||||
velocity=self.node.velocity,
|
||||
blast_type='tnt',
|
||||
blast_radius=2.0)
|
||||
|
||||
|
||||
def handlemessage(self, msg: Any) -> Any:
|
||||
if isinstance(msg, bs.DieMessage):
|
||||
if self.node:
|
||||
|
|
@ -86,11 +88,12 @@ class Meteor(bs.Actor):
|
|||
|
||||
class Player(bs.Player['Team']):
|
||||
"""Our player type for this game."""
|
||||
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.death_time: Optional[float] = None
|
||||
|
||||
|
||||
class Team(bs.Team[Player]):
|
||||
"""Our team type for this game."""
|
||||
|
||||
|
|
@ -98,112 +101,112 @@ class Team(bs.Team[Player]):
|
|||
# ba_meta export bascenev1.GameActivity
|
||||
class NewMeteorShowerGame(bs.TeamGameActivity[Player, Team]):
|
||||
"""Minigame by Jetz."""
|
||||
|
||||
|
||||
name = 'Extinction'
|
||||
description = 'Survive the Extinction.'
|
||||
available_settings = [
|
||||
bs.BoolSetting('Epic Mode', default=False)]
|
||||
|
||||
|
||||
announce_player_deaths = True
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_supported_maps(cls, sessiontype: Type[bs.Session]) -> List[str]:
|
||||
return ['Football Stadium']
|
||||
|
||||
|
||||
@classmethod
|
||||
def supports_session_type(cls, sessiontype: Type[bs.Session]) -> bool:
|
||||
return (issubclass(sessiontype, bs.FreeForAllSession)
|
||||
or issubclass(sessiontype, bs.DualTeamSession))
|
||||
|
||||
|
||||
def __init__(self, settings: dict):
|
||||
super().__init__(settings)
|
||||
|
||||
|
||||
self._epic_mode = bool(settings['Epic Mode'])
|
||||
self._last_player_death_time: Optiobal[float] = None
|
||||
self._meteor_time = 2.0
|
||||
self._timer: Optional[OnScreenTimer] = None
|
||||
|
||||
|
||||
self.default_music = (bs.MusicType.EPIC
|
||||
if self._epic_mode else bs.MusicType.SURVIVAL)
|
||||
|
||||
|
||||
if self._epic_mode:
|
||||
self.slow_motion = True
|
||||
|
||||
|
||||
def on_begin(self) -> None:
|
||||
super().on_begin()
|
||||
|
||||
|
||||
delay = 5.0 if len(self.players) > 2 else 2.5
|
||||
if self._epic_mode:
|
||||
delay *= 0.25
|
||||
bs.timer(delay, self._decrement_meteor_time, repeat=True)
|
||||
|
||||
|
||||
delay = 3.0
|
||||
if self._epic_mode:
|
||||
delay *= 0.25
|
||||
bs.timer(delay, self._set_meteor_timer)
|
||||
|
||||
|
||||
self._timer = OnScreenTimer()
|
||||
self._timer.start()
|
||||
self._check_end_game()
|
||||
|
||||
|
||||
def on_player_join(self, player: Player) -> None:
|
||||
if self.has_begun():
|
||||
bs.broadcastmessage(
|
||||
babase.Lstr(resource='playerDelayedJoinText',
|
||||
subs=[('${PLAYER}', player.getname(full=True))]),
|
||||
subs=[('${PLAYER}', player.getname(full=True))]),
|
||||
color=(0, 1, 0),
|
||||
)
|
||||
assert self._timer is not None
|
||||
player.death_time = self._timer.getstarttime()
|
||||
return
|
||||
self.spawn_player(player)
|
||||
|
||||
|
||||
def spawn_player(self, player: Player) -> None:
|
||||
spaz = self.spawn_player_spaz(player)
|
||||
|
||||
|
||||
spaz.connect_controls_to_player(enable_punch=False,
|
||||
enable_pickup=False,
|
||||
enable_bomb=False,
|
||||
enable_jump=False)
|
||||
spaz.play_big_death_sound = True
|
||||
|
||||
|
||||
return spaz
|
||||
|
||||
|
||||
def on_player_leave(self, player: Player) -> None:
|
||||
super().on_player_leave(player)
|
||||
|
||||
|
||||
self._check_end_game()
|
||||
|
||||
|
||||
def handlemessage(self, msg: Any) -> Any:
|
||||
if isinstance(msg, bs.PlayerDiedMessage):
|
||||
curtime = bs.time()
|
||||
|
||||
|
||||
msg.getplayer(Player).death_time = curtime
|
||||
bs.timer(1.0, self._check_end_game)
|
||||
else:
|
||||
return super().handlemessage(msg)
|
||||
|
||||
|
||||
def _spawn_meteors(self) -> None:
|
||||
pos = (random.randint(-6, 7), 12,
|
||||
random.uniform(-2, 1))
|
||||
velocity = (random.randint(-11, 11), 0,
|
||||
random.uniform(-5, 5))
|
||||
Meteor(pos=pos, velocity=velocity).autoretain()
|
||||
|
||||
|
||||
def _spawn_meteors_cluster(self) -> None:
|
||||
delay = 0.0
|
||||
for _i in range(random.randrange(1, 3)):
|
||||
bs.timer(delay, self._spawn_meteors)
|
||||
delay += 1
|
||||
self._set_meteor_timer()
|
||||
|
||||
|
||||
def _decrement_meteor_time(self) -> None:
|
||||
self._meteor_time = max(0.01, self._meteor_time * 0.9)
|
||||
|
||||
|
||||
def _set_meteor_timer(self) -> None:
|
||||
bs.timer((1.0 + 0.2 * random.random()) * self._meteor_time,
|
||||
self._spawn_meteors_cluster)
|
||||
|
||||
|
||||
def _check_end_game(self) -> None:
|
||||
living_team_count = 0
|
||||
for team in self.teams:
|
||||
|
|
@ -211,44 +214,44 @@ class NewMeteorShowerGame(bs.TeamGameActivity[Player, Team]):
|
|||
if player.is_alive():
|
||||
living_team_count += 1
|
||||
break
|
||||
|
||||
|
||||
if isinstance(self.session, bs.CoopSession):
|
||||
if living_team_count <= 0:
|
||||
self.end_game()
|
||||
else:
|
||||
if living_team_count <= 1:
|
||||
self.end_game()
|
||||
|
||||
|
||||
def end_game(self) -> None:
|
||||
cur_time = bs.time()
|
||||
assert self._timer is not None
|
||||
start_time = self._timer.getstarttime()
|
||||
|
||||
|
||||
for team in self.teams:
|
||||
for player in team.players:
|
||||
survived = False
|
||||
|
||||
|
||||
if player.death_time is None:
|
||||
survived = True
|
||||
player.death_time = cur_time + 1
|
||||
|
||||
|
||||
score = int(player.death_time - self._timer.getstarttime())
|
||||
if survived:
|
||||
score += 50
|
||||
self.stats.player_scored(player, score, screenmessage=False)
|
||||
|
||||
|
||||
self._timer.stop(endtime=self._last_player_death_time)
|
||||
|
||||
|
||||
results = bs.GameResults()
|
||||
|
||||
|
||||
for team in self.teams:
|
||||
|
||||
|
||||
longest_life = 0.0
|
||||
for player in team.players:
|
||||
assert player.death_time is not None
|
||||
longest_life = max(longest_life,
|
||||
player.death_time - start_time)
|
||||
|
||||
|
||||
results.set_team_score(team, int(1000.0 * longest_life))
|
||||
|
||||
self.end(results=results)
|
||||
|
||||
self.end(results=results)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
# - - - - - - - - - - - - - - - - - - - - -
|
||||
# - Fat-Pigs! by Zacker Tz || Zacker#5505 -
|
||||
# - Version 0.01 :v -
|
||||
# - Version 0.01 :v -
|
||||
# - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
from __future__ import annotations
|
||||
|
|
@ -24,12 +24,13 @@ if TYPE_CHECKING:
|
|||
|
||||
# - - - - - - - Mini - Settings - - - - - - - - - - - - - - - - #
|
||||
|
||||
zkBombs_limit = 3 # Number of bombs you can use | Default = 3
|
||||
zkPunch = False # Enable/Disable punchs | Default = False
|
||||
zkPickup = False # Enable/Disable pickup | Default = False
|
||||
zkBombs_limit = 3 # Number of bombs you can use | Default = 3
|
||||
zkPunch = False # Enable/Disable punchs | Default = False
|
||||
zkPickup = False # Enable/Disable pickup | Default = False
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||
|
||||
|
||||
class Player(bs.Player['Team']):
|
||||
"""Our player type for this game."""
|
||||
|
||||
|
|
@ -40,7 +41,9 @@ class Team(bs.Team[Player]):
|
|||
def __init__(self) -> None:
|
||||
self.score = 0
|
||||
|
||||
# ba_meta export bascenev1.GameActivity
|
||||
# ba_meta export bascenev1.GameActivity
|
||||
|
||||
|
||||
class FatPigs(bs.TeamGameActivity[Player, Team]):
|
||||
"""A game type based on acquiring kills."""
|
||||
|
||||
|
|
@ -139,20 +142,18 @@ class FatPigs(bs.TeamGameActivity[Player, Team]):
|
|||
super().on_begin()
|
||||
self.setup_standard_time_limit(self._time_limit)
|
||||
# self.setup_standard_powerup_drops()
|
||||
#Ambiente
|
||||
# Ambiente
|
||||
gnode = bs.getactivity().globalsnode
|
||||
gnode.tint = (0.8, 1.2, 0.8)
|
||||
gnode.ambient_color = (0.7, 1.0, 0.6)
|
||||
gnode.vignette_outer = (0.4, 0.6, 0.4) #C
|
||||
gnode.vignette_outer = (0.4, 0.6, 0.4) # C
|
||||
# gnode.vignette_inner = (0.9, 0.9, 0.9)
|
||||
|
||||
|
||||
|
||||
# Base kills needed to win on the size of the largest team.
|
||||
self._score_to_win = (self._kills_to_win_per_player *
|
||||
max(1, max(len(t.players) for t in self.teams)))
|
||||
self._update_scoreboard()
|
||||
|
||||
|
||||
delay = 5.0 if len(self.players) > 2 else 2.5
|
||||
if self._epic_mode:
|
||||
delay *= 0.25
|
||||
|
|
@ -169,18 +170,17 @@ class FatPigs(bs.TeamGameActivity[Player, Team]):
|
|||
|
||||
# Check for immediate end (if we've only got 1 player, etc).
|
||||
bs.timer(5.0, self._check_end_game)
|
||||
|
||||
|
||||
t = bs.newnode('text',
|
||||
attrs={ 'text':"Minigame by Zacker Tz",
|
||||
'scale':0.7,
|
||||
'position':(0.001,625),
|
||||
'shadow':0.5,
|
||||
'opacity':0.7,
|
||||
'flatness':1.2,
|
||||
'color':(0.6, 1, 0.6),
|
||||
'h_align':'center',
|
||||
'v_attach':'bottom'})
|
||||
|
||||
attrs={'text': "Minigame by Zacker Tz",
|
||||
'scale': 0.7,
|
||||
'position': (0.001, 625),
|
||||
'shadow': 0.5,
|
||||
'opacity': 0.7,
|
||||
'flatness': 1.2,
|
||||
'color': (0.6, 1, 0.6),
|
||||
'h_align': 'center',
|
||||
'v_attach': 'bottom'})
|
||||
|
||||
def spawn_player(self, player: Player) -> bs.Actor:
|
||||
spaz = self.spawn_player_spaz(player)
|
||||
|
|
@ -190,13 +190,13 @@ class FatPigs(bs.TeamGameActivity[Player, Team]):
|
|||
spaz.connect_controls_to_player(enable_punch=zkPunch,
|
||||
enable_bomb=True,
|
||||
enable_pickup=zkPickup)
|
||||
|
||||
|
||||
spaz.bomb_count = zkBombs_limit
|
||||
spaz._max_bomb_count = zkBombs_limit
|
||||
spaz.bomb_type_default = 'sticky'
|
||||
spaz.bomb_type = 'sticky'
|
||||
|
||||
#cerdo gordo
|
||||
# cerdo gordo
|
||||
spaz.node.color_mask_texture = bs.gettexture('melColorMask')
|
||||
spaz.node.color_texture = bs.gettexture('melColor')
|
||||
spaz.node.head_mesh = bs.getmesh('melHead')
|
||||
|
|
@ -210,19 +210,19 @@ class FatPigs(bs.TeamGameActivity[Player, Team]):
|
|||
spaz.node.toes_mesh = bs.getmesh('melToes')
|
||||
spaz.node.style = 'mel'
|
||||
# Sounds cerdo gordo
|
||||
mel_sounds = [bs.getsound('mel01'), bs.getsound('mel02'),bs.getsound('mel03'),bs.getsound('mel04'),bs.getsound('mel05'),
|
||||
bs.getsound('mel06'),bs.getsound('mel07'),bs.getsound('mel08'),bs.getsound('mel09'),bs.getsound('mel10')]
|
||||
mel_sounds = [bs.getsound('mel01'), bs.getsound('mel02'), bs.getsound('mel03'), bs.getsound('mel04'), bs.getsound('mel05'),
|
||||
bs.getsound('mel06'), bs.getsound('mel07'), bs.getsound('mel08'), bs.getsound('mel09'), bs.getsound('mel10')]
|
||||
spaz.node.jump_sounds = mel_sounds
|
||||
spaz.node.attack_sounds = mel_sounds
|
||||
spaz.node.impact_sounds = mel_sounds
|
||||
spaz.node.pickup_sounds = mel_sounds
|
||||
spaz.node.death_sounds = [bs.getsound('melDeath01')]
|
||||
spaz.node.fall_sounds = [bs.getsound('melFall01')]
|
||||
|
||||
|
||||
def _set_meteor_timer(self) -> None:
|
||||
bs.timer((1.0 + 0.2 * random.random()) * self._meteor_time,
|
||||
self._drop_bomb_cluster)
|
||||
|
||||
self._drop_bomb_cluster)
|
||||
|
||||
def _drop_bomb_cluster(self) -> None:
|
||||
|
||||
# Random note: code like this is a handy way to plot out extents
|
||||
|
|
@ -245,15 +245,14 @@ class FatPigs(bs.TeamGameActivity[Player, Team]):
|
|||
vel = ((-5.0 + random.random() * 30.0) * dropdir, -4.0, 0)
|
||||
bs.timer(delay, babase.Call(self._drop_bomb, pos, vel))
|
||||
delay += 0.1
|
||||
self._set_meteor_timer()
|
||||
|
||||
self._set_meteor_timer()
|
||||
|
||||
def _drop_bomb(self, position: Sequence[float],
|
||||
velocity: Sequence[float]) -> None:
|
||||
Bomb(position=position, velocity=velocity,bomb_type='sticky').autoretain()
|
||||
Bomb(position=position, velocity=velocity, bomb_type='sticky').autoretain()
|
||||
|
||||
def _decrement_meteor_time(self) -> None:
|
||||
self._meteor_time = max(0.01, self._meteor_time * 0.9)
|
||||
|
||||
|
||||
def handlemessage(self, msg: Any) -> Any:
|
||||
|
||||
|
|
@ -326,7 +325,7 @@ class FatPigs(bs.TeamGameActivity[Player, Team]):
|
|||
self.end_game()
|
||||
else:
|
||||
if living_team_count <= 1:
|
||||
self.end_game()
|
||||
self.end_game()
|
||||
|
||||
def _update_scoreboard(self) -> None:
|
||||
for team in self.teams:
|
||||
|
|
|
|||
|
|
@ -20,28 +20,35 @@ DECIMAL_LIMIT = 7
|
|||
|
||||
|
||||
PlayerSpaz.supershit = PlayerSpaz.__init__
|
||||
|
||||
|
||||
def ShitInit(self,
|
||||
player: bs.Player,
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
highlight: Sequence[float] = (0.5, 0.5, 0.5),
|
||||
character: str = 'Spaz',
|
||||
powerups_expire: bool = True) -> None:
|
||||
player: bs.Player,
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
highlight: Sequence[float] = (0.5, 0.5, 0.5),
|
||||
character: str = 'Spaz',
|
||||
powerups_expire: bool = True) -> None:
|
||||
self.supershit(player, color, highlight, character, powerups_expire)
|
||||
self.offt = bs.newnode('math', owner=self.node, attrs={'input1': (1.2, 1.8, -0.7),'operation': 'add'})
|
||||
self.offt = bs.newnode('math', owner=self.node, attrs={
|
||||
'input1': (1.2, 1.8, -0.7), 'operation': 'add'})
|
||||
self.node.connectattr('torso_position', self.offt, 'input2')
|
||||
self.txt = bs.newnode('text', owner=self.node, attrs={'text': '3.0','in_world': True,'text':'0','shadow': 1.0,'color': (1,0,0),'flatness': 0.5,'scale': 0.01,'h_align': 'right'})
|
||||
self.txt = bs.newnode('text', owner=self.node, attrs={'text': '3.0', 'in_world': True, 'text': '0', 'shadow': 1.0, 'color': (
|
||||
1, 0, 0), 'flatness': 0.5, 'scale': 0.01, 'h_align': 'right'})
|
||||
p = self.node.position
|
||||
self.xyz = 0
|
||||
self.txt.text = "X: " + str(p[0]) + "\nY: " + str(p[1]) + "\nZ: " + str(p[2])
|
||||
self.offt.connectattr('output', self.txt, 'position')
|
||||
|
||||
def update():
|
||||
p = self.node.position
|
||||
is_moving = abs(self.node.move_up_down) >= 0.01 or abs(self.node.move_left_right) >= 0.01
|
||||
if is_moving:
|
||||
self.xyz = (p[0],p[1],p[2])
|
||||
self.txt.text = "X: " + str(round(self.xyz[0],DECIMAL_LIMIT)) + "\nY: " + str(round(self.xyz[1],DECIMAL_LIMIT)) + "\nZ: " + str(round(self.xyz[2],DECIMAL_LIMIT))
|
||||
bs.timer(0.1,update,repeat=True)
|
||||
|
||||
self.xyz = (p[0], p[1], p[2])
|
||||
self.txt.text = "X: " + str(round(self.xyz[0], DECIMAL_LIMIT)) + "\nY: " + str(
|
||||
round(self.xyz[1], DECIMAL_LIMIT)) + "\nZ: " + str(round(self.xyz[2], DECIMAL_LIMIT))
|
||||
bs.timer(0.1, update, repeat=True)
|
||||
|
||||
|
||||
def replaceable_punch(self) -> None:
|
||||
"""
|
||||
Called to 'press punch' on this spaz;
|
||||
|
|
@ -55,10 +62,11 @@ def replaceable_punch(self) -> None:
|
|||
index += len(files)
|
||||
c27 = str(index + 1)
|
||||
with open(path_aid + '/coords' + c27 + '.txt', 'w') as gg:
|
||||
gg.write("X: " + str(round(self.xyz[0],DECIMAL_LIMIT)) + "\nY: " + str(round(self.xyz[1],DECIMAL_LIMIT)) + "\nZ: " + str(round(self.xyz[2],DECIMAL_LIMIT)) + '\n\n' + '(' + str(round(self.xyz[0],DECIMAL_LIMIT)) + ', ' + str(round(self.xyz[1],DECIMAL_LIMIT)) + ', ' + str(round(self.xyz[2],DECIMAL_LIMIT)) + ')')
|
||||
gg.write("X: " + str(round(self.xyz[0], DECIMAL_LIMIT)) + "\nY: " + str(round(self.xyz[1], DECIMAL_LIMIT)) + "\nZ: " + str(round(self.xyz[2], DECIMAL_LIMIT)) +
|
||||
'\n\n' + '(' + str(round(self.xyz[0], DECIMAL_LIMIT)) + ', ' + str(round(self.xyz[1], DECIMAL_LIMIT)) + ', ' + str(round(self.xyz[2], DECIMAL_LIMIT)) + ')')
|
||||
bui.screenmessage("Coordinates saved in: " + "BombSquad/Saved XYZ/" + "coords" + c27)
|
||||
if _babase.app.classic.platform == 'android':
|
||||
_babase.android_media_scan_file(path_aid)
|
||||
_babase.android_media_scan_file(path_aid)
|
||||
t_ms = bs.time() * 1000
|
||||
assert isinstance(t_ms, int)
|
||||
if t_ms - self.last_punch_time_ms >= self._punch_cooldown:
|
||||
|
|
@ -69,17 +77,20 @@ def replaceable_punch(self) -> None:
|
|||
self.node.punch_pressed = True
|
||||
if not self.node.hold_node:
|
||||
bs.timer(
|
||||
0.1,
|
||||
bs.WeakCall(self._safe_play_sound,
|
||||
SpazFactory.get().swish_sound, 0.8))
|
||||
0.1,
|
||||
bs.WeakCall(self._safe_play_sound,
|
||||
SpazFactory.get().swish_sound, 0.8))
|
||||
self._turbo_filter_add_press('punch')
|
||||
|
||||
# ba_meta export plugin
|
||||
|
||||
|
||||
class ragingspeedhorn(babase.Plugin):
|
||||
try:
|
||||
oath = _babase.env()['python_directory_user'] + '/Saved XYZ'
|
||||
os.makedirs(oath,exist_ok=False)
|
||||
except: pass
|
||||
oath = _babase.env()['python_directory_user'] + '/Saved XYZ'
|
||||
os.makedirs(oath, exist_ok=False)
|
||||
except:
|
||||
pass
|
||||
PlayerSpaz.on_punch_press = replaceable_punch
|
||||
PlayerSpaz.__init__ = ShitInit
|
||||
PlayerSpaz.xyz = 0
|
||||
PlayerSpaz.xyz = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue