How to I modify the work needed to smooth surfaces?

Started by Torchie1455, October 25, 2018, 11:30:44 AM

Previous topic - Next topic

Torchie1455

Hi! I've been trying all morning to figure out how to modify the required work to smoothing stone. I'm not very skilled at modding so my plan was to find the value in the game files and edit that. I found the block of code in Jobs_Works.xml that handles surface smoothing but I can't seem to find the values it's calling. So any guidance would be greatly appreciated, and I apologize if this question has been asked before.  I attempted to google it/search these forums to no avail, but I found it relatively difficult to phrase the search.

  <JobDef>
    <defName>SmoothFloor</defName>
    <driverClass>JobDriver_SmoothFloor</driverClass>
    <reportString>smoothing floor.</reportString>
    <allowOpportunisticPrefix>true</allowOpportunisticPrefix>
  </JobDef>


  <JobDef>
    <defName>SmoothWall</defName>
    <driverClass>JobDriver_SmoothWall</driverClass>
    <reportString>smoothing wall.</reportString>
    <allowOpportunisticPrefix>true</allowOpportunisticPrefix>
  </JobDef

AileTheAlien

The only thing I could find in XML was the trait for pawns which governs their speed at smoothing, but not the time the task itself takes. Effectively it should work the same, although your pawns would have a weird-looking stat in their info boxes, of 500% (for example) smoothing speed.

Torchie1455

Oh nice! That's better progress then I've made, where did you find the values for work speed?

AileTheAlien

Defs/Stats/Stats_Pawns_WorkGeneral.xml:109

<StatDef>
    <defName>SmoothingSpeed</defName>
    <label>smoothing speed</label>
    <description>A multiplier on the speed at which this person smooths rough stone floors and walls.</description>
    <category>PawnWork</category>
    <defaultBaseValue>1</defaultBaseValue>
    <minValue>0.1</minValue>
    <toStringStyle>PercentZero</toStringStyle>
    <statFactors>
        <li>WorkSpeedGlobal</li>
    </statFactors>
    <skillNeedFactors>
        <li Class="SkillNeed_BaseBonus">
            <skill>Construction</skill>
            <baseValue>0.5</baseValue>
            <bonusPerLevel>0.15</bonusPerLevel>
        </li>
    </skillNeedFactors>
    <capacityFactors>
        <li>
            <capacity>Manipulation</capacity>
            <weight>1</weight>
        </li>
        <li>
            <capacity>Sight</capacity>
            <weight>0.3</weight>
            <max>1</max>
        </li>
    </capacityFactors>
</StatDef>

Iamkriil

The base work amount for smoothing floors and walls is hard coded into their JobDriver classes

From JobDriver_SmoothWall:

protected int BaseWorkAmount
{
  get
  {
    return 6500;
  }
}


From JobDriver_SmoothFloor

protected override int BaseWorkAmount
{
  get
  {
    return 2800;
  }
}


These classes would be super easy to override and actually great for a first mod containing code changes.  Just follow jecrell's tutorial on creating a mod: https://ludeon.com/forums/index.php?topic=33219.0

You'll only need to create these classes (or just one or the other).  Just copy the code...give the class a new name and use that class name as the value for driverClass in the XML that Torchie1455 mentioned. (don't forget to preface the class name with your mods namespace as described in the tutorial).