From dbdcd69c1fd6994d89b150cf91c94f3dc96349b8 Mon Sep 17 00:00:00 2001 From: mcbalaam <104003807+mcbalaam@users.noreply.github.com> Date: Sun, 22 Dec 2024 05:09:20 +0700 Subject: [PATCH] Fixes the mail sorter runtiming processing assistant mail (#88562) ## About The Pull Request The mail sorter doesn't runtime when processing assistant mail now. Also now it properly ejects envelopes upon deconstruction. ## Why It's Good For The Game Because that caused the mail sorter to freeze, not even being able to get the mail back. Closes https://github.com/tgstation/tgstation/issues/88549. ## Changelog :cl: fix: The mail sorter no longer runtimes processing assistant mail /:cl: --- code/modules/vending/mail.dm | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/code/modules/vending/mail.dm b/code/modules/vending/mail.dm index 1e091a31287..6bc3648b056 100644 --- a/code/modules/vending/mail.dm +++ b/code/modules/vending/mail.dm @@ -46,11 +46,13 @@ /obj/machinery/mailsorter/proc/get_unload_turf() return get_step(src, output_dir) +/// Opening the maintenance panel. /obj/machinery/mailsorter/screwdriver_act(mob/living/user, obj/item/tool) default_deconstruction_screwdriver(user, "[base_icon_state]-off", base_icon_state, tool) update_appearance(UPDATE_OVERLAYS) return ITEM_INTERACT_SUCCESS +/// Deconstructing the mail sorter. /obj/machinery/mailsorter/crowbar_act(mob/living/user, obj/item/tool) default_deconstruction_crowbar(tool) return ITEM_INTERACT_SUCCESS @@ -63,11 +65,15 @@ . += span_notice("Alt-click to rotate the output direction.") /obj/machinery/mailsorter/Destroy() + QDEL_LIST(mail_list) + . = ..() + +/obj/machinery/mailsorter/on_deconstruction(disassembled) drop_all_mail() . = ..() -/// Drops all enevlopes on the machine turf. Only occurs when the machine is broken. -/obj/machinery/mailsorter/proc/drop_all_mail(damage_flag) +/// Drops all enevlopes on the machine turf. +/obj/machinery/mailsorter/proc/drop_all_mail() if(!isturf(get_turf(src))) QDEL_LIST(mail_list) return @@ -90,10 +96,6 @@ /obj/machinery/mailsorter/proc/accept_check(obj/item/weapon) var/static/list/accepted_items = list( /obj/item/mail, - /obj/item/mail/envelope, - /obj/item/mail/junkmail, - /obj/item/mail/mail_strike, - /obj/item/mail/traitor, /obj/item/paper, ) return is_type_in_list(weapon, accepted_items) @@ -151,10 +153,13 @@ if (some_recipient) var/datum/job/recipient_job = some_recipient.assigned_role var/datum/job_department/primary_department = recipient_job.departments_list?[1] - var/datum/job_department/main_department = primary_department.department_name - if (main_department == sorting_dept) - sorted_mail.Add(some_mail) - sorted ++ + if (primary_department == null) // permabrig is temporary, tide is forever + unable_to_sort ++ + else + var/datum/job_department/main_department = primary_department.department_name + if (main_department == sorting_dept) + sorted_mail.Add(some_mail) + sorted ++ else unable_to_sort ++ if (length(sorted_mail) == 0)