PlaceWorkers question/help

Started by macicka, July 30, 2017, 11:58:04 AM

Previous topic - Next topic

macicka

Hello,

I tried to add new Tool Cabinet (just copied the original one and changed some stuff like build cost, speedFactor and maxSimultaneous), everything is working, I can place my new "Machine Cabinet" with changed build cost and speedFactor, but for some reason when its built, it doesn't do anything and it says inactive. Do I need to do something more? it really is just a copy of original with changed stuff. And when I'm placing it, it doesn't draw any lines to my workbenches (tried with original cabinet, it does). I think its something to do with placeWokers (its the only thing that makes sense). Does anyone knows where I am wrong??


My ThingsDef_Buildings_MM.xml


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

  <ThingDef ParentName="BuildingBase">
    <defName>MachineCabinet</defName>
    <label>machine cabinet</label>
    <graphicData>
      <texPath>Things/Building/Misc/ToolCabinet</texPath>
      <graphicClass>Graphic_Multi</graphicClass>
      <drawSize>(2,1)</drawSize>
      <color>(171,71,71)</color>
      <damageData>
        <cornerTL>Damage/Corner</cornerTL>
        <cornerTR>Damage/Corner</cornerTR>
        <cornerBL>Damage/Corner</cornerBL>
        <cornerBR>Damage/Corner</cornerBR>
      </damageData>
    </graphicData>
<researchPrerequisites><li>Machining</li></researchPrerequisites>
    <altitudeLayer>Building</altitudeLayer>
    <passability>PassThroughOnly</passability>
    <castEdgeShadows>true</castEdgeShadows>
    <staticSunShadowHeight>0.35</staticSunShadowHeight>
    <fillPercent>0.5</fillPercent>
    <canOverlapZones>false</canOverlapZones>
    <statBases>
      <MaxHitPoints>200</MaxHitPoints>
      <WorkToBuild>2500</WorkToBuild>
      <Mass>50</Mass>
      <Flammability>1.0</Flammability>
    </statBases>
    <description>Greatly increase work speed. One workbench can be linked to two of these.</description>
    <size>(2,1)</size>
    <costList>
      <Steel>500</Steel>
  <Plasteel>100</Plasteel>
  <Component>10</Component>
    </costList>
    <designationCategory>Misc</designationCategory>
    <minifiedDef>MinifiedFurniture</minifiedDef>
    <comps>
      <li Class="CompProperties_Facility">
        <statOffsets>
          <WorkTableWorkSpeedFactor>0.50</WorkTableWorkSpeedFactor>
        </statOffsets>
        <maxSimultaneous>4</maxSimultaneous>
      </li>
    </comps>
<placeWorkers>
<li>PlaceWorker_ShowFacilitiesConnections</li>
</placeWorkers>
  </ThingDef>
 
</Buildings>


Thanks for respones.

macicka

Okay I tried everything, I literally just copied the original cabinet and changed ONLY defName, still doesnt work, I tried to load the mod right after core, last, in the middle, still nothing. Tried with and without mods, nothing. I have no clue where the problem is.

Kubouch

You added a machining cabinet building but you also need to tell the workshops to recognize it. Every building you want to be influenced by your cabinet needs to have this:


<comps>
      <li Class="CompProperties_AffectedByFacilities">
        <linkableFacilities>
          <li>MachiningCabinet</li>
        </linkableFacilities>
      </li>
</comps>


Most of the production buildings already have ToolCabinet there so you just add MachineCabinet.

I haven't done this before but I think this is the problem.

macicka

Thanks, I just realized that 10 minutes ago, I am trying to patch all worktables, so I dont have to add it manually but, it works only with Component assembly bench....im trying to patch all worktables by thingClass


<xpath>*/ThingDef[thingClass = "Building_WorkTable"]/comps/li/linkableFacilities</xpath>


but as I said, it only works with Component assembly bench, am I targeting worktables right? Is it possible to target them by thing class?

macicka

#4
Okay I figured it out.
It seems like xpath is case sensitive and some workbenches have:

thingClass

and other:

ThingClass

Really unnoticeable.
Thanks for helping.

Kubouch

Great you figured it out. I actually never did any xpaths so I couldn't help with that.

Case sensitivity comes from the underlying C# code. The XML files are basically exposed C# classes and you're setting parameters of the classes. "ThingClass" is a name of a class while "thingClass" is the class's instance. One need to be careful here :-).