Skip to content

[ContentPatcher] Support includes for dynamic tokens#1172

Open
Mushymato wants to merge 1 commit into
Pathoschild:developfrom
Mushymato:ContentPatcher.DynamicTokenIncludes
Open

[ContentPatcher] Support includes for dynamic tokens#1172
Mushymato wants to merge 1 commit into
Pathoschild:developfrom
Mushymato:ContentPatcher.DynamicTokenIncludes

Conversation

@Mushymato

@Mushymato Mushymato commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Add a way to include dynamic tokens from another file like so:

{
  "$schema": "https://smapi.io/schemas/content-patcher.json",
  "Format": "2.9.0",
  "DynamicTokens": [
    {
      "IncludeFromFile": "dt_include/standard.json"
    },
  ]
}

The file dt_include/standard.json is only allowed to have DynamicTokens section, and dynamic tokens defined inside will behaves as if they were defined at the position of the include in content.json. You can have nested includes, but not repeated include of same file (at the moment).

When is supported for dynamic token includes, and tokens within a include is only evaluated if the include's conditions are all true.

{
  "DynamicTokens": [
    {
      "IncludeFromFile": "dt_include/conditional.json",
      "When": { "Season": "Spring" }
    },
  ]
}

If the When section on an include contains a HasMod condition that will never be true (i.e. mod not installed), the tokens inside will not be added.

In this example, if the dynamic token "MyTok" is defined within dt_include/cmct.json and nowhere else, it will be valid only if Spiderbuttons.CMCT is installed and invalid otherwise.

{
  "DynamicTokens": [
    {
      "IncludeFromFile": "dt_include/cmct.json",
      "When": { "HasMod": "Spiderbuttons.CMCT" }
    },
  ]
}

On the other hand if MyTok is defined like this in content.json, it will only be unready if Spiderbuttons.CMCT is not installed, rather than invalid.

{
  "DynamicTokens": [
    {
      "Name": "MyTok",
      "Value": "Token Value Goes Here",
      "When": { "HasMod": "Spiderbuttons.CMCT" }
    },
  ]
}

Examples

DT_Includes.zip

@Mushymato Mushymato force-pushed the ContentPatcher.DynamicTokenIncludes branch from 15de6a1 to a651a2f Compare January 22, 2026 01:23
@Mushymato Mushymato marked this pull request as ready for review February 15, 2026 00:43
@Mushymato Mushymato force-pushed the ContentPatcher.DynamicTokenIncludes branch from 1cbe06a to 045b5f7 Compare March 15, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant