vinanrra / Docker-7DaysToDie

7 days to die server using LinuxGSM in Docker with backups, monitor, auto-installable mods and more
GNU General Public License v3.0
210 stars 42 forks source link

[FEATURE] OCB's Electricity Overhaul support (and others) #192

Closed JohnCMcDonough closed 3 weeks ago

JohnCMcDonough commented 11 months ago

Is your feature request related to a problem? Please describe.

7 Days to Die is an amazing game, but the built in electricity system sucks and is full of bugs. OCB has an electricity overhaul mod that adds a bunch of functionality that should have been in the base game, and another mod that makes electricity more stable.

I've done some heavy modding of my server, and one of the recent image upgrades seems to have broken compatibility with this mod. The issue I get is from the BepInEx preloader. Adding the mapping file to the Mono config seems to have done the trick, and I was able to get my server booting correctly again.

Describe the solution you'd like

It would be awesome if your container bundled some of OCB's more overhaul type mods, as many of them are real game changers for 7 Days. I installed them before you had proper BepInEx support, so I'm not sure if it works with the BepInEx installer you already have. This is on my list of things I need to try.

Describe alternatives you've considered

Do Nothing The alternative is... well... not adding these things! It's not impossible to just install this mod around what's already here, just inconvenient.

Environment Variable that Downloads Mods (works for other OCB mods) Another solution that's somewhat unrelated to this, but would be another huge quality of life changer is to add an environment variable containing a list of URLs with zips of different mods. Those mods could be automatically downloaded and installed without having to manually copy paste them all into the mods folder. It wouldn't work for more complex mods, but for the basic "drop a folder in the Mods directory" type install, it would make things so much easier. I've debated trying to make a PR of this, but I'm not all that great with shell scripts.

Additional context

Mods that actually make sense to include:

Other cool mods:

vinanrra commented 8 months ago

Hi @JohnCMcDonough thanks for the suggestion, next thing I want to add it's the automation of mods, so people can provide URLs and the container will install the mods

vinanrra commented 7 months ago

@JohnCMcDonough

Here it's the initial support: https://github.com/vinanrra/Docker-7DaysToDie/commits/feature/add-user-mod-download/

Still WIP

vinanrra commented 7 months ago

@JohnCMcDonough I have tested this, and it's working, but I would like a second confirmation if possible, I'm going to release a new version v0.7.0, could you test it?, I know it's "late" but better late than never.

JohnCMcDonough commented 7 months ago

I'll take a look at it! I don't have too many mods that aren't from nexus mods, but I'd be happy to give it a shot!

vinanrra commented 7 months ago

They can be mods from GitHub too, they must be direct link, because I'm using curl to download

JohnCMcDonough commented 7 months ago

Yeah, it appears to work! I'm testing now to see if we can take in nexus mods as a mod_id and file_id. As long as you have nexus premium, you can get an API key to download files. We could have a separate NEXUS_API_KEY and NEXUS_MODS env or something. We process all those first, grab the download URL from the response JSON, and append them to the list of mods to be downloaded.

The API to get the download JSON isn't too bad.

curl -X 'GET' \
  'https://api.nexusmods.com/v1/games/7daystodie/mods/$MOD_ID/files/$FILE_ID/download_link.json' \
  -H 'accept: application/json' \
  -H "apikey: $NEXUS_API_KEY"

Then RIP the first download link with a jq ".[0].URI"

vinanrra commented 7 months ago

Yeah, it appears to work! I'm testing now to see if we can take in nexus mods as a mod_id and file_id. As long as you have nexus premium, you can get an API key to download files. We could have a separate NEXUS_API_KEY and NEXUS_MODS env or something. We process all those first, grab the download URL from the response JSON, and append them to the list of mods to be downloaded.

The API to get the download JSON isn't too bad.

curl -X 'GET' \
  'https://api.nexusmods.com/v1/games/7daystodie/mods/$MOD_ID/files/$FILE_ID/download_link.json' \
  -H 'accept: application/json' \
  -H "apikey: $NEXUS_API_KEY"

Then RIP the first download link with a jq ".[0].URI"

I will need to add a filter to check if it's a Nexus link, and more logic will check how to add it for the next versión, because my vacations are ending tomorrow😢

vinanrra commented 7 months ago

After some checking, I will add two options:

vinanrra commented 7 months ago

@JohnCMcDonough

I don't have nexus mod premium, so i'm unable to get the response.json, could you share the json of this curl?

curl -X 'GET' \
  'https://api.nexusmods.com/v1/games/7daystodie/mods/4002/files/14742/download_link.json' \
  -H 'accept: application/json' \
  -H "apikey: API_KEY"

And i will be able to support this

JohnCMcDonough commented 7 months ago

It comes back looking like this:

[
  {
    "name": "Nexus Global Content Delivery Network",
    "short_name": "Nexus CDN",
    "URI": "https://cf-files.nexusmods.com/cdn/1059/4002/Scrollable Storage-4002-1-0-2-1-1702135378.zip?md5=65RgPxbWa9r2UN4Nlkg3IQ&expires=1702603262&user_id=<redacted>"
  },
  {
    "name": "Amsterdam (Premium)",
    "short_name": "Amsterdam",
    "URI": "https://amsterdam-premium.nexus-cdn.com/1059/4002/Scrollable Storage-4002-1-0-2-1-1702135378.zip?md5=65RgPxbWa9r2UN4Nlkg3IQ&expires=1702603262&user_id=<redacted>"
  },
  {
    "name": "Prague (Premium)",
    "short_name": "Prague",
    "URI": "https://prague-premium.nexus-cdn.com/1059/4002/Scrollable Storage-4002-1-0-2-1-1702135378.zip?md5=65RgPxbWa9r2UN4Nlkg3IQ&expires=1702603262&user_id=<redacted>"
  },
  {
    "name": "Chicago (Premium)",
    "short_name": "Chicago",
    "URI": "https://chicago-premium.nexus-cdn.com/1059/4002/Scrollable Storage-4002-1-0-2-1-1702135378.zip?md5=65RgPxbWa9r2UN4Nlkg3IQ&expires=1702603262&user_id=<redacted>"
  },
  {
    "name": "Los Angeles (Premium)",
    "short_name": "Los Angeles",
    "URI": "https://la-premium.nexus-cdn.com/1059/4002/Scrollable Storage-4002-1-0-2-1-1702135378.zip?md5=65RgPxbWa9r2UN4Nlkg3IQ&expires=1702603262&user_id=<redacted>"
  },
  {
    "name": "Miami (Premium)",
    "short_name": "Miami",
    "URI": "https://miami-premium.nexus-cdn.com/1059/4002/Scrollable Storage-4002-1-0-2-1-1702135378.zip?md5=65RgPxbWa9r2UN4Nlkg3IQ&expires=1702603262&user_id=<redacted>"
  }
]

Additionally, they actually have some swagger docs here: https://app.swaggerhub.com/apis-docs/NexusMods/nexus-mods_public_api_params_in_form_data/1.0#/

That might be a little more helpful! Or not, because I just realized they don't have their responses documented :/

vinanrra commented 7 months ago

Thanks @JohnCMcDonough , I have been checking that document but as you pointed there aren't showing the response, so it's a bit useless if you don't have premium.

JohnCMcDonough commented 7 months ago

Also, I'm not sure if you can grab API Keys from here without being premium.... but I just forged User-Agent: NexusApiClient/0.7.3 (Windows_NT 10.0.17134; x64) Node/8.9.3 and set my apikey: <vortex API Key>. That seemed to work.

vinanrra commented 7 months ago

I have tested it, but because I'm not premium, I'm unable to do it (but with the above JSON I will be able to do it).

vinanrra commented 3 weeks ago

Not going to implement Nexus Mod installation because if something change on their end i can't test it because i'm not premium.