[Modding help] Find and edit mood bonus from Green Thumb trait.

Started by DiamondBorne, October 05, 2017, 09:38:19 AM

Previous topic - Next topic

DiamondBorne

Hello, i'm currently trying to study on how to do a quick and dirty mod and i couldn't find any line about mood bonus when growing from Green Thumb. Can anyone help me please?

swefan

There are:

 
<TraitDef>
    <defName>GreenThumb</defName>
    <commonality>0.5</commonality>
    <degreeDatas>
      <li>
        <label>green thumb</label>
        <description>NAME has a passion for gardening. HECAP gets a mood bonus for every plant HE sows.</description>
        <skillGains>
          <li>
            <key>Growing</key>
            <value>2</value>
          </li>
        </skillGains>
      </li>
    </degreeDatas>
    <requiredWorkTypes>
      <li>Growing</li>
      <li>PlantCutting</li>
    </requiredWorkTypes>
</TraitDef>



      <ThoughtDef>
<defName>GreenThumbHappy</defName>
<durationDays>0.5</durationDays>
<stackLimit>20</stackLimit>
<stackedEffectMultiplier>1.0</stackedEffectMultiplier>
<requiredTraits>
<li>GreenThumb</li>
</requiredTraits>
<stages>
<li>
<label>sowed a plant</label>
<description>What the world needs is more plants!</description>
<baseMoodEffect>1</baseMoodEffect>
</li>
</stages>
      </ThoughtDef>

CannibarRechter

For people asking these types of questions in the future, what you want to do is open up PowerShell, cd over to your Mods/Core/Defs directory, and type something like this:


../Defs> ls -recurse *.xml | sls -pattern Thumb

Bodies\Bodies_Animal_Quadruped.xml:1771:                                            <def>LeftHandThumb</def>
Bodies\Bodies_Animal_Quadruped.xml:1835:                                            <def>RightHandThumb</def>
Bodies\Bodies_Humanlike.xml:360:                      <def>LeftHandThumb</def>
Bodies\Bodies_Humanlike.xml:453:                      <def>RightHandThumb</def>
Bodies\Bodies_Mechanoid.xml:171:                      <def>LeftHandMechanicalThumb</def>
Bodies\Bodies_Mechanoid.xml:225:                      <def>RightHandMechanicalThumb</def>
Bodies\BodyParts_Humanoid.xml:100:    <defName>LeftHandThumb</defName>
Bodies\BodyParts_Humanoid.xml:101:    <label>left thumb</label>
Bodies\BodyParts_Humanoid.xml:199:    <defName>RightHandThumb</defName>
Bodies\BodyParts_Humanoid.xml:200:    <label>right thumb</label>
Bodies\BodyParts_Mechanoid.xml:214:    <defName>LeftHandMechanicalThumb</defName>
Bodies\BodyParts_Mechanoid.xml:215:    <label>left thumb</label>
Bodies\BodyParts_Mechanoid.xml:310:    <defName>RightHandMechanicalThumb</defName>
Bodies\BodyParts_Mechanoid.xml:311:    <label>right thumb</label>
ThoughtDefs\Thoughts_Memory_Misc.xml:187:        <defName>GreenThumbHappy</defName>
ThoughtDefs\Thoughts_Memory_Misc.xml:192:            <li>GreenThumb</li>
TraitDefs\Traits_Singular.xml:172:    <defName>GreenThumb</defName>
TraitDefs\Traits_Singular.xml:176:        <label>green thumb</label>


../Defs>


The commands searches for all files ending in ".xml" and containing the word "Thumb". You can chain them together. For example, all .xml files with both Green and Thumb:


../Defs> ls -recurse *.xml | sls -pattern Thumb | sls -pattern Green

ThoughtDefs\Thoughts_Memory_Misc.xml:187:        <defName>GreenThumbHappy</defName>
ThoughtDefs\Thoughts_Memory_Misc.xml:192:            <li>GreenThumb</li>
TraitDefs\Traits_Singular.xml:172:    <defName>GreenThumb</defName>
TraitDefs\Traits_Singular.xml:176:        <label>green thumb</label>


CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

DiamondBorne

Thank you very much everyone.  :)

Another question: what is the importance of degree in the traitdef? Was it used to govern the appearance rate of a trait or something? And can i add anything more than -2 to 2 in case i want more than 5 spectrum in a trait?

CannibarRechter

Here, at least, is a partial answer:


public float Commonality
{
get
{
if (this.commonality >= 0f)
{
return this.commonality;
}
switch (Mathf.Abs(this.degree))
{
case 0:
return 1f;
case 1:
return 1f;
case 2:
return 0.4f;
case 3:
return 0.2f;
case 4:
return 0.1f;
default:
return 0.05f;
}
}
}


BTW, I first used ILSpy, decompiled the RimWorld code, and then saved to a directory. To answer your question, I used a similar PowerShell technique, like this:


ls -recurse *.cs | sls -pattern TraitDegree


I also exploited my knowledge knowing that the game often has files of the pattern: Name | NameData | NameDef and similar.
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects