Kerbal Inventory System (KIS)

Kerbal Inventory System (KIS)

1M Downloads

CannotAddGroundSciencePartMsg appears for non-science stock parts

ederiel opened this issue ยท 1 comments

commented

Summary
Reassembly Required DLC breaks KIS for stock parts, rendering KIS effectively broken for all new construction.

KSP Version
1.11 (Some Reassembly Required)

KIS Version
1.26

Repro

  1. In VAB, start with a KIS container part.
  2. Open inventory.
  3. Attempt to add any stock part.
  4. Message "Use stock game abilities to handle this part" appears.

Discussion
ModuleKISInventory#AddItem emits the message and exits with an error on detecting that a candidate part has the ModuleCargoPart module.

Based on the commit history, the code causing that to happen appears to have been added as a way to get around incompatibility between KIS and the Breaking Ground DLC specifically around portable science parts. The ModuleCargoPart module was at the time unique to those science parts.

However, the most recent KSP update now uses ModuleCargoPart for most (if not all) stock parts, so what was previously an effective way to handle an edge case is now a major impediment to functionality.

Ironically, many stock parts that are tagged with ModuleCargoPart are not available in the Reassembly Required inventory system, meaning that they now cannot be stored by any means, new or old.

Code
Lines 1066-1071 of ModuleKISInventory.cs:

  public KIS_Item AddItem(Part p, int qty = 1, int slot = -1) {
    if (p.Modules.OfType<ModuleCargoPart>().Any()) {
      ScreenMessaging.ShowPriorityScreenMessage(CannotAddGroundSciencePartMsg);
      UISounds.PlayBipWrong();
      return null;
    }

Solution
If there is some other way to tell "bad" portable science parts from other CargoPart parts, the same overall strategy should work without interfering with stock part interactions with KIS.

commented

Nice fix, thanks!