diff --git a/code/controllers/subsystem/stock_market.dm b/code/controllers/subsystem/stock_market.dm index 7c2cb71dc49..c0d85eaf85d 100644 --- a/code/controllers/subsystem/stock_market.dm +++ b/code/controllers/subsystem/stock_market.dm @@ -51,6 +51,7 @@ SUBSYSTEM_DEF(stock_market) price_minimum = round(initial(mat.minimum_value_override) * SHEET_MATERIAL_AMOUNT) var/price_maximum = round(initial(mat.value_per_unit) * SHEET_MATERIAL_AMOUNT * 3) var/price_baseline = initial(mat.value_per_unit) * SHEET_MATERIAL_AMOUNT + var/quantity_baseline = initial(mat.tradable_base_quantity) var/stock_quantity = materials_quantity[mat] @@ -84,15 +85,15 @@ SUBSYSTEM_DEF(stock_market) switch(trend) if(MARKET_TREND_UPWARD) price_change = ROUND_UP(gaussian(price_units * 0.1, price_baseline * 0.05)) //If we don't ceil, small numbers will get trapped at low values - quantity_change = -round(gaussian(stock_quantity * 0.1, stock_quantity * 0.05)) + quantity_change = -round(gaussian(quantity_baseline * 0.05, quantity_baseline * 0.05)) if(MARKET_TREND_STABLE) price_change = round(gaussian(0, price_baseline * 0.01)) - quantity_change = round(gaussian(0, stock_quantity * 0.01)) + quantity_change = round(gaussian(0, quantity_baseline * 0.01)) if(MARKET_TREND_DOWNWARD) price_change = -ROUND_UP(gaussian(price_units * 0.1, price_baseline * 0.05)) - quantity_change = round(gaussian(stock_quantity * 0.1, stock_quantity * 0.05)) + quantity_change = round(gaussian(quantity_baseline * 0.05, quantity_baseline * 0.05)) materials_prices[mat] = round(clamp(price_units + price_change, price_minimum, price_maximum)) - materials_quantity[mat] = round(clamp(stock_quantity + quantity_change, 0, initial(mat.tradable_base_quantity) * 2)) + materials_quantity[mat] = round(clamp(stock_quantity + quantity_change, 0, quantity_baseline * 2)) /** * Market events are a way to spice up the market and make it more interesting. diff --git a/code/modules/cargo/packs/_packs.dm b/code/modules/cargo/packs/_packs.dm index aaeb55f2533..51ec71649dd 100644 --- a/code/modules/cargo/packs/_packs.dm +++ b/code/modules/cargo/packs/_packs.dm @@ -122,3 +122,16 @@ name = "[purchaser]'s Materials Order" src.cost = cost src.contains = contains + +/datum/supply_pack/custom/minerals/fill(obj/structure/closet/crate/C) + . = ..() + //Remove our material sheets from SSstock_market's materials_quantity equal to the quantity within the crate. + for(var/obj/item/stack/sheet/possible_stack as anything in contains) + if(!ispath(possible_stack, /obj/item/stack/sheet)) + continue + if(!possible_stack.material_type) + continue + if(!SSstock_market.materials_quantity[possible_stack.material_type]) + continue + SSstock_market.materials_quantity[possible_stack.material_type] -= contains[possible_stack] + SSstock_market.materials_prices[possible_stack.material_type] += round((SSstock_market.materials_prices[possible_stack.material_type]) * (contains[possible_stack] / (SSstock_market.materials_quantity[possible_stack.material_type] - contains[possible_stack])))