SavePartSnapshot() public static method

public static SavePartSnapshot ( Part part ) : ConfigNode
part Part
return ConfigNode
Beispiel #1
0
        private void StoreGrabbedPart()
        {
            KASModuleGrab moduleGrab = KAS_Shared.GetGrabbedPartModule(FlightGlobals.ActiveVessel);

            if (!moduleGrab || moduleGrab.part.packed)
            {
                fxSndBipWrong.audio.Play();
                ScreenMessages.PostScreenMessage("You didn't grab anything to store !", 5, ScreenMessageStyle.UPPER_CENTER);
                return;
            }
            if (!moduleGrab.storable)
            {
                fxSndBipWrong.audio.Play();
                ScreenMessages.PostScreenMessage("This part cannot be stored !", 5, ScreenMessageStyle.UPPER_CENTER);
                return;
            }
            if (MaxSizeReached(moduleGrab, 1))
            {
                fxSndBipWrong.audio.Play();
                ScreenMessages.PostScreenMessage("Max size of the container reached !", 5, ScreenMessageStyle.UPPER_CENTER);
                return;
            }
            PartContent info = PartContent.Get(contents, moduleGrab.part.partInfo.name);

            if (info == null)
            {
                fxSndBipWrong.audio.Play();
                ScreenMessages.PostScreenMessage("Could not store part!", 5, ScreenMessageStyle.UPPER_CENTER);
                return;
            }
            if (moduleGrab.stateless)
            {
                info.pristine_count++;
            }
            else
            {
                info.Load(KAS_Shared.SavePartSnapshot(moduleGrab.part));
            }
            RefreshTotalSize();
            moduleGrab.Drop(true);
            moduleGrab.part.Die();
            fxSndStore.audio.Play();
        }