Kerbal Inventory System (KIS)

Kerbal Inventory System (KIS)

1M Downloads

Part (not seat) inventory overwritten by crew inventory when transferring crew into it

jd284 opened this issue ยท 1 comments

commented

When transferring the first crew member into a part that has a proper KISInventory (i.e. in addition to the seat inventories), the part inventory is deleted and overwritten by the crew inventory, while the crew inventory becomes empty.

To reproduce, try e.g. the "UKS Fabrication Module" from the latest UKS release (or add a KISInventory module to any pod). Construct a vessel with this part and any crewed pod, with some parts in the UKS Fabrication Module part inventory (as opposed to seat inventory), and some parts in the crew inventory inside the pod. Launch the vessel and move the crew. The part inventory will have been replaced by the crew inventory, which is now empty. The parts previously in the part inventory have been destroyed.
The log shows an item transfer with one source and two destinations:

[Log]: [KIS] Item transfer | source :MK3.Akademy (1)
[Log]: [KIS] Item transfer | destination :MK3.Fabricator (0)
[Log]: [KIS] Item transfer | destination :MK3.Fabricator (0)

When the part inventory window is open during the transfer, the log will be spammed by NREs and the window will become blank.

As far as I can tell, the crew transfer code considers the part inventory to also have seat number 0, so it first moves the crew inventory there, overwriting everything in it. Then it tries to move the remaining crew inventory (i.e., nothing) to the actual seat number 0, hence the new crew inventory is empty.

I was able to fix it by setting the "podSeat" default value from 0 to -2, so that it will never match a seat number, whereas actual seat inventories will receive the proper value during initialization. A better way to fix it might change the podSeat to a non-seat value when the module is created, but I couldn't figure out how to do that easily. If you want I can create a PR for my change, but it's really just changing that one number.

commented

I was able to reproduce it with KKAOSS parts:

160218T202407.897 [INFO] [KIS.KIS_Shared.DebugLog] [KIS] Item transfer | source :KKAOSS.Habitat.MK2.g (0)
160218T202407.913 [INFO] [KIS.KIS_Shared.DebugLog] [KIS] Item transfer | destination :KKAOSS.airlock.end.g (0)
160218T202407.914 [INFO] [KIS.KIS_Shared.DebugLog] [KIS] Item transfer | destination :KKAOSS.airlock.end.g (0)