Ludeon Forums

RimWorld => Mods => Help => Topic started by: Vakari on September 10, 2020, 07:09:25 PM

Title: Help, please! I'm too braindead to do this, apparently
Post by: Vakari on September 10, 2020, 07:09:25 PM
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!
Title: Re: Help, please! I'm too braindead to do this, apparently
Post by: RawCode on September 11, 2020, 03:02:58 AM
open XML def of object that is valid art
open XML def of object that is not art
compare them
???
profit
Title: Re: Help, please! I'm too braindead to do this, apparently
Post by: 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.
Title: Re: Help, please! I'm too braindead to do this, apparently
Post by: LWM on September 11, 2020, 04:54:41 PM
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?
Title: Re: Help, please! I'm too braindead to do this, apparently
Post by: RawCode on September 12, 2020, 04:47:50 AM
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
Title: Re: Help, please! I'm too braindead to do this, apparently
Post by: Vakari on September 12, 2020, 09:05:26 PM
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>
Title: Re: Help, please! I'm too braindead to do this, apparently
Post by: LWM on September 13, 2020, 06:06:27 PM
Try <xpath>/Defs/ThingDef[defName="AB_GallatrossBones"]/statBases/Beauty</xpath>
Title: Re: Help, please! I'm too braindead to do this, apparently
Post by: Vakari on September 16, 2020, 01:32:49 AM
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.
Title: Re: Help, please! I'm too braindead to do this, apparently
Post by: Kopp on September 26, 2020, 06:47:15 AM
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
Title: Re: Help, please! I'm too braindead to do this, apparently
Post by: Vakari on October 03, 2020, 03:31:12 PM
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.
Title: Re: Help, please! I'm too braindead to do this, apparently
Post by: Kopp on October 03, 2020, 03:49:26 PM
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?
Title: Re: Help, please! I'm too braindead to do this, apparently
Post by: LWM on October 04, 2020, 12:27:59 AM
How about pasting the XML you're trying to patch?
Title: Re: Help, please! I'm too braindead to do this, apparently
Post by: Vakari on October 04, 2020, 01:24:04 PM
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>