Link Module Parts to Material Properties via Contexts
Understand the Context Link
Contexts act as a bridge between materials and modules. When a module variant lists a context name in its contexts array, it only gains bonuses if the material being used has that same context defined.
Create Matching Context Keys
Choose a descriptive context name and use it consistently. For example, if you're creating a "fire-aligned" material set:
In your material JSON:
`json
"contexts": {
"fire_aligned": {
"attributes": { "generic.attack_damage": 2.0 },
"effects": { "fire_aspect": [0, 0] }
}
}
`
In your module JSON:
`json
"contexts": ["fire_aligned"]
`
Verify Compatibility
The context name must match exactly (case-sensitive). If a module requests a context that doesn't exist in the material, the bonus simply won't apply—no error occurs. Use this to create material families: all "fire" materials share fire contexts, all "ice" materials share ice contexts, letting modules automatically adapt to what's available.