anegostudios / vsmodexamples

Vintage Story Servermod Examples
http://www.vintagestory.at/
GNU General Public License v3.0
28 stars 15 forks source link

[WIP] Separation of mods into small mods instead of a big one #6

Closed p3t3rix closed 4 years ago

p3t3rix commented 4 years ago

This separates every mod into it's own folder/mod. This makes it more readable to know what one example exactly needs. Furthermore i changed the .csproj format to the new one, because it is leaner and removed hardcoded paths, instead a environment variable is used ("Vintage_Story") to point the project to the vintage story directory. Also mods are not copied to the mods folder of vintage story, instead they get added via the --addModPath argument, this ensures that the mods will not change the player installation. If the solution is built in release, a separate release directory will be created without pdb files.

This is a WIP PR which is open to discussion and feedback is appreciated.

tyronx commented 4 years ago

This sounds real good so far, need to look at the code changes still

tyronx commented 4 years ago

Hm, shall we perhaps add a sentenvvar.bat/setenvvar.exe for setting "VINTAGE_STORY" or something in that direction? That doesn't require people needing to look up how to set an env var.

p3t3rix commented 4 years ago

Hm, shall we perhaps add a sentenvvar.bat/setenvvar.exe for setting "VINTAGE_STORY" or something in that direction? That doesn't require people needing to look up how to set an env var.

This would require user input to put in the path where the game is located. Also you have to take into account the OS for this (also permissions, users etc.). Not sure if this is worth it 🤔

p3t3rix commented 4 years ago

@tyronx Should i split the classes into separate files while i'm on it or should i leave them as is ?

tyronx commented 4 years ago

Which classes are you referring to?

This would require user input to put in the path where the game is located. Also you have to take into account the OS for this (also permissions, users etc.). Not sure if this is worth it 🤔

Well, this mod repository is meant for beginners. We should make it beginner friendly. I think it would already help a lot if there is a 1-line setenvvar.bat and a 1-line setenvvar.sh with a prefilled default path and then they only need to edit that one single line if they installed the game outside the main path (which is like 1-3% of users).

p3t3rix commented 4 years ago

All the files that contain multiple classes. CustomShapeBlock/CustomShapeBlockShape/BlockCustomShape, GuiDialogAnnoyingText, AnnoyingTextSystem. It would probably also help to have a consistent naming, sometimes ModSystem's get suffixed with System sometimes not, things like this.

p3t3rix commented 4 years ago

I think setting the environment variable would be a good thing for the VintageStory Installer to do, seeing as it would ease the creation of mods, don't you think ? As i see it there is already a install.sh that does setting up some stuff as well as a windows installer that could do this easily.

tyronx commented 4 years ago

Consistent naming sounds reasonable, 1 file for each class where the classes are very small does not feel all that useful to me.

Good suggestion on the the env var on installation but I think I'd prefer to rather not pollute the env var paths when like 98% of users will never even need it.

p3t3rix commented 4 years ago

So what are the default install locations for each OS ?

tyronx commented 4 years ago

I would set these default paths: Win: %appdata%/VintageStory Linux/Mac: ~/Desktop/VintageStory

p3t3rix commented 4 years ago

I added one for windows, but for linux/mac it is a bit more involved. There is .bashrc (which works for linux and macos) but these will not be used for anything graphical (like a IDE) as far as i know. Then there is ~/.pam_environment for linux (i don't think it works for macOS) and generally i went already to deep into the rabbit hole of crossplattform and environment variables 😩 Do you have a suggestion on how you want to do it ?

tyronx commented 4 years ago

Yea, one simple solution that solves it for majority of users. People using special flavors of linux or want to mod on mac os can then still research how its done on their system.

@copygirl can you advise us on this?

copygirl commented 4 years ago

I also use environment variables in my how-to repository. If you want to make it beginner friendly, you can just link to the appropriate official examples of how to set environment variables on the various operating systems. Or just ask beginner modders to replace the bits in the relevant files.

For the record, from what I remember, the only time a user had issues with the environment variable section in the how-to was when I failed to mention that the approach I used was specifically for Linux. Once I edited the section they were able to make the appropriate changes.

If you're on another operating system, I suggest you search online how to set environment variables, as it's not straight forward. On Windows, the paths can be set to be %AppData%\Vintagestory and %AppData\VintagestoryData.

You could link to specific websites, but I tend to think that pushing people in the right direction allows them to find the information themselves and it works out okay.

tyronx commented 4 years ago

Alright, thanks for the hints, copygirl! how about this, @p3t3rix

setenvvar.sh:

# See https://github.com/copygirl/howto-example-mod#environment-variables for further info
export VINTAGE_STORY=/usr/share/vintagestory
p3t3rix commented 4 years ago

this would only set the env variable for the current shell. Meaning it would not effect stuff that was launched through the desktop environment and not last through a restart as far as i am aware. @tyronx

p3t3rix commented 4 years ago

So, i added one script using ~/.pam_environment. This works for me at least under Debian.

tyronx commented 4 years ago

thanks