bombsquad-community / plugin-manager

A Plugin Manager for Bombsquad 1.7+
https://bombsquad-community.web.app/pluginmanager
Other
38 stars 28 forks source link

Wait for scene app mode to activate #245

Closed rikkolovescats closed 2 months ago

rikkolovescats commented 2 months ago

Reported in ballistica's official discord server: https://discord.com/channels/1001896771347304639/1218201750440247296/1227731932838760521.

We were calling _bascenev1.protocol_version() before SceneAppMode was activated (by ballistica), which isn't allowed in newer ballistica versions.

It was the cause of the following traceback:

$ CMAKE_BUILD_TYPE="Debug" make prefab-gui-debug

BA_WSL_TARGETS_WINDOWS=1 tools/pcommand make_prefab gui-debug
make[1]: Entering directory '/home/rikkolovescats/ballistica'
Lazybuild: skipping "meta" (checked 89 inputs in 0.0026s).
Lazybuild: skipping "assets-cmake" (checked 376 inputs in 0.0018s).
Staging for cmake at build/prefab/full/linux_x86_64_gui/debug...
make[1]: Leaving directory '/home/rikkolovescats/ballistica'
cd build/prefab/full/linux_x86_64_gui/debug && ./ballisticakit
root: BallisticaKit 1.7.34 build 21800.
root: Error loading plugin class 'plugin_manager.EntryPoint'.
Traceback (most recent call last):
  File "/home/rikkolovescats/ballistica/build/prefab/full/linux_x86_64_gui/debug/ba_data/python/babase/_plugin.py", line 283, in attempt_load_if_enabled
    cls = getclass(self.class_path, Plugin)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rikkolovescats/ballistica/build/prefab/full/linux_x86_64_gui/debug/ba_data/python/babase/_general.py", line 83, in getclass
    module = importlib.import_module(modulename)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rikkolovescats/.ballisticakit/mods/plugin_manager.py", line 70, in <module>
    protocol_version = _bs.protocol_version()
                       ^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Attempting to access SceneAppMode while it is inactive.

This commit improves the compatibility layer such that any calls that require SceneAppMode to be active aren't made before it gets active.

Loup-Garou911XD commented 2 months ago

I'll try it in few hours