Modding:JSON Patching: Difference between revisions

From Vintage Story Wiki
Added file and name considerations section from unuroboros
(Marked this version for translation)
(Added file and name considerations section from unuroboros)
Line 115: Line 115:
That's all you have to do. If there's already an enabled label in the file then we'd need to switch op from add to replace.
That's all you have to do. If there's already an enabled label in the file then we'd need to switch op from add to replace.


=== File Path and Name Considerations ===
By default, when you generate a mod using ModMaker 3000™, the folder structure will use '''game''' as the domain, and use the same file name as the vanilla JSON file. This can lead to mod conflicts.
Let's use the wolf examples from above. If you run ModMaker after making these changes to '''wolf-male.json''', the resulting ZIP will contain the file '''assets\game\patches\survival-entities-land-wolf-male.json'''. This seems to suggest two conventions that VS expects; that you should put JSON patches under the '''game''' folder, and that you should match the source file name using a folder-hyphen notation. Neither are true, however.
Say you split up the two different wolf changes into two different mods. The first is '''WolvesAreWimps''' and the second is '''WolvesDropSticks'''. ModMaker would generate identical folder structures and files for these two different mods; that is, both would contain the file '''assets\game\patches\survival-entities-land-wolf-male.json'''. These two mods will not work together because they have a filename conflict. (The one that is alphabetically last will take precedence: '''WolvesDropSticks'''.)
To avoid the possibility of mod conflicts, do not use the '''game''' folder. Instead, use a folder with the same name as your '''modid'''; that is, your mod's domain. So in this example, WolvesAreWimps.zip should instead have the folders '''assets\wolvesarewimps\patches''' and WolvesDropSticks.zip should instead have the folders '''assets\wolvesdropsticks\patches'''. File names are also arbitrary, you do not need to use '''survival-entities-land-wolf-male.json''' and can name the file anything you want, since its contents direct the game on what and how to patch, not the file's name.
   
   


Confirmedusers
23

edits