diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm
index b3911d7c9f5..d15e17033f7 100644
--- a/code/game/objects/items/robot/robot_parts.dm
+++ b/code/game/objects/items/robot/robot_parts.dm
@@ -8,6 +8,7 @@
var/construction_time = 100
var/list/construction_cost = list("metal"=20000,"glass"=5000)
var/list/part = null
+ var/sabotaged = 0 //Emagging limbs can have repercussions when installed as prosthetics.
/obj/item/robot_parts/l_arm
name = "robot left arm"
@@ -278,3 +279,13 @@
del(src)
return
return
+
+/obj/item/robot_parts/attackby(obj/item/W as obj, mob/user as mob)
+ if(istype(W,/obj/item/weapon/card/emag))
+ if(sabotaged)
+ user << "\red [src] is already sabotaged!"
+ else
+ user << "\red You slide [W] into the dataport on [src] and short out the safeties."
+ sabotaged = 1
+ return
+ ..()
\ No newline at end of file
diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm
index 7aa3103f174..e22bbf47467 100644
--- a/code/modules/mob/living/carbon/human/human_defense.dm
+++ b/code/modules/mob/living/carbon/human/human_defense.dm
@@ -161,6 +161,17 @@ emp_act
if((user != src) && check_shields(I.force, "the [I.name]"))
return 0
+ if(istype(I,/obj/item/weapon/card/emag))
+ if(!(affecting.status & ORGAN_ROBOT))
+ user << "\red That limb isn't robotic."
+ return
+ if(affecting.sabotaged)
+ user << "\red [src]'s [affecting.display_name] is already sabotaged!"
+ else
+ user << "\red You sneakily slide [I] into the dataport on [src]'s [affecting.display_name] and short out the safeties."
+ affecting.sabotaged = 1
+ return
+
if(I.attack_verb.len)
visible_message("\red [src] has been [pick(I.attack_verb)] in the [hit_area] with [I.name] by [user]!")
else
diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm
index 5e1fba994c7..17f5ea05fb6 100644
--- a/code/modules/organs/organ_external.dm
+++ b/code/modules/organs/organ_external.dm
@@ -35,6 +35,7 @@
var/open = 0
var/stage = 0
var/cavity = 0
+ var/sabotaged = 0 //If a prosthetic limb is emagged, it will detonate when it fails.
var/obj/item/hidden = null
var/list/implants = list()
@@ -482,8 +483,8 @@
owner.u_equip(owner.shoes)
if(organ)
destspawn = 1
- //Robotic limbs explode until specified otherwise
- if(status & ORGAN_ROBOT && !no_explode)
+ //Robotic limbs explode if sabotaged.
+ if(status & ORGAN_ROBOT && !no_explode && sabotaged)
owner.visible_message("\red \The [owner]'s [display_name] explodes violently!",\
"\red Your [display_name] explodes!",\
"You hear an explosion followed by a scream!")
@@ -494,10 +495,10 @@
spark_system.start()
spawn(10)
del(spark_system)
- else
- owner.visible_message("\red [owner.name]'s [display_name] flies off in an arc.",\
- "Your [display_name] goes flying off!",\
- "You hear a terrible sound of ripping tendons and flesh.")
+
+ owner.visible_message("\red [owner.name]'s [display_name] flies off in an arc.",\
+ "Your [display_name] goes flying off!",\
+ "You hear a terrible sound of ripping tendons and flesh.")
//Throw organs around
var/lol = pick(cardinal)
diff --git a/code/modules/surgery/generic.dm b/code/modules/surgery/generic.dm
index 7d7de430bfd..e46bff882d4 100644
--- a/code/modules/surgery/generic.dm
+++ b/code/modules/surgery/generic.dm
@@ -190,7 +190,16 @@
max_duration = 160
can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
- return ..() && target_zone != "chest" && target_zone != "groin" && target_zone != "head"
+ if (target_zone == "eyes") //there are specific steps for eye surgery
+ return 0
+ if (!hasorgans(target))
+ return 0
+ var/datum/organ/external/affected = target.get_organ(target_zone)
+ if (affected == null)
+ return 0
+ if (affected.status & ORGAN_DESTROYED)
+ return 0
+ return target_zone != "chest" && target_zone != "groin" && target_zone != "head"
begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
@@ -203,11 +212,11 @@
var/datum/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] cuts off [target]'s [affected.display_name] with \the [tool].", \
"\blue You cut off [target]'s [affected.display_name] with \the [tool].")
- affected.droplimb(1,1)
+ affected.droplimb(1,0)
fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s hand slips, sawwing through the bone in [target]'s [affected.display_name] with \the [tool]!", \
"\red Your hand slips, sawwing through the bone in [target]'s [affected.display_name] with \the [tool]!")
affected.createwound(CUT, 30)
- affected.fracture()
+ affected.fracture()
\ No newline at end of file
diff --git a/code/modules/surgery/robolimbs.dm b/code/modules/surgery/robolimbs.dm
index 9b8f42e4d76..97db2846220 100644
--- a/code/modules/surgery/robolimbs.dm
+++ b/code/modules/surgery/robolimbs.dm
@@ -144,10 +144,15 @@
"You start attaching [tool] where [target]'s [affected.display_name] used to be.")
end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
+ var/obj/item/robot_parts/L = tool
var/datum/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] has attached [tool] where [target]'s [affected.display_name] used to be.", \
"\blue You have attached [tool] where [target]'s [affected.display_name] used to be.")
affected.robotize()
+ if(L.sabotaged)
+ affected.sabotaged = 1
+ else
+ affected.sabotaged = 0
target.update_body()
target.updatehealth()
target.UpdateDamageIcon()