Making disposals mail sorting mapping less frustrating (#32218)

* mail sorting helpers && mail sorting code tweaks

- Added mail helpers
- Added defines for mail tagger locations
- FUCKED sort_type_txt

* Update mapping_helpers.dmi

* Update deltastation.dmm

* Update deltastation.dmm

* Update cerestation.dmm

* Update metastation.dmm

* Update emeraldstation.dmm

* Update boxstation.dmm

* Update boxstation.dmm

* Update mail_sorting_helpers.dm
This commit is contained in:
Osetrokarasek
2026-07-17 09:22:48 +03:00
committed by GitHub
parent 4c62c1c5b1
commit ad5620118c
11 changed files with 456 additions and 464 deletions
@@ -0,0 +1,50 @@
//Disposal delivery helpers
//Just slap em above sorting junction and they will set their sorting tag by themselves
/obj/effect/mapping_helpers/sortjunc_helper
icon_state = "mail_sorting"
late = TRUE
var/sort_type = list()
/obj/effect/mapping_helpers/sortjunc_helper/Initialize(mapload)
. = ..()
var/obj/structure/disposalpipe/sortjunction/mail_sorter = locate(/obj/structure/disposalpipe/sortjunction) in loc
if(mail_sorter)
mail_sorter.sort_type = sort_type
mail_sorter.update_appearance(UPDATE_NAME|UPDATE_DESC)
else
log_world("[src] failed to find a sorting junction pipe at [AREACOORD(src)]")
qdel(src)
#define MAILSORTINGHELPERS(helper_type, sort_id, icon) \
/obj/effect/mapping_helpers/sortjunc_helper/##helper_type { \
sort_type = sort_id; \
icon_state = icon; \
}
MAILSORTINGHELPERS(disposals, list(TAGGER_LOCATION_DISPOSALS), "mail_sorting_sup")
MAILSORTINGHELPERS(cargo_bay, list(TAGGER_LOCATION_CARGO_BAY), "mail_sorting_sup")
MAILSORTINGHELPERS(qm_office, list(TAGGER_LOCATION_QM_OFFICE), "mail_sorting_com")
MAILSORTINGHELPERS(engineering, list(TAGGER_LOCATION_ENGINEERING), "mail_sorting_eng")
MAILSORTINGHELPERS(ce_office, list(TAGGER_LOCATION_CE_OFFICE), "mail_sorting_com")
MAILSORTINGHELPERS(atmospherics, list(TAGGER_LOCATION_ATMOSPHERICS), "mail_sorting_eng")
MAILSORTINGHELPERS(hos_office, list(TAGGER_LOCATION_HOS_OFFICE), "mail_sorting_com")
MAILSORTINGHELPERS(security, list(TAGGER_LOCATION_SECURITY), "mail_sorting_sec")
MAILSORTINGHELPERS(medbay, list(TAGGER_LOCATION_MEDBAY), "mail_sorting_med")
MAILSORTINGHELPERS(cmo_office, list(TAGGER_LOCATION_CMO_OFFICE), "mail_sorting_com")
MAILSORTINGHELPERS(chemistry, list(TAGGER_LOCATION_CHEMISTRY), "mail_sorting_med")
MAILSORTINGHELPERS(research, list(TAGGER_LOCATION_RESEARCH), "mail_sorting_sci")
MAILSORTINGHELPERS(rd_office, list(TAGGER_LOCATION_RD_OFFICE), "mail_sorting_com")
MAILSORTINGHELPERS(robotics, list(TAGGER_LOCATION_ROBOTICS), "mail_sorting_sci")
MAILSORTINGHELPERS(hop_office, list(TAGGER_LOCATION_HOP_OFFICE), "mail_sorting_com")
MAILSORTINGHELPERS(library, list(TAGGER_LOCATION_LIBRARY), "mail_sorting_serv")
MAILSORTINGHELPERS(chapel, list(TAGGER_LOCATION_CHAPEL), "mail_sorting_serv")
MAILSORTINGHELPERS(captains_office, list(TAGGER_LOCATION_CAPTAIN_OFFICE), "mail_sorting_com")
MAILSORTINGHELPERS(bar, list(TAGGER_LOCATION_BAR), "mail_sorting_serv")
MAILSORTINGHELPERS(kitchen, list(TAGGER_LOCATION_KITCHEN), "mail_sorting_serv")
MAILSORTINGHELPERS(hydroponics, list(TAGGER_LOCATION_HYDROPONICS), "mail_sorting_serv")
MAILSORTINGHELPERS(janitor, list(TAGGER_LOCATION_JANITOR), "mail_sorting_serv")
MAILSORTINGHELPERS(genetics, list(TAGGER_LOCATION_GENETICS), "mail_sorting_sci")
MAILSORTINGHELPERS(detective, list(TAGGER_LOCATION_DETECTIVE), "mail_sorting_sec")
MAILSORTINGHELPERS(morgue, list(TAGGER_LOCATION_MORGUE), "mail_sorting_med")
#undef MAILSORTINGHELPERS
-28
View File
@@ -1181,7 +1181,6 @@
name = "disposal sort junction"
icon_state = "pipe-j1s"
var/list/sort_type = list(1)
var/sort_type_txt //Look at the list called TAGGERLOCATIONS in /code/_globalvars/lists/flavor_misc.dm and cry
var/posdir = 0
var/negdir = 0
var/sortdir = 0
@@ -1204,37 +1203,10 @@
/obj/structure/disposalpipe/sortjunction/Initialize(mapload)
. = ..()
updatedir()
if(mapload)
parse_sort_destinations()
update_appearance(UPDATE_NAME|UPDATE_DESC)
update()
return
/obj/structure/disposalpipe/sortjunction/proc/parse_sort_destinations()
if(sort_type_txt == "1")
return
var/list/sort_type_str = splittext(sort_type_txt, ";")
var/mapping_fail
if(length(sort_type_str)) // Default to disposals if mapped with it along other destinations
if("1" in sort_type_str)
mapping_fail = "Mutually exclusive sort types in sort_type_txt"
else
var/new_sort_type = list()
for(var/x in sort_type_str)
var/n = text2num(x)
if(n)
new_sort_type |= n
if(length(new_sort_type))
sort_type = new_sort_type
else
mapping_fail = "No sort types after parsing sort_type_txt"
else
mapping_fail = "Sort_type_txt is empty"
if(mapping_fail)
stack_trace("[src] mapped incorrectly at [x],[y],[z] - [mapping_fail]")
/obj/structure/disposalpipe/sortjunction/item_interaction(mob/living/user, obj/item/I, list/modifiers)
if(..())
return ITEM_INTERACT_COMPLETE