diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 3c65b03f73..8c55b0d850 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -39,7 +39,7 @@ avoid code duplication. This includes items that may sometimes act as a standard /mob/living/attackby(obj/item/I, mob/user) if(!ismob(user)) return 0 - if(can_operate(src) && do_surgery(src,user,I)) //Surgery + if(can_operate(src) && I.do_surgery(src,user)) //Surgery return 1 return I.attack(src, user, user.zone_sel.selecting) diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 2ddbd4e330..1298206b3e 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -73,50 +73,47 @@ var/mob/living/carbon/human/H = M var/obj/item/organ/external/affecting = H.get_organ(user.zone_sel.selecting) - if(affecting.open == 0) - if(affecting.is_bandaged()) - user << "The wounds on [M]'s [affecting.name] have already been bandaged." - return 1 - else - user.visible_message("\The [user] starts treating [M]'s [affecting.name].", \ - "You start treating [M]'s [affecting.name]." ) - var/used = 0 - for (var/datum/wound/W in affecting.wounds) - if (W.internal) - continue - if(W.bandaged) - continue - if(used == amount) - break - if(!do_mob(user, M, W.damage/5)) - user << "You must stand still to bandage wounds." - break + if(affecting.open) + user << "The [affecting.name] is cut open, you'll need more than a bandage!" + return - if (W.current_stage <= W.max_bleeding_stage) - user.visible_message("\The [user] bandages \a [W.desc] on [M]'s [affecting.name].", \ - "You bandage \a [W.desc] on [M]'s [affecting.name]." ) - //H.add_side_effect("Itch") - else if (W.damage_type == BRUISE) - user.visible_message("\The [user] places a bruise patch over \a [W.desc] on [M]'s [affecting.name].", \ - "You place a bruise patch over \a [W.desc] on [M]'s [affecting.name]." ) - else - user.visible_message("\The [user] places a bandaid over \a [W.desc] on [M]'s [affecting.name].", \ - "You place a bandaid over \a [W.desc] on [M]'s [affecting.name]." ) - W.bandage() - used++ - affecting.update_damages() - if(used == amount) - if(affecting.is_bandaged()) - user << "\The [src] is used up." - else - user << "\The [src] is used up, but there are more wounds to treat on \the [affecting.name]." - use(used) + if(affecting.is_bandaged()) + user << "The wounds on [M]'s [affecting.name] have already been bandaged." + return 1 else - if (can_operate(H)) //Checks if mob is lying down on table for surgery - if (do_surgery(H,user,src)) - return - else - user << "The [affecting.name] is cut open, you'll need more than a bandage!" + user.visible_message("\The [user] starts treating [M]'s [affecting.name].", \ + "You start treating [M]'s [affecting.name]." ) + var/used = 0 + for (var/datum/wound/W in affecting.wounds) + if (W.internal) + continue + if(W.bandaged) + continue + if(used == amount) + break + if(!do_mob(user, M, W.damage/5)) + user << "You must stand still to bandage wounds." + break + + if (W.current_stage <= W.max_bleeding_stage) + user.visible_message("\The [user] bandages \a [W.desc] on [M]'s [affecting.name].", \ + "You bandage \a [W.desc] on [M]'s [affecting.name]." ) + //H.add_side_effect("Itch") + else if (W.damage_type == BRUISE) + user.visible_message("\The [user] places a bruise patch over \a [W.desc] on [M]'s [affecting.name].", \ + "You place a bruise patch over \a [W.desc] on [M]'s [affecting.name]." ) + else + user.visible_message("\The [user] places a bandaid over \a [W.desc] on [M]'s [affecting.name].", \ + "You place a bandaid over \a [W.desc] on [M]'s [affecting.name]." ) + W.bandage() + used++ + affecting.update_damages() + if(used == amount) + if(affecting.is_bandaged()) + user << "\The [src] is used up." + else + user << "\The [src] is used up, but there are more wounds to treat on \the [affecting.name]." + use(used) /obj/item/stack/medical/ointment name = "ointment" @@ -135,26 +132,23 @@ var/mob/living/carbon/human/H = M var/obj/item/organ/external/affecting = H.get_organ(user.zone_sel.selecting) - if(affecting.open == 0) - if(affecting.is_salved()) - user << "The wounds on [M]'s [affecting.name] have already been salved." - return 1 - else - user.visible_message("\The [user] starts salving wounds on [M]'s [affecting.name].", \ - "You start salving the wounds on [M]'s [affecting.name]." ) - if(!do_mob(user, M, 10)) - user << "You must stand still to salve wounds." - return 1 - user.visible_message("[user] salved wounds on [M]'s [affecting.name].", \ - "You salved wounds on [M]'s [affecting.name]." ) - use(1) - affecting.salve() + if(affecting.open) + user << "The [affecting.name] is cut open, you'll need more than a bandage!" + return + + if(affecting.is_salved()) + user << "The wounds on [M]'s [affecting.name] have already been salved." + return 1 else - if (can_operate(H)) //Checks if mob is lying down on table for surgery - if (do_surgery(H,user,src)) - return - else - user << "The [affecting.name] is cut open, you'll need more than a bandage!" + user.visible_message("\The [user] starts salving wounds on [M]'s [affecting.name].", \ + "You start salving the wounds on [M]'s [affecting.name]." ) + if(!do_mob(user, M, 10)) + user << "You must stand still to salve wounds." + return 1 + user.visible_message("[user] salved wounds on [M]'s [affecting.name].", \ + "You salved wounds on [M]'s [affecting.name]." ) + use(1) + affecting.salve() /obj/item/stack/medical/advanced/bruise_pack name = "advanced trauma kit" @@ -172,50 +166,47 @@ var/mob/living/carbon/human/H = M var/obj/item/organ/external/affecting = H.get_organ(user.zone_sel.selecting) - if(affecting.open == 0) - if(affecting.is_bandaged() && affecting.is_disinfected()) - user << "The wounds on [M]'s [affecting.name] have already been treated." - return 1 - else - user.visible_message("\The [user] starts treating [M]'s [affecting.name].", \ - "You start treating [M]'s [affecting.name]." ) - var/used = 0 - for (var/datum/wound/W in affecting.wounds) - if (W.internal) - continue - if (W.bandaged && W.disinfected) - continue - if(used == amount) - break - if(!do_mob(user, M, W.damage/5)) - user << "You must stand still to bandage wounds." - break - if (W.current_stage <= W.max_bleeding_stage) - user.visible_message("\The [user] cleans \a [W.desc] on [M]'s [affecting.name] and seals the edges with bioglue.", \ - "You clean and seal \a [W.desc] on [M]'s [affecting.name]." ) - else if (W.damage_type == BRUISE) - user.visible_message("\The [user] places a medical patch over \a [W.desc] on [M]'s [affecting.name].", \ - "You place a medical patch over \a [W.desc] on [M]'s [affecting.name]." ) - else - user.visible_message("\The [user] smears some bioglue over \a [W.desc] on [M]'s [affecting.name].", \ - "You smear some bioglue over \a [W.desc] on [M]'s [affecting.name]." ) - W.bandage() - W.disinfect() - W.heal_damage(heal_brute) - used++ - affecting.update_damages() - if(used == amount) - if(affecting.is_bandaged()) - user << "\The [src] is used up." - else - user << "\The [src] is used up, but there are more wounds to treat on \the [affecting.name]." - use(used) + if(affecting.open) + user << "The [affecting.name] is cut open, you'll need more than a bandage!" + return + + if(affecting.is_bandaged() && affecting.is_disinfected()) + user << "The wounds on [M]'s [affecting.name] have already been treated." + return 1 else - if (can_operate(H)) //Checks if mob is lying down on table for surgery - if (do_surgery(H,user,src)) - return - else - user << "The [affecting.name] is cut open, you'll need more than a bandage!" + user.visible_message("\The [user] starts treating [M]'s [affecting.name].", \ + "You start treating [M]'s [affecting.name]." ) + var/used = 0 + for (var/datum/wound/W in affecting.wounds) + if (W.internal) + continue + if (W.bandaged && W.disinfected) + continue + if(used == amount) + break + if(!do_mob(user, M, W.damage/5)) + user << "You must stand still to bandage wounds." + break + if (W.current_stage <= W.max_bleeding_stage) + user.visible_message("\The [user] cleans \a [W.desc] on [M]'s [affecting.name] and seals the edges with bioglue.", \ + "You clean and seal \a [W.desc] on [M]'s [affecting.name]." ) + else if (W.damage_type == BRUISE) + user.visible_message("\The [user] places a medical patch over \a [W.desc] on [M]'s [affecting.name].", \ + "You place a medical patch over \a [W.desc] on [M]'s [affecting.name]." ) + else + user.visible_message("\The [user] smears some bioglue over \a [W.desc] on [M]'s [affecting.name].", \ + "You smear some bioglue over \a [W.desc] on [M]'s [affecting.name]." ) + W.bandage() + W.disinfect() + W.heal_damage(heal_brute) + used++ + affecting.update_damages() + if(used == amount) + if(affecting.is_bandaged()) + user << "\The [src] is used up." + else + user << "\The [src] is used up, but there are more wounds to treat on \the [affecting.name]." + use(used) /obj/item/stack/medical/advanced/ointment name = "advanced burn kit" @@ -234,27 +225,23 @@ var/mob/living/carbon/human/H = M var/obj/item/organ/external/affecting = H.get_organ(user.zone_sel.selecting) - if(affecting.open == 0) - if(affecting.is_salved()) - user << "The wounds on [M]'s [affecting.name] have already been salved." - return 1 - else - user.visible_message("\The [user] starts salving wounds on [M]'s [affecting.name].", \ - "You start salving the wounds on [M]'s [affecting.name]." ) - if(!do_mob(user, M, 10)) - user << "You must stand still to salve wounds." - return 1 - user.visible_message( "[user] covers wounds on [M]'s [affecting.name] with regenerative membrane.", \ - "You cover wounds on [M]'s [affecting.name] with regenerative membrane." ) - affecting.heal_damage(0,heal_burn) - use(1) - affecting.salve() + if(affecting.open) + user << "The [affecting.name] is cut open, you'll need more than a bandage!" + + if(affecting.is_salved()) + user << "The wounds on [M]'s [affecting.name] have already been salved." + return 1 else - if (can_operate(H)) //Checks if mob is lying down on table for surgery - if (do_surgery(H,user,src)) - return - else - user << "The [affecting.name] is cut open, you'll need more than a bandage!" + user.visible_message("\The [user] starts salving wounds on [M]'s [affecting.name].", \ + "You start salving the wounds on [M]'s [affecting.name]." ) + if(!do_mob(user, M, 10)) + user << "You must stand still to salve wounds." + return 1 + user.visible_message( "[user] covers wounds on [M]'s [affecting.name] with regenerative membrane.", \ + "You cover wounds on [M]'s [affecting.name] with regenerative membrane." ) + affecting.heal_damage(0,heal_burn) + use(1) + affecting.salve() /obj/item/stack/medical/splint name = "medical splints" diff --git a/code/game/objects/items/stacks/nanopaste.dm b/code/game/objects/items/stacks/nanopaste.dm index 1ff55adf85..da2b23e0e3 100644 --- a/code/game/objects/items/stacks/nanopaste.dm +++ b/code/game/objects/items/stacks/nanopaste.dm @@ -18,7 +18,7 @@ R.adjustFireLoss(-15) R.updatehealth() use(1) - user.visible_message("\The [user] applied some [src] at [R]'s damaged areas.",\ + user.visible_message("\The [user] applied some [src] on [R]'s damaged areas.",\ "You apply some [src] at [R]'s damaged areas.") else user << "All [R]'s systems are nominal." @@ -27,12 +27,14 @@ var/mob/living/carbon/human/H = M var/obj/item/organ/external/S = H.get_organ(user.zone_sel.selecting) - if (S && (S.robotic >= ORGAN_ROBOT)) - if(S.robo_repair(15, "omni", 0, src, user)) - use(1) - user.visible_message("\The [user] applies some nanite paste on [user != M ? "\the [M]'s" : "their"] [S.name].",\ - "You apply some nanite paste on [user == M ? "your" : "[M]'s"] [S.name].") - else - if (can_operate(H)) - if (do_surgery(H,user,src)) - return + if(S.open >= 2) + if (S && (S.robotic >= ORGAN_ROBOT)) + if(!S.get_damage()) + user << "Nothing to fix here." + else if(can_use(1)) + user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) + S.heal_damage(15, 15, robo_repair = 1) + H.updatehealth() + use(1) + user.visible_message("\The [user] applies some nanite paste on [user != M ? "[M]'s [S.name]" : "[S]"] with [src].",\ + "You apply some nanite paste on [user == M ? "your" : "[M]'s"] [S.name].") diff --git a/code/modules/surgery/robotics.dm b/code/modules/surgery/robotics.dm index 6635753ed9..bede5263e2 100644 --- a/code/modules/surgery/robotics.dm +++ b/code/modules/surgery/robotics.dm @@ -166,15 +166,18 @@ if(..()) var/obj/item/stack/cable_coil/C = tool var/obj/item/organ/external/affected = target.get_organ(target_zone) - var/limb_can_operate = ((affected && affected.open >= 3) && (affected.disfigured || affected.burn_dam > 0) && target_zone != O_MOUTH) - if(limb_can_operate) - if(istype(C)) - if(!C.get_amount() >= 3) - user << "You need three or more cable pieces to repair this damage." - return SURGERY_FAILURE - C.use(3) - return 1 - return SURGERY_FAILURE + + var/limb_can_operate = (affected && affected.open == 2 && affected.burn_dam > 0 && target_zone != "mouth") + + if(!limb_can_operate) + return 0 + + if(istype(C)) + if(!C.can_use(10)) + user << "You need ten or more cable pieces to repair this damage." //usage amount made more consistent with regular cable repair + return SURGERY_FAILURE + C.use(10) + return 1 begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/obj/item/organ/external/affected = target.get_organ(target_zone) diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm index cc56b311b5..109da96b69 100644 --- a/code/modules/surgery/surgery.dm +++ b/code/modules/surgery/surgery.dm @@ -68,7 +68,7 @@ proc/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) return null -proc/spread_germs_to_organ(var/obj/item/organ/external/E, var/mob/living/carbon/human/user) +/proc/spread_germs_to_organ(var/obj/item/organ/external/E, var/mob/living/carbon/human/user) if(!istype(user) || !istype(E)) return var/germ_level = user.germ_level @@ -77,7 +77,7 @@ proc/spread_germs_to_organ(var/obj/item/organ/external/E, var/mob/living/carbon/ E.germ_level = max(germ_level,E.germ_level) //as funny as scrubbing microbes out with clean gloves is - no. -proc/do_surgery(mob/living/carbon/M, mob/living/user, obj/item/tool) +/obj/item/proc/do_surgery(mob/living/carbon/M, mob/living/user) if(!istype(M)) return 0 if (user.a_intent == I_HURT) //check for Hippocratic Oath @@ -88,18 +88,18 @@ proc/do_surgery(mob/living/carbon/M, mob/living/user, obj/item/tool) return 1 for(var/datum/surgery_step/S in surgery_steps) //check if tool is right or close enough and if this step is possible - if(S.tool_quality(tool)) - var/step_is_valid = S.can_use(user, M, zone, tool) + if(S.tool_quality(src)) + var/step_is_valid = S.can_use(user, M, zone, src) if(step_is_valid && S.is_valid_target(M)) if(step_is_valid == SURGERY_FAILURE) // This is a failure that already has a message for failing. return 1 M.op_stage.in_progress += zone - S.begin_step(user, M, zone, tool) //start on it + S.begin_step(user, M, zone, src) //start on it //We had proper tools! (or RNG smiled.) and user did not move or change hands. - if(prob(S.tool_quality(tool)) && do_mob(user, M, rand(S.min_duration, S.max_duration))) - S.end_step(user, M, zone, tool) //finish successfully - else if ((tool in user.contents) && user.Adjacent(M)) //or - S.fail_step(user, M, zone, tool) //malpractice~ + if(prob(S.tool_quality(src)) && do_mob(user, M, rand(S.min_duration, S.max_duration))) + S.end_step(user, M, zone, src) //finish successfully + else if ((src in user.contents) && user.Adjacent(M)) //or + S.fail_step(user, M, zone, src) //malpractice~ else // This failing silently was a pain. user << "You must remain close to your patient to conduct surgery." M.op_stage.in_progress -= zone // Clear the in-progress flag. @@ -109,11 +109,11 @@ proc/do_surgery(mob/living/carbon/M, mob/living/user, obj/item/tool) return 1 //don't want to do weapony things after surgery if (user.a_intent == I_HELP) - user << "You can't see any useful way to use [tool] on [M]." + user << "You can't see any useful way to use [src] on [M]." return 1 return 0 -proc/sort_surgeries() +/proc/sort_surgeries() var/gap = surgery_steps.len var/swapped = 1 while (gap > 1 || swapped)