From 889d6d93a01b77ce19a0d693593465c802b8b01e Mon Sep 17 00:00:00 2001 From: cib Date: Mon, 27 Feb 2012 03:41:24 -0800 Subject: [PATCH] Tons of updates to autopsy. - Fire, Electrocution, Strangulation, Trace Chemicals and Radiation Poisoning are now detected - Fixed a bug to head surgery - You now only hurt subjects on an operating table with a scalpel if your intent is set to harm - The sheet of paper printed by the autopsy scanner now goes to a free hand if possible --- code/defines/mob/living/living.dm | 2 +- .../objects/items/weapons/surgery_tools.dm | 74 +++++++++++++++---- code/modules/mob/living/carbon/human/life.dm | 27 +++++++ code/modules/mob/organ/organ.dm | 18 +++-- 4 files changed, 96 insertions(+), 25 deletions(-) diff --git a/code/defines/mob/living/living.dm b/code/defines/mob/living/living.dm index d4709674483..3badf77ed34 100644 --- a/code/defines/mob/living/living.dm +++ b/code/defines/mob/living/living.dm @@ -4,4 +4,4 @@ var/t_sl_gas = null var/t_n2 = null var/now_pushing = null - var/cameraFollow = null + var/cameraFollow = null \ No newline at end of file diff --git a/code/game/objects/items/weapons/surgery_tools.dm b/code/game/objects/items/weapons/surgery_tools.dm index 80739452518..967cc7e8179 100644 --- a/code/game/objects/items/weapons/surgery_tools.dm +++ b/code/game/objects/items/weapons/surgery_tools.dm @@ -319,10 +319,12 @@ CIRCULAR SAW /////////////////// //AUTOPSY SCANNER// /////////////////// -/obj/item/weapon/autopsy_scanner/var/list/datum/wound_data/wdata = list() +/obj/item/weapon/autopsy_scanner/var/list/datum/autopsy_data_data/wdata = list() +/obj/item/weapon/autopsy_scanner/var/list/datum/autopsy_data_data/chemtraces = list() /obj/item/weapon/autopsy_scanner/var/target_name = null +/obj/item/weapon/autopsy_scanner/var/timeofdeath = null -/datum/wound_data +/datum/autopsy_data_data var weapon = null // this is the DEFINITE weapon type that was used list/organs_scanned = list() // this maps a number of scanned organs to @@ -330,10 +332,10 @@ CIRCULAR SAW organ_names = "" /obj/item/weapon/autopsy_scanner/proc/add_data(var/datum/organ/external/O) - if(!O.weapon_wounds.len) return + if(!O.autopsy_data.len && !O.trace_chemicals.len) return - for(var/V in O.weapon_wounds) - var/datum/wound/W = O.weapon_wounds[V] + for(var/V in O.autopsy_data) + var/datum/autopsy_data/W = O.autopsy_data[V] if(!W.pretend_weapon) // the more hits, the more likely it is that we get the right weapon type @@ -343,18 +345,25 @@ CIRCULAR SAW W.pretend_weapon = pick("mechanical toolbox", "wirecutters", "revolver", "crowbar", "fire extinguisher", "tomato soup", "oxygen tank", "emergency oxygen tank", "laser", "bullet") - var/datum/wound_data/D = wdata[V] + var/datum/autopsy_data_data/D = wdata[V] if(!D) D = new() D.weapon = W.weapon wdata[V] = D if(!D.organs_scanned[O.name]) - D.organ_names += "[O.display_name] " + if(D.organ_names == "") + D.organ_names = O.display_name + else + D.organ_names += ", [O.display_name]" del D.organs_scanned[O.name] D.organs_scanned[O.name] = W.copy() + for(var/V in O.trace_chemicals) + if(O.trace_chemicals[V] > 0 && !chemtraces.Find(V)) + chemtraces += V + /obj/item/weapon/autopsy_scanner/verb/print_data() set src in view(usr, 1) set name = "Print Data" @@ -362,27 +371,31 @@ CIRCULAR SAW usr << "No." return - if(wdata.len == 0) - usr << "* There is no data about any wounds in the scanners database. You may have to scan more bodyparts, or otherwise this wound type may not be in the scanner's database." + if(wdata.len == 0 && chemtraces.len == 0) + usr << "* There is no data about any wounds in the scanner's database. You may have to scan more bodyparts, or otherwise this wound type may not be in the scanner's database." return var/scan_data = "" + + if(timeofdeath) + scan_data += "Time since death: [round((world.time - timeofdeath) / (60*10))] minutes

" + var/n = 1 for(var/wdata_idx in wdata) - var/datum/wound_data/D = wdata[wdata_idx] + var/datum/autopsy_data_data/D = wdata[wdata_idx] var/total_hits = 0 var/total_score = 0 var/list/weapon_chances = list() // maps weapon names to a score var/age = 0 for(var/wound_idx in D.organs_scanned) - var/datum/wound/W = D.organs_scanned[wound_idx] + var/datum/autopsy_data/W = D.organs_scanned[wound_idx] total_hits += W.hits var/wname = W.pretend_weapon if(wname in weapon_chances) weapon_chances[wname] += W.damage - else weapon_chances[wname] = W.damage + else weapon_chances[wname] = max(W.damage, 1) total_score+=W.damage @@ -391,9 +404,13 @@ CIRCULAR SAW var/damage_desc + var/damaging_weapon = (total_score != 0) + // total score happens to be the total damage switch(total_score) - if(0 to 5) + if(0) + damage_desc = "Unknown" + if(1 to 5) damage_desc = "negligible" if(5 to 15) damage_desc = "light" @@ -402,9 +419,12 @@ CIRCULAR SAW if(30 to 1000) damage_desc = "severe" + if(!total_score) total_score = D.organs_scanned.len + scan_data += "Weapon #[n]
" - scan_data += "Severity: [damage_desc]
" - scan_data += "Hits by weapon: [total_hits]
" + if(damaging_weapon) + scan_data += "Severity: [damage_desc]
" + scan_data += "Hits by weapon: [total_hits]
" scan_data += "Age of wound: [round(age / (60*10))] minutes
" scan_data += "Affected limbs: [D.organ_names]
" scan_data += "Possible weapons:
" @@ -415,6 +435,12 @@ CIRCULAR SAW n++ + if(chemtraces.len) + scan_data += "Trace Chemicals:
" + for(var/chemID in chemtraces) + scan_data += chemID + scan_data += "
" + for(var/mob/O in viewers(usr)) O.show_message("\red \the [src] rattles and prints out a sheet of paper.", 1) @@ -425,6 +451,19 @@ CIRCULAR SAW P.info = "[scan_data]" P.overlays += "paper_words" + if(istype(usr,/mob/living/carbon)) + // place the item in the usr's hand if possible + if(!usr.r_hand) + P.loc = usr + usr.r_hand = P + P.layer = 20 + else if(!usr.l_hand) + P.loc = usr + usr.l_hand = P + P.layer = 20 + + usr.update_clothing() + /obj/item/weapon/autopsy_scanner/attack(mob/living/carbon/human/M as mob, mob/living/carbon/user as mob) if(!istype(M)) return @@ -438,6 +477,8 @@ CIRCULAR SAW del src.wdata[V] src.wdata = list() + src.timeofdeath = M.timeofdeath + var/datum/organ/external/S = M.organs[user.zone_sel.selecting] if(!S) usr << "You can't scan this body part." @@ -715,6 +756,7 @@ CIRCULAR SAW M.updatehealth() M:brain_op_stage = 1.0 + return if(1) if(istype(M, /mob/living/carbon/metroid)) @@ -812,7 +854,7 @@ CIRCULAR SAW M:eye_op_stage = 1.0 user << "\blue So far so good after." return - if(!try_bone_surgery(M, user)) + if(!try_bone_surgery(M, user) && user.a_intent == "hurt") // if we call ..(), we'll attack them, so require a hurt intent return ..() /* wat diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 0ea389a617b..0c0e551fba7 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -124,6 +124,7 @@ /mob/living/carbon/human proc + handle_health_updates() // if the mob has enough health, she should slowly heal if(stat != 2) @@ -295,16 +296,20 @@ if (radiation < 0) radiation = 0 + var/damage = 0 // stores how much damage was inflicted + switch(radiation) if(1 to 49) radiation-- if(prob(25)) + damage = 1 adjustToxLoss(1) updatehealth() if(50 to 74) radiation -= 2 adjustToxLoss(1) + damage = 1 if(prob(5)) radiation -= 5 Weaken(3) @@ -315,6 +320,7 @@ if(75 to 100) radiation -= 3 adjustToxLoss(3) + damage = 3 if(prob(1)) src << "\red You mutate!" randmutb(src) @@ -322,6 +328,12 @@ emote("gasp") updatehealth() + if(damage) + var/V = pick(organs) + var/datum/organ/external/O = organs[V] + if(istype(O)) O.add_wound("Radiation Poisoning", damage) + + //As close as I could find to where to put it grav_delay = max(grav_delay-3,0) @@ -794,6 +806,21 @@ dizziness = max(0, dizziness - 3) jitteriness = max(0, jitteriness - 3) + if(life_tick % 10 == 0) + // handle trace chemicals for autopsy + for(var/V in organs) + var/datum/organ/O = organs[V] + for(var/chemID in O.trace_chemicals) + O.trace_chemicals[chemID] = O.trace_chemicals[chemID] - 1 + if(O.trace_chemicals[chemID] <= 0) + O.trace_chemicals.Remove(chemID) + for(var/datum/reagent/A in reagents.reagent_list) + // add chemistry traces to a random organ + var/V = pick(organs) + var/datum/organ/O = organs[V] + O.trace_chemicals[A.name] = 100 + + updatehealth() return //TODO: DEFERRED diff --git a/code/modules/mob/organ/organ.dm b/code/modules/mob/organ/organ.dm index f474a4a3049..892d32419b7 100644 --- a/code/modules/mob/organ/organ.dm +++ b/code/modules/mob/organ/organ.dm @@ -3,7 +3,9 @@ name = "organ" mob/living/carbon/human/owner = null - list/datum/wound/weapon_wounds = list() + list/datum/autopsy_data/autopsy_data = list() + list/trace_chemicals = list() // traces of chemicals in the organ, + // links chemical IDs to number of ticks for which they'll stay in the blood proc/process() @@ -12,7 +14,7 @@ proc/receive_chem(chemical as obj) return 0 -/datum/wound +/datum/autopsy_data var weapon = null pretend_weapon = null @@ -21,7 +23,7 @@ time_inflicted = 0 proc/copy() - var/datum/wound/W = new() + var/datum/autopsy_data/W = new() W.weapon = src.weapon W.pretend_weapon = src.pretend_weapon W.damage = src.damage @@ -131,18 +133,18 @@ perma_injury = 0 // if all damage is healed, replace the wounds with scars if(brute_dam + burn_dam == 0) - for(var/V in weapon_wounds) - var/datum/wound/W = weapon_wounds[V] + for(var/V in autopsy_data) + var/datum/autopsy_data/W = autopsy_data[V] del W - weapon_wounds = list() + autopsy_data = list() return update_icon() proc/add_wound(var/used_weapon, var/damage) - var/datum/wound/W = weapon_wounds[used_weapon] + var/datum/autopsy_data/W = autopsy_data[used_weapon] if(!W) W = new() W.weapon = used_weapon - weapon_wounds[used_weapon] = W + autopsy_data[used_weapon] = W W.hits += 1 W.damage += damage