Jump to content

Transfer cargo window - numbers in textboxes sometimes reset after update


Rinart73

Recommended Posts

Sometimes you just enter number of the items you want to pick from your station or ship and this number resets to "1" in a few seconds.

 

As I see, the source of this problem lies in the fact that code saves number to the table using good name as a key.

But if we have both normal and suspicious or stolen cargo variants in one ship/station, script will still save all of them with key good.name, because it the same cargo, just with different statuses.

local boxAmount = TransferCrewGoods.clampNumberString(selfAmountByIndex[good.name] or "1", amount)
selfCargoTextBoxByIndex[good.name] = i

 

So, something like this should solve the problem:

local nameWithStatus = good.name
if good.stolen then nameWithStatus = nameWithStatus .. ".stolen" end
if good.suspicious then nameWithStatus = nameWithStatus .. ".suspicious" end
local boxAmount = TransferCrewGoods.clampNumberString(selfAmountByIndex[nameWithStatus] or "1", amount)
selfCargoTextBoxByIndex[nameWithStatus] = i

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...