From 62ad3a7be408b2216d41157cb16d01e6c58fc607 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 12 Aug 2015 22:24:14 -0400 Subject: [PATCH 1/3] Fixes #10593 Adds a embedded_needs_process() proc to determine if the mob has embedded objects that still need to be processed. The get_visible_implants() remains to determine which implants can be seen on examine and yanked out. --- code/modules/mob/living/carbon/human/human.dm | 6 ++++++ code/modules/mob/living/carbon/human/life.dm | 4 +--- code/modules/mob/mob.dm | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index e6b0744538..9421123ae5 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1030,6 +1030,12 @@ return(visible_implants) +/mob/living/carbon/human/embedded_needs_process() + for(var/obj/item/organ/external/organ in src.organs) + if(organ.implants.len) + return 1 + return 0 + /mob/living/carbon/human/proc/handle_embedded_objects() for(var/obj/item/organ/external/organ in src.organs) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 18312abf92..d3268bfc39 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -1018,9 +1018,7 @@ //Periodically double-check embedded_flag if(embedded_flag && !(life_tick % 10)) - var/list/E - E = get_visible_implants(0) - if(!E.len) + if(!embedded_needs_process()) embedded_flag = 0 //Eyes diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 0010f189e6..f93b139430 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -856,6 +856,9 @@ visible_implants += O return visible_implants +/mob/proc/embedded_needs_process() + return (embedded.len > 0) + mob/proc/yank_out_object() set category = "Object" set name = "Yank out object" From 99e1d88285ef7337c64ca4ab1b57491e9edd5100 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 12 Aug 2015 22:41:30 -0400 Subject: [PATCH 2/3] Fixes #10592 Fixes the right hand being affected if the left arm was broken. --- .../mob/living/carbon/human/human_organs.dm | 35 ++++++++++--------- code/modules/organs/organ_external.dm | 2 +- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_organs.dm b/code/modules/mob/living/carbon/human/human_organs.dm index f2c64fa52a..8598ce04b3 100644 --- a/code/modules/mob/living/carbon/human/human_organs.dm +++ b/code/modules/mob/living/carbon/human/human_organs.dm @@ -134,28 +134,29 @@ continue if(E.is_broken() || E.is_dislocated()) - if(E.body_part == HAND_LEFT) - if(!l_hand) - continue - drop_from_inventory(l_hand) - else - if(!r_hand) - continue - drop_from_inventory(r_hand) + switch(E.body_part) + if(HAND_LEFT, ARM_LEFT) + if(!l_hand) + continue + drop_from_inventory(l_hand) + if(HAND_RIGHT, ARM_RIGHT) + if(!r_hand) + continue + drop_from_inventory(r_hand) var/emote_scream = pick("screams in pain and ", "lets out a sharp cry and ", "cries out and ") emote("me", 1, "[(species.flags & NO_PAIN) ? "" : emote_scream ]drops what they were holding in their [E.name]!") else if(E.is_malfunctioning()) - - if(E.body_part == HAND_LEFT) - if(!l_hand) - continue - drop_from_inventory(l_hand) - else - if(!r_hand) - continue - drop_from_inventory(r_hand) + switch(E.body_part) + if(HAND_LEFT, ARM_LEFT) + if(!l_hand) + continue + drop_from_inventory(l_hand) + if(HAND_RIGHT, ARM_RIGHT) + if(!r_hand) + continue + drop_from_inventory(r_hand) emote("me", 1, "drops what they were holding, their [E.name] malfunctioning!") diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index db62aa91d0..94e1c94ae7 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -50,7 +50,7 @@ var/joint = "joint" // Descriptive string used in dislocation. var/amputation_point // Descriptive string used in amputation. var/dislocated = 0 // If you target a joint, you can dislocate the limb, causing temporary damage to the organ. - var/can_grasp + var/can_grasp //It would be more appropriate if these two were named "affects_grasp" and "affects_stand" at this point var/can_stand /obj/item/organ/external/Destroy() From 1dc853710c408c84c43e02d1e709b5033aefacbe Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 12 Aug 2015 23:38:44 -0400 Subject: [PATCH 3/3] Implant items do not count for continuing to process embedded objects Also makes embedded pain messages respect NO_PAIN. --- code/modules/mob/living/carbon/human/human.dm | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 9421123ae5..43a4fd8914 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1032,8 +1032,9 @@ /mob/living/carbon/human/embedded_needs_process() for(var/obj/item/organ/external/organ in src.organs) - if(organ.implants.len) - return 1 + for(var/obj/item/O in organ.implants) + if(!istype(O, /obj/item/weapon/implant)) //implant type items do not cause embedding effects, see handle_embedded_objects() + return 1 return 0 /mob/living/carbon/human/proc/handle_embedded_objects() @@ -1041,18 +1042,17 @@ for(var/obj/item/organ/external/organ in src.organs) if(organ.status & ORGAN_SPLINTED) //Splints prevent movement. continue - for(var/obj/item/weapon/O in organ.implants) + for(var/obj/item/O in organ.implants) if(!istype(O,/obj/item/weapon/implant) && prob(5)) //Moving with things stuck in you could be bad. // All kinds of embedded objects cause bleeding. - var/msg = null - switch(rand(1,3)) - if(1) - msg ="A spike of pain jolts your [organ.name] as you bump [O] inside." - if(2) - msg ="Your movement jostles [O] in your [organ.name] painfully." - if(3) - msg ="[O] in your [organ.name] twists painfully as you move." - src << msg + if(species.flags & NO_PAIN) + src << "You feel [O] moving inside your [organ.name]." + else + var/msg = pick( \ + "A spike of pain jolts your [organ.name] as you bump [O] inside.", \ + "Your movement jostles [O] in your [organ.name] painfully.", \ + "Your movement jostles [O] in your [organ.name] painfully.") + src << msg organ.take_damage(rand(1,3), 0, 0) if(!(organ.status & ORGAN_ROBOT) && !(species.flags & NO_BLOOD)) //There is no blood in protheses.