Skip to content

Commit

Permalink
accessory removal menu is now radial (cmss13-devs#6274)
Browse files Browse the repository at this point in the history
# About the pull request

title

# Explain why it's good for the game
easier to use and prettier, visual = good

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>


![Screenshot_43](https://github.com/cmss13-devs/cmss13/assets/44546836/e195df49-f62e-4e9a-89e5-51d1562e9e11)

![Screenshot_44](https://github.com/cmss13-devs/cmss13/assets/44546836/17fc2f61-8be2-4579-a0b5-cbcbf64d5623)


</details>


# Changelog
:cl:
qol: Added radial menu to accessory removal
/:cl:

---------

Co-authored-by: Drathek <[email protected]>
  • Loading branch information
2 people authored and Git-Nivrak committed Jun 9, 2024
1 parent 71593d8 commit ffcfc37
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 23 deletions.
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))

var/obj/item/clothing/accessory/accessory = uniform.pick_accessory_to_remove(user, sourcemob)

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

0 comments on commit ffcfc37

Please sign in to comment.