Adjusting Products (updated: now trying to get list of body parts on pawn)

Started by theubie, May 06, 2015, 06:26:21 PM

Previous topic - Next topic

theubie

I'm looking at the decompiled code for RecipeWorkerCounter and RecipeWorkerCounter_MakeStoneBlocks but I'm not seeing a way to actually get access to the specific ingredent(s) being worked on.  Perhaps I'm looking in the wrong place?  Anyone have any experience in this?

I want to change what is produced based on ingredients (in this case, the recipe has one ingredient). 

soltysek

no its not one indigrents fixed set but a category of indigrients and in this case they use butchery system so ... in various stone xml you have crafting resoult definition :
<butcherProducts>
      <BlocksSandstone>20</BlocksSandstone>
    </butcherProducts>


so if you are intrestet in making similar one
first you need to check buthery code where all magig is going on
secend it will be tricki to use but yeah its posible to adopt and modifi this system

pls provide some more information about then i will be avaible to say more

theubie

In this case I was trying to make a workbench that would allow a person to harvest implants/prosthetic/body parts from fresh corpses, but I abandoned that track and instead am working on making an extension method to the Pawn class, similar to Pawn.Strip(), that does the same thing.

RawCode

MakeRecipeProducts is not virtual and static, there is no "easy" way to hook it directly.

also that method do not support custom specialproducts, soo you can't make new specialproduct and handle output in your class.

you will need custom JobDriver_DoBill to perform your recipes inside your own code.

skullywag

Yeah thisll need a full job coded yourself to check the "innerPawn" of the corpse, find all the body parts and remove them.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

theubie

Quote from: RawCode on May 11, 2015, 12:01:52 PM
MakeRecipeProducts is not virtual and static, there is no "easy" way to hook it directly.

also that method do not support custom specialproducts, soo you can't make new specialproduct and handle output in your class.

you will need custom JobDriver_DoBill to perform your recipes inside your own code.

Quote from: theubie on May 10, 2015, 03:37:22 AM
In this case I was trying to make a workbench that would allow a person to harvest implants/prosthetic/body parts from fresh corpses, but I abandoned that track and instead am working on making an extension method to the Pawn class, similar to Pawn.Strip(), that does the same thing.

I'm aware of MakeRecipeProducts not being able to do what I'm working on.  I've dropped the idea of using a recipe completely and instead am writing it to work the same as stripping a corpse.  A little more meatball surgery, but I've got most of it figured out.  My main problem is I'm not completely sure how to get a list of all parts on the Pawn.  I'm a bit confused on how the whole Hediff/Body Part system works.  As a place holder, I just have it popping out two eyes, two lungs, and a heart so I know it's working in my test code. 

I want to figure out exactly which parts are on the corpse (both natural and artificial) and their damages so that I can a) remove them from the Pawn and b) spawn appropriately damaged parts.  All of this is in a new extension on the Pawn class, so I can just call it via the innerPawn method off the corpse after checking if the corpse is "fresh" or not.  Just, like I said, I'm completely confused on how to get a list of body parts, pref as BodyPartRecord classes.

skullywag

Theres some code in my autoheal casket mod (part of omnipack now) see if that helps, if not ill see if i cant dig out the code you need. Ive done this before.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

theubie

Quote from: skullywag on May 12, 2015, 04:05:23 AM
Theres some code in my autoheal casket mod (part of omnipack now) see if that helps, if not ill see if i cant dig out the code you need. Ive done this before.

Bueno, I'll take a look at it!

Edit:  That directed me perfectly on how to get a list of parts like I needed.  Unfortunately, it looks like I can't seem to make the corpse have an attached job like strip (which comes up when you have a pawn selected and right click on the corpse).  Looks like I will have to go via the work table route, but I am pretty sure I can figure that out.  At least, I hope I can.