Help, please! I'm too braindead to do this, apparently

Started by Vakari, September 10, 2020, 07:09:25 PM

Previous topic - Next topic

Vakari

Hi

I've spent an unforgivable amount of time trying to simply add a "View Art" type of joy to a mod's building type.

For example, it has a skeleton that is listed as a building_natural type.  I want to use that same piece to add a view art type of joy, and a beauty amount.  (Basically, as if it were a museum piece.)

Nothing I have done has worked, and I'm so brain-fried at this point that I've given up. 

Does anyone have any simple XML they can provide to do this?  I know it is possible, but I'm just messing up something somewhere.

So, the steps are:

1.  Locate the mod.
2.  Add the view art and beauty to the building piece.

Thank you for any help you can offer!

RawCode

open XML def of object that is valid art
open XML def of object that is not art
compare them
???
profit

Vakari

I already did that. I can't get it to work. Which is why I had to post here. Thanks.

LWM

I took a quick glance in RimWorld/JoyGiver_ViewArt.cs  (yay decompiling code?)

do you have a CompArt for your objects?

If so, what do they look like?

RawCode

Quote from: Vakari on September 11, 2020, 11:48:00 AM
I already did that. I can't get it to work. Which is why I had to post here. Thanks.

post your results
including xml you compared and your xml that does not work

Vakari

Hi,

So, I've switched to just adding the beauty for now.  I want to be sure I'm even updating.  But it is not working.  (No Beauty modifier gets added.)  Below is my latest attempt.  Any help is appreciated.

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

<Patch>

    <Operation Class="PatchOperationFindMod">
    <mods>
        <li>Alpha Biomes</li>
    </mods>
    <match Class="PatchOperationSequence">
        <success>Always</success>
   
        <operations>
               
          <li Class="PatchOperationAdd">
                <xpath>/Defs/ThingDef[defName="AB_GallatrossBones"]/statBases/Beauty/text()</xpath>
                <value>50</value>
            </li>
         <li Class="PatchOperationAdd">
                <xpath>/Defs/ThingDef[defName="AB_AncientGallatrossSkull"]/statBases/Beauty/text()</xpath>
                <value>75</value>
            </li>
         <li Class="PatchOperationAdd">
                <xpath>/Defs/ThingDef[defName="AB_HugeGallatrossSkeleton"]/statBases/Beauty/text()</xpath>
                <value>125</value>
            </li>
         
        </operations>
    </match>
    </Operation>
</Patch>

LWM

Try <xpath>/Defs/ThingDef[defName="AB_GallatrossBones"]/statBases/Beauty</xpath>

Vakari

Thanks for the suggestion, but it does not work (no Beauty gets added).  I am noticing it is treated as a wall, but smoothed walls have beauty, so I would hope it would still work.

If not, maybe I need to just add a new art type and use the graphic?  I'm really out of ideas at this point.  All I wanted was to make this viewable art, like sculptures.  I swear, it sounds simple, but I'm out of ideas.

Kopp

Hey Vakari,
I think this works... At least for your beauty problem.

         <li Class="PatchOperationAdd">
               <xpath>/Defs/ThingDef[defName="AB_GallatrossBones"]/statBases</xpath>
               <value>
               <Beauty>100</Beauty>
               </value>
            </li>      

Greetz

Vakari

Hi, Kopp

Thank you for your help.  Unfortunately, I still don't see a Beauty stat.  I have to think it is because these are related to Buildings.  Something about them being counted as walls.

Thanks for the help, anyway.  I appreciate it.

Kopp

Hmm...
I tried it. The specific bones I patched had a beauty stat afterwards.

Edit: You could try to remove "<success>Always</success>".
Any errors on your side?

LWM


Vakari

Hi.  I got it to work!!  I had to put the patch in both the 1.1 and 1.2 folders, but they now have beauty!  Thank you, this is great progress!

I still want to figure out how to make these sculptures/viewable art, but this is really great.  I can't thank you enough!

For the record, here is my completed XML (so far, beauty only):

<?xml version="1.0" encoding="utf-8" ?>
<Patch>
<Operation Class="PatchOperationFindMod">
      <mods>
         <li>Alpha Biomes</li>
      </mods>

      <match Class="PatchOperationSequence">
         <operations>
         
         <li Class="PatchOperationAdd">
               <xpath>/Defs/ThingDef[defName="AB_AncientGallatrossSkull"]/statBases</xpath>
               <value>
               <Beauty>50</Beauty>
               </value>
            </li>

         <li Class="PatchOperationAdd">
               <xpath>/Defs/ThingDef[defName="AB_HugeGallatrossSkeleton"]/statBases</xpath>
               <value>
               <Beauty>100</Beauty>
               </value>
            </li>
         
      </operations>
      </match>
   </Operation>
</Patch>