1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00
Commit Graph

21 Commits

Author SHA1 Message Date
58a6aabd4c Switch list patching to more user-friendly 1-based indexing 2025-03-30 17:18:47 +03:00
aeb6c0be26 Support for replacement of individual entries in json lists
It is now possible for mods to modify json lists precisely, without full
replacement. Supported options:
- `append`: appends a single item to end of list
- `appendItems`: appends multiple items to end of list
- `insert@NUM`: inserts a single item *before* item NUM (item counting
is 0-based)
- `modify@NUM`: allows editing of a single item NUM (item counting is 0-
based)

Example - addition of a new item into town hall slots:
```json
"hallSlots":
{
	"modify@4" : {
		"append" : [ "dwellingLvl7B", "dwellingUpLvl7B" ]
	}
},
```
This would modify 4th element (last row) by appending new entry to the
end of last row

```json
{
	"modify@4" : {
		"insert@1" : [ "dwellingLvl5B", "dwellingUpLvl5B" ]
	}
},
```
This would add new slot not in the end of last row, but before 1st item
(between 5th and 6th dwellings)
2025-03-27 19:22:50 +00:00
6056d385ed Always load json configs from mod that references it
This should fix rather common problem with mods, where two unrelated mods
accidentally use same file name for a config file, leading to very unclear
conflict since this result in a file override.

Now all config files referenced in mod.json are loaded specifically from
filesystem of mod that referenced it. In other words, it is no longer
possible for one mod to override config from another mod.

As a side effect, this allows mods to use shorter directory layout, e.g.
`config/modName/xxx.json` can now be safely replaced with `config/
xxx.json` without fear of broken mod if there is another mod with same
path to config. Similarly, now all mods can use `config/translation/
language.json` scheme for translation files

Since this is no longer a problem, I've also simplified directory layout
of our built-in 'vcmi' mod, by moving all files from `config/vcmi`
directory directly to `config` directory.

- Overrides for miscellaneous configs like mainmenu.json should works as
before
- Images / animations (png's or def's) work as before (and may still
result in confict)
- Rebalance mods work as before and can modify another mod via standard
`modName:objectName` syntax
2024-10-31 14:49:11 +00:00
6bed497f2c Fix mod validation reporting failure for well-formed mods 2024-10-10 21:18:43 +00:00
2399a5a765 Merge pull request #4712 from IvanSavenko/detect_conflict
Detection of potential conflicts between mods
2024-10-07 17:57:52 +03:00
8e4152bc81 It is now possible to define objects directly in mod.json instead of
using path to file with object definition
2024-10-06 19:42:15 +00:00
d849e53499 Implement detection of mod compatibility patches 2024-10-06 16:11:32 +00:00
d0aba56a5e Analyze json object modifications to detect mod conflicts 2024-10-06 13:58:41 +00:00
434371195d JsonNode constructors: Take fileName as argument
* Don't print JSON in JsonParser::parse() in case of errors
2024-07-17 13:50:59 +02:00
147db10a28 Avoid crash if configs file is missing, e.g. broken version of mod 2024-05-11 13:19:07 +00:00
c90fb47c23 Converted json validator into a class 2024-02-26 12:55:49 +02:00
08deae4186 Moved static methods outside of vcmi namespace 2024-02-26 12:55:49 +02:00
757f77378d Remove unused code 2024-02-26 12:55:49 +02:00
29860848a5 Cleanup 2024-02-26 12:55:49 +02:00
d1c274f93f Replaced vector of strings with simple bool for flag 2024-02-26 12:55:49 +02:00
922966dcf8 Renamed JsonNode::meta to more logical modScope. Member is now private 2024-02-26 12:55:49 +02:00
08a27663f9 Reworked JsonNode constructors to more logical form 2024-02-26 12:55:49 +02:00
54796c7c56 Rename toJson to toString/toCompactString for consistency 2024-02-26 12:55:49 +02:00
3740f8b02f Moved bonus parsing to a new file 2024-02-14 15:48:06 +02:00
0b7bf56597 Remove old files 2024-02-14 14:02:41 +02:00
c3957c2c2a Moved json files to new directory, split on per-class basis 2024-02-14 13:08:24 +02:00