plugin-manager
plugin-manager copied to clipboard
Support plugins with multiple files
The game currently also supports plugins with multiple files. So you could have a directory tree like this for your awesome_plugin
:
mods
├── awesome_plugin
│ ├── __init__.py
│ └── loader.py
└── random_plugin.py
with these file contents:
# awesome_plugin/__init__.py
# ba_meta require api 7
import ba
from .loader import load_awesome_plugin
# ba_meta export plugin
class AwesomePlugin(ba.Plugin):
def on_app_running(self):
load_awesome_plugin()
# awesome_plugin/loader.py
import ba
def load_awesome_plugin():
ba.screenmessage("Awesome Plugin loaded!")
The game'll pick this plugin up and you should see a Awesome Plugin loaded!
screenmessage.
At the moment, only single-file .py plugins work with plugin manager. Support for such multi-file plugins will be nice to have.
This isn't on my priority list at the moment as I feel for most plugins having multiple files would probably be over engineering.
I think we should avoid this for now, this'll add complexity to code which'll probably not bring good enough returns (at least yet).