Appends the cans in a yoke to its name (#20877)

As title, up to two cans inside a yoke are automatically appended to its
name. This is capped at two so the name doesn't get really long. This
also updates if cans are removed from the yoke.

Currently there is no way to tell what is in a yoke without seeing its
icon, which is troublesome for bartenders who have stacks of the things.
This is intended to alleviate that issue.


![image](https://github.com/user-attachments/assets/31435e8c-5ffa-4ba4-9193-fd9cf0fa7f07)


![image](https://github.com/user-attachments/assets/3e63505c-8ce0-40de-8e53-b9040f1e72a5)
This commit is contained in:
hazelrat
2025-06-26 16:41:20 +00:00
committed by GitHub
parent 4d0eca53fe
commit fb289b582a
2 changed files with 85 additions and 2 deletions
@@ -36,6 +36,32 @@
can.pixel_y = positions[2]
underlays += can
// Calling this here so the appended names change when cans are removed from the yoke.
append_cans()
/// We use this to append the names of the cans in a yoke to its name, for QoL.
/obj/item/storage/box/fancy/yoke/proc/append_cans()
// Return early and use the initial name if there's no cans, so we don't have stray brackets.
if(!length(cans))
name = initial(name)
return
// Names of cans in the yoke that we are selecting to append to the name. No names in this should repeat.
var/list/taken_names = list()
for(var/obj/can in cans)
taken_names |= can.name
// We end this at the third item, so at maximum two items in the yoke will be in the name.
var/can_name_string = initial(name) + " (" + jointext(taken_names, ", ", 1, 3)
if(length(taken_names) > 2)
can_name_string += ", ...)"
else
can_name_string += ")"
name = can_name_string
/obj/item/storage/box/fancy/yoke/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
var/mob/mob_dropped_over = over
if(use_check_and_message(mob_dropped_over))
@@ -193,8 +219,7 @@
/obj/item/storage/box/fancy/yoke/threetowns
starts_with = list(/obj/item/reagent_containers/food/drinks/cans/threetowns = 6)
// energy drinks
// Energy drinks
/obj/item/storage/box/fancy/yoke/energy
icon_state = "yoke_energy" //energy drinks are 2 pixels taller