Files
Bubberstation/code/modules/cargo
ArcaneMusic eca216288b Material market sales now are subject to elasticity. (#89674)
## About The Pull Request

This PR serves as an alternative to #89638.

For this proposal, stocks are now subject to market elasticity, similar
to most other standard exports in-game. As a result, the value of a
stock is going to scale downward through the quantity that they're sold
at, whether as a stack of material or as a stock block at a given export
rate. A material's new, elastically modified price can then be
reassessed by scanning it with an export scanner.

There was a good bit of behind the scenes work that came with making
this work properly, but the short version of it is as follows:

Stock blocks are no longer their own datum export, and stock blocks are
now dynamically sorted into their appropriate export datum so that the
`datum/export` `cost` variable can properly track elasticity whether
between the sheet of the block form of the item.

`Get_cost()` now calculates the cost based on the non-elastic form when
saving to the block, and then when assessed for sale elasticity is
applied on the block sale instead so as to not apply elasticity twice
and make them worthless.

I axed the `MARKET_PROFIT_MODIFIER` define and removed it from
calculation. Originally it was meant as a crude alternative to a
floodgate and sales factor that would change how much a stock block is
worth in Lou of an actual elastic modifier, but with this implemented I
feel confident in removing this. The wording of this is also reflected
in the instructions tab of the stock market as well.

Lastly, there are three minor things but they came up during testing and
felt appropriate to tweak, but otherwise I'm happy to atomize out
because I was just kinda on a roll:

* I added a small light to the material market when on and powered, as
50% of the sprite is a big hologram light and it only makes sense that
it would emit some light to the surroundings, albeit not a high range.
* The material market now requires power to create stock blocks.
* Refined Bluespace crystals
(`/obj/item/stack/ore/bluespace_crystal/refined`) and other similar
stacks of ore will now throw a warning if the amount or value is less
than 1 in either case, preventing you from making a functionally useless
stock block.

## Why It's Good For The Game

Technically fixes #79978 ?

This solution still enables for the stock market to exist in a
meaningful way, prevents it from being an insanely powerful method of
getting far too many credits too quickly by basically implementing a
soft cooldown system respective to each material export type, and means
that in avoiding that system, requires for cargo to alternate between a
few different types of materials, which should *hopefully* allow for
cargo to also be incentivized to actually deposit some of it's purchased
materials into the station's resources respectively.

The QOL and fix changes mentioned at the bottom of the first section
allow for there to be fewer edge cases situations where the crew is
unable to sell items that would functionally have zero value without
some rather cheesy implementations of how stock blocks currently work by
preventing otherwise invalid stock blocks from being made, as well as to
make it behave in a way more fitting of a standard machine on the
station.

Also just in general enables a bit less duplicate code by relying a bit
more on `export_items_and_contents()` to gather quantities and values
for then redistributing back into the stock blocks, either for sale or
for storage.

## Changelog

🆑
balance: Sheets of material and stock blocks are now subject to elastic
price changes. AKA, if you sell materials, their price will go down
after sale and will return after some time.
fix: Stock blocks can no longer be made with no value or with a quantity
of zero material.
fix: The GMM Machine can now no longer create stock blocks when
unpowered.
qol: The GMM machine now lights up when powered.
/🆑
2025-03-14 15:48:54 +11:00
..