Ради вашего удобства наш сайт использует cookies! Узнать больше! Мы используем cookies

Stuff As RecipeDef Categories

What this mod does

This mod simplifies and streamlines further modding by creating several new ThingDefCategories: "SARDC_MetallicStuff", "SARDC_StonyStuff", "SARDC_WoodyStuff", and a final "SARDC_AnyStuff" that includes all of the previous three.

A patch then searches all ThingDefs and adds these new categories to anything, including new ThingDefs added by mods, that is Stuffable as Metallic, Stony, and/or Woody.

Why this is worth implementing

Most Stuffable resources in Core share the category "ResourcesRaw"; Metallic, Stony, and Woody Stuffables all. A RecipeDef (used for non-equipment items) therefore has no way to quickly call upon all things that can be used as one particular Stuff. This means RecipeDefs must name individual materials by their ThingDef.

This has the unfortunate consequence of greatly reducing inter-mod soft compatibility. Modders are forced to name particular ThingDefs (such as "Steel" or "WoodLog") for recipe inputs, when a more general Stuff (whether Metallic, Stony, Woody, or any of the three) might be more appropriate.

With this mod, RecipeDefs can call upon all materials within a Stuff with a single line of code, even including materials that are added by other mods.

With regards to equipment and mod compatibility

Stuffable equipment should continue to use recipeMaker and costStuffCount. I don't know what happens if you try to generate a Stuff-dependent piece of equipment without these established methods, but it's probably nothing good, and I can say for sure that use of categories is not supported through either of the former methods.

Non-Stuffed equipment can technically take advantage of SARDC categories by including a RecipeDef for its creation, but there are a lot of problematic idiosyncrasies that you have to be aware of with a RecipeDef, such as there being no "unfinished item" when crafted in this method (so the item needs to be reasonably craftable in one sitting, which is probably inappropriately easy for powerful equipment), and the item requiring appropriate methods of being crafted through recipeMaker anyways (or else you get drowned in red errors at a minimum).

This mod does not patch existing RecipeDefs, nor does it remove any ThingDefCategories. If there is a mod whose RecipeDefs you would like to use SARDC categories, you will need to patch it yourself, the scope of which is beyond the context of this mod.

Testing as of now

This mod was tested with RimBees and Rimefeller as proof of concept, as well as placeholder Stuffables and RecipeDefs drafted up purely for testing.

Mod order seems to be irrelevant as long as it comes after Core/Royalty. SARDC seems to function anywhere in the mod order, regardless of its relative position to mods that add new Stuffables and/or RecipeDefs utilizing SARDC categories.

About and Acknowledgments

Please let me know in the comments section if you encounter any problems with this mod. It is my first foray into modding.

Big thanks to
dninemfive
Helldragger
Jamaican Castle
and The Nerd Wonder
for helping me understand and navigate Rimworld's code.

If you would like to show your support, please do your part for inter-mod soft compatibility by making your mod's buildings Stuffable, as opposed to requiring exactly Steel or WoodLogs.