Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accessory removal menu is now radial #6274

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 32 additions & 14 deletions code/modules/clothing/clothing_accessories.dm
Original file line number Diff line number Diff line change
Expand Up @@ -118,34 +118,52 @@

A.on_removed(user, src)
LAZYREMOVE(accessories, A)

var/any_removable = FALSE
for(var/obj/item/clothing/accessory/accessory in accessories)
if(accessory.removable)
any_removable = TRUE
break
if(!any_removable)
verbs -= /obj/item/clothing/proc/removetie_verb

update_clothing_icon()

/obj/item/clothing/proc/removetie_verb()
set name = "Remove Accessory"
set category = "Object"
set src in usr
if(!isliving(usr))

remove_accessory(usr, pick_accessory_to_remove(usr, usr))

/obj/item/clothing/proc/pick_accessory_to_remove(mob/user, mob/targetmob)
if(!isliving(user))
return
if(usr.stat)
if(user.stat)
return
if(!LAZYLEN(accessories))
return
var/obj/item/clothing/accessory/A
var/obj/item/clothing/accessory/accessory
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(LAZYLEN(accessories) > 1)
A = tgui_input_list(usr, "Select an accessory to remove from [src]", "Remove accessory", removables)
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(removables) > 1)
var/use_radials = user.client.prefs?.no_radials_preference ? FALSE : TRUE
var/choice = use_radials ? show_radial_menu(user, targetmob, removables, require_near = FALSE) : tgui_input_list(user, "Select an accessory to remove from [src]", "Remove accessory", removables)
accessory = choice_to_accessory[choice]
else
A = LAZYACCESS(accessories, 1)
if(!usr.Adjacent(src))
to_chat(usr, SPAN_WARNING("You're too far away!"))
accessory = choice_to_accessory[removables[1]]
if(!user.Adjacent(src))
to_chat(user, SPAN_WARNING("You're too far away!"))
return
src.remove_accessory(usr,A)
removables -= A
if(!removables.len)
verbs -= /obj/item/clothing/proc/removetie_verb

return accessory

/obj/item/clothing/emp_act(severity)
. = ..()
Expand Down
17 changes: 8 additions & 9 deletions code/modules/mob/living/carbon/human/human_stripping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,12 @@ GLOBAL_LIST_INIT(strippable_human_items, create_strippable_list(list(
return

var/obj/item/clothing/under/uniform = sourcemob.w_uniform
if(!LAZYLEN(uniform.accessories))
return FALSE
var/obj/item/clothing/accessory/accessory = LAZYACCESS(uniform.accessories, 1)
if(LAZYLEN(uniform.accessories) > 1)
accessory = tgui_input_list(user, "Select an accessory to remove from [uniform]", "Remove accessory", uniform.accessories)
if(!istype(accessory))

AndroBetel marked this conversation as resolved.
Show resolved Hide resolved
var/obj/item/clothing/accessory/accessory = uniform.pick_accessory_to_remove(user, sourcemob)
AndroBetel marked this conversation as resolved.
Show resolved Hide resolved

if(!accessory)
return

sourcemob.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their accessory ([accessory]) removed by [key_name(user)]</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [key_name(sourcemob)]'s' accessory ([accessory])</font>")
if(istype(accessory, /obj/item/clothing/accessory/holobadge) || istype(accessory, /obj/item/clothing/accessory/medal))
Expand Down Expand Up @@ -231,11 +230,11 @@ GLOBAL_LIST_INIT(strippable_human_items, create_strippable_list(list(
if(tag.dogtag_taken)
to_chat(user, SPAN_WARNING("Someone's already taken [sourcemob]'s information tag."))
return

if(sourcemob.stat != DEAD)
to_chat(user, SPAN_WARNING("You can't take a dogtag's information tag while its owner is alive."))
return

to_chat(user, SPAN_NOTICE("You take [sourcemob]'s information tag, leaving the ID tag"))
tag.dogtag_taken = TRUE
tag.icon_state = "dogtag_taken"
Expand All @@ -244,7 +243,7 @@ GLOBAL_LIST_INIT(strippable_human_items, create_strippable_list(list(
newtag.fallen_assgns = list(tag.assignment)
newtag.fallen_blood_types = list(tag.blood_type)
user.put_in_hands(newtag)



/datum/strippable_item/mob_item_slot/belt
Expand Down
Loading