RimWorld
評價次數不足
ObjPath tester + CDATA tester
   
獎勵
加入最愛
已加入最愛
移除最愛
Mod, 1.4, 1.5, 1.6
檔案大小
發佈於
更新時間
612.732 KB
2022 年 11 月 4 日 上午 5:01
7 月 11 日 上午 3:17
3 項更新註記 (檢視)

訂閱以下載
ObjPath tester + CDATA tester

在 test 的 1 個收藏中
test's mods
19 個項目
描述
This tool allows you to validate objPaths in-game. it is a modding tool, it has no impact on gameplay.

Menu at Options - '+' - objPath tester.


objPath tester
DefDatabase operations in XML Extensions allow you to modify stuff that you can't patch with just XML, and you can apply them without having to restart the game. They use objPath instead of XPath, so you can validate your objPaths with this mod.
https://github.com/15adhami/XmlExtensions/wiki/Using-DefDatabase-Operations for more info on DefDatabase operations.

This mod can only output the objPath results to log. It isn't the most convenient way but still very useable.


Rich Text tester
Rich Text has nothing to do with objPath and DefDatabase operations, but I included it for no particular reason. You can use CDATA to add unity3D Rich Text formatting to any text strings in your mod, such as labels and descriptions.
https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/StyledText.html for more info on Rich Text formatting that you can use inside CDATA.

Basically you can put <![CDATA[some text]]> into any string, and put Rich Text formatting inside. For example <![CDATA[<b><color=green>Shrek</color><b>]]> will look be green bold text saying "Shrek".


This mod also has no custom code, it is in fact an extemely simple XML mod which just combines some XML Extensions functions.

Note that I have very little knowledge of what objPath actually is, I originally wanted an xpath tester that showed results after applying patch operations, but it didn't work. But replacing xpath with objpath worked so here it is, even though I don't really know how to use it and how useful this is
16 則留言
NuanKi 2024 年 6 月 25 日 上午 12:33 
Thanks, looks like i would need to repeat for each one, or simply use the default "required restart to apply"
test  [作者] 2024 年 6 月 24 日 下午 11:48 
@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 2024 年 6 月 24 日 下午 9:51 
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 2024 年 6 月 24 日 下午 9:18 
Do you know how and where i can see the objPath of an item?
yavis 2022 年 11 月 4 日 上午 11:29 
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 2022 年 11 月 4 日 上午 8:19 
Well, thank you again - - I'll try:steamthumbsup:
test  [作者] 2022 年 11 月 4 日 上午 7:56 
@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 2022 年 11 月 4 日 上午 7:40 
You then add a DefDatabaseOperationReplace Go in -, -
yavis 2022 年 11 月 4 日 上午 7:35 
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 2022 年 11 月 4 日 上午 6:41 
You can call Imranfish
Let him edit the wiki again,:steamhappy:
Thank you so much!