mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-05-16 03:40:23 +01:00
346a1b8142
* Initial commit Fixes up surgery.dm Adds some tool behavior * More basic changes * Checkpointing: this is a little gross right now * Add signal COMPONENT_CANCEL_ATTACK_CHAIN * Cleans up surgery initiator * Mostly gets surgery (and canceling it) working * Add abstract proxy surgery steps Also adds them to organ manipulation * Clean up most existing surgeries * Rework organ openness, adds define for aborting a beginstep * surgery works again, also implements retry defines * fix surgery computer * add limb repair to synth implant removal * retry implant checks * Clean up abductor surgeries as well as some other things * A lot - Reworks organ manipulation to use a series of surgery steps instead - Fixes some runtimes with open hands - Lets mito zero out the germ level while treating necrosis - Adds a debug surgery tool * add debug surgery tool, note some TODOs for later * Add conditional check for surgeries repeating * update surgery retry logic to make it more of a bonus * Lets abductors automatically retry any failed surgery steps * Rework robotic surgery to use abstract/proxy steps * Bunch of bugfixes and more! - Limb reattachment works properly now, you can just slap a limb onto a person - If the limb isn't robotic, it'll be useless until the surgery is finished with a hemostat, though it might be enough to get the patient out of the OR. * Remove more now-implicit checks * Slight reorganization * more fixes across the board * Remove unused variable * Trying not to lose my mind here - Does away with can_run() entirely - Cleans up visible messages in code - begin steps should now all have ..() afterwards - slime bone surgery should be fixed now - more docs * Robotic surgery is stoppable with a crowbar, all surgery can_start now checks parent * Fix some broken robotic typepaths * Typepath fixes, do away with some last TODOs * Forgor * Last cleanups before we go gold * jk lol * Make early surgery termination clearer * More "last" cleanups * Fixes tool flags, surgery initiation - Fixes surgery not being startable by sharp objects - Moves surgical tool flags to item traits * Clean up surgery cancellation, especially for borgos * I think this should GC better * Apply suggestions from code review Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com> * Status is now step number * Add a 20% chance to find nothing during organ manipulation * Improve documentation, make forced_surgery a normal arg * Charlie's reviews * Why are abductors like this * Little more verification, ensuring limb augmentation and organ manip healing work properly * Fix torso organ manip being unfinishable * Fix cavity implants, open-hand/any item steps * Make sharp objects not try to start an operation with help intent * Comments, quick target fix * Re-order list so advanced bruise pack is pulled first * Make surgical gripper function like an open hand * Make mito only use one unit per organ for now * Check if user is on operable surface before trying to operate * Reduce admin logging * Fix some bugs that appeared during the testmerge - you can no longer start robotic surgeries with a scalpel (lol) - you can now cancel surgeries on the first step after I fixed some bugs that I introduced (woo hoo) - Synthetic limb attachment is now combined into a single startable surgery step, though still retains the fun flavor of both * Swats some more bugs - (hopefully) fixes a huge source of runtimes where we tried to check if we could run surgeries before checking if the surgery used an organ - In doing so, moves the logic for determining if a surgery can start to the mob-level - Fixes robotic reattachment surgery not working * multi-bug drifting??? - Fixes a bug where a branching surgery with an any tool option could possibly override a step with a matching tool - Fixes some intermediate surgeries failing due to not having specified possible_locs * A few more fixes - Fixes any surgery tool steps again - Fixes cavity surgery again * Hopefully fixes getting stuck in robotic organ manip * Remove extra parent call * Steel review * Steel review * Fix spacing for possible locs * Roundstart traits * Advanced surgical traits and other hal fixes Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>
178 lines
5.3 KiB
Plaintext
178 lines
5.3 KiB
Plaintext
/obj/item/autopsy_scanner
|
|
name = "autopsy scanner"
|
|
desc = "Extracts information on wounds."
|
|
icon = 'icons/obj/autopsy_scanner.dmi'
|
|
icon_state = ""
|
|
flags = CONDUCT
|
|
w_class = WEIGHT_CLASS_TINY
|
|
origin_tech = "magnets=1;biotech=1"
|
|
var/list/datum/autopsy_data_scanner/wdata = list()
|
|
var/list/chemtraces = list()
|
|
var/target_name = null
|
|
var/target_UID = null
|
|
var/timeofdeath = null
|
|
|
|
/obj/item/autopsy_scanner/Destroy()
|
|
QDEL_LIST_ASSOC_VAL(wdata)
|
|
return ..()
|
|
|
|
/datum/autopsy_data_scanner
|
|
var/weapon = null // this is the DEFINITE weapon type that was used
|
|
var/list/organs_scanned = list() // this maps a number of scanned organs to
|
|
// the wounds to those organs with this data's weapon type
|
|
var/organ_names = ""
|
|
|
|
/datum/autopsy_data_scanner/Destroy()
|
|
QDEL_LIST_ASSOC_VAL(organs_scanned)
|
|
return ..()
|
|
|
|
/datum/autopsy_data
|
|
var/weapon = null
|
|
var/damage = 0
|
|
var/hits = 0
|
|
var/time_inflicted = 0
|
|
|
|
/datum/autopsy_data/proc/copy()
|
|
var/datum/autopsy_data/W = new()
|
|
W.weapon = weapon
|
|
W.damage = damage
|
|
W.hits = hits
|
|
W.time_inflicted = time_inflicted
|
|
return W
|
|
|
|
/obj/item/autopsy_scanner/proc/add_data(obj/item/organ/O)
|
|
if(O.autopsy_data.len)
|
|
for(var/V in O.autopsy_data)
|
|
var/datum/autopsy_data/W = O.autopsy_data[V]
|
|
|
|
var/datum/autopsy_data_scanner/D = wdata[V]
|
|
if(!D)
|
|
D = new()
|
|
D.weapon = W.weapon
|
|
wdata[V] = D
|
|
|
|
if(!D.organs_scanned[O.name])
|
|
if(D.organ_names == "")
|
|
D.organ_names = O.name
|
|
else
|
|
D.organ_names += ", [O.name]"
|
|
|
|
qdel(D.organs_scanned[O.name])
|
|
D.organs_scanned[O.name] = W.copy()
|
|
|
|
if(O.trace_chemicals.len)
|
|
for(var/V in O.trace_chemicals)
|
|
if(O.trace_chemicals[V] > 0 && !chemtraces.Find(V))
|
|
chemtraces += V
|
|
|
|
/obj/item/autopsy_scanner/attackby(obj/item/P, mob/user)
|
|
if(istype(P, /obj/item/pen))
|
|
var/dead_name = input("Insert name of deceased individual")
|
|
var/dead_rank = input("Insert rank of deceased individual")
|
|
var/dead_tod = input("Insert time of death")
|
|
var/dead_cause = input("Insert cause of death")
|
|
var/dead_chems = input("Insert any chemical traces")
|
|
var/dead_notes = input("Insert any relevant notes")
|
|
var/obj/item/paper/R = new(user.loc)
|
|
R.name = "Official Coroner's Report - [dead_name]"
|
|
R.info = "<b>[SSmapping.map_datum.fluff_name] - Coroner's Report</b><br><br><b>Name of Deceased:</b> [dead_name]</br><br><b>Rank of Deceased:</b> [dead_rank]<br><br><b>Time of Death:</b> [dead_tod]<br><br><b>Cause of Death:</b> [dead_cause]<br><br><b>Trace Chemicals:</b> [dead_chems]<br><br><b>Additional Coroner's Notes:</b> [dead_notes]<br><br><b>Coroner's Signature:</b> <span class=\"paper_field\">"
|
|
playsound(loc, 'sound/goonstation/machines/printer_thermal.ogg', 50, 1)
|
|
sleep(10)
|
|
user.put_in_hands(R)
|
|
else
|
|
return ..()
|
|
|
|
/obj/item/autopsy_scanner/attack_self(mob/user)
|
|
var/scan_data = ""
|
|
|
|
if(timeofdeath)
|
|
scan_data += "<b>Time of death:</b> [station_time_timestamp("hh:mm:ss", timeofdeath)]<br><br>"
|
|
else
|
|
scan_data += "<b>Time of death:</b> Unknown / Still alive<br><br>"
|
|
|
|
if(wdata.len)
|
|
var/n = 1
|
|
for(var/wdata_idx in wdata)
|
|
var/datum/autopsy_data_scanner/D = wdata[wdata_idx]
|
|
var/total_hits = 0
|
|
var/total_score = 0
|
|
var/age = 0
|
|
|
|
for(var/wound_idx in D.organs_scanned)
|
|
var/datum/autopsy_data/W = D.organs_scanned[wound_idx]
|
|
total_hits += W.hits
|
|
total_score+=W.damage
|
|
|
|
|
|
var/wound_age = W.time_inflicted
|
|
age = max(age, wound_age)
|
|
|
|
var/damage_desc
|
|
// total score happens to be the total damage
|
|
switch(total_score)
|
|
if(1 to 5)
|
|
damage_desc = "<font color='green'>negligible</font>"
|
|
if(5 to 15)
|
|
damage_desc = "<font color='green'>light</font>"
|
|
if(15 to 30)
|
|
damage_desc = "<font color='orange'>moderate</font>"
|
|
if(30 to 1000)
|
|
damage_desc = "<font color='red'>severe</font>"
|
|
else
|
|
damage_desc = "Unknown"
|
|
|
|
var/damaging_weapon = (total_score != 0)
|
|
scan_data += "<b>Weapon #[n]</b><br>"
|
|
if(damaging_weapon)
|
|
scan_data += "Severity: [damage_desc]<br>"
|
|
scan_data += "Hits by weapon: [total_hits]<br>"
|
|
scan_data += "Approximate time of wound infliction: [station_time_timestamp("hh:mm", age)]<br>"
|
|
scan_data += "Affected limbs: [D.organ_names]<br>"
|
|
scan_data += "Weapon: [D.weapon]<br>"
|
|
scan_data += "<br>"
|
|
|
|
n++
|
|
|
|
if(chemtraces.len)
|
|
scan_data += "<b>Trace Chemicals: </b><br>"
|
|
for(var/chemID in chemtraces)
|
|
scan_data += chemID
|
|
scan_data += "<br>"
|
|
user.visible_message("<span class='warning'>[src] rattles and prints out a sheet of paper.</span>")
|
|
|
|
playsound(loc, 'sound/goonstation/machines/printer_thermal.ogg', 50, 1)
|
|
sleep(10)
|
|
|
|
var/obj/item/paper/P = new(user.loc)
|
|
P.name = "Autopsy Data ([target_name])"
|
|
P.info = "<tt>[scan_data]</tt>"
|
|
P.overlays += "paper_words"
|
|
|
|
user.put_in_hands(P)
|
|
|
|
/obj/item/autopsy_scanner/attack(mob/living/carbon/human/M, mob/living/carbon/user)
|
|
if(!istype(M))
|
|
return
|
|
|
|
if(!on_operable_surface(M))
|
|
return
|
|
|
|
if(target_UID != M.UID())
|
|
target_UID = M.UID()
|
|
target_name = M.name
|
|
wdata.Cut()
|
|
chemtraces.Cut()
|
|
timeofdeath = null
|
|
to_chat(user, "<span class='warning'>A new patient has been registered. Purging data for previous patient.</span>")
|
|
|
|
timeofdeath = M.timeofdeath
|
|
|
|
var/obj/item/organ/external/S = M.get_organ(user.zone_selected)
|
|
if(!S)
|
|
to_chat(user, "<span class='warning'>You can't scan this body part.</span>")
|
|
return
|
|
M.visible_message("<span class='warning'>[user] scans the wounds on [M]'s [S.name] with [src]</span>")
|
|
|
|
add_data(S)
|
|
return 1
|