RimWorld

RimWorld

ObjPath tester + CDATA tester
16 Comments
NuanKi Jun 25, 2024 @ 12:33am 
Thanks, looks like i would need to repeat for each one, or simply use the default "required restart to apply"
test  [author] Jun 24, 2024 @ 11:48pm 
@NuanKi I don't think that's possible, the game resolves parents meaning their nodes are copied into all children, before creating defdatabase. The parent thing is more of a convenience for modders and no longer exists at that stage
NuanKi Jun 24, 2024 @ 9:51pm 
this is what i make, and it works, but how can we specify all the defs with the same parent, in this case FlagstoneBase:
TerrainDef/[defName="FlagstoneGranite"]/costList/*
NuanKi Jun 24, 2024 @ 9:18pm 
Do you know how and where i can see the objPath of an item?
yavis Nov 4, 2022 @ 11:29am 
I tested it and it passed!
The last code you posted is correct.
Because this code has many entries, as long as one of them is wrong, all of them will report the same error.
yavis Nov 4, 2022 @ 8:19am 
Well, thank you again - - I'll try:steamthumbsup:
test  [author] Nov 4, 2022 @ 7:56am 
@yavis not sure if that is the issue but you need to add a node inside valu like in normal patch operations, like this
<Operation Class="XmlExtensions.DefDatabaseOperationReplace">
<objPath>HediffDef/[defName = "ControlSublinkImplant"]/stages/[1]/statOffsets/[stat/defName="WorkSpeedGlobalOffsetMech"]/value</objPath>
<value>
<val>52</val><!--The name of the node doesn't matter, only the inner text will be parsed-->
</value>
</Operation>
yavis Nov 4, 2022 @ 7:40am 
You then add a DefDatabaseOperationReplace Go in -, -
yavis Nov 4, 2022 @ 7:35am 
DefDatabaseConditional
ok
DefDatabaseLog
ok
DefDatabaseOperationReplace
Failed to find a node referenced by <objPath>

:steamfacepalm:

<Operation Class="XmlExtensions.DefDatabaseOperationReplace">
<objPath>HediffDef/[defName = "ControlSublinkImplant"]/stages/[1]/statOffsets/[stat/defName="WorkSpeedGlobalOffsetMech"]/value</objPath>
<value>52</value>
</Operation>
yavis Nov 4, 2022 @ 6:41am 
You can call Imranfish
Let him edit the wiki again,:steamhappy:
Thank you so much!
test  [author] Nov 4, 2022 @ 6:36am 
@yavis you can select all of them with HediffDef/[defName = "ControlSublinkImplant"]/stages/*/statOffsets/[stat/defName="WorkSpeedGlobalOffsetMech"]/value
yavis Nov 4, 2022 @ 6:34am 
-,-
Well, it's actually two together
Second:
“ControlSublinkImplant”]/stages/[2]/statOffsets/[stat/defName=“WorkSpeedGlobalOffsetMech”]/value?
test  [author] Nov 4, 2022 @ 6:30am 
@yavis okay I bruteforced it, its HediffDef/[defName = "ControlSublinkImplant"]/stages/[1]/statOffsets/[stat/defName="WorkSpeedGlobalOffsetMech"]/value
yavis Nov 4, 2022 @ 6:28am 
”statOffsets/defName=“WorkSpeedGlobalOffsetMech”
I know this way, but this status is assigned by level, and each level has a different status, so it shouldn't be right to use this way

https://github.com/15adhami/XmlExtensions/wiki/Using-DefDatabase-Operations
This link has the list method inside, but I don't understand it very well, I tested many methods and finally gave up.
Your mod is good, I can try again
test  [author] Nov 4, 2022 @ 5:55am 
@yavis I imagine objPath will look different from xpath, for example I don't think it uses li nodes. It probably uses something like statOffsets/defName="WorkSpeedGlobalOffsetMech". I have an idea about how to extract defDatabase but I don't know if it is going to work yet. Otherwise the only ways to get a working objPath appear to be looking at C# or just bruteforcing stuff with this mod
yavis Nov 4, 2022 @ 5:50am 
Are you asking me to test the last question I posted in discord? haha
You are awesome!

<objPath>HediffDef/[defName = "ControlSublinkImplant"]/stages/li/[1]/statOffsets/WorkSpeedGlobalOffsetMech<objPath>
Failed to find a node referenced by <objPath>