[Content Patcher] Allowing mod to edit other mod's stuff (assets, image, data, etc)
Warilized opened this issue ยท 1 comments
Just a little suggestion, adding the ability to edit other mod's assets.
Idk if this has been proposed but i've searched with some keyword and didn't found any.
{
"Action" : "editImage"
"TargetID": "author.hismod" //this should support configs/token.
"Target ": "assets/image.png"
"FromFile" : "assets/new image.png"
}
I think adding dependencies on the manifest is also required. So making the mod loads after it's dependencies has been loaded.
I wanted to make a CP edit to a mod, replacing an image from it's assets folder. The mod in question isn't CP mod btw. That's why this suggestion got spew from my brain. Haha.
I'm aware that it may conflicts, but i just want to cling to this sliver of hope that it could happen. Lol.
P.S. I wanted to propose inject
action if this suggestion does work. By inject I mean loading a file to target's mod folder. But i know it won't work (infeasible or so difficult). So i just leave it as an afterthought.
Hi! Unfortunately that isn't really feasible. SMAPI deliberately doesn't provide a way to patch another mod's internal files directly, since that's considered bad practice that makes mods more fragile. There are generally two approaches suggested instead:
- The target mod can explicitly allow patches by loading the asset through
IAssetEditor
. For example, Small Beach Farm uses that approach to let content packs change its custom tilesheet. - You can apply your edits after the mod. For example, if the target mod applies a change to the
Cursors
asset, you can apply your own edit to theCursors
asset over it.