From 58fba8f1312ef63fad18e3c3188d2ddb9dc3fab2 Mon Sep 17 00:00:00 2001 From: AndroBetel <44546836+AndroBetel@users.noreply.github.com> Date: Sat, 27 Apr 2024 07:20:42 +0300 Subject: [PATCH 1/4] radial menu for accessory reoval --- code/modules/clothing/clothing_accessories.dm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/code/modules/clothing/clothing_accessories.dm b/code/modules/clothing/clothing_accessories.dm index e4a19b7bed3..1fb821f7f00 100644 --- a/code/modules/clothing/clothing_accessories.dm +++ b/code/modules/clothing/clothing_accessories.dm @@ -132,11 +132,18 @@ return var/obj/item/clothing/accessory/A var/list/removables = list() + var/list/choice_to_accessory = list() for(var/obj/item/clothing/accessory/ass in accessories) - if(ass.removable) - removables |= ass + if(!ass.removable) + continue + var/capitalized_name = capitalize_first_letters(ass.name) + removables[capitalized_name] = image(icon = ass.icon, icon_state = ass.icon_state) + choice_to_accessory[capitalized_name] = ass + if(LAZYLEN(accessories) > 1) - A = tgui_input_list(usr, "Select an accessory to remove from [src]", "Remove accessory", removables) + var/use_radials = usr.client.prefs?.no_radials_preference ? FALSE : TRUE + var/choice = use_radials ? show_radial_menu(usr, src, removables, require_near = TRUE) : tgui_input_list(usr, "Select an accessory to remove from [src]", "Remove accessory", removables) + A = choice_to_accessory[choice] else A = LAZYACCESS(accessories, 1) if(!usr.Adjacent(src)) From 62fad22ab2aa59e18ac2d83a5e80a514eb647bb0 Mon Sep 17 00:00:00 2001 From: AndroBetel <44546836+AndroBetel@users.noreply.github.com> Date: Sat, 27 Apr 2024 07:33:34 +0300 Subject: [PATCH 2/4] Update clothing_accessories.dm --- code/modules/clothing/clothing_accessories.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/clothing/clothing_accessories.dm b/code/modules/clothing/clothing_accessories.dm index 1fb821f7f00..f9515eab70f 100644 --- a/code/modules/clothing/clothing_accessories.dm +++ b/code/modules/clothing/clothing_accessories.dm @@ -140,12 +140,12 @@ removables[capitalized_name] = image(icon = ass.icon, icon_state = ass.icon_state) choice_to_accessory[capitalized_name] = ass - if(LAZYLEN(accessories) > 1) + if(LAZYLEN(removables) > 1) var/use_radials = usr.client.prefs?.no_radials_preference ? FALSE : TRUE var/choice = use_radials ? show_radial_menu(usr, src, removables, require_near = TRUE) : tgui_input_list(usr, "Select an accessory to remove from [src]", "Remove accessory", removables) A = choice_to_accessory[choice] else - A = LAZYACCESS(accessories, 1) + A = choice_to_accessory[removables[1]] if(!usr.Adjacent(src)) to_chat(usr, SPAN_WARNING("You're too far away!")) return From 381d36195bf93b568ec42650c6829182d28a44b3 Mon Sep 17 00:00:00 2001 From: AndroBetel <44546836+AndroBetel@users.noreply.github.com> Date: Fri, 10 May 2024 19:45:47 +0300 Subject: [PATCH 3/4] updatado --- code/modules/mob/living/carbon/human/human.dm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index f37b1d6a86a..d93a5cddfe0 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -502,9 +502,24 @@ var/obj/item/clothing/under/U = w_uniform if(!LAZYLEN(U.accessories)) return FALSE - var/obj/item/clothing/accessory/A = LAZYACCESS(U.accessories, 1) + var/obj/item/clothing/accessory/A + var/list/removables = list() + var/list/choice_to_accessory = list() + + for(var/obj/item/clothing/accessory/ass in U.accessories) + if(!ass.removable) + continue + var/capitalized_name = capitalize_first_letters(ass.name) + removables[capitalized_name] = image(icon = ass.icon, icon_state = ass.icon_state) + choice_to_accessory[capitalized_name] = ass + if(LAZYLEN(U.accessories) > 1) - A = tgui_input_list(usr, "Select an accessory to remove from [U]", "Remove accessory", U.accessories) + var/use_radials = usr.client.prefs?.no_radials_preference ? FALSE : TRUE + var/choice = use_radials ? show_radial_menu(usr, src, removables, require_near = TRUE) : tgui_input_list(usr, "Select an accessory to remove from [src]", "Remove accessory", removables) + A = choice_to_accessory[choice] + else + A = choice_to_accessory[removables[1]] + if(!istype(A)) return attack_log += text("\[[time_stamp()]\] Has had their accessory ([A]) removed by [key_name(usr)]") From 30bc73b8cf2fc941227b7dda81bca97f9b9d1a7a Mon Sep 17 00:00:00 2001 From: AndroBetel <44546836+AndroBetel@users.noreply.github.com> Date: Fri, 10 May 2024 22:49:43 +0300 Subject: [PATCH 4/4] Update human.dm --- code/modules/mob/living/carbon/human/human.dm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index d93a5cddfe0..70774b6b96b 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -520,6 +520,10 @@ else A = choice_to_accessory[removables[1]] + if(!usr.Adjacent(src)) + to_chat(usr, SPAN_WARNING("You're too far away!")) + return + if(!istype(A)) return attack_log += text("\[[time_stamp()]\] Has had their accessory ([A]) removed by [key_name(usr)]")