RimWorld

RimWorld

47 ratings
Custom Butcher Framework
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.3, 1.4
File Size
Posted
Updated
335.338 KB
13 Aug, 2022 @ 5:43am
8 Oct, 2022 @ 7:04am
9 Change Notes ( view )

Subscribe to download
Custom Butcher Framework

Description
This is a modding library, it adds no new content to game. But it provide a mod extension for customizing what your animal would yield when you butcher it.

Which means you can make mushroom man from dark souls, a luxurious breed of cattle that yield many different cuts and parts, even lithoid, a living rock that yield mineral when enslaved as livestock in Stellaris.

Why?
In vanilla, meat is auto generated by fleshDefs or something like that, I'm not Tynan nor a coding expert so I don't know exactly how it works. Anyway the meat from animals is hard-coded and its properties cannot be changed.

You might ask there are walking cactus in Alpha Animal and they yield plant meat which's considered as veggie and manchicken from VGE has cursetom crispy meat. They are harmony patched in a hard-coded way, basically they check if the defName of the butchered animal is matched, then they took the first <thing> in <butcherProducts> and calculated the result.

TL;DR, Vanilla expanded team also hard-coded those custom meat generation.

Why not just use <butcherProducts>
Using <butcherProducts> yield a constant amount of resource no matter what, a fully-grown beast would yield the same as a newborn cub. That doesn't make sense, right?

How to use?
Update, after further inspection, I finally figured out how to make it looks like vanilla <butcherProduct> tag, so you don't have to match number and ThingDefs, sorry in advance if this mess up your mod development

adding the following code to ThingDef:
<modExtensions> <li Class="CustomButcherFramework.CustomButcherExtension"> <customButcherProducts> <ThingDef1>NumberYouWant1</ThingDef1> <ThingDef2>NumberYouWant2</ThingDef2> <ThingDef3>NumberYouWant3</ThingDef3> . . </customButcherProducts> </li> </modExtensions>

There is an example:
<ThingDef ParentName="AnimalThingBase"> <defName>TestPig</defName> (labels, attributes, stats, etc.) <modExtensions> <li Class="CustomButcherFramework.CustomButcherExtension"> <customButcherProducts> <Steel>100</Steel> <Milk>200</Milk> </customButcherProducts> </li> </modExtensions> </ThingDef>
This mean this creature called testpig would yield 100*1.7(bodysize) = 170 steel and 200*1.7=340 milk when butchered, but a baby testpig would only yield 100*0.34 = 34 steel and 200*0.34 = 68 milk.
Also the library detect if the animal is violently murdered by checking if there's any part missing, such method is not perfect as your animal would be consider damaged if they missed some part before butchered by colonist, resulting crippled and cybernetic-enhanced animal yield much less resource.(BTW if you don't know, In vanilla if animals were not killed by butchering will yield 1/3 less meat and leather)
There is the full example def in mod file for how to use the extension, also the custom resource won't be display on pawn information.

Update! again
Don't worry, this time only adds some optional functions, which shouldn't mess up your mod.I add 6 different tags to the assembly:

<spawnChance>
<maxAmount>
<productFluctuation>
<damagedBodyPartThreshold>
<damagedMultiplier>
<wasteIfDamaged> new function since August 13
<wasteIfNotAdult> new function since August 17

These function would be explained in discussion section.

FAQ
Q1: Does the mod affect normal meat generation?
A: No, they can be used togather, if you want to create a wagyu that yield both normal meat and prime steak, you can do that.

Q2: How many custom resource can be put in the extension?
A: As many as your computer can handle.

Q3: How about vanilla <butcherProducts> tag?
A: Unchanged, you can use them together with the mod.

Q4: May I use the library to make my mods?
A: Yes, as long as you follow the CC license below and maybe share your mod in comment section.

Q5: CE?
A: I don't see anything that would break it as the mod only add a modExtension class in game, but seriously...

Credit

Tynan Sylvester, creator of Rimworld.

Brrainz for HarmonyLib.

Epicfloor for C# coding and example.

(CC BY-NC-ND 4.0)[creativecommons.org]



Would you like to make a donation? It will be greatly appreciated.
[ko-fi.com]
Popular Discussions View All (1)
0
17 Aug, 2022 @ 12:46am
PINNED: Optional function explanation.
epicfloor
22 Comments
ProfileName 16 May @ 5:31am 
RimPy screams about this mod when you use "More Animal Products." You only need this mod if you're on 1.4, so.
heymegalodon 11 May @ 3:59am 
Really needs 1.5 update
gunns22 29 Apr @ 9:35am 
@epicfloor any news on the 1.5 update?
Fuzzy Pickles 26 Apr @ 4:59pm 
Hello, do you have plans on updating this to 1.5?
that bird guy 11 Apr @ 11:31pm 
1.5?
awdiaf 10 Jun, 2023 @ 3:13am 
pansexual muffalo
epicfloor  [author] 7 Dec, 2022 @ 8:44am 
It's only work on pawns probably, 'cause I use Harmony patched the butcherProduct method to produce custom products, unless you can somehow utilize butcherProduct method to 'butcher' something that is not a corpse, As for multiplicative part I'm not sure about that.
Holgast 7 Dec, 2022 @ 1:12am 
dumb question - does this only work on animals? I wanted to use it like vanilla does for the any stone blocks recipe
Holgast 7 Dec, 2022 @ 12:12am 
if not, no worries, I can fluff it with the output of the bulk recipe being the minimum, so if you want a chance at better stuff you can use the butcherproduct recipe
Holgast 7 Dec, 2022 @ 12:07am 
question - is this multiplicative as well? like, if I have a thing that will butcher into x and sometimes y things, but I want to have a bulk recipe for it, is it possible to set that up so it will have all the products at the same rates, but with multiplied output for the bulk recipe?