NQualityOfLife.XML.Add - Niilo007/RimWorld-NQoL GitHub Wiki
<Operation Class="NQualityOfLife.XML.Add">
<xpath>string</xpath>
<toVar>string</toVar> <!-- Optional -->
<count>string</count> <!-- Optional -->
<value>
</value>
<done Class="PatchOperation"> <!-- Optional -->
</done>
<error Class="PatchOperation"> <!-- Optional -->
</error>
</Operation>
Used the same way as Verse.PatchOperationAdd
but supports NQoL xml variables.
- 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 value
to.
Supports variables.
Apply variables to the xpath
and to the text contained in value
?
The xpath
gets stored in this variable if provided.
The count
of matching nodes 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.
- Add
- AddTextVariable
- StringConcat
- PatchIfExists
- AddOrReplace
- SetAttribute
- Remove
- AddDeep
- ClearVariable
- Verse.PatchOperationSequence
- Verse.PatchOperationAdd
<li Class="NQualityOfLife.XML.AddTextVariable">
<value>NQoL_Gunpowder_Research</value>
<toVar>{GunPowder}</toVar>
</li>
<li Class="NQualityOfLife.XML.AddTextVariable">
<value>Defs/ResearchProjectDef[not(defName="NQoL_Gunpowder_Research")][defName[contains(text(), "Gunpowder")]]</value>
<toVar>{FindGunPowderXpath}</toVar>
</li>
<li Class="NQualityOfLife.XML.StringConcat">
<value>{FindGunPowderXpath}</value>
<value2>/defName</value2>
<toVar>{FindGunPowderXpath_defName}</toVar>
</li>
<li Class="NQualityOfLife.XML.StringConcat">
<value>{FindGunPowderXpath}</value>
<value2>/tab</value2>
<toVar>{FindGunPowderXpath_tab}</toVar>
</li>
<li Class="NQualityOfLife.XML.PatchIfExists">
<xpath>{FindGunPowderXpath}</xpath>
<exists Class="PatchOperationSequence">
<operations>
<li Class="NQualityOfLife.XML.AddTextVariable">
<xpath>{FindGunPowderXpath_defName}</xpath>
<toVar>{GunPowder}</toVar>
</li>
<li Class="NQualityOfLife.XML.AddOrReplace">
<xpath>{FindGunPowderXpath}</xpath>
<value>
<researchViewX>6.00</researchViewX>
<researchViewY>2.00</researchViewY>
<baseCost>300</baseCost>
<techLevel>Medieval</techLevel>
</value>
</li>
<li Class="NQualityOfLife.XML.SetAttribute">
<xpath>{FindGunPowderXpath}</xpath>
<attribute>ParentName</attribute>
<value>NQoL_Progression_Project</value>
</li>
<li Class="NQualityOfLife.XML.Remove">
<xpath>{FindGunPowderXpath_tab}</xpath>
<success>Always</success>
</li>
<li Class="NQualityOfLife.XML.AddDeep">
<xpath>{FindGunPowderXpath}</xpath>
<value>
<prerequisites/>
</value>
<deepValue>
<li>NQoL_Fire_Research</li>
</deepValue>
</li>
</operations>
</exists>
<doesNotExist Class="PatchOperationAdd">
<xpath>Defs</xpath>
<value>
<ResearchProjectDef ParentName="NQoL_Progression_Project">
<defName>NQoL_Gunpowder_Research</defName>
<label>gunpowder</label>
<description>Learn to make gunpowder and use it to improve existing weapons. Or maybe even some new ones.\n\nThe powder leaves behind a lot of residue, perhaps the formula could be improved to fix this issue.</description>
<baseCost>300</baseCost>
<techLevel>Medieval</techLevel>
<prerequisites>
<li>NQoL_Fire_Research</li>
</prerequisites>
<tags>
<li>ClassicStart</li>
</tags>
<researchViewX>6.00</researchViewX>
<researchViewY>2.00</researchViewY>
</ResearchProjectDef>
</value>
</doesNotExist>
</li>
<li Class="NQualityOfLife.XML.ClearVariable">
<name>{FindGunPowderXpath_defName}</name>
</li>
<li Class="NQualityOfLife.XML.ClearVariable">
<name>{FindGunPowderXpath_tab}</name>
</li>
<li Class="NQualityOfLife.XML.ClearVariable">
<name>{FindGunPowderXpath}</name>
</li>
<li Class="NQualityOfLife.XML.Add">
<xpath>Defs</xpath>
<value>
<ResearchProjectDef ParentName="NQoL_Progression_Project">
<defName>NQoL_HandCannon_Research</defName>
<label>hand cannons</label>
<description>Learn to use gunpowder to propel projectiles.</description>
<baseCost>200</baseCost>
<techLevel>Medieval</techLevel>
<prerequisites>
<li>{GunPowder}</li>
<li>NQoL_Javelin_Research</li>
<li>Smithing</li>
</prerequisites>
<tags>
<li>ClassicStart</li>
</tags>
<researchViewX>3.00</researchViewX>
<researchViewY>1.20</researchViewY>
</ResearchProjectDef>
</value>
</li>