Clonebay

MOD Desc
NOW COMPATIBLE WITH 1.1 (Thanks, Shadow Seeker!) 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]


  • Not sure if this is a bug, a feature, or some outlier. I had a machine body trans-humanist die (from implant surgery ironically) and successfully return via clone. However, the clone did not have the various bionic implants of the original (would not expect it to) and the original body only had ‘brain scanned’ and ‘neural scanner’. When the body was harvested the organs were all the standard organs one might expect a non-upgraded pawn to have. Mod functioning as expected otherwise and has saved the lives of about a dozen pawns so far (some more that once). Thanks for this useful mod.
  • Ah, yes. That would make sense. If you take a look at the ‘technical details’ section, you’ll see that the pawn you harvested is not actually the original. Instead, its a copy of the original pawn that, for the most part, is totally identical, except for relationships and Hediffs (health stuff.) The original pawn – the one that died in a raid, or whatever – is actually just teleported, resurrected, and patched up before coming out of the bay. Doing this was necessary to preserve the relationships/social opinions of the original pawn.However, yes, I do see how that could cause problems if you have a corpse disassembly mod installed. I’ll take a peek into transferring Hediffs, but I can’t make any promises. Even if it does work, I might have to refrain from adding it if it enables bionic farming or something similar.
  • Sorry about that – Gradual Relations Decay had ceased working for unknown reasons and I currently cannot make it function again, so I’m recommending that everyone who used that use the Faction Control mod (which grants control over the decay). Turrets Aren’t Bombs needed a significant rework to include other common turret mods and implement the changes using the standard patch system rather than my original clumsy methods, and should return to the Workshop soonish.
  • Well yes, they’ll still have the knowledge they had before (which is basically none). You can set the age at which they can attend school higher in the mod settings though, so that they can try and keep up regardless. I never claimed that this was beneficial for their education, or mental health at that!The part where all bionics and implants are gone from the clone also makes for a lot of new applications on its own. The only way I know to remove implants and even certain diseases.
  • Nice, just like the clone bays in eve. you pay the resource required to scan you brain at regular intervals to keep skills up to date. and if you dont scan regular enough you will lose the skill progress.My only note on this is it might be worth using a mix of compononts/advanced components glitterworld medicine / medicine required for the scan proceduregood job, well credited and well explained. this is why i love this community =)
  • Put Clonebay at the top of your modlist; there’s a known issue with other mods (including EPOE) that requires Clonebay to be loaded first so other mods can pick up on its data.The dead pawn has no relations. If you were to revive him he’d be a blank slate colonist – unfortunately I couldn’t find a way to stop people from reviving the corpse pawns, but it is dissuaded by the fact that the corpse pawns have no skills.

Leave a Reply

Your email address will not be published. Required fields are marked *