RimWorld

RimWorld

Bonded Leather
Kayesh  [developer] 19 Aug, 2022 @ 2:25pm
Random out of place modding tips
I was asked about tips for modding. I'm not sure I'm a great person to talk to, but I figured I'd give some suggestions to start things off! I think the best thing to start with would be to download some sample mods and mess with them, using the info at https://rimworldwiki.com/wiki/Modding_Tutorials as documentation. Start by choosing an XML-only mod, for example this Bonded Leather mod.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2682647250

After subscribing to it, pull it out of the downloaded mods folder (wherever your steam downloads live, but it's gonna be something like c:\program files (x86)\Steam\SteamApps\workshop\content\294100\2682647250) and chuck the contents in a new folder under Steam\SteamApps\common\RimWorld\Mods, let's say Steam\SteamApps\common\RimWorld\Mods\TestBondedLeather.

Go into the About directory and delete PublishedFileId.txt. Go into About.xml and give it a new name, author, and package id.

Defs contain the content that's added into Rimworld; you'll find Bonded Leather's defs under 1.3\Defs.

Start with something small: let's mess with the recipe for "shred leather x1". Search for "shred leather x1" in the XML under ThingDefs. Currently it turns 1 piece of leather 1 shredded leather. Let's make it turn 1 piece of leather into into 50 plasteel. Replace the line "<BondedLeather_ShreddedLeather>1</BondedLeather_ShreddedLeather>" with "<Plasteel>50</Plasteel>". Save it, then start up Rimworld and load up your modified mod. Start a new game, give yourself the Bonded Leather research, a tailor bench, and at least one piece of leather, and do the "shred leather x1" bill at the tailor bench. Boom, modified recipe!

How'd I know that plasteel was called Plasteel? We needed to provide a ThingDef, and the ThingDef reference for plasteel calls out the defName "Plasteel" on line 183 of Steam\SteamApps\common\RimWorld\Data\Core\Defs\ThingDefs_Items\Items_Resource_Stuff.xml.

But yeah, use this cloned mod as a test ground. Make a new RecipeDef, add a new ThingDef, add a new research project that the recipe def requires.