mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
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.  
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user