NQualityOfLife.XML.AddDeep - Niilo007/RimWorld-NQoL GitHub Wiki
<Operation Class="NQualityOfLife.XML.AddDeep">
<xpath>string</xpath>
<toVar>string</toVar> <!-- Optional -->
<count>string</count> <!-- Optional -->
<value>
</value>
<deepValue>
</deepValue>
<done Class="PatchOperation"> <!-- Optional -->
</done>
<error Class="PatchOperation"> <!-- Optional -->
</error>
</Operation>
- If
<toVar>
is provided, the given<xpath>
is saved to it.- Variable names must begin and end with '
{
' & '}
'
- Variable names must begin and end with '
Used to select the matching nodes that you wish to add the deepValue
to.
Supports variables.
Apply variables to the xpath
and to the text contained in value
and deepValue
?
The xpath
gets stored in this variable if provided.
The count
of nodes that matched gets stored in this variable if provided.
The patch operation to perform when this one has completed successfully.
The patch operation to perform if this one fails or errors.
AddDeep
is essentially a more streamlined version of this AddIfMissing
implementation:
<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>
Converting the above to:
<Operation Class="NQualityOfLife.XML.AddDeep">
<xpath>Defs/ResearchProjectDef[defName="Hydroponics"]</xpath>
<value>
<hiddenPrerequisites/>
</value>
<deepValue>
<li>NQoL_Agriculture_Late</li>
<li>NMS_TillingN</li>
</deepValue>
</Operation>
<Operation Class="NQualityOfLife.XML.PatchIfExists">
<xpath>
Defs/ResearchProjectDef
[label[contains(text(),"trap") or contains(text(),"IEDs")]]
[description[contains(text(),"trap")]]
[not(defName="NQoL_Trapping_Research")]
[not(prerequisites/li="NQoL_Trapping_Research")]
</xpath>
<toVar>{TrapsXpath}</toVar>
<exists Class="NQualityOfLife.XML.AddDeep">
<xpath>{TrapsXpath}</xpath>
<value>
<hiddenPrerequisites/>
</value>
<deepValue>
<li>NQoL_Trapping_Research</li>
</deepValue>
</exists>
</Operation>
<Operation Class="NQualityOfLife.XML.ClearVariable">
<name>{TrapsXpath}</name>
</Operation>