/// <summary> /// Removes inventory parts, refunds funds, marks it as tracked /// </summary> /// <param name="parts">The vessel as a List of Parts</param> /// <returns>True if processed, false otherwise</returns> public bool ProcessVessel_Nodes(IEnumerable <ConfigNode> partNodes) { if (!ScrapYard.Instance.Settings.EnabledForSave) { return(true); } //try to get the ID out of the list uint ID = 0; if (partNodes.FirstOrDefault()?.TryGetValue("persistentId", ref ID) != true) { return(false); //for now we can't process this vessel. Sorry. Maybe later we'll be able to add the module } //check that it isn't already processed if (ScrapYard.Instance.ProcessedTracker.IsProcessed(ID)) { return(false); } //remove parts InventoryManagement.RemovePartsFromInventory(partNodes); //Mark as processed ScrapYard.Instance.ProcessedTracker.TrackVessel(ID, true); return(true); }
public void VesselRolloutEvent(ShipConstruct vessel) { if (!ScrapYard.Instance.Settings.EnabledForSave) { return; } Logging.DebugLog("Vessel Rollout!"); //If vessel not processed, then take parts //If already processed, just return if (ScrapYard.Instance.ProcessedTracker.Remove(vessel.Parts[0].persistentId)) { return; } InventoryManagement.RemovePartsFromInventory(vessel.Parts); ScrapYard.Instance.PartTracker.AddBuild(vessel.Parts); }