NQualityOfLife.XML.AddIfMissing - Niilo007/RimWorld-NQoL GitHub Wiki

AddIfMissing

Related:


XML

<Operation Class="NQualityOfLife.XML.AddIfMissing">
    <xpath>string</xpath>
    <toVar>string</toVar> <!-- Optional -->
    <value>

    </value>
    <done Class="PatchOperation"> <!-- Optional -->

    </done>
    <error Class="PatchOperation"> <!-- Optional -->

    </error>
</Operation>

Usage

  • If <toVar> is provided, the given <xpath> is saved to it.
    • Variable names must begin and end with '{' & '}'

Errors


Examples

Used In Example:

<Operation Class="NQualityOfLife.XML.AddIfMissing">
    <xpath>Defs/ResearchProjectDef[defName="Hydroponics"]</xpath>
    <value>
        <hiddenPrerequisites/>
    </value>
    <done Class="PatchOperationAdd">
        <xpath>Defs/ResearchProjectDef[defName="Hydroponics"]/hiddenPrerequisites</xpath>
        <value>
            <li>NQoL_Agriculture_Late</li>
            <li>NMS_TillingN</li>
        </value>
    </done>
</Operation>

Used In Example:

<Operation Class="NQualityOfLife.XML.AddIfMissing">
    <xpath>Defs/ResearchProjectDef[defName="Hydroponics"]</xpath>
    <toVar>{myXpath}</toVar>
    <value>
        <hiddenPrerequisites/>
    </value>
    <done Class="NQualityOfLife.XML.Add">
        <xpath>{myXpath}/hiddenPrerequisites</xpath>
        <value>
            <li>NQoL_Agriculture_Late</li>
            <li>NMS_TillingN</li>
        </value>
    </done>
</Operation>

<Operation Class="NQualityOfLife.XML.ClearVariable">
    <name>{myXpath}</name>
</Operation>

⚠️ **GitHub.com Fallback** ⚠️