I have a thermo shell nanofac installed, and when I go to the ship view and scroll through my inventory, every time the nanofac "activates", I get scrolled up to the top of the view. This obviously makes the inventory view rather hard to use. :)

Additionally, once when I tried to use a repair kit, I was told that my armor could not be repaired by a thermo shell nanofac. I'm guessing the "active item" or something got switched from the repair kit I wanted to use, to the nanofac, when the nanofac activated.

Running the Steam "next" version (1.8 beta, presumably).

nms 15 May 2017:

The first issue can also happen (though less frequently) with things like fresh fruit, autons returning to the auton bay, multiple ships looting at once, and probably ammo restocking. Technically, it should be possible to prevent this in TLisp, but ensuring the same item stays selected if possible is complicated. I think you would have to:
1) Save the current screen's selected item.
2) Add/change/remove item(s).
3) Iterate, setting the list cursor to each value, until the current selected item is equal to the old selected item, except for quantity, or the cursor stops going up (in which case, you set the cursor to 0).

A better solution would be for the C functions called by built-in TLisp functions that add, change, or remove items to handle this automatically.

the_shrike 15 May 2017:

Again, as with the last ticket, the steam "next" version is still 1.7 Stable.

But yeah, this is a very old issue with the way the game updates item lists (rather than updating the total for an item, it refreshes the entire list and resets your position as a result)

giantcabbage 15 May 2017:

The second issue (attempting to use the nanofac to repair the armor) is due to all the old armor repair screen assuming that the global gItem is not updated while the dockscreen is displayed.

However, if ANY item OnUpdate events are called then gItem will be changed

The dockscreen should probably save the barrel / repair kit item to screen data

derakon 16 May 2017:

Okay, sounds like this is a known issue. Sorry about the version confusion. Feel free to close this bug if it's not serving a useful purpose; I just wanted to make certain it was a known issue.

nms 16 May 2017:

"Known to some players" isn't the same as "documented". So, thanks!

george moromisato 1 Jul 2017:

There are two problems that need to be fixed in the engine:

When we're inside the <OnUpdate> for the nanofac, we've set gItem to the nanofac. This is usually OK because we restore gItem when we're done. But when we add items to the ship, we fire an event to the dock screen from inside <OnUpdate>, which means gItem is set incorrectly.

We meed to defer the notification to the dock screen until after we've exited <OnUpdate>.

Secondly, we need to fix the case where the list gets reset. We probably need to be better about keep the current item position. Now that items have unique pointers, we can probably use that instead of the cursor or item properties.

nms 4 Jul 2017:

When we're inside the <OnUpdate> for the nanofac, we've set gItem to the nanofac. This is usually OK because we restore gItem when we're done. But when we add items to the ship, we fire an event to the dock screen from inside <OnUpdate>, which means gItem is set incorrectly.

We meed to defer the notification to the dock screen until after we've exited <OnUpdate>.

Better yet, never use changeable global variables inside dockscreens, since stuff can happen while they're open. Use screen data instead.

george moromisato 4 Dec 2018:

Fixed in 1.8 Beta 4. Thanks!