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

Replace

Related:


XML

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

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

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

    </error>
</Operation>

Usage


<xpath>

Used to select the matching nodes that you wish to replace. Supports variables.


<applyVariables>

Apply variables to the xpath and to the text contained in value?


<toVar>

The xpath gets stored in this variable if provided.


<count>

The count of nodes that matched the xpath gets stored in this variable if provided.


<done>

The patch operation to perform when this one has completed successfully.


<error>

The patch operation to perform if this one fails or errors.


Errors


Examples

Used In Example:

<Operation Class="NQualityOfLife.XML.PatchIfEnabledAndExists">
    <settingKey>NiilosQoL_Settings_Disable_Plant_Rest</settingKey>
    <xpath>Defs/ThingDef[thingClass="Plant"]/thingClass</xpath>
    <toVar>{plantThingClass}</toVar>
    <enabledAndExists Class="NQualityOfLife.XML.Replace">
        <xpath>{plantThingClass}</xpath>
        <value>
            <thingClass>NQualityOfLife.Plants.Plant_NoRest</thingClass>
        </value>
    </enabledAndExists>
    <doesNotExist Class="NQualityOfLife.XML.Log">
        <warning>NQoL [W] - Failed to find any thing with class 'Plant' to change to 'Plant_NoRest'! This means that the patch has no affect. This is un-expected behaviour, and should be reported as a bug, with a modlist / log. (NiilosQoL_Settings_Disable_Plant_Rest)</warning>
    </doesNotExist>
</Operation>

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