This commit is contained in:
SandPoot
2024-04-10 20:54:04 -03:00
parent 8ed65490a4
commit ca8ce67cd6
63 changed files with 872 additions and 116 deletions
+50
View File
@@ -27,6 +27,9 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
/obj/machinery/syndicatebomb,
/obj/item/hilbertshotel,
/obj/machinery/launchpad,
/obj/machinery/disposal,
/obj/structure/disposalpipe,
/obj/item/mail,
/obj/item/hilbertshotel,
/obj/machinery/camera,
/obj/item/gps,
@@ -102,6 +105,7 @@ GLOBAL_LIST_INIT(cargo_shuttle_leave_behind_typecache, 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
@@ -236,6 +240,7 @@ GLOBAL_LIST_INIT(cargo_shuttle_leave_behind_typecache, 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)
@@ -286,8 +291,53 @@ GLOBAL_LIST_INIT(cargo_shuttle_leave_behind_typecache, typecacheof(list(
D.adjust_money(gain)
msg = copytext_char(msg, 1, MAX_MESSAGE_LEN)
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(is_blocked_turf(shuttle_floor))
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