ThingCategory as resource for building?

Started by JT, April 18, 2017, 06:23:59 PM

Previous topic - Next topic

JT

I'm currently working on a side mod where it is possible to use stone chunks to construct buildings, but trying the resource cost: <stuffCategories>
<li>StoneChunks</li>
</stuffCategories>
<costStuffCount>1</costStuffCount>

will actually break the game badly.  Don't even try it, it will wipe your mods list because it will crash Unity's XML parser (Unity's a fickle hivemind, which is why Rick likes it so much, but it's technically RimWorld's fault: it makes no safety check before trying to invoke the constructor, as it tries to reflect a class that doesn't exist -- bad things ensue).

However, I'm not aware of any similar construct that would allow me to use the matching ThingCategory -- i.e., to use the StoneChunks thingcategory like recipes have access to.  Recipes, of course, can take advantage of the nifty little selector and specific slots filtered by ThingCategory, but buildings don't seem to have this option available.

Has anyone played around with building resources beyond the mere costList (which requires specific thingDefs) and stuffCost?  Is it possible to "stuff" buildings out of ThingCategories rather than StuffCategories?

Worst case scenario, I've conceived of a possible scripted solution -- a "free" building like a conventional crafting spot, which uses an automatic job-giver to stock the building with a stone chunk, which once fulfilled replaces the free building with a special building in its place.  But that's a long and version-dependent workaround for something that seems like it should be ultimately simple to keep to XML... =)