From 85002cca6c2fc3f4141a21398cf00fa599bc5345 Mon Sep 17 00:00:00 2001 From: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> Date: Thu, 7 May 2026 01:02:49 -0400 Subject: [PATCH] [EE] Adds Market Crash Event (#31870) * Adds Market Crash Event * Typo * Bees Co-authored-by: JimKil3 <47290811+JimKil3@users.noreply.github.com> Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> --------- Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> Co-authored-by: JimKil3 <47290811+JimKil3@users.noreply.github.com> --- code/game/machinery/vendors/vending.dm | 4 +-- code/modules/events/event_container.dm | 1 + code/modules/events/false_alarm.dm | 2 +- code/modules/events/market_crash.dm | 39 ++++++++++++++++++++++++++ paradise.dme | 1 + 5 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 code/modules/events/market_crash.dm diff --git a/code/game/machinery/vendors/vending.dm b/code/game/machinery/vendors/vending.dm index cef446187eb..7414b3cd2c0 100644 --- a/code/game/machinery/vendors/vending.dm +++ b/code/game/machinery/vendors/vending.dm @@ -337,7 +337,7 @@ * products that the vending machine is to carry without manually populating * src.product_records. */ -/obj/machinery/economy/vending/proc/build_inventory(list/productlist, list/recordlist, start_empty = FALSE) +/obj/machinery/economy/vending/proc/build_inventory(list/productlist, list/recordlist, start_empty = FALSE, price_mult = 1) for(var/typepath in productlist) var/amount = productlist[typepath] if(isnull(amount)) @@ -350,7 +350,7 @@ if(!start_empty) R.amount = amount R.max_amount = amount - R.price = (typepath in prices) ? prices[typepath] : 0 + R.price = (typepath in prices) ? (prices[typepath] * price_mult) : 0 recordlist += R /** * Refill a vending machine from a refill canister diff --git a/code/modules/events/event_container.dm b/code/modules/events/event_container.dm index b0344b7234c..2ccd6c423ce 100644 --- a/code/modules/events/event_container.dm +++ b/code/modules/events/event_container.dm @@ -198,6 +198,7 @@ GLOBAL_LIST_EMPTY(event_last_fired) new /datum/event_meta(EVENT_LEVEL_MODERATE, /datum/event/tourist_arrivals, 40, TRUE, _first_run_time = 35 MINUTES), new /datum/event_meta(EVENT_LEVEL_MODERATE, /datum/event/shuttle_loan, 50, is_one_shot = TRUE), new /datum/event_meta(EVENT_LEVEL_MODERATE, /datum/event/anomalous_particulate_event, 60, is_one_shot = TRUE), + new /datum/event_meta(EVENT_LEVEL_MODERATE, /datum/event/market_crash, 20), new /datum/event_meta(EVENT_LEVEL_MODERATE, /datum/event/cargo_pods, 50), new /datum/event_meta(EVENT_LEVEL_MODERATE, /datum/event/spawn_floor_cluwne, 3), ) diff --git a/code/modules/events/false_alarm.dm b/code/modules/events/false_alarm.dm index 2a2649918eb..b8278c06fc5 100644 --- a/code/modules/events/false_alarm.dm +++ b/code/modules/events/false_alarm.dm @@ -23,7 +23,7 @@ /datum/event/tear, /datum/event/tear/honk, /datum/event/traders, - /datum/event/vent_clog, + /datum/event/market_crash, /datum/event/disease_outbreak, /datum/event/vent_clog, /datum/event/disposals_clog, diff --git a/code/modules/events/market_crash.dm b/code/modules/events/market_crash.dm new file mode 100644 index 00000000000..c70812485f7 --- /dev/null +++ b/code/modules/events/market_crash.dm @@ -0,0 +1,39 @@ +/datum/event/market_crash + name = "Market Crash" + nominal_severity = EVENT_LEVEL_MODERATE + endWhen = 300 + /// Vendor price multiplier + var/price_mult = 3 + +/datum/event/market_crash/announce(false_alarm) + var/list/possible_reasons = list( + "supply chain shortages", + "[syndicate_name()] operatives attacking a shipment", + "space wizard interference", + "bluespace traffic", + "gravitational anomalies", + "extended trade routes", + "market speculation", + "vox", + "a clown college graduation party", + "a Trans-Solar Federation investigation", + "too many credits being invested in WetSkrell.nt", + "an overabundance of bees", + ) + + GLOB.minor_announcement.Announce("Due to [pick(possible_reasons)], prices for on-station vendors will be increased for a short period. We apologize for the inconvenience.", "Central Command Finance Division") + +/datum/event/market_crash/start() + for(var/obj/machinery/economy/vending/vendor in SSmachines.get_by_type(/obj/machinery/economy/vending)) + if(!is_station_level(vendor.z)) + continue + vendor.build_inventory(vendor.products, vendor.product_records, FALSE, price_mult) + vendor.build_inventory(vendor.contraband, vendor.hidden_records, FALSE, price_mult) + addtimer(CALLBACK(src, PROC_REF(reset_prices)), rand(5 MINUTES, 10 MINUTES)) + +/datum/event/market_crash/proc/reset_prices() + for(var/obj/machinery/economy/vending/vendor in SSmachines.get_by_type(/obj/machinery/economy/vending)) + if(!is_station_level(vendor.z)) + continue + vendor.build_inventory(vendor.products, vendor.product_records, FALSE, 1) + vendor.build_inventory(vendor.contraband, vendor.hidden_records, FALSE, 1) diff --git a/paradise.dme b/paradise.dme index 63db91f3361..069625b0b47 100644 --- a/paradise.dme +++ b/paradise.dme @@ -2278,6 +2278,7 @@ #include "code\modules\events\infestation.dm" #include "code\modules\events\ion_storm.dm" #include "code\modules\events\koi_mirgration.dm" +#include "code\modules\events\market_crash.dm" #include "code\modules\events\mass_hallucination.dm" #include "code\modules\events\meaty_gore.dm" #include "code\modules\events\meaty_ores.dm"