Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloning Refactor #735

Merged
merged 34 commits into from
Sep 2, 2024
Merged

Conversation

VMSolidus
Copy link
Member

@VMSolidus VMSolidus commented Aug 15, 2024

Description

Since Cloning code is effectively abandonware by it's original codeowners, and I was the last person in this entire game to update it, I am technically the codeowner of Cloning. And by extension, it's also my responsibility to maintain the Cloning code. I've been putting this off for awhile due to how busy I've been with other projects, but since I'm now waiting on all my other refactors to be reviewed, I decided to finally sit down and comprehensively refactor Cloning.

In addition to massive substantial code cleanup(Cloning machines no longer run on Frametime for one!), here's most of the changes.

  • Cloning Pods must be powered for the entire 30 second duration of the cloning process.
  • Said "30 second duration" is no longer hardcoded. Although no methods currently exist to reduce it. I plan on revisiting this after I bring back Machine Upgrading.
  • Cloning can now FAIL partway through. If the cloning pod is Depowered, Unanchored, or Emagged, it will automatically swap to the "Gore" state.
  • When in a Gore state, Cloning Pods will destroy the entity they were trying to clone, replacing them with a pool of blood and ammonia that scales with the mass of the entity that was to be cloned!
  • Clones come out of the pod with a significant quantity of Cellular damage, and are almost always in need of resuscitation. Consider using Cryogenics to "Finish" your clones. Doxarubixadone is literally named after this process, and is a perfectly suitable cryo chem for resuscitating clones.

Media

New gore sprites for the Metem machine, because it can now have gore mode.
Metem gore spites

Changelog

🆑

  • add: Cloning & Metempsychosis Machines have been refactored!
  • add: Cloning can now fail at any point during the cloning process, turning the would-be clone into a soup of blood and ammonia.
  • add: "Clone Soup" scales directly with the mass of the entity you're attempting to clone. Fail to clone a Lamia, and you'll be greeted with an Olympic swimming pool worth of blood when the machine opens.
  • add: Cloning will fail if at any point during the procedure, the machine is depowered, unanchored, or emagged.
  • add: Clones come out of the machine with severe Cellular damage. Consider using Doxarubixadone in a Cryo tube as an affordable means of "Finishing" clones.
  • tweak: Cloning Time is now increased proportionally if an entity being cloned is larger than a standard human(smaller entities are unchanged)
  • tweak: The cost to clone an entity can now be configured on a per-server basis via CCVar "cloning.biomass_cost_multiplier"
  • tweak: The Biomass Reclaimer can now be toggled to round-remove ensouled bodies or not via CCVar "cloning.reclaim_souled_bodies"
  • add: The effects of Metempsychosis now scale with a Psion's relevant caster stats. More powerful psychics are more likely to get favorable results from being forcibly reincarnated.

@github-actions github-actions bot added Changes: C# Changes any cs files Changes: Sprite Changes any png or json in an RSI Changes: YML Changes any yml files labels Aug 15, 2024
Copy link
Contributor

github-actions bot commented Aug 15, 2024

RSI Diff Bot; head commit de49b2b merging into 495d331
This PR makes changes to 1 or more RSIs. Here is a summary of all changes:

Resources/Textures/Structures/Machines/metempsychotic.rsi

State Old New Status
cloning_failed Added

Edit: diff updated after de49b2b

Copy link
Contributor

@DangerRevolution DangerRevolution left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CL isn't all "add" some of it is "tweak"
Lamia don't exist so that CL entry makes no sense

@VMSolidus
Copy link
Member Author

CL isn't all "add" some of it is "tweak" Lamia don't exist so that CL entry makes no sense

Then edit it yourself to make sense. You're a big boy maintainer.
faridaiscute

@DangerRevolution
Copy link
Contributor

DangerRevolution commented Aug 15, 2024

CL isn't all "add" some of it is "tweak" Lamia don't exist so that CL entry makes no sense

Then edit it yourself to make sense. You're a big boy maintainer

teach a man to fish and he eats for a day; give him fish and he eats for life

@VMSolidus
Copy link
Member Author

VMSolidus commented Aug 15, 2024

Lamia don't exist

THEY DO IN MY HEART, SHUT UP.

Content.Shared/CCVar/CCVars.cs Outdated Show resolved Hide resolved
Content.Shared/CCVar/CCVars.cs Outdated Show resolved Hide resolved
Content.Shared/Cloning/CloningPodComponent.cs Show resolved Hide resolved
@VMSolidus
Copy link
Member Author

Uncloneable now hooks into an AttemptCloningEvent, and cancels it, while also handing it a specific cancellation message. It also ignores the event if the CloningPod was a MetempsychosisMachine. In the future, x-Waveform Misalignment is going to cancel the AttemptCloningEvent if it's a MetempsychosisMachine.

@Mnemotechnician
Copy link
Contributor

It also ignores the event if the CloningPod was a MetempsychosisMachine

People choose unclonable exactly because they don't wanna be metemed, why take away that right from them?

@VMSolidus
Copy link
Member Author

It also ignores the event if the CloningPod was a MetempsychosisMachine

People choose unclonable exactly because they don't wanna be metemed, why take away that right from them?

Right...

@VMSolidus
Copy link
Member Author

THIS WAS LAST UPDATED 2 WEEKS AGO. PLEASE FOR THE LOVE OF GOD REVIEW THIS.

@VMSolidus
Copy link
Member Author

image

I've been making some improvements to the system for "Readability", namely by splitting off shittons of checks and cleanups into separate private functions. Which, when that caused issues with the CloningSystem.cs file being so very long and bloated, I then split it into CloningSystem.cs and CloningSystem.Utility.cs, the latter of which contains a body of the majority of all of CloningSystem's private functions. I notably did not include FetchAndSpawnMob in the Utilities file, because it's still a significant part of the "Main Body" of the cloning system, and is kept on the same page to maintain the logical "Flow" of the system.

Comment on lines +224 to +233
EnsureComp<SpeechComponent>(uid);
EnsureComp<DamageForceSayComponent>(uid);
EnsureComp<EmotingComponent>(uid);
EnsureComp<MindContainerComponent>(uid);
EnsureComp<SSDIndicatorComponent>(uid);
RemComp<ReplacementAccentComponent>(uid);
RemComp<MonkeyAccentComponent>(uid);
RemComp<SentienceTargetComponent>(uid);
RemComp<GhostTakeoverAvailableComponent>(uid);
_tag.AddTag(uid, "DoorBumpOpener");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It gets bigger every time I look at it... There needs to be a better solution.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only other alternative I can think of is to use the method that BuildAMimicWorkshop calls, but that method has a significant weakness in that it CANNOT be used with an Abstract or NoSpawn entity, so whatever "Reference Entity" is used to workshop all the "These are components a player character requires", must itself be a totally valid entity to spawn. Even then it won't work for Removing components, so we'd be bringing in an awful solution to replace 5 EnsureComps at most.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could... Technically add a trio of ComponentRegistries to the ClonePodComponent? CopyComponents, EnsureComponents, RemoveComponents?

Content.Server/Cloning/CloningSystem.Utility.cs Outdated Show resolved Hide resolved
Content.Server/Cloning/CloningSystem.Utility.cs Outdated Show resolved Hide resolved
Content.Server/Cloning/CloningSystem.cs Show resolved Hide resolved
Content.Server/Cloning/CloningSystem.cs Outdated Show resolved Hide resolved
Content.Shared/Cloning/CloningPodComponent.cs Outdated Show resolved Hide resolved
Content.Shared/Cloning/CloningPodComponent.cs Outdated Show resolved Hide resolved
Content.Shared/Cloning/CloningSystem.Events.cs Outdated Show resolved Hide resolved
Content.Shared/Cloning/CloningSystem.Events.cs Outdated Show resolved Hide resolved
VMSolidus and others added 2 commits September 1, 2024 19:46
@VMSolidus
Copy link
Member Author

8mb.video-wbK-wUTb9MPB.mp4

I have just now completed my ingame testing and bugfixing, and have now verified that the new Cloning System works.

@FoxxoTrystan FoxxoTrystan requested review from FoxxoTrystan and removed request for DangerRevolution September 2, 2024 05:55
Copy link
Member

@FoxxoTrystan FoxxoTrystan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making everything around Psionic, is really making me angry.

I WANT SCIENCE BACK, normal bluespace fucking science.
And EPI just a side of it!
aaa

anyway, code gud on my side, Cvars are nice.

@Elijahrane
Copy link
Contributor

Elijahrane commented Sep 2, 2024

Making everything around Psionic, is really making me angry.

I WANT SCIENCE BACK

both variants are literally reincarnation machines that operate on souls (i.e. psyches).

defibs are a preexisting mechanic you can use if you don't want psionics

@VMSolidus VMSolidus merged commit 071389e into Simple-Station:master Sep 2, 2024
14 checks passed
SimpleStation14 added a commit that referenced this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changes: C# Changes any cs files Changes: Sprite Changes any png or json in an RSI Changes: YML Changes any yml files Status: Needs Review Someone please review this
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants