Files
Bubberstation/code/modules/surgery/plastic_surgery.dm
Watermelon914 375a20e49b Refactors most spans into span procs (#59645)
Converts most spans into span procs. Mostly used regex for this and sorted out any compile time errors afterwards so there could be some bugs.
Was initially going to do defines, but ninja said to make it into a proc, and if there's any overhead, they can easily be changed to defines.

Makes it easier to control the formatting and prevents typos when creating spans as it'll runtime if you misspell instead of silently failing.
Reduces the code you need to write when writing spans, as you don't need to close the span as that's automatically handled by the proc.

(Note from Lemon: This should be converted to defines once we update the minimum version to 514. Didn't do it now because byond pain and such)
2021-06-14 13:03:53 -07:00

60 lines
3.0 KiB
Plaintext

/datum/surgery/plastic_surgery
name = "Plastic surgery"
steps = list(
/datum/surgery_step/incise,
/datum/surgery_step/retract_skin,
/datum/surgery_step/reshape_face,
/datum/surgery_step/close)
possible_locs = list(BODY_ZONE_HEAD)
//reshape_face
/datum/surgery_step/reshape_face
name = "reshape face"
implements = list(
TOOL_SCALPEL = 100,
/obj/item/kitchen/knife = 50,
TOOL_WIRECUTTER = 35)
time = 64
/datum/surgery_step/reshape_face/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
user.visible_message(span_notice("[user] begins to alter [target]'s appearance."), span_notice("You begin to alter [target]'s appearance..."))
display_results(user, target, span_notice("You begin to alter [target]'s appearance..."),
span_notice("[user] begins to alter [target]'s appearance."),
span_notice("[user] begins to make an incision in [target]'s face."))
/datum/surgery_step/reshape_face/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results = FALSE)
if(HAS_TRAIT_FROM(target, TRAIT_DISFIGURED, TRAIT_GENERIC))
REMOVE_TRAIT(target, TRAIT_DISFIGURED, TRAIT_GENERIC)
display_results(user, target, span_notice("You successfully restore [target]'s appearance."),
span_notice("[user] successfully restores [target]'s appearance!"),
span_notice("[user] finishes the operation on [target]'s face."))
else
var/list/names = list()
if(!isabductor(user))
for(var/i in 1 to 10)
names += target.dna.species.random_name(target.gender, TRUE)
else
for(var/_i in 1 to 9)
names += "Subject [target.gender == MALE ? "i" : "o"]-[pick("a", "b", "c", "d", "e")]-[rand(10000, 99999)]"
names += target.dna.species.random_name(target.gender, TRUE) //give one normal name in case they want to do regular plastic surgery
var/chosen_name = input(user, "Choose a new name to assign.", "Plastic Surgery") as null|anything in names
if(!chosen_name)
return
var/oldname = target.real_name
target.real_name = chosen_name
var/newname = target.real_name //something about how the code handles names required that I use this instead of target.real_name
display_results(user, target, span_notice("You alter [oldname]'s appearance completely, [target.p_they()] is now [newname]."),
span_notice("[user] alters [oldname]'s appearance completely, [target.p_they()] is now [newname]!"),
span_notice("[user] finishes the operation on [target]'s face."))
if(ishuman(target))
var/mob/living/carbon/human/human_target = target
human_target.sec_hud_set_ID()
return ..()
/datum/surgery_step/reshape_face/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, span_warning("You screw up, leaving [target]'s appearance disfigured!"),
span_notice("[user] screws up, disfiguring [target]'s appearance!"),
span_notice("[user] finishes the operation on [target]'s face."))
ADD_TRAIT(target, TRAIT_DISFIGURED, TRAIT_GENERIC)
return FALSE