public static void onPartKISInventoryVolumeChanged(Part part, float liters)
{
if (!isKISInstalled())
{
return;
}
string typeName = "KIS.ModuleKISInventory,KIS";
Type kisModuleType = Type.GetType(typeName);
if (kisModuleType == null)
{
MonoBehaviour.print("ERROR: Could not locate KIS module for name: "+typeName);
}
PartModule pm = (PartModule)part.GetComponent(kisModuleType);
if(pm == null)
{
if (liters != 0)
{
MonoBehaviour.print("ERROR: Could not locate KIS module on part for type: " + part + " :: " + kisModuleType);
}
return;
}
FieldInfo fi = kisModuleType.GetField("maxVolume");
fi.SetValue(pm, liters);
BaseEvent inventoryEvent = pm.Events["ShowInventory"];
inventoryEvent.guiActive = inventoryEvent.guiActiveEditor = liters > 0;
}