Making patch for Deep Storage

Started by Jackdawson, July 30, 2021, 02:19:53 AM

Previous topic - Next topic

Jackdawson

I am making an xml patch for LWM's deeps storage for personal use. So far most of the patching works, but I got to a part that got me stuck.

First thing is I'm trying to add a new ingredient to an existing deep storage def. I tried using the code below but it seems to be wrong. No idea why

                       
Quote<li Class="PatchOperationAdd">
                       <xpath>Defs/ThingDef[defName="ExampleDefName"]/costList</xpath>
                 <value>
                 <ComponentIndustrial>1</ComponentIndustrial>
            </value>
                      </li>

Second thing is I want to patch the storage capacity, but I have no idea how to go about it since it's a custom class and my best but still wrong guess would be something like

Quote
<li Class="PatchOperationReplace">
            <xpath>/Defs/ThingDef[defName="ExampleDefName"]/comps/maxNumberStacks</xpath>
            <value>
               <maxNumberStacks>6</maxNumberStacks>
            </value>
             </li>

any help is welcome


Jackdawson

Update: I figured out the two original problems. Now I only need to make a patch that replaces the designation category of a thingdef. This is what I've got so far, but it's throwing up a red error:

Quote<match Class="PatchOperationSequence">
      <operations>
         <li Class="PatchOperationReplace">
                     <xpath>/Defs/ThingDef[defName="ExampleDef"]/designationCategory</xpath>
                     <value>
                           <designationCategory>Misc</designationCategory>
                     </value>
                   </li>
      </operations>
   </match>

Shinzy

Just for clarity, is the defname of the thingdef you're trying to patch actually "ExampleDef"? cause that doesn't sound like something that would be in a mod :P

I'm only asking because the xpaths look okay to me at a glance, and that's the first thing that strikes a little odd to me
(It's also been a while since I've patched anything myself, so maybe I'm just missing something)

Also, since you're making this just for personal use. You'd have the option to just drag and plop the mod from steam workshop folder into the rimworld mods folder and use it locally, and then change the designation category directly in the mods' xml's without a patch

Jackdawson

Quote from: Shinzy on July 30, 2021, 11:26:40 AM
Just for clarity, is the defname of the thingdef you're trying to patch actually "ExampleDef"? cause that doesn't sound like something that would be in a mod :P

I'm only asking because the xpaths look okay to me at a glance, and that's the first thing that strikes a little odd to me
(It's also been a while since I've patched anything myself, so maybe I'm just missing something)

Also, since you're making this just for personal use. You'd have the option to just drag and plop the mod from steam workshop folder into the rimworld mods folder and use it locally, and then change the designation category directly in the mods' xml's without a patch
It's just a placeholder def name. I was trying to find a section of code that can work universally for as many defs as I want to use it. I already solved the problem myself.

Editing the xmls is a no go. I used to do that before and accumulated 16 mods that were custom edited and were a pain in the butt to update by hand every time I needed to do it. I'm making patches now so that I don't have to worry about updating them manually anymore

Shinzy

That's completely fair!
I'm glad you figured it out, what was the problem if you don't mind me asking?
just mildly curious now after spending cupla minutes on looking at them ;D

Jackdawson

Quotewhat was the problem if you don't mind me asking?

Honestly no idea. I just used a different formatting of the code block like this and it worked:

Quote<match Class="PatchOperationSequence">
      <operations>
         <li Class="PatchOperationReplace">
                 <xpath>/Defs/ThingDef[@Name="Exampledef"]/designationCategory</xpath>
                    <value>
                      <designationCategory>Misc</designationCategory>
                    </value>
         </li>
      </operations>
   </match>