Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Fixes material market prices going negative & runtime when buying materials #706

Merged
merged 1 commit into from
Nov 19, 2023

Conversation

Steals-The-PRs
Copy link
Collaborator

@Steals-The-PRs Steals-The-PRs commented Nov 19, 2023

Mirrored on Skyrat: Skyrat-SS13/Skyrat-tg#25095
Original PR: tgstation/tgstation#79732

About The Pull Request

  • Fixes #79114
  • Fixes #79245

The hope is that it should fix these 2 issues because looking at the math is seems solid. This PR ensures 2 things

  • If the current market price of a material is 0 then neither the market quantity nor its price is changed because the material is worthless at that point so adding more is just meaningless
  • Corrects the formulae to calculate the new price so we get the right rate of change

For more details on how this bug occurs refer to tgstation/tgstation#79114 (comment)

Mentioning @ Iajret in the changelog cause credits(no pun intended) goes to them for discovering said bug

This also corrects a runtime that went unresolved in

  • #79307

I could not get my code suggestion there in time so i'm just carrying it over here

Changelog

🆑 SyncIt21, Iajret
fix: selling large amount of mats in cargo should not give you infinite credits
fix: runtime when adjusting material market after buying
/:cl:

…uying materials [MDB IGNORE] (#25095)

* Fixes material market prices going negative & runtime when buying materials (#79732)

## About The Pull Request
- Fixes #79114
- Fixes #79245

The hope is that it should fix these 2 issues because looking at the
math is seems solid. This PR ensures 2 things
- If the current market price of a material is 0 then neither the market
quantity nor its price is changed because the material is worthless at
that point so adding more is just meaningless
- Corrects the formulae to calculate the new price so we get the right
rate of change

For more details on how this bug occurs refer to
tgstation/tgstation#79114 (comment)

Mentioning @ Iajret in the changelog cause credits(no pun intended) goes
to them for discovering said bug

This also corrects a runtime that went unresolved in
- #79307

I could not get my code suggestion there in time so i'm just carrying it
over here

## Changelog
SyncIt21, Iajret
:cl:
fix: selling large amount of mats in cargo should not give you infinite
credits
fix: runtime when adjusting material market after buying
/:cl:

* Fixes material market prices going negative & runtime when buying materials

---------

Co-authored-by: SyncIt21 <[email protected]>
@Iajret Iajret enabled auto-merge (squash) November 19, 2023 08:45
@Iajret Iajret merged commit 484cd75 into master Nov 19, 2023
25 checks passed
@Iajret Iajret deleted the upstream-mirror-25095 branch November 19, 2023 09:24
AnywayFarus added a commit that referenced this pull request Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants