RimWorld

RimWorld

112 ratings
Clonebay
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.0, 1.1, 1.2
File Size
Posted
Updated
12.604 MB
Aug 16, 2019 @ 2:09pm
Apr 18, 2021 @ 3:27pm
5 Change Notes ( view )

Subscribe to download
Clonebay

Description
This mod is deprecated.

Clonebay is a simple, streamlined way to resurrect dead colonists. No muss, no fuss!

Features
  • Automatic, instant resurrection of any colonist that has been suitably prepared with a special implant prior to death!
  • EVERYTHING is carried over! Skills, traits, passions, name, appearance, relationships and even the colonist's log tab will be preserved!
  • Balanced - there's no way for you to create a clone army, and the implants needed to resurrect a colonist can only be found from exotic goods traders or quest rewards. Even then, there's no guarantee it will work - if the colonist dies from decapitation, brain destruction, collapsing mountain roof, or anything else that renders the brain unscannable... they aren't coming back.
  • Alien Races compatibility! Clonebay should be capable of resurrecting any non-human colonists. I've tested a few races, but if the one you use cries bloody murder when Clonebay tries to resurrect them, let me know.

Guide

To get started, you'll need a hi-tech research bench, a multianalyzer, and the Biofuel Refining tech.

Once you've got that, head to the "Clonebay" research tab and start work on "raw biomass refinement." Raw biomass is the fuel clonebays consume; it takes 100 units of it to clone one colonist, and it can be refined from any sort of raw food. The recipe requires 5 nutrition, which is equivalent to 100 units of regular meat, and produces 100 raw biomass in return.

Once that's unlocked, start "neural scanner implantation." This unlocks the surgery to implant neural scanners in colonists; it needs a doctor with level 10 in medicine or higher, plus three industrial medicine. Neural scanners can be acquired from exotic goods traders and quest rewards, and are required if you want to resurrect colonist(s).

While that's running, I would recommend you get started on raw biomass production. A clonebay can hold 1000 units of raw biomass, and it's in your best interest to keep it topped up; if a colonist dies and no clonebay has enough fuel, they'll be dead forever. For a start, I would make 500 units.

After you finish researching scanner implantation, move on to researching the clonebay itself. Once that's going, I would recommend you start implanting your favorite/most valuable colonists, if you haven't already. If you get that done now, those colonists will be protected the instant the bay comes online.

When you're ready, build the Clonebay in a secure area (like a Hospital, or dedicated cloning room deep in your base) and fuel it up. That's it! Implanted colonists will now automatically be resurrected upon death!

Futher Info/Tips:
  • Organic neural scanners is a significant research investment, but it's well worth it; resurrected colonists will automatically have a brand-new neural scanner installed, eliminating the time and cost involved in acquiring a new implant.
  • Implanted colonists who die in a caravan or on another map without a clonebay will not be resurrected; their scanners don't have enough power to transmit their genome and brainmap all the way back to your main base.
  • Colonists who die in a way that makes their brain unreadable, such as through decapitation, brain destruction, mountain collapse crushing, etc. will not be revived by the Clonebay. This is partly a design choice and partly a technical limitation; see "Technical Details" below if you're interested.
  • Build multiple clonebays if you have a lot of implanted colonists on the front lines. If multiple implanted colonists die simultaneously, due to say, a rocket launcher, only one will make it through if you have only one clonebay.
  • Transhumanists will get a large mood buff upon resurrection. Regular colonists will get a minor mood debuff. Body purists will get a large mood debuff.

Technical Details

WARNING: NERD STUFF. If you don't care, feel free to ignore it.

The code behind this mod probably doesn't work the way you think it does.

Chances are, if you thought about it at all, you probably assumed that it made an entirely new pawn and transferred all the data from the old one into the new one. And that's a perfectly reasonable assumption!

However, it's not quite correct. The bay does create a new pawn, and it does transfer the data of the old pawn to it, except for one key thing - relationships. It's impossible - as far as I can tell - to transfer relationship/social data from one pawn to the other. Without this data being transferred, the resurrected colonist will be treated as if they were a totally new member of the colony. This is unacceptable.

So how did I get around this? After all, I do promise transfer of relationships above.

The solution is both absurdly stupid and absurdly simple.

Once the new pawn is created, it is killed via code before being teleported out of the bay and into the location of the original's corpse. At the same time, the original is resurrected via debug commands, teleported into the bay, cleaned up (Hediffs removed, age rewound, resurrection thoughts added) and subsequently ejected. This all happens in a frame or two, creating a seamless illusion that supports the whole "cloning" premise of the mod. Credit for this brilliant idea goes to "Jamaican Castle" on the RW Discord's #mod-development channel.

This whole trick does have one key flaw; if an implanted colonist dies in such a way that they leave no corpse, they won't be resurrected. Originally, this was a huge problem - the neural scanner at the time was a "whole body" Hediff, and therefore the pawn would be resurrected even if they lost their brain or head.

I spent quite a while trying to figure out a workaround, until I realized that it would probably make more sense to have the neural scanner be a brain-specific implant - sure, it meant that if the brain or body was destroyed somehow, the resurrection wouldn't happen, but I figured it made more sense that way and ensured that the implant wasn't just a guaranteed ticket to eternal life.

Credits

If you couldn't tell just by the clonebay texture, this mod is actually a heavily modified fork of ChJees's Questionable Ethics, now superseded by Questionable Ethics Enhanced. All I did was strip out most of the code, modify the cloning process and clone vat, and write some Harmony patches to kick off the resurrection process. Basically, the code is 90% his and 10% mine. Don't worry - this mod is fully compatible with QE and QEE.

I'd also like to thank everyone on #mod-development, and more specifically Mehni, erdelf and dninemfive for helping me out with the really complicated C# stuff.

Other Stuff
  • IF YOU USE EPOE, MAKE SURE TO LOAD CLONEBAY BEFORE EPOE!
  • If you enjoy Clonebay, make sure to give it a thumbs-up so the workshop algorithm will give it some time in the limelight. Thanks!
  • This is my first C# mod, and while I've debugged it thoroughly, it's almost certainly inevitable that bugs will pop up. If this is the case, let me know in the comments (including any relevant error messages, etc), and I'll push out a fix as soon as possible.
  • Github link for non-Steam players here[github.com]