Is it even possible to Patch an Abstract Type Def? (A17)

Started by XeoNovaDan, May 21, 2017, 08:51:30 AM

Previous topic - Next topic

XeoNovaDan

My struggle with the new patching feature continues, this time I'm trying to make a patch to adjust raider apparel budgets - using GrenadierBase as an example in this situation. Here's how I have the XML set up so far:


<?xml version="1.0" encoding="utf-8"?>
<Patch>

<!-- ========== GrenadierBase ========== -->

<Operation Class="PatchOperationSequence">
  <success>Always</success>
  <operations>
    <li Class="PatchOperationTest">
      <xpath>//PawnKindDef[@Name = "GrenadierBase"]</xpath>
      <success>Invert</success>
    </li>
    <li Class="PatchOperatonReplace">
      <xpath>//PawnKindDef[@Name = "GrenadierBase"]/apparelMoney/min</xpath>
      <value>
        <min>875</min>
      </value>
    </li>
    <li Class="PatchOperatonReplace">
      <xpath>//PawnKindDef[@Name = "GrenadierBase"]/apparelMoney/max</xpath>
      <value>
        <max>1600</max>
      </value>
    </li>
  </operations>
</Operation>

</Patch>


But upon trying to load up RimWorld with this patch active, the error log will be spammed with errors - which is attached to this post because it'll make the post exceed the character limit. As the title of this post implies, I'm reckoning this is down to the fact that GrenadierBase is an abstract type def (as are all Humanlike PawnKinds), so therefore can't be directly altered - meaning it has to be re-defined (the current solution I'm using), leaving it open to incompatibility with other mods.

This is another solution I tried which didn't work:


<Operation Class="PatchOperatonReplace">
  <xpath>//PawnKindDef[@Name = "GrenadierBase"]/apparelMoney/min</xpath>
  <value>
    <min>875</min>
  </value>
</Operation>
<Operation Class="PatchOperatonReplace">
  <xpath>//PawnKindDef[@Name = "GrenadierBase"]/apparelMoney/max</xpath>
  <value>
    <max>1600</max>
  </value>
</Operation>


I'm sorry if I'm becoming a nuisance by asking for a lot of assistance recently, but some feedback would be very much appreciated. Do note that my C# skills don't go beyond Console.WriteLine("Message here") though.

Summary: Is it even possible to change Abstract type defs via the new patch feature, or do they absolutely have to be re-defined?

[attachment deleted by admin due to age]

SihvMan

Hello again, XeoNovaDan!

Check your spelling. You wrote Operaton instead of Operation in all areas where the error message kicked in.

Quote from: XeoNovaDan on May 21, 2017, 08:51:30 AM
--Snip--

<?xml version="1.0" encoding="utf-8"?>
<Patch>

<!-- ========== GrenadierBase ========== -->

<Operation Class="PatchOperationSequence">
  <success>Always</success>
  <operations>
    <li Class="PatchOperationTest">
      <xpath>//PawnKindDef[@Name = "GrenadierBase"]</xpath>
      <success>Invert</success>
    </li>
    <li Class="PatchOperatonReplace">  <=====================Operation, not Operaton
      <xpath>//PawnKindDef[@Name = "GrenadierBase"]/apparelMoney/min</xpath>
      <value>
        <min>875</min>
      </value>
    </li>
    <li Class="PatchOperatonReplace">  <=====================Operation, not Operaton
      <xpath>//PawnKindDef[@Name = "GrenadierBase"]/apparelMoney/max</xpath>
      <value>
        <max>1600</max>
      </value>
    </li>
  </operations>
</Operation>

</Patch>

--Snip--

<Operation Class="PatchOperatonReplace"> <=====================Operation, not Operaton
  <xpath>//PawnKindDef[@Name = "GrenadierBase"]/apparelMoney/min</xpath>
  <value>
    <min>875</min>
  </value>
</Operation>
<Operation Class="PatchOperatonReplace"> <=====================Operation, not Operaton
  <xpath>//PawnKindDef[@Name = "GrenadierBase"]/apparelMoney/max</xpath>
  <value>
    <max>1600</max>
  </value>
</Operation>

--Snip--

With the spelling fixed, the patch loaded successfully on my end.

XeoNovaDan

I swear to god you're a lifesaver. Thanks!
Always the trivial mistakes :P

SihvMan

Quote from: XeoNovaDan on May 21, 2017, 10:16:58 AM
I swear to god you're a lifesaver. Thanks!
Always the trivial mistakes :P

lol. No problem. Happens to the best of us.