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

Resources recalculation does not apply negative income when storage is full #88

Open
mdziekon opened this issue Mar 20, 2020 · 3 comments
Labels
bug:confirmed All bug reports that were reproduced, therefore confirmed to exist bug All bug reports

Comments

@mdziekon
Copy link
Owner

Steps to reproduce

  1. Fill up deuterium storage
  2. Set deuterium production to 0% and deuterium consumption (reactor) to >0%

What should happen

  • Deuterium should slowly be drained from the storage

What actually happens

  • Deuterium is stuck at the full storage capacity amount

Regression tracking

Caused by (PR):

Caused by (relevant code pieces):

if ($resourceCurrentAmount >= $resourceMaxStorage) {
return [
'isUpdated' => false,
'income' => 0
];
}

@mdziekon mdziekon added the bug:confirmed All bug reports that were reproduced, therefore confirmed to exist label Mar 20, 2020
@mdziekon mdziekon added the bug All bug reports label Mar 20, 2020
@theGroom66
Copy link

Hi,
regarding the #88. How about changing the line 582 from
if ($resourceCurrentAmount >= $resourceMaxStorage) to if ($resourceCurrentAmount > $resourceMaxStorage) ?
this way it does not block the resource mysql recalculation when the values are equal.
Worked for me.

@mdziekon
Copy link
Owner Author

mdziekon commented Mar 25, 2022

Hi @theGroom66, thanks for your suggestion, really appreciate it!
I haven't touched this bug in a long time, so I'll have to read that code through again and try to validate if your proposal works fine - resource calculation code can be tricky, especially when it comes to stacked updates. I hope I can get this validated in a couple of days.

As an additional question, what did you do to validate this fix on your end? Did you run some extensive tests? What about your testing environment, if you don't mind sharing that info? Did you run it locally, or on some public/semi-public instance where other people than yourself play the game on a regular basis?

@theGroom66
Copy link

Hi @mdziekon ,
You're welcome. I was just interested in Your project, so I cloned and ran it to give it a try. I've seen some of Your issues and tried to figure one out. The instance is living on my personal server to used only by me. It is a nice reading, the code, must have been a lot of work. Appreciate it man!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:confirmed All bug reports that were reproduced, therefore confirmed to exist bug All bug reports
Projects
None yet
Development

No branches or pull requests

2 participants