Plugins: Add plugin settings

- Add support for plugin settings, they appear in the same menu as the plugins, indented from the left to emphasize which plugin the setting belongs to
  - Note that plugin settings can still be changed even when the plugins are stopped
- Add tooltips to plugin menu to view the plugin descriptions, description_lang can also be used
- Fix scolling not working on song select when returning from game settings
- Let instance owners set default plugin files in config.py, to make them easier to maintain
- plugins.add() can now add plugins using a url
- Plugins can be hidden from the plugin menu using PluginLoader.hide, an option in plugins.add(), or in config.py
- Make p2.disable() incremental so that multiple plugins can disable multiplayer independently
- Server no longer crashes if certain optional config fields were not copied over from an updated example config
- Fix not being able to unload plugins if one was imported with errors
This commit is contained in:
KatieFrogs
2022-02-22 16:23:01 +03:00
parent 78fe7062dc
commit 7d818877f8
15 changed files with 375 additions and 71 deletions

View File

@@ -11,6 +11,7 @@ class P2Connection{
this.allEvents = new Map()
this.addEventListener("message", this.message.bind(this))
this.currentHash = ""
this.disabled = 0
pageEvents.add(window, "hashchange", this.onhashchange.bind(this))
}
addEventListener(type, callback){
@@ -257,11 +258,11 @@ class P2Connection{
}
}
enable(){
this.disabled = false
this.open()
this.disabled = Math.max(0, this.disabled - 1)
setTimeout(this.open.bind(this), 100)
}
disable(){
this.disabled = true
this.disabled++
this.close()
}
}