From 9904eae75c76405dfe59009372ead2cc38c931d8 Mon Sep 17 00:00:00 2001 From: Interrobang01 <113810873+Interrobang01@users.noreply.github.com> Date: Sat, 22 Oct 2022 15:05:06 -0700 Subject: [PATCH] Cognizine, a chemical that makes an entity sentient and a ghost role (#11992) --- .../Chemistry/ReagentEffects/MakeSentient.cs | 39 +++++++++++++++++++ .../ghost/roles/ghost-role-component.ftl | 2 + .../Locale/en-US/reagents/meta/medicine.ftl | 3 ++ .../en-US/reagents/meta/physical-desc.ftl | 1 + Resources/Prototypes/Reagents/medicine.yml | 15 +++++++ .../Prototypes/Recipes/Reactions/medicine.yml | 12 ++++++ 6 files changed, 72 insertions(+) create mode 100644 Content.Server/Chemistry/ReagentEffects/MakeSentient.cs diff --git a/Content.Server/Chemistry/ReagentEffects/MakeSentient.cs b/Content.Server/Chemistry/ReagentEffects/MakeSentient.cs new file mode 100644 index 0000000000..b54677d757 --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/MakeSentient.cs @@ -0,0 +1,39 @@ +using Content.Server.Mind.Components; +using Content.Server.Speech.Components; + +using Content.Shared.Chemistry.Reagent; +using Content.Server.Ghost.Roles.Components; + +namespace Content.Server.Chemistry.ReagentEffects; + +public sealed class MakeSentient : ReagentEffect +{ + public override void Effect(ReagentEffectArgs args) + { + var entityManager = args.EntityManager; + var uid = args.SolutionEntity; + + // This makes it so it doesn't affect things that are already sentient + if (entityManager.HasComponent(uid)) + { + return; + } + + // This piece of code makes things able to speak "normally". One thing of note is that monkeys have a unique accent and won't be affected by this. + entityManager.RemoveComponent(uid); + + // No idea what anything past this point does + if (entityManager.TryGetComponent(uid, out GhostTakeoverAvailableComponent? takeOver)) + { + return; + } + + takeOver = entityManager.AddComponent(uid); + + var entityData = entityManager.GetComponent(uid); + takeOver.RoleName = entityData.EntityName; + takeOver.RoleDescription = Loc.GetString("ghost-role-information-cognizine-description"); + } +} + +// Original code written by areitpog on GitHub in Issue #7666, then I (Interrobang01) copied it and used my nonexistant C# skills to try to make it work again. diff --git a/Resources/Locale/en-US/ghost/roles/ghost-role-component.ftl b/Resources/Locale/en-US/ghost/roles/ghost-role-component.ftl index eb38b0f298..b15222c5bd 100644 --- a/Resources/Locale/en-US/ghost/roles/ghost-role-component.ftl +++ b/Resources/Locale/en-US/ghost/roles/ghost-role-component.ftl @@ -8,3 +8,5 @@ ghost-role-information-mouse-description = A hungry and mischievous mouse. ghost-role-information-giant-spider-name = Giant spider ghost-role-information-giant-spider-description = Wreak havoc on the station's inhabitants! + +ghost-role-information-cognizine-description = Made conscious with the magic of cognizine. \ No newline at end of file diff --git a/Resources/Locale/en-US/reagents/meta/medicine.ftl b/Resources/Locale/en-US/reagents/meta/medicine.ftl index da31ecbcd5..c40f105cf0 100644 --- a/Resources/Locale/en-US/reagents/meta/medicine.ftl +++ b/Resources/Locale/en-US/reagents/meta/medicine.ftl @@ -87,3 +87,6 @@ reagent-desc-oculine = Heals eye damage. reagent-name-ethylredoxrazine = ethylredoxrazine reagent-desc-ethylredoxrazine = Neutralises the effects of alcohol in the blood stream. Though it is commonly needed, it is rarely requested. + +reagent-name-cognizine = cognizine +reagent-desc-cognizine = A mysterious chemical which is able to make any non-sentient creature sentient. \ No newline at end of file diff --git a/Resources/Locale/en-US/reagents/meta/physical-desc.ftl b/Resources/Locale/en-US/reagents/meta/physical-desc.ftl index 58b425fa0c..aa2e66172b 100644 --- a/Resources/Locale/en-US/reagents/meta/physical-desc.ftl +++ b/Resources/Locale/en-US/reagents/meta/physical-desc.ftl @@ -81,3 +81,4 @@ reagent-physical-desc-electric = electric reagent-physical-desc-chewy = chewy reagent-physical-desc-volatile = volatile reagent-physical-desc-inky = inky +reagent-physical-desc-enigmatic = enigmatic \ No newline at end of file diff --git a/Resources/Prototypes/Reagents/medicine.yml b/Resources/Prototypes/Reagents/medicine.yml index bc82185471..d6b90a854b 100644 --- a/Resources/Prototypes/Reagents/medicine.yml +++ b/Resources/Prototypes/Reagents/medicine.yml @@ -690,3 +690,18 @@ Medicine: effects: - !type:ChemHealEyeDamage + +- type: reagent + id: Cognizine + name: reagent-name-cognizine + desc: reagent-desc-cognizine + group: Medicine + physicalDesc: reagent-physical-desc-enigmatic + color: "#b50ee8" + metabolisms: + Medicine: + effects: + - !type:MakeSentient + conditions: + - !type:ReagentThreshold + min: 5 \ No newline at end of file diff --git a/Resources/Prototypes/Recipes/Reactions/medicine.yml b/Resources/Prototypes/Recipes/Reactions/medicine.yml index 243424c2fa..c5828edd31 100644 --- a/Resources/Prototypes/Recipes/Reactions/medicine.yml +++ b/Resources/Prototypes/Recipes/Reactions/medicine.yml @@ -343,3 +343,15 @@ amount: 1 products: Spaceacillin: 2 + +- type: reaction + id: Cognizine + reactants: + CarpoToxin: + amount: 1 + Siderlac: + amount: 1 + UnstableMutagen: + amount: 1 + products: + Cognizine: 1 \ No newline at end of file