WorkGivers help.

Started by Berengar, December 03, 2014, 09:06:44 AM

Previous topic - Next topic

Berengar

Greetings.
So i need some help.
Im working on a new smithing system, thats start with a forge, where your have to heat metal, to become GlowingIron.
With that your can form an Metalpipe, witch your can heat again, and form it than on the Anvil. So far so good.
I start with testing the glowing iron. The Forge works, and is buidable.. same with the rezept. But, something is'nt correkt with the workgiver def i think.. My Colonist just dont start to work on the Forge, and i dont can priorize the order.
Here the Codes.

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

  <RecipeDef>
    <defName>MakeGlowingIron</defName>
    <label>Heat Iron</label>
    <description>Heat some Iron.</description>
    <jobString>Heat Iron.</jobString>
    <workAmount>600</workAmount>
    <workSpeedStat>TailoringSpeed</workSpeedStat>
    <sustainerSoundDef>Recipe_MakeClothes</sustainerSoundDef>
    <productHasIngredientStuff>true</productHasIngredientStuff>
    <ingredients>
      <li>
         <filter>
            <thingDefs>
               <li>Metal</li>
            </thingDefs>
         </filter>
      <count>10</count>
   </li>
    </ingredients>
    <products>
      <GlowingIron>1</GlowingIron>
    </products>
    <skillGains>
      <li>
        <skill>Crafting</skill>
        <xp>300</xp>
      </li>
    </skillGains>
  </RecipeDef>

 
 
</Defs>

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



  <ThingDef Name="BuildingBase" Abstract="True">
    <category>Building</category>
    <soundImpactDefault>BulletImpactMetal</soundImpactDefault>
    <selectable>true</selectable>
    <drawerType>MapMeshAndRealTime</drawerType>
    <terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
    <repairEffect>Repair</repairEffect>
  </ThingDef>





  <ThingDef ParentName="BuildingBase">
    <DefName>Forge</DefName>
    <EType>Building_WorkTable</EType>
    <label>Forge</label>
    <ThingClass>Building_WorkTable</ThingClass>
    <Description>A Forge.</Description>
    <graphicPathSingle>Smith/Forge</graphicPathSingle>
    <CostList>
      <WoodLog>30</WoodLog>
      <Metal>30</Metal>
    </CostList>
    <AltitudeLayer>Waist</AltitudeLayer>
    <UseStandardHealth>True</UseStandardHealth>
    <statBases>
      <WorkToBuild>1000</WorkToBuild>
      <MaxHealth>180</MaxHealth>
      <Flammability>1.0</Flammability>
    </statBases>
    <Size>(3,1)</Size>
    <Overdraw>False</Overdraw>
    <DesignationCategory>Production</DesignationCategory>
    <Passability>Impassable</Passability>
    <hasInteractionSquare>True</hasInteractionSquare>
    <interactionSquareOffset>(0,0,-1)</interactionSquareOffset>
    <itemSurface>True</itemSurface>
    <recipes>
      <li>MakeGlowingIron</li>
    </recipes>
    <inspectorTabs>
      <li>ITab_Bills</li>
    </inspectorTabs>
    <building>
      <spawnedConceptLearnOpportunity>BillsTab</spawnedConceptLearnOpportunity>
    </building>
  </ThingDef>






</ThingDefs>

And at least the Workdef
Quote<?xml version="1.0" encoding="utf-8" ?>
<WorkGivers>

  <WorkGiverDef>
    <defName>MakeGlowingIron</defName>
    <giverClass>WorkGiver_DoBill</giverClass>
    <workType>Crafting</workType>
    <priorityInType>10</priorityInType>
   <billGiverDef>Forge</billGiverDef>
    <verb>produce GlowingIron</verb>
    <gerund>producing GlowingIron</gerund>
  </WorkGiverDef>


</WorkGivers>

Oh and the Item
Quote<?xml version="1.0" encoding="utf-8" ?>
<Resources>


  <ThingDef Name="ResourceBase" Abstract="True">
    <thingClass>ThingWithComponents</thingClass>
    <label>unspecified resource</label>
    <category>Item</category>
    <eType>Item</eType>
    <resourceReadoutPriority>Middle</resourceReadoutPriority>
    <useStandardHealth>true</useStandardHealth>
    <selectable>true</selectable>
    <altitudeLayer>Item</altitudeLayer>
    <stackLimit>75</stackLimit>
    <tradersCarry>true</tradersCarry>
    <comps>
      <li>
        <compClass>CompForbiddable</compClass>
      </li>
    </comps>
    <alwaysHaulable>true</alwaysHaulable>
    <drawGUIOverlay>true</drawGUIOverlay>
    <rotatable>false</rotatable>
    <pathCost>15</pathCost>
  </ThingDef>

  <ThingDef Name="ResourceVerbBase" ParentName="ResourceBase" Abstract="True">
    <eType>Equipment</eType>
    <thingClass>Equipment</thingClass>
    <equipmentType>Primary</equipmentType>
    <techLevel>Neolithic</techLevel>
    <comps>
      <li>
        <compClass>CompForbiddable</compClass>
      </li>
    </comps>
  </ThingDef>




  <!--
  <ThingDef ParentName="ResourceBase">
    <defName>WoodPlank</defName>
    <label>wood planks</label>
    <description>For building structures.</description>
    <graphicPathSingle>Things/Item/Resource/WoodPlank</graphicPathSingle>
    <soundInteract>Wood_Drop</soundInteract>
    <soundDrop>Wood_Drop</soundDrop>
    <baseMarketValue>1.9</baseMarketValue>
    <tradersCarry>false</tradersCarry>
    <statBases><MaxHealth>150</MaxHealth><Flammability>1.0</Flammability></statBases>
    <storeCategories>
      <li>ResourcesRaw</li>
    </storeCategories>
  </ThingDef>
  -->


  <!--=============== Pure stuffs: Fabric, leather, etc  ====================-->

  <ThingDef ParentName="ResourceBase">
    <defName>GlowingIron</defName>
    <label>GlowingIron</label>
    <description>Heatet iron.</description>
    <graphicPathSingle>Smith/GlowingMetal</graphicPathSingle>
    <soundInteract>Metal_Drop</soundInteract>
    <soundDrop>Metal_Drop</soundDrop>
   <baseMarketValue>1</baseMarketValue>
    <statBases>
      <Flammability>1.0</Flammability>
    </statBases>
    <stuffProps>
      <canMakeApparel>false</canMakeApparel>
      <color>(200,200,200)</color>
      <statFactors>
        <MarketValue>1</MarketValue>
      </statFactors>
    </stuffProps>
    <storeCategories>
      <li>ResourcesRaw</li>
    </storeCategories>
  </ThingDef>



</Resources>

Im realy new at moding Rimworld, so i think its a small problem.. i hope. :D

Rikiki

There might be a problem with the workgiver.
Its defName is the same as the recipe one.

Try renaming it like:
  <WorkGiverDef>
    <defName>DoBillsForge</defName>
    <giverClass>WorkGiver_DoBill</giverClass>


I would also recommend to set the priority to 100 instead of 10 (10 is really a low priority).

Berengar

So thanks first.
Ã,,hm i try that out, but its help not realy.
The colonist do ignor that Forge, even when there is nothing more to do..

mfg: Berengar

ItchyFlea

Add this code to the recipe def just below the products part.

<fixedIngredientFilter>
<thingDefs>
<li>Metal</li>
</thingDefs>
</fixedIngredientFilter>


The recipe def should then look like this:

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

  <RecipeDef>
    <defName>MakeGlowingIron</defName>
    <label>Heat Iron</label>
    <description>Heat some Iron.</description>
    <jobString>Heat Iron.</jobString>
    <workAmount>600</workAmount>
    <workSpeedStat>TailoringSpeed</workSpeedStat>
    <sustainerSoundDef>Recipe_MakeClothes</sustainerSoundDef>
    <productHasIngredientStuff>true</productHasIngredientStuff>
    <ingredients>
      <li>
         <filter>
            <thingDefs>
               <li>Metal</li>
            </thingDefs>
         </filter>
      <count>10</count>
   </li>
    </ingredients>
    <products>
      <GlowingIron>1</GlowingIron>
    </products>
<fixedIngredientFilter>
<thingDefs>
<li>Metal</li>
</thingDefs>
</fixedIngredientFilter>
    <skillGains>
      <li>
        <skill>Crafting</skill>
        <xp>300</xp>
      </li>
    </skillGains>
  </RecipeDef>



</Defs>
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

Berengar

I know it is something stupid...  ;D
But thanks man, that helps me alot.

Berengar the fat Pesant