mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
GMM correctly adjusts ordered materials with proper feedback (#92009)
## About The Pull Request - Fixes #82910 Cargo now adjusts the material market quantity & prices when the shuttle is called from the order console itself instead of adjusting it after the shuttle arrives 1 minute later. This has 2 implications - If the market crashes 1 minute after calling the shuttle i.e when it arrives, the ordered quantities are not affected because it retrieved those sheets from the market at the time of calling the shuttle from the order console - If some orders could not be satisfied because there were not enough materials at the time of calling the shuttle then instead of arriving with an empty crate a detailed summary is displayed explaining which orders could not be delivered & why, even cancelling the order if needed **a) Order adjusted**  **b) Order adjusted & cancelled**  **c) Order fully cancelled**  ## Changelog 🆑 fix: ordering materials from the GMM won't result in empty crates & will display detailed feedback if there weren't enough sheets in the market /🆑
This commit is contained in:
@@ -169,6 +169,21 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
|
||||
for(var/datum/supply_order/spawning_order in SSshuttle.shopping_list)
|
||||
if(!empty_turfs.len)
|
||||
break
|
||||
|
||||
//adjust galactic material market based on the ordered quantities
|
||||
var/datum/supply_pack/custom/minerals/sheets = astype(spawning_order.pack)
|
||||
if(!isnull(sheets))
|
||||
var/list/orders_adjusted = sheets.adjust_market()
|
||||
if(orders_adjusted.len)
|
||||
var/datum/bank_account/paying_for_this = spawning_order.paying_account || SSeconomy.get_dep_account(ACCOUNT_CAR)
|
||||
if(!sheets.contains.len) //no sheets in the market at all
|
||||
paying_for_this.bank_card_talk("Order #[spawning_order.id] ([spawning_order.pack.name]) was cancelled due to insufficient materials in the market!.")
|
||||
SSshuttle.shopping_list -= spawning_order
|
||||
clean_up_orders += spawning_order
|
||||
continue
|
||||
//some of the orders were adjusted(quantity changed or cancelled) according to the market
|
||||
paying_for_this.bank_card_talk("Order #[spawning_order.id] ([spawning_order.pack.name]) had the following orders adjusted<br>[orders_adjusted.Join("<br>")]<br>.")
|
||||
|
||||
price = spawning_order.get_final_cost()
|
||||
|
||||
// department orders EARN money for cargo, not the other way around
|
||||
|
||||
Reference in New Issue
Block a user