• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Dogfisc

Second Lieutenant
11 Badges
Apr 25, 2018
174
5
  • Stellaris
  • BATTLETECH
  • BATTLETECH - Initiate of the Order
  • BATTLETECH - Beta Backer
  • BATTLETECH - Backer
  • Shadowrun Returns
  • Shadowrun: Dragonfall
  • Shadowrun: Hong Kong
  • BATTLETECH: Flashpoint
  • BATTLETECH: Season pass
  • BATTLETECH: Heavy Metal
I'm looking for a way to tone down the availability of mechs and improved weapons in stores, and I'm trying to determine the best way to edit the itemcollections files. I've added gauss ammunition with
{ "Type": "ItemCollectionDef", "Path": "itemcollections/", "ShouldAppendText": true }
but that just adds items to a file, rather than editing the file. Will itemcollections get merged if they are in \mods\modname\StreamingAssets\data\itemcollections (from Modtek documentation I think not, only json will be merged)? I'd rather not overwrite files in the game's data directory, though I will if that's what is needed.
 
I haven't tried it myself... but if you set "ShouldAppendText" to false instead of true, I assume it would replace the contents entirely.

I don't think merging would work any better than appending items, since the format could theoretically have the same ID multiple times there's no way for the merge routine to know if a duplicate ID is intended to replace the existing item or supplement it. So I suspect that to remove items you will probably have to replace the whole thing.
 
Modloader (from ModTek) doesn't modify files (at least not by default). It modifies in-memory content. Otherwise we would be quite hosed.

The key thing to remember is that once the initial data is loaded from source (usually the base game JSONs), you can use the Merge or Append context to tell the system to either amend or add on information that is in memory (not on file). Merge will replace existing existing and add additional information, Append (should be) just adding to the back.

The implication is that Order of Operations is important. If you attempt to Merge to something that doesn't exist, it will throw an error. I'm not quite sure what would happen if you Append a parameter to something that already has that parameter defined... usually nothing good, but I'm not sure what has precedence. All these are done in memory, so the baseline files should be safe. Should.

What I'm not clear about is what happens if you run a "Delete from Manifest" and then add an item with the same ID in the mod. Not yet figured out what sequence the Modloader will execute that.
 
Modloader (from ModTek) doesn't modify files (at least not by default). It modifies in-memory content. Otherwise we would be quite hosed.
Right, I worded that badly. Modifying the actual files is what I'm trying to avoid.

I haven't tried it myself... but if you set "ShouldAppendText" to false instead of true, I assume it would replace the contents entirely.

I don't think merging would work any better than appending items, since the format could theoretically have the same ID multiple times there's no way for the merge routine to know if a duplicate ID is intended to replace the existing item or supplement it. So I suspect that to remove items you will probably have to replace the whole thing.
I'll try experimenting with this. Maybe see if RemoveManifestEntries on the existing itemcollections and then adding my own copies to the DB will work. If I can't figure anything out, I'll just fall back to backing up the files and editing them directly.