Files
Bubberstation/code/modules/admin/verbs/manipulate_organs.dm
T
JeremiahandGitHub 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

79 lines
2.5 KiB
Plaintext

/client/proc/manipulate_organs(mob/living/carbon/C in world)
set name = "Manipulate Organs"
set category = "Debug"
var/operation = tgui_input_list(usr, "Select organ operation", "Organ Manipulation", list("add organ", "add implant", "drop organ/implant", "remove organ/implant"))
if (isnull(operation))
return
var/list/organs = list()
switch(operation)
if("add organ")
for(var/path in subtypesof(/obj/item/organ))
var/dat = replacetext("[path]", "/obj/item/organ/", ":")
organs[dat] = path
var/obj/item/organ/organ = tgui_input_list(usr, "Select organ type", "Organ Manipulation", organs)
if(isnull(organ))
return
if(isnull(organs[organ]))
return
organ = organs[organ]
organ = new organ
organ.Insert(C)
log_admin("[key_name(usr)] has added organ [organ.type] to [key_name(C)]")
message_admins("[key_name_admin(usr)] has added organ [organ.type] to [ADMIN_LOOKUPFLW(C)]")
if("add implant")
for(var/path in subtypesof(/obj/item/implant))
var/dat = replacetext("[path]", "/obj/item/implant/", ":")
organs[dat] = path
var/obj/item/implant/organ = tgui_input_list(usr, "Select implant type", "Organ Manipulation", organs)
if(isnull(organ))
return
if(isnull(organs[organ]))
return
organ = organs[organ]
organ = new organ
organ.implant(C)
log_admin("[key_name(usr)] has added implant [organ.type] to [key_name(C)]")
message_admins("[key_name_admin(usr)] has added implant [organ.type] to [ADMIN_LOOKUPFLW(C)]")
if("drop organ/implant", "remove organ/implant")
for(var/X in C.internal_organs)
var/obj/item/organ/I = X
organs["[I.name] ([I.type])"] = I
for(var/X in C.implants)
var/obj/item/implant/I = X
organs["[I.name] ([I.type])"] = I
var/obj/item/organ = tgui_input_list(usr, "Select organ/implant", "Organ Manipulation", organs)
if(isnull(organ))
return
if(isnull(organs[organ]))
return
organ = organs[organ]
var/obj/item/organ/O
var/obj/item/implant/I
log_admin("[key_name(usr)] has removed [organ.type] from [key_name(C)]")
message_admins("[key_name_admin(usr)] has removed [organ.type] from [ADMIN_LOOKUPFLW(C)]")
if(isorgan(organ))
O = organ
O.Remove(C)
else
I = organ
I.removed(C)
organ.forceMove(get_turf(C))
if(operation == "remove organ/implant")
qdel(organ)
else if(I) // Put the implant in case.
var/obj/item/implantcase/case = new(get_turf(C))
case.imp = I
I.forceMove(case)
case.update_appearance()