From 59874f6553fca86cc1f9f98f1ea2d064ed88b6ac Mon Sep 17 00:00:00 2001
From: TomGarou <31218944+TomGarou@users.noreply.github.com>
Date: Fri, 8 Apr 2022 01:26:07 -0400
Subject: [PATCH] Synth Brainwashing
Adds synthetic brainwashing to Citadel-Station-13
---
.../research/designs/medical_designs.dm | 7 +++
.../research/techweb/nodes/medical_nodes.dm | 2 +-
code/modules/surgery/advanced/brainwashing.dm | 5 +-
.../surgery/advanced/robot_brainwashing.dm | 60 +++++++++++++++++++
tgstation.dme | 1 +
5 files changed, 73 insertions(+), 2 deletions(-)
create mode 100644 code/modules/surgery/advanced/robot_brainwashing.dm
diff --git a/code/modules/research/designs/medical_designs.dm b/code/modules/research/designs/medical_designs.dm
index cf17ec8545..5d28603055 100644
--- a/code/modules/research/designs/medical_designs.dm
+++ b/code/modules/research/designs/medical_designs.dm
@@ -958,6 +958,13 @@
surgery = /datum/surgery/advanced/brainwashing
research_icon_state = "surgery_head"
+/datum/design/surgery/robo_brainwashing
+ name = "Reprogramming"
+ desc = "A surgical procedure which hardcodes a directive into the patient's logic subroutines, making it their absolute priority. It can be purged using a mindshield implant."
+ id = "surgery_robot_brainwashing"
+ surgery = /datum/surgery/advanced/robot_brainwashing
+ research_icon_state = "surgery_head"
+
/datum/design/surgery/nerve_splicing
name = "Nerve Splicing"
desc = "A surgical procedure which splices the patient's nerves, making them more resistant to stuns."
diff --git a/code/modules/research/techweb/nodes/medical_nodes.dm b/code/modules/research/techweb/nodes/medical_nodes.dm
index 1d7d579dad..018d2a8f44 100644
--- a/code/modules/research/techweb/nodes/medical_nodes.dm
+++ b/code/modules/research/techweb/nodes/medical_nodes.dm
@@ -152,5 +152,5 @@
display_name = "Alien Surgery"
description = "Abductors did nothing wrong."
prereq_ids = list("exp_surgery", "alientech")
- design_ids = list("surgery_brainwashing","surgery_zombie", "surgery_ext_dissection", "surgery_heal_combo_upgrade_femto")
+ design_ids = list("surgery_brainwashing", "surgery_robot_brainwashing", "surgery_zombie", "surgery_ext_dissection", "surgery_heal_combo_upgrade_femto")
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 10000)
diff --git a/code/modules/surgery/advanced/brainwashing.dm b/code/modules/surgery/advanced/brainwashing.dm
index 2a09fd2b93..dae7346ab4 100644
--- a/code/modules/surgery/advanced/brainwashing.dm
+++ b/code/modules/surgery/advanced/brainwashing.dm
@@ -1,7 +1,10 @@
/obj/item/disk/surgery/brainwashing
name = "Brainwashing Surgery Disk"
desc = "The disk provides instructions on how to impress an order on a brain, making it the primary objective of the patient."
- surgeries = list(/datum/surgery/advanced/brainwashing)
+ surgeries = list(
+ /datum/surgery/advanced/brainwashing,
+ /datum/surgery/advanced/robot_brainwashing)
+
/datum/surgery/advanced/brainwashing
name = "Brainwashing"
desc = "A surgical procedure which directly implants a directive into the patient's brain, making it their absolute priority. It can be cleared using a mindshield implant."
diff --git a/code/modules/surgery/advanced/robot_brainwashing.dm b/code/modules/surgery/advanced/robot_brainwashing.dm
new file mode 100644
index 0000000000..427005b4c0
--- /dev/null
+++ b/code/modules/surgery/advanced/robot_brainwashing.dm
@@ -0,0 +1,60 @@
+/datum/surgery/advanced/robot_brainwashing
+ name = "Reprogramming"
+ desc = "A surgical procedure which hardcodes a directive into the patient's logic subroutines, making it their absolute priority. It can be purged using a mindshield implant."
+ possible_locs = list(BODY_ZONE_HEAD)
+ requires_bodypart_type = BODYPART_ROBOTIC
+ steps = list(/datum/surgery_step/mechanic_open,
+ /datum/surgery_step/open_hatch,
+ /datum/surgery_step/mechanic_unwrench,
+ /datum/surgery_step/prepare_electronics,
+ /datum/surgery_step/reprogram,
+ /datum/surgery_step/mechanic_wrench,
+ /datum/surgery_step/mechanic_close)
+
+/datum/surgery/advanced/reprogramming/can_start(mob/user, mob/living/carbon/target, obj/item/tool)
+ if(!..())
+ return FALSE
+ var/obj/item/organ/brain/B = target.getorganslot(ORGAN_SLOT_BRAIN)
+ if(!B)
+ return FALSE
+ return TRUE
+
+/datum/surgery_step/reprogram
+ name = "reprogram"
+ implements = list(TOOL_MULTITOOL = 85, TOOL_HEMOSTAT = 50, TOOL_WIRECUTTER = 35, /obj/item/stack/packageWrap = 35, /obj/item/stack/cable_coil = 15, /obj/item/card/emag = 100)
+ time = 200
+ var/objective
+
+/datum/surgery_step/reprogram/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ objective = stripped_input(user, "Choose the objective to imprint on your victim's posibrain.", "Reprogramming", null, MAX_MESSAGE_LEN)
+ if(!objective)
+ return -1
+ display_results(user, target, "You begin to reprogram [target]...",
+ "[user] begins to fix [target]'s posibrain.",
+ "[user] begins to perform surgery on [target]'s posibrain.")
+
+/datum/surgery_step/reprogram/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ if(!target.mind)
+ to_chat(user, "[target] doesn't respond to the reprogramming, as if [target.p_they()] lacked a mind...")
+ return FALSE
+ if(HAS_TRAIT(target, TRAIT_MINDSHIELD))
+ to_chat(user, "You hear a faint buzzing from a device inside [target]'s posibrain, and the programming is purged.")
+ return FALSE
+ display_results(user, target, "You succeed in reprogramming [target].",
+ "[user] successfully fixes [target]'s posibrain!",
+ "[user] completes the surgery on [target]'s posibrain.")
+ to_chat(target, "A new directive fills your mind... you feel forced to obey it!")
+ brainwash(target, objective)
+ message_admins("[ADMIN_LOOKUPFLW(user)] surgically synth-brainwashed [ADMIN_LOOKUPFLW(target)] with the objective '[objective]'.")
+ log_game("[key_name(user)] surgically synth-brainwashed [key_name(target)] with the objective '[objective]'.")
+ return TRUE
+
+/datum/surgery_step/reprogram/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ if(target.getorganslot(ORGAN_SLOT_BRAIN))
+ display_results(user, target, "You screw up, causing more damage!",
+ "[user] screws up, causing damage to the circuits!/span>",
+ "[user] completes the surgery on [target]'s posibrain.")
+ target.adjustOrganLoss(ORGAN_SLOT_BRAIN, 40)
+ else
+ user.visible_message("[user] suddenly notices that the posibrain [user.p_they()] [user.p_were()] working on is not there anymore.", "You suddenly notice that the posibrain you were working on is not there anymore.")
+ return FALSE
diff --git a/tgstation.dme b/tgstation.dme
index cb2fa07f50..2067a48791 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -3603,6 +3603,7 @@
#include "code\modules\surgery\advanced\necrotic_revival.dm"
#include "code\modules\surgery\advanced\pacification.dm"
#include "code\modules\surgery\advanced\revival.dm"
+#include "code\modules\surgery\advanced\robot_brainwashing.dm"
#include "code\modules\surgery\advanced\toxichealing.dm"
#include "code\modules\surgery\advanced\viral_bonding.dm"
#include "code\modules\surgery\advanced\bioware\bioware.dm"