diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index e000b2d3016..92eb16774fb 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -787,7 +787,7 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C product_ads = "Go save some lives!;The best stuff for your medbay.;Only the finest tools.;Natural chemicals!;This stuff saves lives.;Don't you want some?;Ping!" req_access_txt = "5" products = list(/obj/item/weapon/reagent_containers/syringe = 12,/obj/item/weapon/reagent_containers/dropper = 3,/obj/item/stack/medical/gauze = 8,/obj/item/weapon/reagent_containers/pill/patch/styptic = 5, /obj/item/weapon/reagent_containers/pill/insulin = 10, - /obj/item/weapon/reagent_containers/pill/patch/silver_sulf = 5,/obj/item/weapon/reagent_containers/glass/bottle/charcoal = 4, + /obj/item/weapon/reagent_containers/pill/patch/silver_sulf = 5,/obj/item/weapon/reagent_containers/glass/bottle/charcoal = 4, /obj/item/weapon/reagent_containers/spray/medical/sterilizer = 1, /obj/item/weapon/reagent_containers/glass/bottle/epinephrine = 4,/obj/item/weapon/reagent_containers/glass/bottle/morphine = 4,/obj/item/weapon/reagent_containers/glass/bottle/salglu_solution = 3, /obj/item/weapon/reagent_containers/glass/bottle/toxin = 3,/obj/item/weapon/reagent_containers/syringe/antiviral = 6,/obj/item/weapon/reagent_containers/pill/salbutamol = 2,/obj/item/device/healthanalyzer = 4, /obj/item/device/sensor_device = 2) contraband = list(/obj/item/weapon/reagent_containers/pill/tox = 3,/obj/item/weapon/reagent_containers/pill/morphine = 4,/obj/item/weapon/reagent_containers/pill/charcoal = 6) @@ -809,7 +809,8 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C icon_deny = "wallmed-deny" density = 0 products = list(/obj/item/weapon/reagent_containers/syringe = 3,/obj/item/weapon/reagent_containers/pill/patch/styptic = 5, - /obj/item/weapon/reagent_containers/pill/patch/silver_sulf = 5,/obj/item/weapon/reagent_containers/pill/charcoal = 2) + /obj/item/weapon/reagent_containers/pill/patch/silver_sulf = 5,/obj/item/weapon/reagent_containers/pill/charcoal = 2, + /obj/item/weapon/reagent_containers/spray/medical/sterilizer = 1) contraband = list(/obj/item/weapon/reagent_containers/pill/tox = 2,/obj/item/weapon/reagent_containers/pill/morphine = 2) /obj/machinery/vending/security diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 56d75b56517..4fc25452cda 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -18,12 +18,11 @@ take_organ_damage(10) /mob/living/carbon/attackby(obj/item/I, mob/user, params) - if(lying) - if(surgeries.len) - if(user != src && user.a_intent == "help") - for(var/datum/surgery/S in surgeries) - if(S.next_step(user, src)) - return 1 + if(lying && surgeries.len) + if(user != src && user.a_intent == "help") + for(var/datum/surgery/S in surgeries) + if(S.next_step(user)) + return 1 return ..() @@ -39,12 +38,11 @@ if(D.IsSpreadByTouch()) ContractDisease(D) - if(lying) + if(lying && surgeries.len) if(user.a_intent == "help") - if(surgeries.len) - for(var/datum/surgery/S in surgeries) - if(S.next_step(user, src)) - return 1 + for(var/datum/surgery/S in surgeries) + if(S.next_step(user)) + return 1 return 0 diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index 232d66b8f20..10dafe8f1e2 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -292,7 +292,7 @@ var/list/slime_colours = list("rainbow", "grey", "purple", "metal", "orange", if(stat == DEAD && surgeries.len) if(M.a_intent == "help") for(var/datum/surgery/S in surgeries) - if(S.next_step(M, src)) + if(S.next_step(M)) return 1 if(..()) //successful attack attacked += 10 @@ -307,7 +307,7 @@ var/list/slime_colours = list("rainbow", "grey", "purple", "metal", "orange", if(stat == DEAD && surgeries.len) if(user.a_intent == "help") for(var/datum/surgery/S in surgeries) - if(S.next_step(user, src)) + if(S.next_step(user)) return 1 if(istype(W,/obj/item/stack/sheet/mineral/plasma) && !stat) //Let's you feed slimes plasma. if (user in Friends) diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index ef802527662..c70c022d467 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -56,8 +56,18 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/reaction_mob(mob/living/M, method=TOUCH, reac_volume)//Splashing people with ethanol isn't quite as good as fuel. if(!istype(M, /mob/living)) return - if(method == TOUCH || method == VAPOR) + + if(method in list(TOUCH, VAPOR, PATCH)) M.adjust_fire_stacks(reac_volume / 15) + + if(iscarbon(M)) + var/mob/living/carbon/C = M + var/power_multiplier = boozepwr / 65 // Weak alcohol has less sterilizing power + + for(var/s in C.surgeries) + var/datum/surgery/S = s + S.success_multiplier = max(0.10*power_multiplier, S.success_multiplier) + // +10% success propability on each step, useful while operating in less-than-perfect conditions return ..() /datum/reagent/consumable/ethanol/beer diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 46bc5472217..df4a732fd52 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -306,6 +306,12 @@ if(show_message) M << "Your stomach agonizingly cramps!" else + var/mob/living/carbon/C = M + for(var/s in C.surgeries) + var/datum/surgery/S = s + S.success_multiplier = max(0.10, S.success_multiplier) + // +10% success propability on each step, useful while operating in less-than-perfect conditions + if(show_message) M << "You feel your wounds fade away to nothing!" //It's a painkiller, after all ..() diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index b2e0b8fb995..efcad8ef892 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -387,8 +387,10 @@ if(initial(S.blacklisted)) continue possible_morphs += S + + var/current_species = H.dna.species.type var/datum/species/mutation = pick(possible_morphs) - if(prob(90) && mutation) + if(mutation && mutation != current_species) H << "The pain subsides. You feel... different." H.set_species(mutation) else @@ -607,12 +609,21 @@ GG = new/obj/effect/decal/cleanable/greenglow(T) GG.reagents.add_reagent("radium", reac_volume) -/datum/reagent/sterilizine +/datum/reagent/space_cleaner/sterilizine name = "Sterilizine" id = "sterilizine" description = "Sterilizes wounds in preparation for surgery." color = "#C8A5DC" // rgb: 200, 165, 220 +/datum/reagent/space_cleaner/sterilizine/reaction_mob(mob/living/M, method=TOUCH, reac_volume) + if(iscarbon(M) && (method in list(TOUCH, VAPOR, PATCH))) + var/mob/living/carbon/C = M + for(var/s in C.surgeries) + var/datum/surgery/S = s + S.success_multiplier = max(0.20, S.success_multiplier) + // +20% success propability on each step, useful while operating in less-than-perfect conditions + ..() + /datum/reagent/iron name = "Iron" id = "iron" diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index f999590d933..83eaa1ff201 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -117,7 +117,6 @@ user << "You switch the nozzle setting to [stream_mode ? "\"stream\"":"\"spray\""]. You'll now use [amount_per_transfer_from_this] units per use." /obj/item/weapon/reagent_containers/spray/verb/empty() - set name = "Empty Spray Bottle" set category = "Object" set src in usr @@ -136,6 +135,7 @@ desc = "BLAM!-brand non-foaming space cleaner!" list_reagents = list("cleaner" = 250) +//spray tan /obj/item/weapon/reagent_containers/spray/spraytan name = "spray tan" volume = 50 @@ -143,6 +143,19 @@ list_reagents = list("spraytan" = 50) +/obj/item/weapon/reagent_containers/spray/medical + name = "medical spray" + icon = 'icons/obj/chemical.dmi' + icon_state = "medspray" + volume = 100 + + +/obj/item/weapon/reagent_containers/spray/medical/sterilizer + name = "sterilizer spray" + desc = "Spray bottle loaded with non-toxic sterilizer. Useful in preparation for surgery." + list_reagents = list("sterilizine" = 100) + + //pepperspray /obj/item/weapon/reagent_containers/spray/pepper name = "pepperspray" diff --git a/code/modules/surgery/helpers.dm b/code/modules/surgery/helpers.dm index 59259bda02f..79b641e3c06 100644 --- a/code/modules/surgery/helpers.dm +++ b/code/modules/surgery/helpers.dm @@ -1,93 +1,90 @@ /proc/attempt_initiate_surgery(obj/item/I, mob/living/M, mob/user) - if(istype(M)) - var/mob/living/carbon/human/H - var/obj/item/bodypart/affecting - var/selected_zone = user.zone_selected + if(!istype(M)) + return - if(istype(M, /mob/living/carbon/human)) - H = M - affecting = H.get_bodypart(check_zone(selected_zone)) + var/mob/living/carbon/human/H + var/obj/item/bodypart/affecting + var/selected_zone = user.zone_selected - if(M.lying || isslime(M)) //if they're prone or a slime - var/datum/surgery/current_surgery + if(istype(M, /mob/living/carbon/human)) + H = M + affecting = H.get_bodypart(check_zone(selected_zone)) - for(var/datum/surgery/S in M.surgeries) - if(S.location == selected_zone) - current_surgery = S + if(!M.lying && !isslime(M)) //if they're prone or a slime + return - if(!current_surgery) - var/list/all_surgeries = surgeries_list.Copy() - var/list/available_surgeries = list() + var/datum/surgery/current_surgery - for(var/datum/surgery/S in all_surgeries) - if(!S.possible_locs.Find(selected_zone)) - continue - if(affecting) - if(!S.requires_bodypart) - continue - if(S.requires_organic_bodypart && affecting.status == ORGAN_ROBOTIC) - continue - else if(H && S.requires_bodypart) //human with no limb in surgery zone when we need a limb - continue - if(!S.can_start(user, M)) - continue - for(var/path in S.species) - if(istype(M, path)) - available_surgeries[S.name] = S - break + for(var/datum/surgery/S in M.surgeries) + if(S.location == selected_zone) + current_surgery = S - var/P = input("Begin which procedure?", "Surgery", null, null) as null|anything in available_surgeries - if(P && user && user.Adjacent(M) && (I in user)) - var/datum/surgery/S = available_surgeries[P] + if(!current_surgery) + var/list/all_surgeries = surgeries_list.Copy() + var/list/available_surgeries = list() - for(var/datum/surgery/other in M.surgeries) - if(other.location == S.location) - return //during the input() another surgery was started at the same location. + for(var/datum/surgery/S in all_surgeries) + if(!S.possible_locs.Find(selected_zone)) + continue + if(affecting) + if(!S.requires_bodypart) + continue + if(S.requires_organic_bodypart && affecting.status == ORGAN_ROBOTIC) + continue + else if(H && S.requires_bodypart) //human with no limb in surgery zone when we need a limb + continue + if(!S.can_start(user, M)) + continue + for(var/path in S.species) + if(istype(M, path)) + available_surgeries[S.name] = S + break - var/datum/surgery/procedure = new S.type - if(procedure) - procedure.location = selected_zone + var/P = input("Begin which procedure?", "Surgery", null, null) as null|anything in available_surgeries + if(P && user && user.Adjacent(M) && (I in user)) + var/datum/surgery/S = available_surgeries[P] - //we check that the surgery is still doable after the input() wait. - if(H) - affecting = H.get_bodypart(check_zone(selected_zone)) - if(affecting) - if(!procedure.requires_bodypart) - return - if(procedure.requires_organic_bodypart && affecting.status == ORGAN_ROBOTIC) - return - else if(H && procedure.requires_bodypart) - return - if(!procedure.can_start(user, M)) - return + for(var/datum/surgery/other in M.surgeries) + if(other.location == S.location) + return //during the input() another surgery was started at the same location. - if(procedure.ignore_clothes || get_location_accessible(M, selected_zone)) - M.surgeries += procedure - procedure.organ = affecting - user.visible_message("[user] drapes [I] over [M]'s [parse_zone(selected_zone)] to prepare for \an [procedure.name].", \ - "You drape [I] over [M]'s [parse_zone(selected_zone)] to prepare for \an [procedure.name].") + //we check that the surgery is still doable after the input() wait. + if(H) + affecting = H.get_bodypart(check_zone(selected_zone)) + if(affecting) + if(!S.requires_bodypart) + return + if(S.requires_organic_bodypart && affecting.status == ORGAN_ROBOTIC) + return + else if(H && S.requires_bodypart) + return + if(!S.can_start(user, M)) + return - add_logs(user, M, "operated", addition="Operation type: [procedure.name], location: [selected_zone]") - else - user << "You need to expose [M]'s [parse_zone(selected_zone)] first!" + if(S.ignore_clothes || get_location_accessible(M, selected_zone)) + var/datum/surgery/procedure = new S.type(M, selected_zone, affecting) + user.visible_message("[user] drapes [I] over [M]'s [parse_zone(selected_zone)] to prepare for \an [procedure.name].", \ + "You drape [I] over [M]'s [parse_zone(selected_zone)] to prepare for \an [procedure.name].") - else if(!current_surgery.step_in_progress) - if(current_surgery.status == 1) - M.surgeries -= current_surgery - user.visible_message("[user] removes the drapes from [M]'s [parse_zone(selected_zone)].", \ - "You remove the drapes from [M]'s [parse_zone(selected_zone)].") - qdel(current_surgery) - else if(istype(user.get_inactive_hand(), /obj/item/weapon/cautery) && current_surgery.can_cancel) - M.surgeries -= current_surgery - user.visible_message("[user] mends the incision and removes the drapes from [M]'s [parse_zone(selected_zone)].", \ - "You mend the incision and remove the drapes from [M]'s [parse_zone(selected_zone)].") - qdel(current_surgery) - else if(current_surgery.can_cancel) - user << "You need to hold a cautery in inactive hand to stop [M]'s surgery!" + add_logs(user, M, "operated", addition="Operation type: [procedure.name], location: [selected_zone]") + else + user << "You need to expose [M]'s [parse_zone(selected_zone)] first!" + else if(!current_surgery.step_in_progress) + if(current_surgery.status == 1) + M.surgeries -= current_surgery + user.visible_message("[user] removes the drapes from [M]'s [parse_zone(selected_zone)].", \ + "You remove the drapes from [M]'s [parse_zone(selected_zone)].") + qdel(current_surgery) + else if(istype(user.get_inactive_hand(), /obj/item/weapon/cautery) && current_surgery.can_cancel) + M.surgeries -= current_surgery + user.visible_message("[user] mends the incision and removes the drapes from [M]'s [parse_zone(selected_zone)].", \ + "You mend the incision and remove the drapes from [M]'s [parse_zone(selected_zone)].") + qdel(current_surgery) + else if(current_surgery.can_cancel) + user << "You need to hold a cautery in inactive hand to stop [M]'s surgery!" - return 1 - return 0 + return 1 diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm index 8bb3cf641a5..6595ee3f8a0 100644 --- a/code/modules/surgery/surgery.dm +++ b/code/modules/surgery/surgery.dm @@ -1,16 +1,37 @@ /datum/surgery var/name = "surgery" var/status = 1 - var/list/steps = list() //Steps in a surgery - var/step_in_progress = 0 //Actively performing a Surgery - var/can_cancel = 1 //Can cancel this surgery after step 1 with cautery - var/list/species = list(/mob/living/carbon/human) //Acceptable Species - var/location = "chest" //Surgery location - var/requires_organic_bodypart = 1 //Prevents you from performing an operation on robotic limbs - var/list/possible_locs = list() //Multiple locations -- c0 - var/ignore_clothes = 0 //This surgery ignores clothes - var/obj/item/organ/organ //Operable body part - var/requires_bodypart = TRUE //Surgery available only when a bodypart is present, or only when it is missing. + var/list/steps = list() //Steps in a surgery + var/step_in_progress = 0 //Actively performing a Surgery + var/can_cancel = 1 //Can cancel this surgery after step 1 with cautery + var/list/species = list(/mob/living/carbon/human) //Acceptable Species + var/location = "chest" //Surgery location + var/requires_organic_bodypart = 1 //Prevents you from performing an operation on robotic limbs + var/list/possible_locs = list() //Multiple locations + var/ignore_clothes = 0 //This surgery ignores clothes + var/mob/living/carbon/target //Operation target mob + var/obj/item/organ/organ //Operable body part + var/requires_bodypart = TRUE //Surgery available only when a bodypart is present, or only when it is missing. + var/success_multiplier = 0 //Step success propability multiplier + + +/datum/surgery/New(surgery_target, surgery_location, surgery_organ) + ..() + if(surgery_target) + target = surgery_target + target.surgeries += src + if(surgery_location) + location = surgery_location + if(surgery_organ) + organ = surgery_organ + +/datum/surgery/Destroy() + if(target) + target.surgeries -= src + target = null + organ = null + return ..() + /datum/surgery/proc/can_start(mob/user, mob/living/carbon/target) // if 0 surgery wont show up in list @@ -18,9 +39,9 @@ return 1 -/datum/surgery/proc/next_step(mob/user, mob/living/carbon/target) +/datum/surgery/proc/next_step(mob/user) if(step_in_progress) - return + return 1 var/datum/surgery_step/S = get_surgery_step() if(S) @@ -32,10 +53,23 @@ var/step_type = steps[status] return new step_type +/datum/surgery/proc/complete() + qdel(src) + + +/datum/surgery/proc/get_propability_multiplier() + var/propability = 0.5 + var/turf/T = get_turf(target) + + if(locate(/obj/structure/table/optable, T)) + propability = 1 + else if(locate(/obj/structure/table, T)) + propability = 0.8 + else if(locate(/obj/structure/bed, T)) + propability = 0.7 + + return propability + success_multiplier -/datum/surgery/proc/complete(mob/living/carbon/human/target) - target.surgeries -= src - src = null @@ -45,7 +79,6 @@ //Other important variables are var/list/surgeries (/mob/living) and var/list/internal_organs (/mob/living/carbon) // var/list/bodyparts (/mob/living/carbon/human) is the LIMBS of a Mob. //Surgical procedures are initiated by attempt_initiate_surgery(), which is called by surgical drapes and bedsheets. -// /code/modules/surgery/multiple_location_example.dm contains steps to setup a multiple location operation. //TODO @@ -60,4 +93,4 @@ //RESOLVED ISSUES //"Todo" jobs that have been completed //combine hands/feet into the arms - Hands/feet were removed - RR -//surgeries (not steps) that can be initiated on any body part (corresponding with damage locations) - Call this one done, see multiple_location_example.dm - RR \ No newline at end of file +//surgeries (not steps) that can be initiated on any body part (corresponding with damage locations) - Call this one done, see possible_locs var - c0 \ No newline at end of file diff --git a/code/modules/surgery/surgery_step.dm b/code/modules/surgery/surgery_step.dm index 0b9c9980668..dae2c7092e2 100644 --- a/code/modules/surgery/surgery_step.dm +++ b/code/modules/surgery/surgery_step.dm @@ -1,10 +1,10 @@ /datum/surgery_step + var/name var/list/implements = list() //format is path = probability of success. alternatively var/implement_type = null //the current type of implement used. This has to be stored, as the actual typepath of the tool may not match the list type. var/accept_hand = 0 //does the surgery step require an open hand? If true, ignores implements. Compatible with accept_any_item. var/accept_any_item = 0 //does the surgery step accept any item? If true, ignores implements. Compatible with require_hand. var/time = 10 //how long does the step take? - var/name /datum/surgery_step/proc/try_op(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) @@ -48,7 +48,7 @@ if(implement_type) //this means it isn't a require hand or any item step. prob_chance = implements[implement_type] - prob_chance *= get_location_modifier(target) + prob_chance *= surgery.get_propability_multiplier() if(prob(prob_chance) || isrobot(user)) if(success(user, target, target_zone, tool, surgery)) @@ -60,7 +60,7 @@ if(advance) surgery.status++ if(surgery.status > surgery.steps.len) - surgery.complete(target) + surgery.complete() surgery.step_in_progress = 0 diff --git a/icons/obj/chemical.dmi b/icons/obj/chemical.dmi index c673435c854..17c68ddb123 100644 Binary files a/icons/obj/chemical.dmi and b/icons/obj/chemical.dmi differ