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)