Content Patcher

Content Patcher

378k Downloads

[Content Patcher] don't require dependency for custom tokens protected by HasMod

Pathoschild opened this issue ยท 2 comments

commented

If a content pack only uses custom tokens with an appropriate HasMod condition, don't require an explicit dependency on the mod that provides them.

commented

The simplest cases are easy to handle with some basic condition preparsing:

"HasMod": "example.id",
"HasMod:example.id": "true"

Handling HasMod conditions with dynamic tokens is trickier, since validation needs the full token context and may change when the context changes:

"HasMod:{{DynamicToken}}": "{{AnotherDynamicToken}}" // which mod is this?

Even worse, a HasMod condition can use a mod-provided token. That means whether a HasMod condition is valid depends on other HasMod tokens or even itself:

"HasMod": "spacechase0.spaceCore, {{spacecore:json-assets-id}}"
commented

Done in develop for the upcoming Content Patcher 1.10.

A HasMod condition avoids the need for a dependency only if it has no tokens, per the previous comment. That's sufficient for the vast majority of cases, and is documented in the readme.