Deli-Collective / Deli

Deli Eliminates Loader Intricacies with BepInEx plugins and custom content.
GNU General Public License v3.0
5 stars 0 forks source link

Custom fields to the manifest.json #25

Closed Frityet closed 3 years ago

Frityet commented 3 years ago

Mods could have an dictionary added to the manifest.json which can be accessed by the mod for additional options for mod creators and also less files created as resources for the mods.

Example:

{
  "name": "SosigScriptExample",
  "authors": [
      "Frityet"
  ],

  "guid": "net.frityet.sosigscriptexample",
  "version": "1.0.0",

  "require": "0.3.0",
  "dependencies": {},

  "assets": {
    "setup": {
        "ExampleMod.ss" : "SosigScript:Script"
    }
  },

  "SosigScriptExample": {
      "ScriptLanguage" : "Lua",
      "ScriptGlobals" : {
          "StartupMessage" : "Hello World",
          "DoesLuaSuck"    : false
      }
  }
}
malicean commented 3 years ago

I'm not really sure if I see the need for this. Is there a reason why you wouldn't just have the loader accept a folder and read the script and variables from that?

Frityet commented 3 years ago

But what would be the need for deli then if I accept scripts from a separate folder? The reason why I would use this system would be to define properties/metadata of a script as I want it to be easy to use multiple scripts in one mod

nrgill28 commented 3 years ago

You could use a system similar to grease/tamper monkey scripts and just have them include a comment header in their script file. The ScriptLanauge field is probably also redundant, since you could be defining different loaders for each language.

  "assets": {
    "setup": {
        "ExampleMod.ss" : "SosigScript:LuaScript"
    }
  }
Frityet commented 3 years ago

Thanks for the loader feature!

The problem I see is getting globals exposed to other mods, as I need to define them in the actual SosigScript mod.

I would much rather not have a commented header, as I believe its messy and too much could go wrong

malicean commented 3 years ago

Assuming you really want to go down this path, here are the major (I have many minor) problems I see with this proposal:

  1. It removes the purity of loaders: it's unclear what data is used by what mod, at what time, for what purpose.
  2. It promotes putting JSON data in the manifest instead of files. At what point would a developer write a loader (even though it's very small and easy), when they can just use data from a manifest?

Again, it's very easy to just have a loader accept a folder. WurstMod does this, and it uses the folder to read level metadata and the level itself. Replace "level" with "script" and it is the exact dilemma you are in.

Frityet commented 3 years ago

Understandable, I will look into the tampermonkey route. Thank you