Selection Block Attributes
There is one part of selection blocks that was not mentioned in Rulesets, Selectors, and Selection Blocks
These are basically certain @attributes
prefixed to the selection block, each one is described in the following sections.
@stage
This attribute can only be used on the outermost selection block (the one directly at the top level of the file). It is defined as follows @stage
followed by the stage name for the selection block as a string.
Example:
Stages are described in Stages
@require
This attribute conditionally enables the patch depending on the existence or non-existence of certain mods in the current installation. It is @require
followed by a boolean expression (using and
, or
, and not
) with the only values allowed being mod ids as strings. These mod ids resolve to true
if the mod is installed otherwise false
. If the expression resolves to true, the block is enabled, otherwise it is disabled.
This can be used at any nesting level of a patch block.
Example:
@new
This attribute can only be used in the outermost selection block, and it is used to create new assets rather than patching assets, it takes a list of arguments in ()
after it, and these arguments do different things depending on the ruleset of the selection block it is attached to.
Ruleset | Argument names | Description of behaviour |
---|---|---|
|
| Creates a new part asset of the name "name", it is recommended to use KSP2 Unity Tools to generate these patches. |
|
| Creates a new resource with "name", this resource is a recipe if |
|
| Creates a new generic json asset in Addressables with the label |
Examples: