This works and things are all good

Revert "This works and things are all good"

This reverts commit a8a40d6a3111478a572047d3ffbcf0f85550827b.

This works and is all good
This commit is contained in:
C.L
2022-10-03 01:01:50 -04:00
parent 4215e8f6e1
commit 366533390e
3 changed files with 168 additions and 70 deletions
+42 -37
View File
@@ -203,49 +203,54 @@
/datum/surgery_step/cavity/implant_removal/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/chest/affected = target.get_organ(target_zone)
var/find_prob = 0
if (affected.implants.len)
var/obj/item/obj = pick(affected.implants)
var/obj/item/obj = tgui_input_list(user, "Which embedded item do you wish to remove?", "Surgery Select", affected.implants)
if(isnull(obj)) //They clicked cancel.
user.visible_message("<span class='notice'>[user] takes \the [tool] out of [target]'s [affected.name].</span>", \
"<span class='notice'>You take \the [tool] out of the incision on [target]'s [affected.name].</span>" )
return
if(!do_mob(user, target, 1)) //They moved away
to_chat(user, "<span class='warning'>You must remain close to and keep focused on your patient to conduct surgery.</span>")
user.visible_message("<span class='notice'>[user] fails to remove anything from [target]'s [affected.name] with \the [tool]!</span>", \
"<span class='notice'>You fail to remove the [obj] from [target]'s [affected.name]s with \the [tool]!</span>" )
return
if(istype(obj,/obj/item/weapon/implant))
var/obj/item/weapon/implant/imp = obj
if (imp.islegal())
find_prob +=60
else
find_prob +=40
if (!imp.islegal()) //ILLEGAL IMPLANT ALERT!!!!!!!!!!
user.visible_message("<span class='notice'>[user] seems to be intently working on something within [target]'s [affected.name] with \the [tool]!</span>", \
"<span class='notice'>You intently begin to take [obj] out of the incision on [target]'s [affected.name]s with \the [tool]!</span>" )
if(!do_after(user, min_duration, target))
user.visible_message("<span class='notice'>[user] fails to remove anything from [target]'s [affected.name] with \the [tool]!</span>", \
"<span class='notice'>You fail to remove the [obj] from [target]'s [affected.name]s with \the [tool]!</span>" )
return
user.visible_message("<span class='notice'>[user] takes something out of the incision on [target]'s [affected.name] with \the [tool]!</span>", \
"<span class='notice'>You take [obj] out of the incision on [target]'s [affected.name]s with \the [tool]!</span>" )
affected.implants -= obj
if(!target.has_embedded_objects())
target.clear_alert("embeddedobject")
BITSET(target.hud_updateflag, IMPLOYAL_HUD)
//Handle possessive brain borers.
if(istype(obj,/mob/living/simple_mob/animal/borer))
var/mob/living/simple_mob/animal/borer/worm = obj
if(worm.controlling)
target.release_control()
worm.detatch()
worm.leave_host()
else
find_prob +=50
if (prob(find_prob))
user.visible_message("<span class='notice'>[user] takes something out of incision on [target]'s [affected.name] with \the [tool]!</span>", \
"<span class='notice'>You take [obj] out of incision on [target]'s [affected.name]s with \the [tool]!</span>" )
affected.implants -= obj
if(!target.has_embedded_objects())
target.clear_alert("embeddedobject")
BITSET(target.hud_updateflag, IMPLOYAL_HUD)
//Handle possessive brain borers.
if(istype(obj,/mob/living/simple_mob/animal/borer))
var/mob/living/simple_mob/animal/borer/worm = obj
if(worm.controlling)
target.release_control()
worm.detatch()
worm.leave_host()
else
obj.loc = get_turf(target)
obj.add_blood(target)
obj.update_icon()
if(istype(obj,/obj/item/weapon/implant))
var/obj/item/weapon/implant/imp = obj
imp.imp_in = null
imp.implanted = 0
else if(istype(tool,/obj/item/device/nif)){var/obj/item/device/nif/N = tool;N.unimplant(target)} //VOREStation Add - NIF support
else
user.visible_message("<span class='notice'>[user] removes \the [tool] from [target]'s [affected.name].</span>", \
"<span class='notice'>There's something inside [target]'s [affected.name], but you just missed it this time.</span>" )
obj.loc = get_turf(target)
obj.add_blood(target)
obj.update_icon()
if(istype(obj,/obj/item/weapon/implant))
var/obj/item/weapon/implant/imp = obj
imp.imp_in = null
imp.implanted = 0
else if(istype(tool,/obj/item/device/nif)){var/obj/item/device/nif/N = tool;N.unimplant(target)} //VOREStation Add - NIF support
else
user.visible_message("<span class='notice'>[user] could not find anything inside [target]'s [affected.name], and pulls \the [tool] out.</span>", \
"<span class='notice'>You could not find anything inside [target]'s [affected.name].</span>" )
+75
View File
@@ -105,6 +105,81 @@
if(I && I.damage > 0)
I.take_damage(dam_amt,0)
//Robo internal organ fix. For when an organic has robotic limbs.
/datum/surgery_step/fix_organic_organ_robotic //For artificial organs
allowed_tools = list(
/obj/item/stack/nanopaste = 100,
/obj/item/stack/cable_coil = 75,
/obj/item/weapon/tool/wrench = 50,
/obj/item/weapon/storage/toolbox = 10 //Percussive Maintenance
)
min_duration = 70
max_duration = 90
/datum/surgery_step/fix_organic_organ_robotic/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if (!hasorgans(target))
return
var/obj/item/organ/external/affected = target.get_organ(target_zone)
if(!affected) return
var/is_organ_damaged = 0
for(var/obj/item/organ/I in affected.internal_organs)
if(I.damage > 0 && (I.robotic >= ORGAN_ROBOT))
is_organ_damaged = 1
break
return affected.open != 3 && is_organ_damaged //Robots have their own code.
/datum/surgery_step/fix_organic_organ_robotic/begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if (!hasorgans(target))
return
var/obj/item/organ/external/affected = target.get_organ(target_zone)
for(var/obj/item/organ/I in affected.internal_organs)
if(I && I.damage > 0)
if(I.robotic >= ORGAN_ROBOT)
user.visible_message("[user] starts mending the damage to [target]'s [I.name]'s mechanisms.", \
"You start mending the damage to [target]'s [I.name]'s mechanisms." )
target.custom_pain("The pain in your [affected.name] is living hell!",1)
..()
/datum/surgery_step/fix_organic_organ_robotic/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if (!hasorgans(target))
return
var/obj/item/organ/external/affected = target.get_organ(target_zone)
for(var/obj/item/organ/I in affected.internal_organs)
if(I && I.damage > 0)
if(I.robotic >= ORGAN_ROBOT)
user.visible_message("<span class='notice'>[user] repairs [target]'s [I.name] with [tool].</span>", \
"<span class='notice'>You repair [target]'s [I.name] with [tool].</span>" )
I.damage = 0
if(I.organ_tag == O_EYES)
target.sdisabilities &= ~BLIND
/datum/surgery_step/fix_organic_organ_robotic/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if (!hasorgans(target))
return
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("<span class='warning'>[user]'s hand slips, gumming up the mechanisms inside of [target]'s [affected.name] with \the [tool]!</span>", \
"<span class='warning'>Your hand slips, gumming up the mechanisms inside of [target]'s [affected.name] with \the [tool]!</span>")
target.adjustBruteLoss(5)
for(var/obj/item/organ/I in affected.internal_organs)
if(I)
I.take_damage(rand(3,5),0)
//Robo limb fix end
///////////////////////////////////////////////////////////////
// Organ Detaching Surgery
///////////////////////////////////////////////////////////////
+51 -33
View File
@@ -24,8 +24,10 @@
// evil infection stuff that will make everyone hate me
var/can_infect = 0
//How much blood this step can get on surgeon. 1 - hands, 2 - full body.
// How much blood this step can get on surgeon. 1 - hands, 2 - full body.
var/blood_level = 0
// What the surgery will be called in the rare event of multiple surgery steps being shown to the user.
var/surgery_name
//returns how well tool is suited for this step
/datum/surgery_step/proc/tool_quality(obj/item/tool)
@@ -140,50 +142,66 @@
to_chat(user, "<span class='warning'>You can't operate on this area while surgery is already in progress.</span>")
return 1
var/list/available_surgeries = list()
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(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)
continue
available_surgeries += S //Add the surgery to a list of 'We can perform this step'
continue
if(M == user) // Once we determine if we can actually do a step at all, give a slight delay to self-surgery to confirm attempts.
to_chat(user, "<span class='critical'>You focus on attempting to perform surgery upon yourself.</span>")
if(!available_surgeries.len) //No available surgeries. Failure.
return 0
if(!do_after(user, 3 SECONDS, M))
return 0
if(M == user) // Once we determine if we can actually do a step at all, give a slight delay to self-surgery to confirm attempts.
to_chat(user, "<span class='critical'>You focus on attempting to perform surgery upon yourself.</span>")
if(!do_after(user, 3 SECONDS, M))
return 0
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, src) //start on it
var/success = TRUE
// Bad tools make it less likely to succeed.
if(!prob(S.tool_quality(src)))
success = FALSE
var/datum/surgery_step/selected_surgery
if(available_surgeries.len > 1) //More than one possible? Ask them which one.
selected_surgery = tgui_input_list(user, "Select which surgery step you wish to perform", "Surgery Select", available_surgeries)
else
selected_surgery = pick(available_surgeries)
// Bad or no surface may mean failure as well.
var/obj/surface = M.get_surgery_surface(user)
if(!surface || !prob(surface.surgery_odds))
success = FALSE
if(isnull(selected_surgery)) //They clicked 'cancel'
return 1
// Not staying still fails you too.
if(success)
var/calc_duration = rand(S.min_duration, S.max_duration)
if(!do_mob(user, M, calc_duration * toolspeed, zone, exclusive = TRUE))
success = FALSE
to_chat(user, "<span class='warning'>You must remain close to and keep focused on your patient to conduct surgery.</span>")
M.op_stage.in_progress += zone
selected_surgery.begin_step(user, M, zone, src) //start on it
var/success = TRUE
if(success)
S.end_step(user, M, zone, src)
else
S.fail_step(user, M, zone, src)
// Bad tools make it less likely to succeed.
if(!prob(selected_surgery.tool_quality(src)))
success = FALSE
M.op_stage.in_progress -= zone // Clear the in-progress flag.
if (ishuman(M))
var/mob/living/carbon/human/H = M
H.update_surgery()
return 1 //don't want to do weapony things after surgery
// Bad or no surface may mean failure as well.
var/obj/surface = M.get_surgery_surface(user)
if(!surface || !prob(surface.surgery_odds))
success = FALSE
// Not staying still fails you too.
if(success)
var/calc_duration = rand(selected_surgery.min_duration, selected_surgery.max_duration)
if(!do_mob(user, M, calc_duration * toolspeed, zone, exclusive = TRUE))
success = FALSE
to_chat(user, "<span class='warning'>You must remain close to and keep focused on your patient to conduct surgery.</span>")
if(success)
selected_surgery.end_step(user, M, zone, src)
else
selected_surgery.fail_step(user, M, zone, src)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) //Gets rid of instakill mechanics.
M.op_stage.in_progress -= zone // Clear the in-progress flag.
if (ishuman(M))
var/mob/living/carbon/human/H = M
H.update_surgery()
return 1 //don't want to do weapony things after surgery
return 0
/proc/sort_surgeries()
@@ -208,4 +226,4 @@
var/brainstem = 0
var/head_reattach = 0
var/current_organ = "organ"
var/list/in_progress = list()
var/list/in_progress = list()