mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-03 21:42:06 +00:00
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
77 lines
1.9 KiB
Plaintext
77 lines
1.9 KiB
Plaintext
/client/proc/outfit_manager()
|
|
set category = "Debug"
|
|
set name = "Outfit Manager"
|
|
|
|
if(!check_rights(R_DEBUG))
|
|
return
|
|
var/datum/outfit_manager/ui = new(usr)
|
|
ui.ui_interact(usr)
|
|
|
|
|
|
/datum/outfit_manager
|
|
var/client/owner
|
|
|
|
/datum/outfit_manager/New(user)
|
|
owner = CLIENT_FROM_VAR(user)
|
|
|
|
/datum/outfit_manager/ui_state(mob/user)
|
|
return GLOB.admin_state
|
|
|
|
/datum/outfit_manager/ui_close(mob/user)
|
|
qdel(src)
|
|
|
|
/datum/outfit_manager/ui_interact(mob/user, datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "OutfitManager")
|
|
ui.open()
|
|
|
|
/datum/outfit_manager/proc/entry(datum/outfit/outfit)
|
|
var/vv = FALSE
|
|
var/datum/outfit/varedit/varoutfit = outfit
|
|
if(istype(varoutfit))
|
|
vv = length(varoutfit.vv_values)
|
|
return list(
|
|
"name" = "[outfit.name] [vv ? "(VV)" : ""]",
|
|
"ref" = REF(outfit),
|
|
)
|
|
|
|
/datum/outfit_manager/ui_data(mob/user)
|
|
var/list/data = list()
|
|
|
|
var/list/outfits = list()
|
|
for(var/datum/outfit/custom_outfit in GLOB.custom_outfits)
|
|
outfits += list(entry(custom_outfit))
|
|
data["outfits"] = outfits
|
|
|
|
return data
|
|
|
|
/datum/outfit_manager/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
if(..())
|
|
return
|
|
. = TRUE
|
|
|
|
switch(action)
|
|
if("new")
|
|
owner.open_outfit_editor(new /datum/outfit)
|
|
if("load")
|
|
owner.holder.load_outfit(owner.mob)
|
|
if("copy")
|
|
var/datum/outfit/outfit = tgui_input_list(owner, "Pick an outfit to copy from", "Outfit Manager", subtypesof(/datum/outfit))
|
|
if(isnull(outfit))
|
|
return
|
|
if(!ispath(outfit))
|
|
return
|
|
owner.open_outfit_editor(new outfit)
|
|
|
|
var/datum/outfit/target_outfit = locate(params["outfit"])
|
|
if(!istype(target_outfit))
|
|
return
|
|
switch(action) //wow we're switching through action again this is horrible optimization smh
|
|
if("edit")
|
|
owner.open_outfit_editor(target_outfit)
|
|
if("save")
|
|
owner.holder.save_outfit(owner.mob, target_outfit)
|
|
if("delete")
|
|
owner.holder.delete_outfit(owner.mob, target_outfit)
|