[MIRROR] Ports Mail From Kiwi Take 2: Arconomy Class Mail (#5172)

* Ports Mail From Kiwi Take 2: Arconomy Class Mail

* Update wardrobes.dm

Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
This commit is contained in:
SkyratBot
2021-04-25 21:20:20 +01:00
committed by GitHub
co-authored by ArcaneMusic Gandalf
parent 78ba8f1f7c
commit c418b139be
46 changed files with 690 additions and 40 deletions
+48
View File
@@ -28,6 +28,7 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
/obj/machinery/launchpad,
/obj/machinery/disposal,
/obj/structure/disposalpipe,
/obj/item/mail,
/obj/item/hilbertshotel,
/obj/machinery/camera,
/obj/item/gps,
@@ -82,6 +83,7 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
/obj/docking_port/mobile/supply/initiate_docking()
if(getDockedId() == "supply_away") // Buy when we leave home.
buy()
create_mail()
. = ..() // Fly/enter transit.
if(. != DOCKING_SUCCESS)
return
@@ -197,6 +199,7 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
SO.generateCombo(miscboxes[I], I, misc_contents[I])
qdel(SO)
SSeconomy.import_total += value
var/datum/bank_account/cargo_budget = SSeconomy.get_dep_account(ACCOUNT_CAR)
investigate_log("[purchases] orders in this shipment, worth [value] credits. [cargo_budget.account_balance] credits left.", INVESTIGATE_CARGO)
@@ -230,8 +233,53 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
msg += export_text + "\n"
D.adjust_money(ex.total_value[E])
SSeconomy.export_total += (D.account_balance - presale_points)
SSshuttle.centcom_message = msg
investigate_log("Shuttle contents sold for [D.account_balance - presale_points] credits. Contents: [ex.exported_atoms ? ex.exported_atoms.Join(",") + "." : "none."] Message: [SSshuttle.centcom_message || "none."]", INVESTIGATE_CARGO)
/*
Generates a box of mail depending on our exports and imports.
Applied in the cargo shuttle sending/arriving, by building the crate if the round is ready to introduce mail based on the economy subsystem.
Then, fills the mail crate with mail, by picking applicable crew who can recieve mail at the time to sending.
*/
/obj/docking_port/mobile/supply/proc/create_mail()
//Early return if there's no mail waiting to prevent taking up a slot.
if(!SSeconomy.mail_waiting)
return
//spawn crate
var/list/empty_turfs = list()
for(var/place as anything in shuttle_areas)
var/area/shuttle/shuttle_area = place
for(var/turf/open/floor/shuttle_floor in shuttle_area)
if(shuttle_floor.is_blocked_turf())
continue
empty_turfs += shuttle_floor
var/obj/structure/closet/crate/mail/mailcrate = new(pick(empty_turfs))
//collect recipients
var/list/mail_recipients = list()
for(var/mob/living/carbon/human/player_human in GLOB.player_list)
if(player_human.stat != DEAD)
mail_recipients += player_human
//Creates mail for all the mail waiting to arrive, if there's nobody to recieve it it's just junkmail.
for(var/mail_iterator in 1 to SSeconomy.mail_waiting)
var/obj/item/mail/new_mail
if(prob(FULL_CRATE_LETTER_ODDS))
new_mail = new /obj/item/mail(mailcrate)
else
new_mail = new /obj/item/mail/envelope(mailcrate)
var/mob/living/carbon/human/mail_to
if(mail_recipients.len)
mail_to = pick(mail_recipients)
new_mail.initialize_for_recipient(mail_to)
mail_recipients -= mail_to
else
new_mail.junk_mail()
if(new_mail)
SSeconomy.mail_waiting += 1
mailcrate.update_icon()
return mailcrate
#undef GOODY_FREE_SHIPPING_MAX
#undef CRATE_TAX