[B19] Reclaim Reuse Recycle - Harvest & reuse Corpse parts

Started by DoctorVanGogh, August 26, 2017, 08:43:36 AM

Previous topic - Next topic

DoctorVanGogh


Reclaim, Reuse, Recycle

Rimworld mod that allows extracting added parts (aka Bionics, Peg legs, etc) & implants from corpses.

This mods basically adds two types of jobs/recipes:

  • A set of "Harvest corpse" jobs at the Butcher & Machining Tables which will try to extract all recoverable artificial body parts.
  • A set of "refurbish" type jobs on the Drug Lab which will transform extracted parts into fully reusable body parts again.
There are research projects unlocking the different jobs.

Installation
Subscribe on Steam
Get the mod from the github project page.

Changelog

Version 0.19.1.4:
- B19 release
- Improved Textures by Syrchalis

Version 1.0.1.4:
- 1.0 unstable support

Version 0.18.1.3:
- B18 support
- New versioning scheme (game-major.game-minor.mod-major.mod-minor)...
- Harvesting & Refurbishment are now done at dedicated workbenches.
Those benches have a massive bonus to workspeed & harvesting success chance if installed adjacent to each other.
(Textures not 100% final)
- Harvesting & Refurbishment are their own dedicated work types (located under Crafting).

Version 1.0.1:
- Non corpse corpses are no longer valid harvesting targets. No more carving up shellfish looking for implants.
- Removed the specialized workGivers for harvesting. For the time being harvesting will count as butchering/crafting.



Basic concepts

Extracted part status

Reclaimed parts (which can be any added part or implant that could be removed from a corresponding live pawn) are either extracted in a non-sterile or mangled variant. Undamaged (or slightly damaged) parts are extracted as non-sterile, while moderately damaged parts get extracted as mangled versions. The thresholds for non-sterile/mangled/no extraction can be changed in the mod options. (Defaults are 100%-85%: non-sterile, 85%-50%: mangled, otherwise: non reclaimable).
Non-sterile parts only need the part and medicine to be usable again, while mangled parts need additional material(s) for restoration.



Non-SterileMangled

Extracted part 'Complexity'

Parts are categorized by Complexity (a visible stat on the reclaimed part). Available levels are

  • Primitive
  • Advanced
  • Glittertech

This complexity is derived from the extracted part by internal tags, techlevel or ultimately price and should account for all mod-added parts.
Each complexity level corresponds to the medicine (and possibly other materials) needed to make the part usable again. Primitive needs Herbal Medicine (plus wood/cloth), Advanced uses regular Medicine (plus steel/components) and Glittertech requires Glitterworld Medicine (plus components & plasteel).

Harvesting Jobs

Extraction is a composite job that will always try to remove all possible parts in a corpse.
The extraction can fail and that failure is calculated per part. Failures work similar to surgery and are in fact calculated from the surgery/mechanoid extraction success chance of the executing pawn. Success chance is multiplied by 1.5 compared to regular surgeries to accomodate for the composite nature of the harvesting job as well as the lack of 'supporting' medicine (Room stats still apply for biological harvests).
A minor failure will typically still allow extraction of a (mostly) undamaged part, while catastrophic failure will almost certainly destroy the part.

Changes to vanilla behavior

This mods adds special filters to the corpse categories for fully harvested corpses and corpses with parts of a certain complexity.
Harvested corpses contain no reclaimable parts, while Unharvested corpses ultimately could have (some) parts removed.
The vanilla Butcher corpse job get's changed to only use Harvested corpses by default. If you want to make it use any corpse, make sure to activate Unharvested corpses too (but why would you?).

Compatibility

Mod load order should not matter for this mod. It also should support any and all additional parts from 3rd party mods.
Quote from: SpaceDorf on August 05, 2017, 10:24:05 PM
from experience I have no conflicts with :
XeoNovaDans Surgery Tweaks, Better Surgery,Birds and Bees,  Children and Pregnancies, DESurgeries, RBSE-Hardcore, Epoe, ADogSaid, EPOE Limb Harvesting, Harvest Everything, JTFieldSurgerie, More Consumables and Mutagens, Malfunction, Mod Medicine Patch, Quality Surgeon, sd_medicaddons, fluffies medical tab and of course :

Ushanka!

what I have not tried so far is Craftable Mutants and the Extended Human Body Simulation but since it is based on epoe ..

-----

@Doc you may quote me on that and refer all complaints to me.

While the complexity might not be 100% as expected for 'weird' extra parts it will always guess something and thus allow reclamation & reuse of the part(s).

Some remarks:

I've decided against simply 'vomiting' out the final usable bionics directly in the harvesting job, since that makes bionic acquisition way too easy. But now with this mod you have the option to reclaim those parts you want - or if you feel like making a recycling industry out of your raiders, you can do that - it's just a bit more involved than 'Click, get bionics' .


Bugs & issues

Please report any errors or issues here or on the github issue tracker.

License:
This mod is licensed under CC BY-NC-SA 4.0
Appreciate my mods? Buy me a coffee

DoctorVanGogh

Seems this thread does not show on the board overview after being moved - let's correct that ;)
Appreciate my mods? Buy me a coffee

tonsrd

yay its moved to release ( congrats ill delete old version and install new one )

ps: does ur mod work with this one ? to extract these odd parts from raiders ? ( rim gen )

https://ludeon.com/forums/index.php?topic=35158.0

I

DoctorVanGogh

Honestly - I have no fricken clue if it works with this or that mod ;D

It is designed to work with any mod that adds implantable parts (stuff where you could get an 'install XYZ' or 'Remove XYZ' operation). It also does not destroy corpses on harvesting (well, except maybe, possibly if your pawn fails in a ridiculous way and tries to remove that eyepatch with a chainsaw - what did you expect to happen?).

So - here you have my 100% vote on mod compatibility: Maybe? ;)
Appreciate my mods? Buy me a coffee

firestrock

Quote from: DoctorVanGogh on August 26, 2017, 08:43:36 AM
Extraction is a composite job that will always try to remove all possible parts in a corpse.

Does that mean all parts (even natural organs like liver, lungs, etc.) or just all added parts like bionics and peg legs and whatnot?

DoctorVanGogh

This mod only ever works with artificial parts. I had to add specific code to exclude natural organs ;)
Appreciate my mods? Buy me a coffee

firestrock

#6
Quote from: DoctorVanGogh on August 27, 2017, 09:42:56 AM
This mod only ever works with artificial parts. I had to add specific code to exclude natural organs ;)

Hmm, I'll see if I go with your balancing or find and eliminate that code ;)

I've tested your mod for a few hours and here's what I found:
Having the harvesting job be a doctoring work type leads to colonists butchering (vanilla bill) even though they're not assigned to cooking. I know where you are trying to go with the harvesting being of the doctoring work type, because it's basically surgery on dead patients, but this leads to designated doctors always harvesting and butchering corpses. Maybe the work type for the harvesting should be cooking (butchering) but requiring a certain level of doctoring, depending on the tier. I didn't have the opportunity to test this with the machining table yet but it looks like it'd be the same issue there too.
Steps to reproduce:
- Set up a butcher table
- Have one colonist be asigned only to doctoring
- Set up a 'Butcher creature' bill on the work table
- Colonist will butcher the creature for meat

Second bug, or rather incompatibility: The mod Basic Bridges adds fish and shellfish to the game that colonists will try to harvest. Upon finishing the job, the fish corpse will disappear and yield nothing. I don't know if it's the same with mega fauna and other mods that add animals, but you'd think it is.

Otherwise it's a great idea. With an option for the not-so-balance-focused people to enable natural organ harvesting it would be the mod that I have been searching for since A14.

DoctorVanGogh

Well poop..... I thought I had eliminated that issue with the duplicate work types.....

Okay - seems I'll have to go back to where you need to enable cooking for your doctor....  (Or rather, grab Fluffy's work tab and just enable the harvest subtypes for cooking but still...).

As for the fishy stuff - you're the second person to report on this issue.. Seems I'll have to take a closer look.

Appreciate my mods? Buy me a coffee

firestrock

WorkTab is actually what I came up with like thirty seconds before reading this  ;D
It's a bit... buggy atm, because there's a metric shitton of work types listed there and it all overlaps, but it works  ::)

The thing with the fishes is more of a minor annoyance because you can exclude them from the allowed corpses but if it's not too much work it would be nice if they were not there in the first place.

I'll be keeping an eye on my colonists and see whether I can find anything else. Seems good so far but I have ~180 mods installed so there might be some things that didn't happen yet.
Anything regarding the 'easy-money button'? Or did you not respond to that on purpose?  :'(

DoctorVanGogh

Okay... regarding the fishes. I've found the cause and sadly there's not a lot I can do about it without some Rube-Goldberg-esque contraption. Which ultimately is not worth it.

Seems RBB wants its shellfish categorized as Corpses. But they aren't.

Neither according to its definitions nor the game. But they're lobbed in as corpses.

So now my harvesting jobs who want a corpse (with certain parameters) gets something else entirely and.... "does stuff"... which leads to .... "weird stuff"....

Easiest workaround from a user perspective: Manually disallow the whole "Shellfish corpses" category for harvesting jobs.
Workable way forward: Get RBB to categorize the shellfish as meat (or "raw food" or whatever - which might have implications for cooking recipes, but that's not my problem :D). Because I can see issues for any recipe that wants to work on corpses. There's some special patching code for the regular vanilla butcher job in there, but that's just one recipe out of a potentially infinite number.

So yeah: Crayfish are weird food.... as are snails... and crustaceans in general...

Also: The worktype patch may take a bit - I might solve this with a dedicated harvesting/refurbishment workbench. That would solve both the job misalignment and the double worktypes.
But it also requires me doing art.... which.... takes time - at best ;)
Appreciate my mods? Buy me a coffee

tonsrd

Quote from: DoctorVanGogh on August 27, 2017, 03:53:24 PM
Okay... regarding the fishes. I've found the cause and sadly there's not a lot I can do about it without some Rube-Goldberg-esque contraption. Which ultimately is not worth it.

Quote from: firestrock on August 27, 2017, 01:29:47 PM
Quote from: DoctorVanGogh on August 27, 2017, 09:42:56 AM
This mod only ever works with artificial parts. I had to add specific code to exclude natural organs ;)

Hmm, I'll see if I go with your balancing or find and eliminate that code ;)

I've tested your mod for a few hours and here's what I found:
Having the harvesting job be a doctoring work type leads to colonists butchering (vanilla bill) even though they're not assigned to cooking. I know where you are trying to go with the harvesting being of the doctoring work type, because it's basically surgery on dead patients, but this leads to designated doctors always harvesting and butchering corpses. Maybe the work type for the harvesting should be cooking (butchering) but requiring a certain level of doctoring, depending on the tier. I didn't have the opportunity to test this with the machining table yet but it looks like it'd be the same issue there too.
Steps to reproduce:
- Set up a butcher table
- Have one colonist be asigned only to doctoring
- Set up a 'Butcher creature' bill on the work table
- Colonist will butcher the creature for meat

Second bug, or rather incompatibility: The mod Basic Bridges adds fish and shellfish to the game that colonists will try to harvest. Upon finishing the job, the fish corpse will disappear and yield nothing. I don't know if it's the same with mega fauna and other mods that add animals, but you'd think it is.

Otherwise it's a great idea. With an option for the not-so-balance-focused people to enable natural organ harvesting it would be the mod that I have been searching for since A14.

Neither according to its definitions nor the game. But they're lobbed in as corpses.

So now my harvesting jobs who want a corpse (with certain parameters) gets something else entirely and.... "does stuff"... which leads to .... "weird stuff"....



I use this https://ludeon.com/forums/index.php?topic=33083.0

you can set a lvl for a person doing the job
aswell as which colonist can do the job. ( and displays there lvl )
med and cook lvl at butcher.

for other work benches it lets u pick how things get counted ( make until 10 "normal+" for example )

firestrock

Quote from: tonsrd on August 27, 2017, 07:54:09 PM
I use this https://ludeon.com/forums/index.php?topic=33083.0

See... I use this too (to be fair, with 186 mods installed there's hardly a mod I don't use) but that doesn't fix your problem when your designated doc is also your butcher. And gardener. And hauler. And the only person alive because everybody else totally didn't die of dehydration! (Borderlands 2, anyone?)

Anyway back to the fishes!
Quote from: DoctorVanGogh on August 27, 2017, 03:53:24 PM
with certain parameters
What parameters are we talking about exactly? And can't you just create a method "hasHediffAddedPart" that checks the corpse for... well a hediff of the "addedPart" type before processing it? That would fix this, wouldn't it? If this is total nonsense then forgive me, I don't know anything about Rimworld's inner wiring, but since you know which added parts a corpse has after you're done harvesting it (to know which items to drop), you also gotta know it beforehand, right?.

dburgdorf

Quote from: DoctorVanGogh on August 27, 2017, 03:53:24 PMOkay... regarding the fishes.... There's some special patching code for the regular vanilla butcher job in there, but that's just one recipe out of a potentially infinite number....

Both fish and shellfish in my mod ("Basic Bridges") are corpses that don't happen to have live pawn analogues, since it's never possible to encounter them in the game until after they've been caught and killed, anyway.

As I already noted on the thread for my mods, there's no "special patching code" regarding shellfish for the butcher job, and none is needed. Like most recipes that utilize corpses, the butcher job has no problem at all with the corpses in my mod.

The "patch" being referenced does nothing more than exclude shellfish from the butchering recipe because they're not intended to be butchered and wouldn't yield anything if they *were* butchered. (And that has nothing to do with how they're defined as corpses, and everything to do with the fact that they lack any defined butchering products.) Fish, which are defined as corpses in exactly the same way as shellfish, can be butchered just fine.

The problem that users of "Reclaim Reuse Recycle" are encountering has very little to do with how my corpses are defined as corpses, except incidentally. It derives from the fact that the code in RRR assumes without checking that any corpse has a live pawn analogue.

(In fairness to DoctorVanGogh, that assumption is actually quite reasonable within a purely vanilla context.)

Quote from: firestrock on August 28, 2017, 12:13:18 PMAnd can't you just create a method "hasHediffAddedPart" that checks the corpse for... well a hediff of the "addedPart" type before processing it?

That's essentially the suggestion I made to DoctorVanGogh, myself.

I'm going to go ahead and recategorize shellfish as raw food in the next "Basic Bridges" update, as it makes sense to do so, but that won't fix potential problems in RRR as regards fish corpses (or corpses potentially added by other mods that similarly don't have living animal analogues). The real fix for the issue being discussed here is what ought to be a pretty simple conditional in the RRR code that checks to make sure a corpse being used in the recipe actually has a matching "pawn type" with the expected attributes, and rejects it if it doesn't.
- Rainbeau Flambe (aka Darryl Burgdorf) -
Old. Short. Grumpy. Bearded. "Yeah, I'm a dorf."



Buy me a Dr Pepper?

DoctorVanGogh

Nice of burgdorf to check in here - in the end I agree that's it's an issue I could should work around in a defensive way. Also nice of him to reclassify his fishes as food :D

I've pushed version 1.0.1 to github. If I get no (unexpected) error reports steam will follow in a day or two.

Changes

  • Non corpse corpses are no longer valid targets for harvesting. Sorry dear shellfish and snails - we don't want your implants ;)
  • Harvesting is no longer a special work subtype. For the moment it's categorized under Cooking (specifically butchering) & Crafting.
    This might lead to errors on load for existing saves if a pawn is currently trying to execute a harvesting job. This error should simply reset itself. If pawns act weird, simply draft/undraft them - that should reset their jobs. Sorry about that.

Appreciate my mods? Buy me a coffee

MajorDam

QuoteHarvesting is no longer a special work subtype. For the moment it's categorized under Cooking (specifically butchering) & Crafting.
This might lead to errors on load for existing saves if a pawn is currently trying to execute a harvesting job. This error should simply reset itself. If pawns act weird, simply draft/undraft them - that should reset their jobs. Sorry about that.

Hello DoctorVanGogh,

I've just got this problem after updating to the new version of the mod. My pawns were all in their beds and their hauling priority were not high either in their work schedule ( 7 and 8 with worktab mod from fluffy). I touhgt that it was a good time to update the mod. I save, make the update then after that (and one mistake later, you'll see why after) impossible to haul anything. The game didn't recognize an available storage anymore for everything I wanted to haul basicaly (wood, chunks, food 100% sure, didn't check everything, but you got the point). At first sight I didn't understood what was the problem since nobody was actually hauling anything when I load my save, neither it was on their to do list after their wake-up. After a close check I saw that there was a single chunk of granite that still had a manual hauling demand in pending. Maybe this is what has been problematic druing the update ??  At this point, drafting and undrafting my pawns didn't change anything. I let 2 days past in game without any improvement... Yeah, and like a bad news doesn't come alone, I've made the "famous" mistake to save my game on the same file just after the update since I tought to be okay according to your instructions, plus, I took a look at the debug console just before saving and there was no error so far (I tough there is no reason for a problem to occur, "let's save and play now" ::)). Well I screwed up my gamesave...almost... because I installed back the first version of the mod instead in a desperate attempt and it worked. I'm able to haul again like before >.<

During a couple of minutes I was afraid to have committed the irreparable.

All that story only to say this: Please, I kindly advise you to insist on this warning and on the potential problem you can have if  there is a pending order to move manualy some stuff, so other people would not encounter the same problem as me. May I suggest the use of bold and red ?  ;D

Regards ! and thank you for the mod otherwise !  ;)