Content Patcher

Content Patcher

463k Downloads

[Content Patcher] add dynamic tokens

Pathoschild opened this issue ยท 2 comments

commented

Some of the more complex mods need to repeat conditions a lot. Let players define custom tokens/conditions to make this easier.

commented

Proposed implementation

Let content packs define custom token values with optional conditions (evaluated first-to-last, so later values override earlier ones if both apply):

"CustomTokens": [
    {
        "Name": "SpriteVariant",
        "Value": "default"
    },
    {
        "Name": "SpriteVariant",
        "Value": "Spring_Rainy",
        "When": {
            "Season": "spring, summer",
            "Weather": "rain, storm"
        }
    },
    {
        "Name": "SpriteVariant",
        "Value": "{{season}}_Indoor",
        "When": {
            "Season": "spring, summer",
            "Weather": "sun, snow"
        }
    }
]

Then content modders can replace a mess of repeated patches for every NPC like this:

{
    "LogName": "Emily Spring/Summer - Rain",
    "Action": "Load",
    "Target": "Characters/Emily",
    "FromFile": "Characters/Emily/Emily_Spring_Rain.png",
    "When": {
        "Season": "spring, summer",
        "Weather": "rain, storm"
    }
},
{
    "LogName": "Emily Spring/Summer - Indoor",
    "Action": "Load",
    "Target": "Characters/Emily",
    "FromFile": "Characters/Emily/Emily_{{season}}_Indoor.png",
    "When": {
        "Season": "spring, summer",
        "Weather": "sun, snow"
    }
},

With something like this:

{
    "LogName": "Emily Sprite",
    "Action": "Load",
    "Target": "Characters/Emily",
    "FromFile": "Characters/Emily/Emily_{{SpriteVariant}}.png"
}
commented

Done in develop for the upcoming Content Patcher 1.5.