[Content Patcher] support variants
Pathoschild opened this issue ยท 4 comments
It's common for XNB mods to come in multiple versions (e.g. dark wood bridge vs light wood bridge). Look into supporting this in content.json
, so modders don't need to create separate downloads for each version.
One option is an Enabled
flag so players can toggle the one they want:
{
"Format": "1.0",
"Changes": [
// Labrador Retriever
{
"Action": "Load",
"Target": "Animals/dog",
"FromFile": "assets/labrador-retriever.png",
"Enabled": true
},
// Bulldog
{
"Action": "Load",
"Target": "Animals/dog",
"FromFile": "assets/bulldog.png",
"Enabled": false
}
]
}
The Enabled
flag was added via #192; I'll keep this open a for bit in case we think of a way to handle variants specifically.
One option is to support config tokens:
{
"Format": "1.0",
"Config": {
"Variant": "DarkWood",
"EnableFloors": true
},
"Changes": [
{
"Action": "Load",
"Target": "Flooring",
"FromFile": "assets/{{variant}}/floors.png",
"Enabled": "{{EnableFloors}}"
}
]
}
Maybe let modders set optional restrictions on field values, so users get helpful errors (like "Skipped Content Pack Name: the 'variant' field must be one of "DarkWood", "LightWood", or "Crystal""). For example:
"ConfigSchema": {
"Variant": {
"Values": ["DarkWood", "LightWood", "Crystal"]
},
"EnableFloors": {
"Type": "boolean"
}
}
This lets modders create much more flexible content packs with less duplication, and we could extend it with dynamic tokens like {{season}}
for seasonal assets.