mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 05:00:55 +01:00
[MIRROR] Fixes to the Galactic Material Market regarding market quantity. [MDB IGNORE] (#25022)
* Fixes to the Galactic Material Market regarding market quantity. (#79307) ## About The Pull Request This PR makes a fix to market quantity of materials on the GMM. In short, when you buy sheets, they get removed from the market's pool of available resources. When buying resources, they now shift up and down based on a fraction of their inherent base_market_quantity, and not their current quantity, preventing situations where a material can fully deplete all its stock forever. I've also tweaked the numbers to try and keep those changes from swinging too far wide as a result of this change. Respecting quantity of materials should additionally help to decrease the quantity of bike rounds in-game as well as the rare but horrifying billion credit round. ## Why It's Good For The Game Respecting quantity of materials should additionally help to decrease the quantity of bike rounds in-game as well as the rare but horrifying billion credit round. Also, I namely just completely missed this during the original PR and I've been out of state for a few weeks so I've been meaning to get around to fixing this. Fixes #79116. Fixes #79247. ## Changelog 🆑 fix: The Galactic Material Market now respects quantity of materials purchased, removing them from the market when bought and preventing you from ordering more than are available at a given time. /🆑 --------- Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@ users.noreply.github.com> * Fixes to the Galactic Material Market regarding market quantity. --------- Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@ users.noreply.github.com>
This commit is contained in:
co-authored by
LemonInTheDark
ArcaneMusic
parent
9096fc586a
commit
df26dfaf03
@@ -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.
|
||||
|
||||
@@ -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])))
|
||||
|
||||
Reference in New Issue
Block a user