Aviuz / PrisonLabor

Prison Labor mod for RimWorld game
http://steamcommunity.com/sharedfiles/filedetails/?id=972057888
39 stars 22 forks source link

Zones disappears on Menu-reload #227

Closed emipa606 closed 3 years ago

emipa606 commented 3 years ago

Why are the Zone-designators not added via xml but in the C#-code? This causes them to disappear if another mod reloads/sorts the tab-menu. If possible, can they be added as other areas via a xml-definition, or add a postfix to the menu-reload that readds them if they need to be added in C#?

emipa606 commented 3 years ago

You could also use the DefGenerator.AddImpliedDef(); function to add it to the database instead of adding it to the menu manually.

Hazzer commented 3 years ago

I guess only Avius can answer to your question. However, I don't see a blocker to try xml approach. Will check this out and hopeful it will be change in next update. Thanks for pointing that out!

emipa606 commented 3 years ago

Great, as of now I just added this patch to my mod as a temporary solution:

<Patch>
  <Operation Class="PatchOperationAdd">
    <xpath>/Defs/DesignationCategoryDef[defName = "Zone"]/specialDesignatorClasses</xpath>
    <value>
      <li>PrisonLabor.Core.LaborArea.Designator_AreaLaborExpand</li>
      <li>PrisonLabor.Core.LaborArea.Designator_AreaLaborClear</li>
    </value>
  </Operation>
</Patch>