bombsquad-community / plugin-manager

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

Support plugins with multiple files #136

Open rikkolovescats opened 1 year ago

rikkolovescats commented 1 year ago

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.

rikkolovescats commented 1 year ago

This isn't on my priority list at the moment as I feel for most plugins having multiple files would probably be over engineering.

rikkolovescats commented 1 year ago

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).