godarklight / DarkMultiPlayer

DarkMultiPlayer - A multiplayer mod for Kerbal Space Program
MIT License
280 stars 120 forks source link

(kind of a pull-request but not really) I made a script to autogenerate the modcontrol from linux shell #429

Open nonchip opened 6 years ago

nonchip commented 6 years ago

you can get it at https://gist.github.com/nonchip/f9968f92c9d020da27253ccbb201414f where I'll continue developing it, therefore I'd recommend linking to that from the readme instead pulling it into the repo.

license is MIT (essentially "do what you want with it as long as you don't remove the author info")

Xinayder commented 6 years ago

I'm not a Linux expert but I'm pretty sure not everyone uses Zsh like you do, so putting it in the README would be a bad idea. The other complaint about linking your work in the README is that people would constantly seek for support in our repository, and since this isn't "official", we won't give any support for it.

Despite that, does it work and formats the file correctly? Does it fetch the name of modules as well or just parts (ConfigNodes are silly and if you don't do it right you may end up fetching the name of a module)?

nonchip commented 6 years ago

@RockyTV

I'm not a Linux expert but I'm pretty sure not everyone uses Zsh like you do, so putting it in the README would be a bad idea.

true, not everyone uses it, but everyone who has it installed would automatically use it for this script because of the #!/bin/zsh line. worst case: things crash, they look at why, they install zsh. best case: it works as expected.

I mean also not everyone uses mono like you do, but you depend on it anyway. that's what dependencies are for :D

The other complaint about linking your work in the README is that people would constantly seek for support in our repository, and since this isn't "official", we won't give any support for it.

I see, but i think people might understand it if you phrase it like this in the server section: "to generate the modcontrol from the command line, there exists an unofficial tool: [link]" or similar instead of e.g. copying the file into your repo (also because I still have to work out some kinks, see below).

Despite that, does it work and formats the file correctly? yes and yes, as far as I can see it even works better than DMP (since it actually calculates hashes). Does it fetch the name of modules as well or just parts (ConfigNodes are silly and if you don't do it right you may end up fetching the name of a module)? it does the same DMP does (I loosely ported the C# code to zsh):

  • top level dlls are required
  • dlls from mods that have parts (find toplevel folders containing "*.cfg" files containing the word "PART"; then recursively output all ".dll"s in that folder) are required
  • dlls from other mods (actually "from all mods", might contain duplicates from the required list, I'm working on that) are optional
  • parts are parts (found by finding "*.cfg", searching for "PART" sections in there, and getting the most top-level (currently by fetching only the first occurence in the PART section to prevent modules, there might be a single edge case where this fails (when the first field in the part section is a module) but I'm working on refining that logic; in the future it'll simply "cut out" all subsections before parsing the file) "name" variable inside the section)
  • file is a whitelist, but whitelist is empty (configurable to fill with custom stuff but whitelisting non-required non-optional dlls is almost never needed)

tl'dr: for me it works, but there might be some mods with totally messed up part definitions where it currently would fail, I'm working on that.