mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 23:17:02 +01:00
fix mail crates with no recipients (#32502)
This commit is contained in:
@@ -617,34 +617,16 @@
|
||||
icon_closed = "mailsealed"
|
||||
material_drop = /obj/item/stack/sheet/plastic
|
||||
material_drop_amount = 4
|
||||
var/list/possible_contents = list(/obj/item/envelope/security = DEP_MAIL_LIST_SECURITY,
|
||||
/obj/item/envelope/science = DEP_MAIL_LIST_SCIENCE,
|
||||
/obj/item/envelope/supply = DEP_MAIL_LIST_SUPPLY,
|
||||
/obj/item/envelope/medical = DEP_MAIL_LIST_MEDICAL,
|
||||
/obj/item/envelope/engineering = DEP_MAIL_LIST_ENGINEERING,
|
||||
/obj/item/envelope/bread = DEP_MAIL_LIST_BREAD,
|
||||
/obj/item/envelope/circuses = DEP_MAIL_LIST_SERVICE,
|
||||
/obj/item/envelope/command = DEP_MAIL_LIST_COMMAND,
|
||||
/obj/item/envelope/misc = DEP_MAIL_LIST_MISC)
|
||||
var/list/envelope_types = list()
|
||||
|
||||
/obj/structure/closet/crate/mail/Initialize(mapload, envelope_types_)
|
||||
envelope_types = envelope_types_
|
||||
. = ..()
|
||||
|
||||
/obj/structure/closet/crate/mail/populate_contents()
|
||||
. = ..()
|
||||
var/list/narrowed_contents = possible_contents.Copy()
|
||||
for(var/envelope_type in narrowed_contents)
|
||||
var/found = FALSE
|
||||
for(var/datum/mind/recipient in SSticker.minds)
|
||||
var/turf/recipient_turf = get_turf(recipient.current)
|
||||
if(recipient.offstation_role || !ishuman(recipient.current) || is_admin_level(recipient_turf.z))
|
||||
continue
|
||||
if(recipient.assigned_role in narrowed_contents[envelope_type])
|
||||
found = TRUE
|
||||
break
|
||||
if(!found)
|
||||
narrowed_contents -= envelope_type
|
||||
|
||||
for(var/i in 1 to (ceil(length(GLOB.crew_list) / 20) + rand(1, 5))) // Scale number of letters with number of crew.
|
||||
var/item = pick(narrowed_contents)
|
||||
new item(src)
|
||||
for(var/envelope_type in envelope_types)
|
||||
new envelope_type(src)
|
||||
|
||||
/obj/structure/closet/crate/tape/populate_contents()
|
||||
if(prob(10))
|
||||
|
||||
Reference in New Issue
Block a user