Circuit multitools can now mark (visible) items worn/held by a mob (#81215)

## About The Pull Request
Title. This includes a small change to the get_visible_items proc, only
used by phobias until now, to include worn accessories. Not really worth
of a changelog entry itself.

## Why It's Good For The Game
This makes the process of scanning oft worn equipment a bit easier,
perhaps weavering the need of consent for some pranks and shenanigans.


![immagine](https://github.com/tgstation/tgstation/assets/42542238/a0d62488-2ee1-4051-9737-62c9247a6137)

I've added a bit of contrast to the icon for the "mob" option since
then.

## Changelog

🆑
qol: Circuit multitools can now mark (visible) items worn/held by a mob.
/🆑
This commit is contained in:
Ghom
2024-02-18 13:08:54 -05:00
committed by GitHub
parent b2ae229cbc
commit 32b2989d06
4 changed files with 90 additions and 31 deletions
+52
View File
@@ -32,6 +32,13 @@
if(marked_atom || !user.Adjacent(target) || is_right_clicking)
return ..()
if(isliving(target))
INVOKE_ASYNC(src, PROC_REF(mark_mob_or_contents), user, target)
return TRUE
mark_target(target)
/obj/item/multitool/circuit/proc/mark_target(atom/target)
say("Marked [target].")
marked_atom = target
RegisterSignal(marked_atom, COMSIG_QDELETING, PROC_REF(cleanup_marked_atom))
@@ -40,6 +47,51 @@
playsound(src.loc, 'sound/misc/compiler-stage2.ogg', 30, TRUE)
return TRUE
/// Allow users to mark items equipped by the target that are visible.
/obj/item/multitool/circuit/proc/mark_mob_or_contents(mob/user, mob/living/target)
var/list/visible_items
var/mob/living/carbon/carbon_target
if(iscarbon(target))
carbon_target = target
visible_items = carbon_target.get_visible_items()
else
visible_items = target.get_equipped_items()
visible_items -= src // the multitool cannot mark itself.
if(!length(visible_items))
mark_target(target)
return
var/list/selectable_targets = list()
var/datum/radial_menu_choice/mob_choice = new
mob_choice.image = image(icon = 'icons/hud/radial.dmi', icon_state = "radial_mob")
mob_choice.name = target.name
selectable_targets[REF(target)] = mob_choice
for(var/obj/item/item as anything in visible_items)
var/datum/radial_menu_choice/item_choice = new
var/mutable_appearance/item_appearance = new(item)
item_appearance.layer = FLOAT_LAYER
item_appearance.plane = FLOAT_PLANE
item_choice.name = item.name
item_choice.image = item_appearance
selectable_targets[REF(item)] = item_choice
var/picked_ref = show_radial_menu(user, src, selectable_targets, uniqueid = TRUE, radius = 38, custom_check = CALLBACK(src, PROC_REF(check_menu), user, target), tooltips = TRUE)
if(!picked_ref)
return
var/atom/movable/chosen = locate(picked_ref)
if(chosen == target || (chosen in (carbon_target ? carbon_target.get_visible_items() : target.get_equipped_items())))
mark_target(chosen)
else
balloon_alert(user, "cannot mark entity")
/obj/item/multitool/circuit/proc/check_menu(mob/user, mob/living/target)
return !marked_atom && user.is_holding(src) && user.Adjacent(target)
/obj/item/multitool/circuit/update_overlays()
. = ..()
cut_overlays()