mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 11:34:19 +01:00
so you can almost perform surgery with a claymore
things needed: Addeing the sharp object used as a low success allowed tool on the fly. Handleing advanced scalpals.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/proc/attempt_initiate_surgery(obj/item/I, mob/living/M, mob/user)
|
||||
/proc/attempt_initiate_surgery(obj/item/I, mob/living/M, mob/user, var/override )
|
||||
world << "[istype(M)]"
|
||||
if(istype(M))
|
||||
var/mob/living/carbon/human/H
|
||||
@@ -33,16 +33,37 @@
|
||||
available_surgeries[S.name] = S
|
||||
break
|
||||
|
||||
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]
|
||||
var/datum/surgery/procedure = new S.type
|
||||
if(procedure)
|
||||
procedure.location = selected_zone
|
||||
M.surgeries += procedure
|
||||
procedure.organ_ref = affecting
|
||||
user.visible_message("[user] prepares to operate on [M]'s [parse_zone(selected_zone)].", \
|
||||
"<span class='notice'>You prepare to operate on [M]'s [parse_zone(selected_zone)].</span>")
|
||||
if(override)
|
||||
if(I == /obj/item/weapon/circular_saw)
|
||||
var/datum/surgery/S = available_surgeries["amputation"]
|
||||
if(S)//we might be targetting a zone without the named procedure.
|
||||
var/datum/surgery/procedure = new S.type
|
||||
if(procedure)
|
||||
procedure.location = selected_zone
|
||||
M.surgeries += procedure
|
||||
procedure.organ_ref = affecting
|
||||
procedure.next_step(user, M)
|
||||
else if(I == /obj/item/robot_parts)
|
||||
var/datum/surgery/S = available_surgeries["robotic limb attachment"]
|
||||
if(S)//we might be targetting a zone without the named procedure.
|
||||
var/datum/surgery/procedure = new S.type
|
||||
if(procedure)
|
||||
procedure.location = selected_zone
|
||||
M.surgeries += procedure
|
||||
procedure.organ_ref = affecting
|
||||
procedure.next_step(user, M)
|
||||
|
||||
else
|
||||
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]
|
||||
var/datum/surgery/procedure = new S.type
|
||||
if(procedure)
|
||||
procedure.location = selected_zone
|
||||
M.surgeries += procedure
|
||||
procedure.organ_ref = affecting
|
||||
user.visible_message("[user] prepares to operate on [M]'s [parse_zone(selected_zone)].", \
|
||||
"<span class='notice'>You prepare to operate on [M]'s [parse_zone(selected_zone)].</span>")
|
||||
|
||||
else if(!current_surgery.step_in_progress)
|
||||
if(current_surgery.status == 1)
|
||||
|
||||
@@ -3,6 +3,54 @@
|
||||
// LIMB SURGERY //
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
/datum/surgery/amputation
|
||||
name = "amputation"
|
||||
steps = list(/datum/surgery_step/generic/amputate)
|
||||
possible_locs = list("head","l_arm", "l_hand","r_arm","r_hand","r_leg","r_foot","l_leg","l_foot","groin")
|
||||
|
||||
|
||||
/datum/surgery/amputation/can_start(mob/user, mob/living/carbon/target)
|
||||
if(ishuman(target))
|
||||
var/mob/living/carbon/human/H = target
|
||||
var/obj/item/organ/external/affected = H.get_organ(user.zone_sel.selecting)
|
||||
if(affected.cannot_amputate)
|
||||
return 0
|
||||
if(affected.status && ORGAN_DESTROYED)
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
/datum/surgery/reattach
|
||||
name = "limb attachment"
|
||||
steps = list(/datum/surgery_step/limb/attach,/datum/surgery_step/limb/connect)
|
||||
possible_locs = list("head","l_arm", "l_hand","r_arm","r_hand","r_leg","r_foot","l_leg","l_foot","groin")
|
||||
|
||||
/datum/surgery/reattach/can_start(mob/user, mob/living/carbon/target)
|
||||
if(ishuman(target))
|
||||
var/mob/living/carbon/human/H = target
|
||||
var/obj/item/organ/external/affected = H.get_organ(user.zone_sel.selecting)
|
||||
|
||||
if(affected.status && ~ORGAN_DESTROYED)
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
cannot_amputate
|
||||
/datum/surgery/robo_attach
|
||||
name = "robotic limb attachment"
|
||||
steps = list(/datum/surgery_step/limb/mechanize)
|
||||
possible_locs = list("head","l_arm", "l_hand","r_arm","r_hand","r_leg","r_foot","l_leg","l_foot","groin")
|
||||
|
||||
/datum/surgery/robo_attach/can_start(mob/user, mob/living/carbon/target)
|
||||
if(ishuman(target))
|
||||
var/mob/living/carbon/human/H = target
|
||||
var/obj/item/organ/external/affected = H.get_organ(user.zone_sel.selecting)
|
||||
|
||||
if(affected.status && ~ORGAN_DESTROYED)
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
/datum/surgery_step/limb/
|
||||
priority = 3 // Must be higher than /datum/surgery_step/internal
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
/obj/item/weapon/reagent_containers/food/snacks/organ/New()
|
||||
..()
|
||||
|
||||
reagents.add_reagent("nutriment" = 5)
|
||||
reagents.add_reagent("nutriment", 5)
|
||||
|
||||
|
||||
/obj/item/organ/internal/Destroy()
|
||||
|
||||
@@ -179,6 +179,7 @@
|
||||
I = null
|
||||
affected = target.get_organ(target_zone)
|
||||
if(isorgan(tool))
|
||||
world << "Insert"
|
||||
current_type = "insert"
|
||||
I = tool
|
||||
if(target_zone != I.parent_organ || target.get_organ_slot(I.slot))
|
||||
@@ -197,7 +198,7 @@
|
||||
"You start transplanting \the [tool] into [target]'s [affected.name].")
|
||||
target.custom_pain("Someone's rooting around in your [affected.name]!",1)
|
||||
|
||||
else if(tool in implements_extract)
|
||||
else if(implement_type in implements_extract)
|
||||
current_type = "extract"
|
||||
var/list/organs = target.get_organs_zone(target_zone)
|
||||
if(!organs.len)
|
||||
@@ -219,7 +220,7 @@
|
||||
else
|
||||
return -1
|
||||
|
||||
else if(tool in implements_mend)
|
||||
else if(implement_type in implements_mend)
|
||||
//todo Change message, make it heal the organs...
|
||||
current_type = "mend"
|
||||
var/tool_name = "\the [tool]"
|
||||
|
||||
@@ -249,7 +249,7 @@
|
||||
|
||||
I = null
|
||||
affected = target.get_organ(target_zone)
|
||||
if(tool in implements_insert)
|
||||
if(implement_type in implements_insert)
|
||||
current_type = "insert"
|
||||
//I = tool
|
||||
var/off_tool = user.get_inactive_hand()
|
||||
@@ -312,7 +312,7 @@
|
||||
user.visible_message("[user] starts installing \the [tool] into [target]'s [affected.name].", \
|
||||
"You start installing \the [tool] into [target]'s [affected.name].")
|
||||
|
||||
else if(tool in implements_extract)
|
||||
else if(implement_type in implements_extract)
|
||||
current_type = "extract"
|
||||
var/list/organs = target.get_organs_zone(target_zone)
|
||||
if(!(affected && (affected.status & ORGAN_ROBOT)))
|
||||
@@ -339,7 +339,7 @@
|
||||
else
|
||||
return -1
|
||||
|
||||
else if(tool in implements_mend)
|
||||
else if(implement_type in implements_mend)
|
||||
current_type = "mend"
|
||||
if (!hasorgans(target))
|
||||
return
|
||||
|
||||
@@ -182,38 +182,6 @@
|
||||
if(!(E.status & ORGAN_ROBOT)) //Germs on robotic limbs bad
|
||||
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,datum/surgery/surgery)
|
||||
if(!istype(M))
|
||||
return 0
|
||||
if (user.a_intent == I_HARM) //check for Hippocratic Oath
|
||||
return 0
|
||||
var/zone = user.zone_sel.selecting
|
||||
if(zone in surgery.step_in_progress) //Can't operate on someone repeatedly.
|
||||
user << "\red You can't operate on this area while surgery is already in progress."
|
||||
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(step_is_valid && S.is_valid_target(M))
|
||||
if(step_is_valid == 2) // This is a failure that already has a message for failing.
|
||||
return 1
|
||||
surgery.step_in_progress += zone
|
||||
S.begin_step(user, M, zone, tool) //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~
|
||||
else // This failing silently was a pain.
|
||||
user << "<span class='warning'>You must remain close to your patient to conduct surgery.</span>"
|
||||
surgery.step_in_progress = 0 // Clear the in-progress flag.
|
||||
return 1 //don't want to do weapony things after surgery
|
||||
|
||||
if (user.a_intent == I_HELP)
|
||||
user << "<span class='warning'>You can't see any useful way to use [tool] on [M].</span>"
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/sort_surgeries()
|
||||
var/gap = surgery_steps.len
|
||||
|
||||
@@ -132,10 +132,14 @@
|
||||
origin_tech = "materials=1;biotech=1"
|
||||
attack_verb = list("attacked", "slashed", "sawed", "cut")
|
||||
|
||||
///obj/item/weapon/circular_saw/attack(mob/living/M, mob/user)
|
||||
|
||||
/obj/item/weapon/scalpel/attack(mob/living/M, mob/user)
|
||||
if(!attempt_initiate_surgery(src, M, user))
|
||||
..()
|
||||
// if(!attempt_initiate_surgery(src, M, user,1))
|
||||
// ..()
|
||||
|
||||
///obj/item/weapon/scalpel/attack(mob/living/M, mob/user)
|
||||
// if(!attempt_initiate_surgery(src, M, user))
|
||||
//..()
|
||||
|
||||
//misc, formerly from code/defines/weapons.dm
|
||||
/obj/item/weapon/bonegel
|
||||
|
||||
Reference in New Issue
Block a user