Files
Bubberstation/code/modules/surgery/plastic_surgery.dm
Jeremiah 9c6fdb567d TGUI list conversions + bug fixes (#63354)
About The Pull Request

    Converts more inputs to TGUI. Possibly all user-facing input lists in the game.
    Did any surrounding text/number inputs as well
    Added null choice support so users can press cancel.
    Added some misc TGUI input fixes
    Fixed custom vendors while I was there

I refactored a lot of code while just poking around.
Primarily, usage of .len in files where I was already working on lists.
Some code was just awful - look at guardian.dm and its non use of early returns
If there are any disputes, I can revert it just fine, those changes are not integral to the PR.
Why It's Good For The Game

Fixes #63629
Fixes #63307
Fixes custom vendors /again/
Text input is more performant.
Part of a long series of TGUI conversion to make the game more visually appealing
Changelog

cl
refactor: The majority of user facing input lists have been converted to TGUI.
refactor: Tgui text inputs now scale with entered input.
fix: Many inputs now properly accept cancelling out of the menu.
fix: Fixes an edge case where users could not press enter on number inputs.
fix: Custom vendor bluescreen.
fix: You can now press ENTER on text inputs without an entry to cancel.
/cl
2021-12-31 11:07:28 +13:00

64 lines
3.2 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/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."))
display_pain(target, "You feel slicing pain across your 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."))
display_pain(target, "The pain fades, your face feels normal again!")
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 = tgui_input_list(user, "New name to assign", "Plastic Surgery", names)
if(isnull(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."))
display_pain(target, "The pain fades, your face feels new and unfamiliar!")
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."))
display_pain(target, "Your face feels horribly scarred and deformed!")
ADD_TRAIT(target, TRAIT_DISFIGURED, TRAIT_GENERIC)
return FALSE