diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm
index 4d75e247a0..d92456cc9f 100644
--- a/code/__DEFINES/traits.dm
+++ b/code/__DEFINES/traits.dm
@@ -118,7 +118,7 @@
#define TRAIT_NOLIMBDISABLE "no_limb_disable"
#define TRAIT_EASYLIMBDISABLE "easy_limb_disable"
#define TRAIT_TOXINLOVER "toxinlover"
-#define TRAIT_ROBOTICORGANISM "robotic_organism"
+#define TRAIT_ROBOTIC_ORGANISM "robotic_organism"
#define TRAIT_NOBREATH "no_breath"
#define TRAIT_ANTIMAGIC "anti_magic"
#define TRAIT_HOLY "holy"
diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm
index 510eeebdce..27dd17eabb 100644
--- a/code/_globalvars/traits.dm
+++ b/code/_globalvars/traits.dm
@@ -52,7 +52,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_NOLIMBDISABLE" = TRAIT_NOLIMBDISABLE,
"TRAIT_EASYLIMBDISABLE" = TRAIT_EASYLIMBDISABLE,
"TRAIT_TOXINLOVER" = TRAIT_TOXINLOVER,
- "TRAIT_ROBOTICORGANISM" = TRAIT_ROBOTICORGANISM,
+ "TRAIT_ROBOTIC_ORGANISM" = TRAIT_ROBOTIC_ORGANISM,
"TRAIT_NOBREATH" = TRAIT_NOBREATH,
"TRAIT_ANTIMAGIC" = TRAIT_ANTIMAGIC,
"TRAIT_HOLY" = TRAIT_HOLY,
diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm
index 18796c99fd..d9bfa4b00e 100644
--- a/code/game/objects/items/devices/scanners.dm
+++ b/code/game/objects/items/devices/scanners.dm
@@ -155,7 +155,7 @@ GENETICS SCANNER
if(oxy_loss > 10)
msg += "\n\t[oxy_loss > 50 ? "Severe" : "Minor"] oxygen deprivation detected."
if(tox_loss > 10)
- msg += "\n\t[tox_loss > 50 ? "Severe" : "Minor"] amount of [HAS_TRAIT(M, TRAIT_ROBOTICORGANISM) ? "system corruption" : "toxin damage"] detected."
+ msg += "\n\t[tox_loss > 50 ? "Severe" : "Minor"] amount of [HAS_TRAIT(M, TRAIT_ROBOTIC_ORGANISM) ? "system corruption" : "toxin damage"] detected."
if(M.getStaminaLoss())
msg += "\n\tSubject appears to be suffering from fatigue."
if(advanced)
@@ -182,7 +182,7 @@ GENETICS SCANNER
Damage: | \
Brute | \
Burn | \
- [HAS_TRAIT(C, TRAIT_ROBOTICORGANISM) ? "Corruption" :"Toxin"] | \
+ [HAS_TRAIT(C, TRAIT_ROBOTIC_ORGANISM) ? "Corruption" :"Toxin"] | \
Suffocation | \
| Overall: | \
[brute_loss] | \
diff --git a/code/modules/mob/living/carbon/human/species_types/android.dm b/code/modules/mob/living/carbon/human/species_types/android.dm
index e2f6ac6e1c..3c6a2a8e13 100644
--- a/code/modules/mob/living/carbon/human/species_types/android.dm
+++ b/code/modules/mob/living/carbon/human/species_types/android.dm
@@ -3,7 +3,7 @@
id = SPECIES_ANDROID
say_mod = "states"
species_traits = list(NOBLOOD,NOGENITALS,NOAROUSAL,ROBOTIC_LIMBS)
- inherent_traits = list(TRAIT_RESISTHEAT,TRAIT_NOBREATH,TRAIT_RESISTCOLD,TRAIT_RESISTHIGHPRESSURE,TRAIT_RESISTLOWPRESSURE,TRAIT_RADIMMUNE,TRAIT_NOFIRE,TRAIT_PIERCEIMMUNE,TRAIT_NOHUNGER,TRAIT_LIMBATTACHMENT, TRAIT_ROBOTICORGANISM)
+ inherent_traits = list(TRAIT_RESISTHEAT,TRAIT_NOBREATH,TRAIT_RESISTCOLD,TRAIT_RESISTHIGHPRESSURE,TRAIT_RESISTLOWPRESSURE,TRAIT_RADIMMUNE,TRAIT_NOFIRE,TRAIT_PIERCEIMMUNE,TRAIT_NOHUNGER,TRAIT_LIMBATTACHMENT, TRAIT_ROBOTIC_ORGANISM)
inherent_biotypes = MOB_ROBOTIC|MOB_HUMANOID
meat = null
gib_types = /obj/effect/gibspawner/robot
diff --git a/code/modules/mob/living/carbon/human/species_types/ipc.dm b/code/modules/mob/living/carbon/human/species_types/ipc.dm
index 2ab2826d46..eb870f9624 100644
--- a/code/modules/mob/living/carbon/human/species_types/ipc.dm
+++ b/code/modules/mob/living/carbon/human/species_types/ipc.dm
@@ -5,7 +5,7 @@
default_color = "00FF00"
blacklisted = 0
sexes = 0
- inherent_traits = list(TRAIT_EASYDISMEMBER,TRAIT_LIMBATTACHMENT,TRAIT_NO_PROCESS_FOOD, TRAIT_ROBOTICORGANISM)
+ inherent_traits = list(TRAIT_EASYDISMEMBER,TRAIT_LIMBATTACHMENT,TRAIT_NO_PROCESS_FOOD, TRAIT_ROBOTIC_ORGANISM)
species_traits = list(MUTCOLORS,NOEYES,NOTRANSSTING,HAS_FLESH,HAS_BONE,HAIR,ROBOTIC_LIMBS)
hair_alpha = 210
inherent_biotypes = MOB_ROBOTIC|MOB_HUMANOID
diff --git a/code/modules/mob/living/carbon/human/species_types/synthliz.dm b/code/modules/mob/living/carbon/human/species_types/synthliz.dm
index 5ba3438a3d..b6a7e93c72 100644
--- a/code/modules/mob/living/carbon/human/species_types/synthliz.dm
+++ b/code/modules/mob/living/carbon/human/species_types/synthliz.dm
@@ -4,7 +4,7 @@
say_mod = "beeps"
default_color = "00FF00"
species_traits = list(MUTCOLORS,NOTRANSSTING,EYECOLOR,LIPS,HAIR,ROBOTIC_LIMBS,HAS_FLESH,HAS_BONE)
- inherent_traits = list(TRAIT_EASYDISMEMBER,TRAIT_LIMBATTACHMENT,TRAIT_NO_PROCESS_FOOD, TRAIT_ROBOTICORGANISM)
+ inherent_traits = list(TRAIT_EASYDISMEMBER,TRAIT_LIMBATTACHMENT,TRAIT_NO_PROCESS_FOOD, TRAIT_ROBOTIC_ORGANISM)
inherent_biotypes = MOB_ROBOTIC|MOB_HUMANOID
mutant_bodyparts = list("ipc_antenna" = "Synthetic Lizard - Antennae","mam_tail" = "Synthetic Lizard", "mam_snouts" = "Synthetic Lizard - Snout", "legs" = "Digitigrade", "mam_body_markings" = "Synthetic Lizard - Plates", "taur" = "None")
meat = /obj/item/reagent_containers/food/snacks/meat/slab/human/mutant/ipc
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index 95f00c1faf..587d9321e0 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -746,7 +746,7 @@ GLOBAL_LIST_INIT(ballmer_windows_me_msg, list("Yo man, what if, we like, uh, put
#define CORRUPTION_THRESHHOLD_CRITICAL 70 //Above: Extremely annoying stuff, possibly life-threatening
/mob/living/carbon/proc/handle_corruption()
- if(!HAS_TRAIT(src, TRAIT_ROBOTICORGANISM)) //Only robot-people need to care about this
+ if(!HAS_TRAIT(src, TRAIT_ROBOTIC_ORGANISM)) //Only robot-people need to care about this
return
corruption_timer++
var/corruption = getToxLoss(toxins_type = TOX_SYSCORRUPT)
diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm
index afb6a584c6..44701a26b2 100644
--- a/code/modules/mob/living/damage_procs.dm
+++ b/code/modules/mob/living/damage_procs.dm
@@ -174,7 +174,7 @@
return toxloss
var/affected_by = TOX_DEFAULT
- if(HAS_TRAIT(src, TRAIT_ROBOTICORGANISM))
+ if(HAS_TRAIT(src, TRAIT_ROBOTIC_ORGANISM))
affected_by = TOX_SYSCORRUPT
if(toxins_type != affected_by)
@@ -186,7 +186,7 @@
if(!forced && (status_flags & GODMODE))
return FALSE
var/affected_by = TOX_DEFAULT
- if(HAS_TRAIT(src, TRAIT_ROBOTICORGANISM))
+ if(HAS_TRAIT(src, TRAIT_ROBOTIC_ORGANISM))
affected_by = TOX_SYSCORRUPT
if(toxins_type != TOX_OMNI && toxins_type != affected_by)
return FALSE
@@ -202,7 +202,7 @@
return FALSE
var/affected_by = TOX_DEFAULT
- if(HAS_TRAIT(src, TRAIT_ROBOTICORGANISM))
+ if(HAS_TRAIT(src, TRAIT_ROBOTIC_ORGANISM))
affected_by = TOX_SYSCORRUPT
if(toxins_type != TOX_OMNI && toxins_type != affected_by)
return FALSE
diff --git a/code/modules/surgery/purge_corruption.dm b/code/modules/surgery/purge_corruption.dm
new file mode 100644
index 0000000000..e069b99141
--- /dev/null
+++ b/code/modules/surgery/purge_corruption.dm
@@ -0,0 +1,94 @@
+/*
+Timeconsuming but highly effective surgery that purges any system corruption currently present, only works on robotic organisms.
+Has a version for organic people and robotic/synthetic ones, considering robotic limbs and robotic organism isn't neccessarily linked and, say, someone could surgery a synthetic's brain into a nonsynthetic head.
+*/
+/datum/surgery/purge_corruption
+ name = "Purge corruption"
+ desc = "A highly complex and time-consuming surgery used to purge any corruption currently present in a robotic organism. Will knock the target out for an amount of time proportional to corruption purged."
+ steps = list(
+ /datum/surgery_step/incise,
+ /datum/surgery_step/retract_skin,
+ /datum/surgery_step/clamp_bleeders,
+ /datum/surgery_step/saw,
+ /datum/surgery_step/clamp_bleeders,
+ /datum/surgery_step/incise,
+ /datum/surgery_step/clamp_bleeders,
+ /datum/surgery_step/override_safeties,
+ /datum/surgery_step/remove_corruption,
+ /datum/surgery_step/close)
+ location = BODY_ZONE_HEAD
+
+/datum/surgery/purge_corruption/robotic
+ 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/cut_wires,
+ /datum/surgery_step/prepare_electronics,
+ /datum/surgery_step/override_safeties,
+ /datum/surgery_step/remove_corruption,
+ /datum/surgery_step/mechanic_wrench,
+ /datum/surgery_step/mechanic_close)
+
+/datum/surgery/purge_corruption/can_start(mob/user, mob/living/carbon/target, obj/item/tool)
+ if(!(. = ..()))
+ return
+ var/obj/item/organ/brain/B = target.getorganslot(ORGAN_SLOT_BRAIN)
+ if(!B || !HAS_TRAIT(target, TRAIT_ROBOTIC_ORGANISM))
+ return FALSE
+
+/datum/surgery_step/override_safeties
+ name = "Override inbuilt safeguards (multitool)"
+ implements = list(TOOL_MULTITOOL = 100, TOOL_WIRECUTTER = 20)
+ time = 50
+
+/datum/surgery_step/override_safeties/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ display_results(user, target, "You begin to override the safeties of [target]'s brain...",
+ "[user] begins to override the hardware safeties of [target]'s brain.",
+ "[user] begins to perform surgery on [target]'s brain.")
+
+/datum/surgery_step/override_safeties/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ display_results(user, target, "You succeed in overriding the safeties of [target]'s brain.",
+ "[user] successfully overrides the safeties of [target]'s posibrain!",
+ "[user] completes the surgery on [target]'s brain.")
+ return TRUE
+
+/datum/surgery_step/override_safeties/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ display_results(user, target, "You fail overriding the safeties of [target]'s brain.",
+ "[user] fails overriding the safeties of [target]'s brain!",
+ "[user] completes the surgery on [target]'s brain.")
+ return FALSE
+
+/datum/surgery_step/remove_corruption
+ name = "Initiate system purge (multitool)"
+ implements = list(TOOL_MULTITOOL = 95, TOOL_WIRECUTTER = 10) //You are relatively safe just using a multitool, but you should use sterilizer or simillar success chance increasing chems regardless.
+ time = 80 //Takes a l o n g time, but completely purges system corruption
+
+/datum/surgery_step/remove_corruption/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ display_results(user, target, "You begin to initiate a system purge in [target]...",
+ "[user] begins to initiate a system purge in [target].",
+ "[user] begins to perform surgery on [target].")
+
+/datum/surgery_step/remove_corruption/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ if(!target.getorganslot(ORGAN_SLOT_BRAIN) || !HAS_TRAIT(target, TRAIT_ROBOTIC_ORGANISM))
+ user.visible_message("[user] suddenly realises that [user.p_they()] can't actually initiate a system purge in [target]...", "You suddenly realise that you cannot initiate a system purge in [target].")
+ return FALSE
+ display_results(user, target, "You successfully initate a system purge in [target]...",
+ "[user] successfully initiates a system purge in [target].",
+ "[user] completes the surgery on [target].")
+ var/purged = target.getToxLoss(TOX_SYSCORRUPT)
+ target.setToxLoss(0, TOX_SYSCORRUPT)
+ target.Sleeping(round(purged * 0.2, 1))
+ return TRUE
+
+/datum/surgery_step/remove_corruption/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+ if(!target.getorganslot(ORGAN_SLOT_BRAIN) || !HAS_TRAIT(target, TRAIT_ROBOTIC_ORGANISM))
+ user.visible_message("[user] suddenly realises that [user.p_they()] can't actually initiate a system purge in [target]...", "You suddenly realise that you cannot initiate a system purge in [target].")
+ return FALSE
+ display_results(user, target, "You fail purging [target]'s system of corruption, damaging [target.p_them()] instead...",
+ "[user] fails purging [target]'s system of corruption, damaging [target.p_them()] instead.",
+ "[user] completes the surgery on [target].")
+ target.adjustOrganLoss(ORGAN_SLOT_BRAIN, 40)
+ target.gain_trauma_type(BRAIN_TRAUMA_SEVERE, TRAUMA_RESILIENCE_LOBOTOMY)
+ return FALSE
diff --git a/tgstation.dme b/tgstation.dme
index 2008f39c3d..590632b22b 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -3418,6 +3418,7 @@
#include "code\modules\surgery\organic_steps.dm"
#include "code\modules\surgery\plastic_surgery.dm"
#include "code\modules\surgery\prosthetic_replacement.dm"
+#include "code\modules\surgery\purge_corruption.dm"
#include "code\modules\surgery\remove_embedded_object.dm"
#include "code\modules\surgery\repair_puncture.dm"
#include "code\modules\surgery\robot_brain_surgery.dm"