Leather Recipe: Noob modder help

Started by Hans Lemurson, February 02, 2017, 05:16:06 AM

Previous topic - Next topic

Hans Lemurson

I want to create a mod for myself where I can consolidate the little scraps of rat, squirrel, and yorkie hide into a new material that can actually be used.  Patchwork leather?  Reconsolidated hide?  Defragmented skin?  I'll think of a name later.  The important thing is that I have no idea how to start.

--I need to create a new type of Leather, but I don't know what file that would go in, or even what template to copy.

--I need to create a new recipe (probably for the crafting spot), but again I don't know where to put the file or what info I need to specify.

Lastly, (and this is minor) I'd like to actually create recipes that would be able to consolidate the warmer furs separately from stuff like emu or iguana leather.  I don't want to have to specify each leather type individually though, and I'd like this to somehow play nice with other mods that might introduce new animals and skins.
Mental break: playing RimWorld
Hans Lemurson is hiding in his room playing computer games.
Final straw was: Overdue projects.

Shinzy

Leathers are generated automatically by the game so the closest example you can find for your custom one is the 'Cloth' item, which you can find in
Core/Defs/Thingdefs_Items/ Resource_stuff.xml

to make it behave like leather ingame all you really need to do is to change the category tag from Fabric to whatever tag leather uses (you can find all the categories in Defs/Misc/StuffCategoryDefs)

and to make the crafting recipe you can add a "recipe maker" to your item, pretty much anywhere in the def file
Check the apparel defs for example
find the bits about 'recipe makers' and things like 'stuff costs' and 'work to make'

now it might feel slightly overwhelming if you don't have *any* idea what you're doing but once you get to know the xml files they're really easy. They're very logical too for the most part so you shouldn't have too many problems with this :p

I'd recommend trying to find a small mod someone else has made that adds some kind of crafting recipe to the game to learn how the stuff works

Tammabanana

Hans,

I've got a WIP that includes the first part, patching leathers together; feel free to use it for learning/template/whatever.

https://github.com/Tammabanana/Initial-Conditions-Subsistence

I'm not sure how to do the latter, though, choosing specific furs. The names of each in-game leather are auto-generated, I think, and I don't know the format. Ummmmm... somebody wrote a mod that makes Grade A, Grade B, Grade C leathers out of specific leathers, so I bet that one has the info you'd need. I can't remember its name, but I'll go look for it.
Tam's tiny mods: forum thread: Kitchen Counters and other shelving *** Smoked meat *** Travel rations: MREs *** Pygmy Muffalo

Tammabanana

Here it is, Unified Leathers: http://steamcommunity.com/sharedfiles/filedetails/?id=788284244&searchtext=unified+leathers

It's A15, not A16, and the author says he's not updating it, but I don't think A16 changed the method of naming leathers, so you can probably still use it to find out what those are.
Tam's tiny mods: forum thread: Kitchen Counters and other shelving *** Smoked meat *** Travel rations: MREs *** Pygmy Muffalo

Hans Lemurson

Thanks for the help guys.  I'll take a look at everything and try my hand at my own mod before being lazy and just downloading a pre-existing one.  :)
Mental break: playing RimWorld
Hans Lemurson is hiding in his room playing computer games.
Final straw was: Overdue projects.

Hans Lemurson

I've got the resource to appear, but I can't get its graphic to load.

"Could not load UnityEngine.Texture2D at Things/Item/Resource/StitchedLeather in any active mod or in base resources."

How should I be arranging the file structure and/or naming the files?  Is there a difference between setting <texPath> versus <graphicPath>? 

I'm copying from the cloth template, but maybe the image I used doesn't could as a texture?
Mental break: playing RimWorld
Hans Lemurson is hiding in his room playing computer games.
Final straw was: Overdue projects.

Shinzy

There could be a typo or the path is wrong
the texture file should be .png and the file structure starts looking for the path you give inside the textures folder

so you could literally just have the path be
<texPath>StichedLeather</texPath>
and drop your texture right at the base of the textures folder

Try this and if it doesn't work please show your files so it's easier to spot the problem

Hans Lemurson

#7
I found my solution:
Quote from: Thirite on January 16, 2017, 01:04:13 AM
Get rid of the .tex in the file name

I realize now that I did not have to use such a deep file structure, especially since there is literally nothing to keep organized, but whatever.  It works and seems consistent with other things.

For the recipe, I basically copied Tammabanana's "Patched Leather" recipe, with a few tweaks of my own preference.

Is there any handy list of "All the things you would need to define to make a recipe work" anywhere?
...
Also, how would I go about excepting Human Leather from the ingredients?  The leathers are dynamically generated, so I don't think <exceptedThingDefs> will cover them.
Mental break: playing RimWorld
Hans Lemurson is hiding in his room playing computer games.
Final straw was: Overdue projects.

Tammabanana

Quote from: Hans Lemurson on February 05, 2017, 05:19:07 AM
Is there any handy list of "All the things you would need to define to make a recipe work" anywhere?
...
Also, how would I go about excepting Human Leather from the ingredients?  The leathers are dynamically generated, so I don't think <exceptedThingDefs> will cover them.

Dingo made this, which explains the function of many XML defs:
https://github.com/RimWorldMod/RimworldModdingFiles
Disclaimer: it was written in A15. Many of the tags should still be the same, but some have changed. ThingDefs are super extensive, so he hadn't gotten that far. I don't think he has plans to continue updating in the near future. I don't remember if anything in RecipeDefs changed in A16, but I don't think so.

Milon has done some auto-documentation:
https://ludeon.com/forums/index.php?topic=21440.0

Between those two resources, I often find what I'm looking for, or at least a pointer towards a Core file that does something like what I'm trying to do.

I dunno about the Human Leather. I would assume if you can identify what the auto-generated name is (LeatherHuman or whatever), it would still work in the exceptedthingdefs, but I haven't played with that.
Tam's tiny mods: forum thread: Kitchen Counters and other shelving *** Smoked meat *** Travel rations: MREs *** Pygmy Muffalo

Shinzy

Quote from: Tammabanana on February 05, 2017, 08:11:10 AM
I dunno about the Human Leather. I would assume if you can identify what the auto-generated name is (LeatherHuman or whatever), it would still work in the exceptedthingdefs, but I haven't played with that.

Tamma's suggestion is def worth a try

Also there's probably a better way to find this info but I found you can see the thingdefs for leathers (and everything else) by opening your savefile with notepad.
It'll list all the thingdefs of items currently on your map so make sure you've butchered some visitors from township-by-the-brook raiders first

And just to be overly annoying: the easiest way to find the save files is through ingame options where you can find 'Open save data folder' button :p

Hans Lemurson

Thanks  for those resources!  They were a big help in sorting out my last little issues.

Human_Leather seems to be a valid thingDef to use in <exceptedThingDefs>.  No error reports and "Human Leather" doesn't appear as a valid ingredient!

I added a recipe that turns 10 leather into 10 Stitched Leather, and another special one for the Crafting Spot that just does a 1x batch in case you're stuck with remainders.

Mod complete!
https://github.com/HansLemurson/Stitched-Leather

Mental break: playing RimWorld
Hans Lemurson is hiding in his room playing computer games.
Final straw was: Overdue projects.