diff --git a/dist/ba_root/mods/custom_hooks.py b/dist/ba_root/mods/custom_hooks.py index 537fcdd..a4ad789 100644 --- a/dist/ba_root/mods/custom_hooks.py +++ b/dist/ba_root/mods/custom_hooks.py @@ -28,7 +28,7 @@ from chatHandle import handlechat from features import team_balancer, afk_check, fire_flies, dual_team_score as newdts from stats import mystats from spazmod import modifyspaz -from tools import servercheck, ServerUpdate, logger +from tools import servercheck, ServerUpdate, logger, playlist from playersData import pdata from features import EndVote from features import text_on_map @@ -43,15 +43,19 @@ def filter_chat_message(msg: str, client_id: int) -> str | None: """Returns all in game messages or None (ignore's message).""" return handlechat.filter_chat_message(msg, client_id) +# ba_meta export plugin +class modSetup(ba.Plugin): + def on_app_running(self): + """Runs when app is launched.""" + bootstraping() + servercheck.checkserver().start() + ServerUpdate.check() -def on_app_running() -> None: - """Runs when app is launched.""" - bootstraping() - servercheck.checkserver().start() - ServerUpdate.check() + if settings["afk_remover"]['enable']: + afk_check.checkIdle().start() + def on_app_shutdown(self): + playlist.flush_playlists() - if settings["afk_remover"]['enable']: - afk_check.checkIdle().start() def score_screen_on_begin(_stats: ba.Stats) -> None: @@ -67,6 +71,7 @@ def playerspaz_init(playerspaz: ba.Player, node: ba.Node, player: ba.Player): def bootstraping(): """Bootstarps the server.""" + print("Bootstraping mods..") # server related _ba.set_server_device_name(settings["HostDeviceName"]) _ba.set_server_name(settings["HostName"]) diff --git a/dist/ba_root/mods/tools/playlist.py b/dist/ba_root/mods/tools/playlist.py index 632a25e..6410fcd 100644 --- a/dist/ba_root/mods/tools/playlist.py +++ b/dist/ba_root/mods/tools/playlist.py @@ -101,3 +101,20 @@ def setPlaylist(para): _ba.chatmessage(play) +def flush_playlists(): + for playlist in _ba.app.config["Team Tournament Playlists"]: + _ba.add_transaction( + { + "type":"REMOVE_PLAYLIST", + "playlistType":"Team Tournament", + "playlistName":playlist + }) + _ba.run_transactions() + for playlist in _ba.app.config["Free-for-All Playlists"]: + _ba.add_transaction( + { + "type":"REMOVE_PLAYLIST", + "playlistType":"Free-for-All", + "playlistName":playlist + }) + _ba.run_transactions() diff --git a/dist/bombsquad_headless b/dist/bombsquad_headless index 22c2e6d..20560f0 100644 Binary files a/dist/bombsquad_headless and b/dist/bombsquad_headless differ