diff --git a/code/modules/vehicles/mecha/equipment/tools/medical_tools.dm b/code/modules/vehicles/mecha/equipment/tools/medical_tools.dm index 83167bf29e2..b1e0d84f14e 100644 --- a/code/modules/vehicles/mecha/equipment/tools/medical_tools.dm +++ b/code/modules/vehicles/mecha/equipment/tools/medical_tools.dm @@ -17,12 +17,12 @@ /obj/item/mecha_parts/mecha_equipment/medical/sleeper name = "mounted sleeper" - desc = "Equipment for medical exosuits. A mounted sleeper that stabilizes patients and can inject reagents in the exosuit's reserves." + desc = "Equipment for medical exosuits. A mounted sleeper that stabilizes patients and can inject reagents from a equipped exosuit syringe gun." icon_state = "mecha_sleeper" energy_drain = 20 range = MECHA_MELEE equip_cooldown = 20 - ///ref to the patient loaded in the sleeper + /// ref to the patient loaded in the sleeper var/mob/living/carbon/patient /// amount of chems to inject into patient from other hands syringe gun var/inject_amount = 10 @@ -32,15 +32,47 @@ content.forceMove(get_turf(src)) return ..() +/obj/item/mecha_parts/mecha_equipment/medical/proc/get_reagent_data(list/datum/reagent/reagent_list) + var/list/contained_reagents = list() + if(length(reagent_list)) + for(var/datum/reagent/reagent as anything in reagent_list) + contained_reagents += list(list("name" = reagent.name, "volume" = round(reagent.volume, 0.01))) // list in a list because Byond merges the first list... + return contained_reagents + /obj/item/mecha_parts/mecha_equipment/medical/sleeper/get_snowflake_data() var/list/data = list("snowflake_id" = MECHA_SNOWFLAKE_ID_SLEEPER) - if(!patient) + if(isnull(patient)) return data + var/patient_state + switch(patient.stat) + if(0) + patient_state = "Conscious" + if(1) + patient_state = "Unconscious" + if(2) + patient_state = "*dead*" + else + patient_state = "Unknown" + var/core_temp = "" + if(ishuman(patient)) + var/mob/living/carbon/human/humi = patient + core_temp = humi.bodytemperature-T0C data["patient"] = list( - "patientname" = patient.name, - "is_dead" = patient.stat == DEAD, + "patient_name" = patient.name, "patient_health" = patient.health/patient.maxHealth, + "patient_state" = patient_state, + "core_temp" = core_temp, + "brute_loss" = patient.getBruteLoss(), + "burn_loss" = patient.getFireLoss(), + "toxin_loss" = patient.getToxLoss(), + "oxygen_loss" = patient.getOxyLoss(), ) + data["has_brain_damage"] = patient.get_organ_loss(ORGAN_SLOT_BRAIN) != 0 + data["has_traumas"] = length(patient.get_traumas()) != 0 + data["contained_reagents"] = get_reagent_data(patient.reagents.reagent_list) + + var/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/shooter = locate(/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun) in chassis + data["injectible_reagents"] = get_reagent_data(shooter.reagents.reagent_list) return data /obj/item/mecha_parts/mecha_equipment/medical/sleeper/handle_ui_act(action, list/params) @@ -48,10 +80,13 @@ if("eject") go_out() return TRUE - if("view_stats") - usr << browse(get_patient_stats(),"window=msleeper") - onclose(usr, "msleeper") - return FALSE + var/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/shooter = locate() in chassis + for(var/datum/reagent/medication in shooter.reagents.reagent_list) + if(action == ("inject_reagent_" + medication.name)) + inject_reagent(medication, shooter) + break // or maybe return TRUE? i'm not certain + + return FALSE /obj/item/mecha_parts/mecha_equipment/medical/sleeper/action(mob/source, atom/atomtarget, list/modifiers) if(!action_checks(atomtarget)) @@ -59,7 +94,7 @@ if(!iscarbon(atomtarget)) return var/mob/living/carbon/target = atomtarget - if(!patient_insertion_check(target)) + if(!patient_insertion_check(target, source)) return to_chat(source, "[icon2html(src, source)][span_notice("You start putting [target] into [src]...")]") chassis.visible_message(span_warning("[chassis] starts putting [target] into \the [src].")) @@ -76,7 +111,7 @@ return ..() /obj/item/mecha_parts/mecha_equipment/medical/sleeper/proc/patient_insertion_check(mob/living/carbon/target, mob/user) - if(target.buckled) + if(!isnull(target.buckled)) to_chat(user, "[icon2html(src, user)][span_warning("[target] will not fit into the sleeper because [target.p_theyre()] buckled to [target.buckled]!")]") return FALSE if(target.has_buckled_mobs()) @@ -103,92 +138,7 @@ STOP_PROCESSING(SSobj, src) return ..() -/obj/item/mecha_parts/mecha_equipment/medical/sleeper/Topic(href,href_list) - . = ..() - if(.) - return - if(!(usr in chassis.occupants)) - return - if(href_list["inject"]) - var/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/SG = locate() in chassis - var/datum/reagent/R = locate(href_list["inject"]) in SG.reagents.reagent_list - if(istype(R)) - inject_reagent(R, SG) - -/obj/item/mecha_parts/mecha_equipment/medical/sleeper/proc/get_patient_stats() - if(!patient) - return - return {" - - - [patient] statistics - - - - -

Health statistics

-
- [get_patient_dam()] -
-

Reagents in bloodstream

-
- [get_patient_reagents()] -
-
- [get_available_reagents()] -
- - "} - -/obj/item/mecha_parts/mecha_equipment/medical/sleeper/proc/get_patient_dam() - var/t1 - switch(patient.stat) - if(0) - t1 = "Conscious" - if(1) - t1 = "Unconscious" - if(2) - t1 = "*dead*" - else - t1 = "Unknown" - var/core_temp = "" - if(ishuman(patient)) - var/mob/living/carbon/human/humi = patient - core_temp = {"Body Temperature: [humi.bodytemperature-T0C]°C ([humi.bodytemperature*1.8-459.67]°F)
"} - return {"Health: [patient.stat > 1 ? "[t1]" : "[patient.health]% ([t1])"]
- [core_temp] - Body Temperature: [patient.bodytemperature-T0C]°C ([patient.bodytemperature*1.8-459.67]°F)
- Brute Damage: [patient.getBruteLoss()]%
- Respiratory Damage: [patient.getOxyLoss()]%
- Toxin Content: [patient.getToxLoss()]%
- Burn Severity: [patient.getFireLoss()]%
- [span_danger("[patient.get_organ_loss(ORGAN_SLOT_BRAIN) ? "Significant brain damage detected." : ""]")]
- [span_danger("[length(patient.get_traumas()) ? "Brain Traumas detected." : ""]")]
- "} - -/obj/item/mecha_parts/mecha_equipment/medical/sleeper/proc/get_patient_reagents() - if(patient.reagents) - for(var/datum/reagent/R in patient.reagents.reagent_list) - if(R.volume > 0) - . += "[R]: [round(R.volume,0.01)]
" - return . || "None" - -/obj/item/mecha_parts/mecha_equipment/medical/sleeper/proc/get_available_reagents() - var/output - var/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/SG = locate(/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun) in chassis - if(SG && SG.reagents && islist(SG.reagents.reagent_list)) - for(var/datum/reagent/R in SG.reagents.reagent_list) - if(R.volume > 0) - output += "Inject [R.name]
" - return output - - -/obj/item/mecha_parts/mecha_equipment/medical/sleeper/proc/inject_reagent(datum/reagent/R,obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/SG) +/obj/item/mecha_parts/mecha_equipment/medical/sleeper/proc/inject_reagent(datum/reagent/R, obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/SG) if(!R || !patient || !SG || !(SG in chassis.flat_equipment)) return var/to_inject = min(R.volume, inject_amount) @@ -294,11 +244,7 @@ "total_reagents" = reagents.maximum_volume, "analyzed_reagents" = analyzed_reagents, ) - var/list/contained_reagents = list() - if(length(reagents.reagent_list)) - for(var/datum/reagent/reagent as anything in reagents.reagent_list) - contained_reagents += list(list("name" = reagent.name, "volume" = round(reagent.volume, 0.01))) // list in a list because Byond merges the first list... - data["contained_reagents"] = contained_reagents + data["contained_reagents"] = get_reagent_data(reagents.reagent_list) return data /obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/handle_ui_act(action, list/params) diff --git a/tgui/packages/tgui/interfaces/Mecha/ModulesPane.tsx b/tgui/packages/tgui/interfaces/Mecha/ModulesPane.tsx index 31ed70080cb..e1ea1b81ef5 100644 --- a/tgui/packages/tgui/interfaces/Mecha/ModulesPane.tsx +++ b/tgui/packages/tgui/interfaces/Mecha/ModulesPane.tsx @@ -228,8 +228,8 @@ const ModuleDetailsBasic = (props) => { label="Integrity" buttons={ + + + ))} + ); }; @@ -473,17 +525,17 @@ const SnowflakeSyringe = (props) => { } = props.module.snowflake; return ( <> - + {`${syringe} of ${max_syringe}`} - + {`${reagents} of ${total_reagents} units`} - +