Sterilizine now reduces surgery step failure prob (#19337)

* surgery refactor

* Sterilizine now reduces surgery step failure prob

* Adds steriliizne sprayer to medical vendors
This commit is contained in:
Core0verload
2016-07-18 00:21:48 +03:00
committed by oranges
parent 394d253c8b
commit c0746aec8d
11 changed files with 183 additions and 114 deletions
@@ -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
@@ -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)
@@ -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
@@ -306,6 +306,12 @@
if(show_message)
M << "<span class='warning'>Your stomach agonizingly cramps!</span>"
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 << "<span class='danger'>You feel your wounds fade away to nothing!</span>" //It's a painkiller, after all
..()
@@ -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 << "<span class='danger'>The pain subsides. You feel... different.</span>"
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"
@@ -117,7 +117,6 @@
user << "<span class='notice'>You switch the nozzle setting to [stream_mode ? "\"stream\"":"\"spray\""]. You'll now use [amount_per_transfer_from_this] units per use.</span>"
/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"
+72 -75
View File
@@ -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].", \
"<span class='notice'>You drape [I] over [M]'s [parse_zone(selected_zone)] to prepare for \an [procedure.name].</span>")
//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 << "<span class='warning'>You need to expose [M]'s [parse_zone(selected_zone)] first!</span>"
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].", \
"<span class='notice'>You drape [I] over [M]'s [parse_zone(selected_zone)] to prepare for \an [procedure.name].</span>")
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)].", \
"<span class='notice'>You remove the drapes from [M]'s [parse_zone(selected_zone)].</span>")
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)].", \
"<span class='notice'>You mend the incision and remove the drapes from [M]'s [parse_zone(selected_zone)].</span>")
qdel(current_surgery)
else if(current_surgery.can_cancel)
user << "<span class='warning'>You need to hold a cautery in inactive hand to stop [M]'s surgery!</span>"
add_logs(user, M, "operated", addition="Operation type: [procedure.name], location: [selected_zone]")
else
user << "<span class='warning'>You need to expose [M]'s [parse_zone(selected_zone)] first!</span>"
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)].", \
"<span class='notice'>You remove the drapes from [M]'s [parse_zone(selected_zone)].</span>")
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)].", \
"<span class='notice'>You mend the incision and remove the drapes from [M]'s [parse_zone(selected_zone)].</span>")
qdel(current_surgery)
else if(current_surgery.can_cancel)
user << "<span class='warning'>You need to hold a cautery in inactive hand to stop [M]'s surgery!</span>"
return 1
return 0
return 1
+50 -17
View File
@@ -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
//surgeries (not steps) that can be initiated on any body part (corresponding with damage locations) - Call this one done, see possible_locs var - c0
+3 -3
View File
@@ -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