Modding:Variants: Difference between revisions

From Vintage Story Wiki
m
Line 68: Line 68:
* Recipe ingredients. Any matching code will work as a valid ingredient for the recipe.
* Recipe ingredients. Any matching code will work as a valid ingredient for the recipe.


=== {Variant Groups} ===
=== {Variant Group} Substitutions ===
One way to specify slight differences between object variants is by using the variant substitution system. In an asset file that defines variants, any property that accepts a string can include a variant code surrounded by { }'s. This will then get substituted by the variant's state. For example, each seashell chooses its texture based on its ''color'' variant, and its shape based on its ''type'' variant.<syntaxhighlight lang="json">
textures: {
color: { base: "block/creature/seashell/{color}" }
}
</syntaxhighlight><syntaxhighlight lang="json">
shape: {
base: "block/seashell/{type}"
}
</syntaxhighlight>


=== ByType Properties ===
=== ByType Properties ===
Confirmedusers
566

edits