From 6d369caae7b972cacac7ed2b87ee90ef62012ab7 Mon Sep 17 00:00:00 2001 From: Chinsky Date: Fri, 8 Nov 2013 03:55:22 +0400 Subject: [PATCH] Replaces long check with lots of get_organ calls with shorter one. Also changed weird condition that amputated leg must not be splinted. Removed checks for haslimbs, since movement while downed is not possible anyway. Moved some special effects for broken limbs after check for such, so healthy ones wont bother. Fixed a derp in populating the global list of sideffects. --- code/__HELPERS/global_lists.dm | 2 +- code/modules/organs/organ.dm | 43 +++++++--------------------------- 2 files changed, 10 insertions(+), 35 deletions(-) diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index 9625d9c716..ce8d788f25 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -80,7 +80,7 @@ var/global/list/backbaglist = list("Nothing", "Backpack", "Satchel", "Satchel Al paths = typesof(/datum/medical_effect)-/datum/medical_effect for(var/T in paths) var/datum/medical_effect/M = new T - side_effects[S.name] = T + side_effects[M.name] = T //Languages and species. diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm index 45828edc2a..33ce1131c5 100644 --- a/code/modules/organs/organ.dm +++ b/code/modules/organs/organ.dm @@ -91,7 +91,7 @@ I.take_damage(rand(3,5)) //Special effects for limbs. - if(E.name in list("l_hand","l_arm","r_hand","r_arm")) + if(E.name in list("l_hand","l_arm","r_hand","r_arm") && (broken||malfunction)) var/obj/item/c_hand //Getting what's in this hand if(E.name == "l_hand" || E.name == "l_arm") c_hand = l_hand @@ -99,8 +99,7 @@ c_hand = r_hand if (c_hand) - if (broken||malfunction) - u_equip(c_hand) + u_equip(c_hand) if(broken) emote("me", 1, "screams in pain and drops what they were holding in their [E.display_name?"[E.display_name]":"[E]"]!") @@ -124,35 +123,11 @@ paralysis = 10 //Check arms and legs for existence - var/canstand_l = 1 //Can stand on left leg - var/canstand_r = 1 //Can stand on right leg - var/hasleg_l = 1 //Have left leg - var/hasleg_r = 1 //Have right leg - var/hasarm_l = 1 //Have left arm - var/hasarm_r = 1 //Have right arm - var/datum/organ/external/E - E = get_organ("l_leg") - if(E.status & ORGAN_DESTROYED && !(E.status & ORGAN_SPLINTED)) - canstand_l = 0 - hasleg_l = 0 - E = get_organ("r_leg") - if(E.status & ORGAN_DESTROYED && !(E.status & ORGAN_SPLINTED)) - canstand_r = 0 - hasleg_r = 0 - E = get_organ("l_foot") - if(E.status & ORGAN_DESTROYED && !(E.status & ORGAN_SPLINTED)) - canstand_l = 0 - E = get_organ("r_foot") - if(E.status & ORGAN_DESTROYED && !(E.status & ORGAN_SPLINTED)) - canstand_r = 0 - E = get_organ("l_arm") - if(E.status & ORGAN_DESTROYED && !(E.status & ORGAN_SPLINTED)) - hasarm_l = 0 - E = get_organ("r_arm") - if(E.status & ORGAN_DESTROYED && !(E.status & ORGAN_SPLINTED)) - hasarm_r = 0 + can_stand = 2 //can stand on both legs + var/datum/organ/external/E = organs_by_name["l_foot"] + if(E.status & ORGAN_DESTROYED) + can_stand-- - // Can stand if have at least one full leg (with leg and foot parts present) - // Has limbs to move around if at least one arm or leg is at least partially there - can_stand = canstand_l||canstand_r - has_limbs = hasleg_l||hasleg_r||hasarm_l||hasarm_r + E = organs_by_name["r_foot"] + if(E.status & ORGAN_DESTROYED) + can_stand--