Ludeon Forums

RimWorld => Mods => Help => Topic started by: beeeeber on June 07, 2014, 07:38:23 AM

Title: Production bill not used : help needed
Post by: beeeeber on June 07, 2014, 07:38:23 AM
Hello !

I'm doing a little mod to revamp the cook part of the game :
Basically it add

Everything is now in place BUT my colonist NEVER work on my production tabs on my new kitchen/stone furnace. They do it with the modified cookstove (simple meal), but never fulfill the other tabs.
can someone could explain me why this little fucker doesnt work ?
thanks !

KitchenUnit.xml :
<?xml version="1.0" encoding="utf-8" ?>
<Buildings>

  <ThingDef Name="BuildingBase" Abstract="True">
    <category>Building</category>
    <soundBulletHit>BulletImpactMetal</soundBulletHit>
    <selectable>true</selectable>
    <drawerType>MapMeshAndRealTime</drawerType>
    <surfaceNeeded>Light</surfaceNeeded>
    <constructionEffect>ConstructMetal</constructionEffect>
    <repairEffect>Repair</repairEffect>
  </ThingDef>



  <ThingDef ParentName="BuildingBase">
    <defName>CookStove</defName>
    <EType>Building_WorkTable</EType>
    <Label>Cook stove</Label>
    <ThingClass>Building_WorkTable</ThingClass>
    <Description>A simple stove and attached countertop for preparing meals from simpler ingredients.</Description>
    <TexturePath>Things/Building/Production/TableCookStove</TexturePath>
    <CostList>
      <li>
        <thingDef>Metal</thingDef>
        <count>60</count>
      </li>
    </CostList>
    <AltitudeLayer>Waist</AltitudeLayer>
    <WorkToBuild>300</WorkToBuild>
    <UseStandardHealth>True</UseStandardHealth>
    <maxHealth>180</maxHealth>
    <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>CookMealSimple</li>
    </recipes>
    <inspectorTabs>
      <li>ITab_Bills</li>
    </inspectorTabs>
    <comps>
      <li>
        <compClass>CompPowerTrader</compClass>
        <startElectricalFires>true</startElectricalFires>
        <basePowerConsumption>350</basePowerConsumption>
        <soundPowerOn>PowerOnSmall</soundPowerOn>
        <soundPowerOff>PowerOffSmall</soundPowerOff>
      </li>
    </comps>
    <building>
      <spawnedConceptLearnOpportunity>BillsTab</spawnedConceptLearnOpportunity>
    </building>
    <designationHotKey>O</designationHotKey>
  </ThingDef>
 
  <ThingDef ParentName="BuildingBase">
    <defName>Kitchen</defName>
    <EType>Building_WorkTable</EType>
    <Label>Kitchen</Label>
    <ThingClass>Building_WorkTable</ThingClass>
    <Description>A proper kitchen for preparing meals </Description>
    <TexturePath>Things/KitchenUnit</TexturePath>
    <CostList>
      <li>
        <thingDef>Metal</thingDef>
        <count>80</count>
      </li>
       <li>
        <thingDef>WoodPlank</thingDef>
        <count>50</count>
      </li>
    </CostList>
    <AltitudeLayer>Waist</AltitudeLayer>
    <WorkToBuild>300</WorkToBuild>
    <UseStandardHealth>True</UseStandardHealth>
    <maxHealth>180</maxHealth>
    <Size>(5,1)</Size>
    <Overdraw>False</Overdraw>
    <DesignationCategory>Production</DesignationCategory>
    <Passability>Impassable</Passability>
    <hasInteractionSquare>True</hasInteractionSquare>
    <interactionSquareOffset>(0,0,-1)</interactionSquareOffset>
    <itemSurface>True</itemSurface>
    <recipes>
      <li>CookMealSimple</li>
      <li>CookMealFine</li>
      <li>CookMealLavish</li>
    </recipes>
    <inspectorTabs>
      <li>ITab_Bills</li>
    </inspectorTabs>
    <comps>
      <li>
        <compClass>CompPowerTrader</compClass>
        <startElectricalFires>true</startElectricalFires>
        <basePowerConsumption>350</basePowerConsumption>
        <soundPowerOn>PowerOnSmall</soundPowerOn>
        <soundPowerOff>PowerOffSmall</soundPowerOff>
      </li>
    </comps>
    <building>
      <spawnedConceptLearnOpportunity>BillsTab</spawnedConceptLearnOpportunity>
    </building>
    <designationHotKey>O</designationHotKey>
  </ThingDef>
   
 
</Buildings>



StoneFurnace.xml :
<?xml version="1.0" encoding="utf-8" ?>
<Buildings>

  <ThingDef Name="BuildingBase" Abstract="True">
    <category>Building</category>
    <soundBulletHit>BulletImpactMetal</soundBulletHit>
    <selectable>true</selectable>
    <drawerType>MapMeshAndRealTime</drawerType>
    <surfaceNeeded>Light</surfaceNeeded>
    <constructionEffect>ConstructMetal</constructionEffect>
    <repairEffect>Repair</repairEffect>
  </ThingDef>
   
  <ThingDef ParentName="BuildingBase">
    <defName>StoneFurnace</defName>
    <EType>Building_WorkTable</EType>
    <Label>Stone furnace</Label>
    <ThingClass>Building_WorkTable</ThingClass>
    <Description>A stone furnace to cook meal from your homeworld</Description>
    <TexturePath>Things/StoneFurnace</TexturePath>
    <CostList>
      <li>
        <thingDef>Metal</thingDef>
        <count>40</count>
      </li>
  <li>
        <thingDef>StoneBlocks</thingDef>
        <count>100</count>
      </li>
    </CostList>
    <AltitudeLayer>Waist</AltitudeLayer>
    <WorkToBuild>300</WorkToBuild>
    <UseStandardHealth>True</UseStandardHealth>
    <maxHealth>180</maxHealth>
    <Size>(3,3)</Size>
    <Overdraw>False</Overdraw>
    <DesignationCategory>Production</DesignationCategory>
    <Passability>Impassable</Passability>
    <hasInteractionSquare>True</hasInteractionSquare>
    <interactionSquareOffset>(0,0,-1)</interactionSquareOffset>
    <itemSurface>True</itemSurface>
    <recipes>
      <li>CookMealSimple</li>
    </recipes>
    <inspectorTabs>
      <li>ITab_Bills</li>
    </inspectorTabs>
    <comps>
      <li>
        <compClass>CompPowerTrader</compClass>
        <startElectricalFires>true</startElectricalFires>
        <basePowerConsumption>350</basePowerConsumption>
        <soundPowerOn>PowerOnSmall</soundPowerOn>
        <soundPowerOff>PowerOffSmall</soundPowerOff>
      </li>
    </comps>
    <building>
      <spawnedConceptLearnOpportunity>BillsTab</spawnedConceptLearnOpportunity>
    </building>
    <designationHotKey>O</designationHotKey>
  </ThingDef>
 
</Buildings>



(http://uppix.net/WbQDqZl.jpg) (http://uppix.net/WbQDqZ)
Title: Re: Production bill not used : help needed
Post by: Haplo on June 07, 2014, 07:54:52 AM
Did you add the work giver? Without that it's just a nice building without function :)
Title: Re: Production bill not used : help needed
Post by: beeeeber on June 07, 2014, 08:55:51 AM
Ahh ! But I dont really understand how it work. I tryed something like the code bellow but that didnt work...
Do i need to use a SkillNeedDefs too ?

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

<!-- ============= Cooking ============= -->
 
    <WorkGiverDef>
    <defName>DoBillsCookKitchen</defName>
    <giverClass>AI.WorkGiver_DoBill</giverClass>
    <workType>Cooking</workType>
    <priorityInType>100</priorityInType>
    <workTableDef>Kitchen</workTableDef>
    <verb>cook</verb>
    <gerund>cooking</gerund>
  </WorkGiverDef>
 
   
    <WorkGiverDef>
    <defName>DoBillsCookFurnace</defName>
    <giverClass>AI.WorkGiver_DoBill</giverClass>
    <workType>Cooking</workType>
    <priorityInType>100</priorityInType>
    <workTableDef>StoneFurnac</workTableDef>
    <verb>cook</verb>
    <gerund>cooking</gerund>
  </WorkGiverDef>
</WorkGivers>
Title: Re: Production bill not used : help needed
Post by: mrofa on June 07, 2014, 09:24:53 AM
Cooked up a small example of work table
http://www.sendspace.com/file/yp9fb5 (http://www.sendspace.com/file/yp9fb5)
Title: Re: Production bill not used : help needed
Post by: beeeeber on June 07, 2014, 09:54:29 AM
Thank, but this is driving me nuts ! On your nice example you create a new from scratch, but right now I'm trying to use an exsisting recipe in a different workplace.

Could you how to link the files between them ? I understand which file do what, but for the rest I'm so fucking lost right now...
I have this error :
could not resolve cross-reference : No Verse.WorkTypeDef named KitchenUnit found to give to Verse.WorkGiverDefDoBillsKitchenUnit

RecipeDefs/Kitchen_Recipes
<?xml version="1.0" encoding="utf-8" ?>
<RecipeDefs>
<RecipeDef>
<defName>CookMealFine</defName>
<label>Cook fine meal</label>
<description>Cooks a somewhat complex meal from a combination of raw meat and raw plant ingredients.</description>
<jobString>Cooking fine meal.</jobString>
<workAmount>400</workAmount>
<workTimeSkillNeed>CookKitchenTime</workTimeSkillNeed>
<workEffect>Cook</workEffect>
    <sustainerSoundDef>Recipe_CookMeal</sustainerSoundDef>
    <ingredients>
<li>
<filter>
<categories>
<li>MeatRaw</li>
</categories>
</filter>
<count>5</count>
</li>
<li>
<filter>
<categories>
<li>PlantFoodRaw</li>
</categories>
</filter>
<count>5</count>
</li>
</ingredients>
<products>
<li>
<thingDef>MealFine</thingDef>
<count>1</count>
</li>
</products>
<fixedIngredientFilter>
<categories>
<li>FoodRaw</li>
</categories>
</fixedIngredientFilter>
<defaultIngredientFilter>
<categories>
<li>FoodRaw</li>
</categories>
<exceptedThingDefs>
<li>Human_Meat</li>
</exceptedThingDefs>
</defaultIngredientFilter>
<skillRequirements>
<li>
<skill>Cooking</skill>
<minLevel>7</minLevel>
</li>
</skillRequirements>
<skillGains>
<li>
<skill>Cooking</skill>
<xp>110</xp>
</li>
</skillGains>
</RecipeDef>


<RecipeDef>
<defName>CookMealLavish</defName>
<label>Cook lavish meal</label>
<description>Cooks a very complex meal from a combination of raw meat and raw plant ingredients. Much of the ingredients are wasted.</description>
<jobString>Cooking lavish meal.</jobString>
<workAmount>1000</workAmount>
<workTimeSkillNeed>CookFurnaceTime</workTimeSkillNeed>
<workEffect>Cook</workEffect>
    <sustainerSoundDef>Recipe_CookMeal</sustainerSoundDef>
    <ingredients>
<li>
<filter>
<categories>
<li>MeatRaw</li>
</categories>
</filter>
<count>10</count>
</li>
<li>
<filter>
<categories>
<li>PlantFoodRaw</li>
</categories>
</filter>
<count>10</count>
</li>
</ingredients>
<products>
<li>
<thingDef>MealLavish</thingDef>
<count>1</count>
</li>
</products>
<fixedIngredientFilter>
<categories>
<li>FoodRaw</li>
</categories>
</fixedIngredientFilter>
<defaultIngredientFilter>
<categories>
<li>FoodRaw</li>
</categories>
<exceptedThingDefs>
<li>Human_Meat</li>
</exceptedThingDefs>
</defaultIngredientFilter>
<skillRequirements>
<li>
<skill>Cooking</skill>
<minLevel>12</minLevel>
</li>
</skillRequirements>
<skillGains>
<li>
<skill>Cooking</skill>
<xp>180</xp>
</li>
</skillGains>
</RecipeDef>


</RecipeDefs>


SkillNeedDefs/SkillsNeeds_KitchenUnit
<?xml version="1.0" encoding="utf-8" ?>
<SkillNeeds>

  <SkillNeedDef Class="SkillNeedDef_BaseBonus">
<defName>CookKitchenTime</defName>
<skill>Cooking</skill>
<baseFactor>2.5</baseFactor>
<bonusFactor>-0.11</bonusFactor>
<description>Cooks meals in {0}% the normal time.</description>
</SkillNeedDef>

  <SkillNeedDef Class="SkillNeedDef_BaseBonus">
<defName>CookFurnaceTime</defName>
<skill>Cooking</skill>
<baseFactor>2.5</baseFactor>
<bonusFactor>-0.11</bonusFactor>
<description>Cooks meals in {0}% the normal time.</description>
</SkillNeedDef>

</SkillNeeds>



WorkGiverDefs/WorkGivers_KitchenUnit
<?xml version="1.0" encoding="utf-8" ?>
<WorkGivers>

<WorkGiverDef>
<defName>DoBillsKitchenUnit</defName>
<giverClass>AI.WorkGiver_DoBill</giverClass>
<workType>Cooking</workType>
<priorityInType>10</priorityInType>
<workTableDef>KitchenUnit</workTableDef>
<verb>cook</verb>
    <gerund>cooking</gerund>
</WorkGiverDef>
 
  <WorkGiverDef>
<defName>DoBillsStoneFurnace</defName>
<giverClass>AI.WorkGiver_DoBill</giverClass>
<workType>Cooking</workType>
<priorityInType>10</priorityInType>
<workTableDef>StoneFurnace</workTableDef>
<verb>cook</verb>
    <gerund>cooking</gerund>
</WorkGiverDef>
 
</WorkGivers>
Title: Re: Production bill not used : help needed
Post by: mrofa on June 07, 2014, 10:08:46 AM
Workgiver def have "<workTableDef>KitchenUnit</workTableDef>"
You should put a thingdefname of a worktable.
Like the lower one have "StoneFurnace"

Example that i did sent you console unit had a thingdefname "Converter"
Title: Re: Production bill not used : help needed
Post by: beeeeber on June 07, 2014, 10:14:34 AM
thingdefname ? How can I do that ? There is no such thing of ThingDefName in core to help me understand. Sorry about that, I'm pretty new to do such kind of things and the first steps are always the hardest :)

Thanks for the help btw !
Title: Re: Production bill not used : help needed
Post by: mrofa on June 07, 2014, 10:18:57 AM
Yehh dont worry we all did start like this :)
So every object you make in game have a ThingDefName and thats how game see it.
Now in the example i did send you when you go into Defs/ThingDefs/XConsoleUnit.xml
Open it and you will see something like :
<?xml version="1.0" encoding="utf-8" ?>
<Buildings>

<ThingDef Name="BuildingBase" Abstract="True">
<category>Building</category>
<soundBulletHit>BulletImpactMetal</soundBulletHit>
<selectable>true</selectable>
<drawerType>MapMeshAndRealTime</drawerType>
<surfaceNeeded>Light</surfaceNeeded>
<constructionEffect>ConstructMetal</constructionEffect>
<repairEffect>Repair</repairEffect>
</ThingDef>

<ThingDef ParentName="BuildingBase">
<DefName>Converter</DefName>
<EType>Building_WorkTable</EType>
<Label>Converter Unit</Label>
<ThingClass>Building_WorkTable</ThingClass>
<Description>Small converter unit, that convert silver into metal.</Description>
<TexturePath>Things/Building/Converter</TexturePath>
<CostList>


Thers <DefName>Converter</DefName> and thats what its asking for
Title: Re: Production bill not used : help needed
Post by: beeeeber on June 07, 2014, 10:29:27 AM
Fuck me I used "Kitchen" in defName instead of "KitchenUnit" which i used everywhere... godsake... So, now that work like a charm for my "KitchenUnit" !
But I'm still clueless about my "StoneFurnace" with "lavish meal" only. Same than before.
And RW dont get me any error ???
Title: Re: Production bill not used : help needed
Post by: mrofa on June 07, 2014, 10:43:25 AM
Well whats dont work for you ?
Title: Re: Production bill not used : help needed
Post by: beeeeber on June 07, 2014, 10:51:27 AM
I mean the bill for my "KitchenUnit" is perfectly done by the colonist, but the one from "StoneFurnace" stay untouch
(Checked ingame with a enough skilled colonist and enough food).
And RW doesnt give me any errors.. This will never end haha :)
Title: Re: Production bill not used : help needed
Post by: mrofa on June 07, 2014, 10:54:43 AM
You mean that you select the bill for cooked meal but no one is crafting it ?
Title: Re: Production bill not used : help needed
Post by: beeeeber on June 07, 2014, 11:00:13 AM
yep
Title: Re: Production bill not used : help needed
Post by: beeeeber on June 07, 2014, 11:05:46 AM
Here are the files, maybe it will be easier

[attachment deleted by admin: too old]
Title: Re: Production bill not used : help needed
Post by: mrofa on June 07, 2014, 12:47:37 PM
Well, interactions square is inside the furance and normally it should be set to -2 insted of -1. Thats the only problem i found.

But even with proper settings it wont work, and its becouse of its size, dont know why, if you make it smaller like 3x2, 3x1 or 2x2 it works without a problem.
Title: Re: Production bill not used : help needed
Post by: beeeeber on June 07, 2014, 01:42:42 PM
Strange, but perfect ! Thank you soo much for helping me !

edit : mod released :)

http://ludeon.com/forums/index.php?topic=3915.0